1616 * limitations under the License.
1717 */
1818
19- group = " com.github.hyperdevs-team"
20-
2119buildscript {
2220 repositories {
2321 mavenCentral()
@@ -30,16 +28,17 @@ buildscript {
3028 }
3129
3230 dependencies {
33- classpath(kotlin( " gradle-plugin " , version = " 1.4.20 " ) )
31+ classpath(libs. kotlin.gradle )
3432 }
3533}
3634
3735plugins {
3836 `java- gradle- plugin`
3937 `kotlin- dsl`
4038 groovy
41- maven
42- id(" io.gitlab.arturbosch.detekt" ).version(" 1.18.1" )
39+ `maven- publish`
40+ alias(libs.plugins.detekt)
41+ alias(libs.plugins.gitVersionGradle)
4342}
4443
4544repositories {
@@ -55,40 +54,46 @@ repositories {
5554dependencies {
5655 implementation(localGroovy())
5756
58- compileOnly(" com.android.tools.build:gradle:4.2.0" )
59-
60- implementation(" org.jetbrains.kotlin:kotlin-stdlib:1.4.20" )
61-
62- implementation(" com.squareup.moshi:moshi:1.12.0" )
63- implementation(" com.squareup.moshi:moshi-kotlin:1.12.0" )
64- implementation(" com.squareup.moshi:moshi-adapters:1.12.0" )
65-
66- implementation(" com.squareup.retrofit2:retrofit:2.9.0" )
67- implementation(" com.squareup.retrofit2:converter-moshi:2.9.0" )
57+ compileOnly(libs.android.buildTools)
6858
69- implementation(" com.squareup.okhttp3:logging-interceptor:4.9.1" )
70- implementation(" com.squareup.okhttp3:okhttp:4.9.1" )
71-
72- implementation(" io.github.cdimascio:dotenv-kotlin:6.2.2" )
59+ implementation(libs.kotlin.stdlib)
60+ implementation(libs.bundles.moshi)
61+ implementation(libs.bundles.retrofit)
62+ implementation(libs.bundles.okhttp3)
63+ implementation(libs.dotenvKotlin)
7364
7465 testImplementation(gradleTestKit())
7566 testImplementation(kotlin(" test" ))
76- testImplementation(" junit:junit:4.13.2 " )
67+ testImplementation(libs.junit )
7768
78- detektPlugins(" io.gitlab.arturbosch. detekt:detekt-formatting:1.18.1 " )
69+ detektPlugins(libs. detekt.formatting )
7970}
8071
8172java {
8273 sourceCompatibility = JavaVersion .VERSION_1_8
8374 targetCompatibility = JavaVersion .VERSION_1_8
75+
76+ withJavadocJar()
77+ withSourcesJar()
78+ }
79+
80+ tasks.javadoc {
81+ if (JavaVersion .current().isJava9Compatible) {
82+ (options as StandardJavadocDocletOptions ).addBooleanOption(" html5" , true )
83+ }
8484}
8585
8686detekt {
87- toolVersion = " 1.18.1 "
87+ toolVersion = libs.versions.detekt.get()
8888 config = files(" ${project.rootDir} /config/detekt.yml" )
8989 autoCorrect = true
9090}
9191
92+ androidGitVersion {
93+ codeFormat = " MMNNPP"
94+ format = " %tag%"
95+ }
96+
9297tasks {
9398 test {
9499 useJUnit()
@@ -110,21 +115,54 @@ tasks {
110115 // Install hooks automatically before building a new compilation
111116 // Idea from: https://gist.github.com/KenVanHoeylandt/c7a928426bce83ffab400ab1fd99054a
112117 getByPath(" compileKotlin" ).dependsOn(installGitHooks)
118+ }
113119
114- val sourcesJar by creating(Jar ::class ) {
115- dependsOn(JavaPlugin .CLASSES_TASK_NAME )
116- archiveClassifier.set(" sources" )
117- from(sourceSets[" main" ].allSource)
118- }
119-
120- val javadocJar by creating(Jar ::class ) {
121- val javadoc by tasks
122- from(javadoc)
123- archiveClassifier.set(" javadoc" )
124- }
125-
126- artifacts {
127- add(" archives" , sourcesJar)
128- add(" archives" , javadocJar)
120+ group = " com.github.hyperdevs-team"
121+ version = androidGitVersion.name()
122+
123+ publishing {
124+ publications {
125+ // Edit the `pluginMaven` publication, which is the name for the default publication task of the `java-gradle-plugin`
126+ register<MavenPublication >(" pluginMaven" ) {
127+ groupId = " com.github.hyperdevs-team"
128+ artifactId = " poeditor-android-gradle-plugin"
129+
130+ pom {
131+ name.set(" PoEditor Android Gradle Plug-in" )
132+ description.set(" Gradle plug-in that enables importing PoEditor localized strings directly to an Android project" )
133+ url.set(" https://github.com/hyperdevs-team/poeditor-android-gradle-plugin" )
134+ version = androidGitVersion.name()
135+ inceptionYear.set(" 2016" )
136+
137+ licenses {
138+ license {
139+ name.set(" The Apache License, Version 2.0" )
140+ url.set(" http://www.apache.org/licenses/LICENSE-2.0.txt" )
141+ }
142+ }
143+
144+ developers {
145+ developer {
146+ name.set(" Iván Martínez" )
147+ id.set(" imartinez" )
148+ url.set(" https://github.com/imartinez" )
149+ roles.set(listOf (" Initial work" ))
150+ }
151+
152+ developer {
153+ name.set(" Adrián García" )
154+ id.set(" adriangl" )
155+ url.set(" https://github.com/adriangl" )
156+ roles.set(listOf (" Maintainer" ))
157+
158+ organization {
159+ name.set(" HyperDevs" )
160+ id.set(" hyperdevs-team" )
161+ url.set(" https://github.com/hyperdevs-team" )
162+ }
163+ }
164+ }
165+ }
166+ }
129167 }
130168}
0 commit comments