Skip to content

Commit c17cc3f

Browse files
committed
migrated to Kotlin DSL.
1 parent 9b9631b commit c17cc3f

File tree

5 files changed

+128
-125
lines changed

5 files changed

+128
-125
lines changed

build.gradle

Lines changed: 0 additions & 122 deletions
This file was deleted.

build.gradle.kts

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// :buildSrc
2+
plugins {
3+
alias(plugin.plugins.maven.publish)
4+
alias(plugin.plugins.gradle.plugin)
5+
alias(plugin.plugins.gradle.publish)
6+
}
7+
8+
project.ext.set("github_handle", "syslogic")
9+
project.ext.set("plugin_display_name", "AppGallery Connect Publishing Plugin")
10+
project.ext.set("plugin_description", "It uploads Android APK/ABB artifacts with AppGallery Connect Publishing API.")
11+
project.ext.set("plugin_identifier", "agconnect-publishing-gradle-plugin")
12+
project.ext.set("plugin_class", "io.syslogic.agconnect.PublishingPlugin")
13+
project.ext.set("plugin_id", "io.syslogic.agconnect.publishing")
14+
project.ext.set("plugin_version", plugin.versions.plugin.version.get())
15+
16+
dependencies {
17+
18+
compileOnly(dependencyNotation = gradleApi())
19+
//noinspection DependencyNotationArgument
20+
implementation(dependencyNotation = plugin.android.gradle)
21+
//noinspection DependencyNotationArgument
22+
implementation(dependencyNotation = plugin.annotations)
23+
//noinspection DependencyNotationArgument
24+
implementation(dependencyNotation = plugin.bundles.http.components)
25+
26+
testImplementation(dependencyNotation = plugin.junit)
27+
testImplementation(dependencyNotation = gradleTestKit())
28+
//noinspection DependencyNotationArgument
29+
testImplementation(dependencyNotation = plugin.annotations)
30+
testImplementation(dependencyNotation = project)
31+
}
32+
33+
gradlePlugin {
34+
plugins {
35+
create("PublishingPlugin") {
36+
id = "${project.ext.get("plugin_id")}"
37+
implementationClass = "${project.ext.get("plugin_class")}"
38+
displayName = "${project.ext.get("plugin_display_name")}"
39+
description = "${project.ext.get("plugin_description")}"
40+
}
41+
}
42+
}
43+
44+
tasks.withType<Jar>().configureEach {
45+
archiveBaseName.set("${project.ext.get("plugin_identifier")}")
46+
archiveVersion.set("${project.ext.get("plugin_version")}")
47+
}
48+
49+
tasks.withType<Test>().configureEach {
50+
useJUnitPlatform()
51+
}
52+
53+
tasks.register<Javadoc>("javadocs") {
54+
setDestinationDir(project.file("/build/outputs/javadoc"))
55+
title = "${project.ext.get("plugin_display_name")} ${project.ext.get("plugin_version")} API"
56+
source = sourceSets.getByName("main").java
57+
classpath = files(File(System.getProperty("java.home") + File.separator + "lib" + File.separator + "rt.jar"))
58+
classpath += configurations.getByName("implementation")
59+
// options.links = "https://docs.oracle.com/en/java/javase/17/docs/api/"
60+
// options.linkSource = true
61+
// options.author = true
62+
isFailOnError = false
63+
}
64+
val javadocJar by tasks.registering(Jar::class) {
65+
archiveClassifier.set("javadoc")
66+
from(project.file("/build/outputs/javadoc"))
67+
dependsOn("javadocs")
68+
}
69+
70+
val sourcesJar by tasks.registering(Jar::class) {
71+
archiveClassifier.set("sources")
72+
from(sourceSets.getByName("main").java.srcDirs)
73+
}
74+
75+
group = "io.syslogic"
76+
version = "${project.ext.get("plugin_version")}"
77+
artifacts {
78+
archives(javadocJar)
79+
archives(sourcesJar)
80+
}
81+
82+
afterEvaluate {
83+
publishing {
84+
publications {
85+
create<MavenPublication>("release") {
86+
from(components.getByName("java"))
87+
groupId = "io.syslogic"
88+
artifactId = "${project.ext.get("plugin_identifier")}"
89+
version = "${project.ext.get("plugin_version")}"
90+
pom {
91+
name = "${project.ext.get("plugin_display_name")}"
92+
description = "${project.ext.get("plugin_description")}"
93+
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}"
94+
scm {
95+
connection = "scm:git:git://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
96+
developerConnection = "scm:git:ssh://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}.git"
97+
url = "https://github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}/"
98+
}
99+
}
100+
}
101+
}
102+
repositories {
103+
/*
104+
* JetBrains Spaces Repository (private)
105+
* https://lp.jetbrains.com/space-source-code-management/
106+
*/
107+
if (System.getenv("JB_SPACE_MAVEN_REPO") != null) {
108+
maven {
109+
url = uri(System.getenv("JB_SPACE_MAVEN_REPO"))
110+
credentials {
111+
username = System.getenv("JB_SPACE_CLIENT_ID")
112+
password = System.getenv("JB_SPACE_CLIENT_SECRET")
113+
}
114+
}
115+
}
116+
}
117+
}
118+
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
android_gradle = "8.7.3"
2+
android_gradle = "8.10.1"
33
gradle_publish = "1.2.2"
44
plugin_version = "1.3.7"
55
annotations = "26.0.1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle renamed to settings.gradle.kts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// settings.gradle
1+
// settings.gradle.kts
22
pluginManagement {
33
repositories {
44
gradlePluginPortal()
@@ -7,6 +7,7 @@ pluginManagement {
77
}
88
}
99

10+
@Suppress("UnstableApiUsage")
1011
dependencyResolutionManagement {
1112
//noinspection UnnecessaryQualifiedReference
1213
repositoriesMode.set(org.gradle.api.initialization.resolve.RepositoriesMode.PREFER_SETTINGS)
@@ -15,4 +16,10 @@ dependencyResolutionManagement {
1516
mavenCentral()
1617
mavenLocal()
1718
}
19+
20+
versionCatalogs {
21+
create("plugin") {
22+
from(files("gradle/libs.versions.toml"))
23+
}
24+
}
1825
}

0 commit comments

Comments
 (0)