11import io.gitlab.arturbosch.detekt.Detekt
2- import java.util.Properties
32import java.io.FileInputStream
43import java.io.IOException
4+ import java.util.Properties
55import org.jetbrains.kotlin.gradle.dsl.JvmTarget
66
77plugins {
@@ -18,10 +18,12 @@ val keystorePropertiesFile = rootProject.file("keystore.properties")
1818val keystoreProperties = Properties ()
1919
2020try {
21- keystoreProperties.load(FileInputStream (keystorePropertiesFile))
21+ keystoreProperties.load(FileInputStream (keystorePropertiesFile))
2222} catch (ignored: IOException ) {
23- if (project.hasProperty(" centralUsername" )) keystoreProperties[" centralUsername" ] = property(" centralUsername" )
24- if (project.hasProperty(" centralPassword" )) keystoreProperties[" centralPassword" ] = property(" centralPassword" )
23+ if (project.hasProperty(" centralUsername" ))
24+ keystoreProperties[" centralUsername" ] = property(" centralUsername" )
25+ if (project.hasProperty(" centralPassword" ))
26+ keystoreProperties[" centralPassword" ] = property(" centralPassword" )
2527}
2628
2729android {
@@ -34,8 +36,8 @@ android {
3436
3537 // The version must be of the form "X.Y.Z[-b][-SNAPSHOT]"
3638 version =
37- if (project.hasProperty(" VERSION" )) project.property(" VERSION" ).toString()
38- else " 1.0.1-SNAPSHOT"
39+ if (project.hasProperty(" VERSION" )) project.property(" VERSION" ).toString()
40+ else " 1.0.1-SNAPSHOT"
3941
4042 testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
4143 }
@@ -49,42 +51,34 @@ android {
4951 sourceCompatibility = JavaVersion .VERSION_17
5052 targetCompatibility = JavaVersion .VERSION_17
5153 }
52-
54+
5355 testOptions { unitTests { isIncludeAndroidResources = true } }
5456
55- publishing {
56- singleVariant(" release" ) {}
57- }
57+ publishing { singleVariant(" release" ) {} }
5858}
5959
60- kotlin {
61- compilerOptions {
62- jvmTarget.set(JvmTarget .JVM_17 )
63- }
64- }
60+ kotlin { compilerOptions { jvmTarget.set(JvmTarget .JVM_17 ) } }
6561
6662spotless {
67- kotlin {
68- target(" **/*.kts" , " **/*.kt" )
69- // Versions can be monitored: https://github.com/facebook/ktfmt/releases
70- ktfmt(" 0.58" )
71- }
72- json {
73- target(" **/*.json" )
74- gson().indentWithSpaces(4 )
75- }
63+ kotlin {
64+ target(" **/*.kts" , " **/*.kt" )
65+ // Versions can be monitored: https://github.com/facebook/ktfmt/releases
66+ ktfmt(" 0.58" )
67+ }
68+ json {
69+ target(" **/*.json" )
70+ gson().indentWithSpaces(4 )
71+ }
7672}
7773
78- detekt {
79- config.setFrom(" $projectDir /config/detekt.yml" )
80- }
74+ detekt { config.setFrom(" $projectDir /config/detekt.yml" ) }
8175
8276tasks.withType<Detekt >().configureEach {
83- reports {
84- html.required.set(true )
85- sarif.required.set(true )
86- md.required.set(true )
87- }
77+ reports {
78+ html.required.set(true )
79+ sarif.required.set(true )
80+ md.required.set(true )
81+ }
8882}
8983
9084tasks.withType<Test > {
@@ -112,98 +106,94 @@ dependencies {
112106 androidTestImplementation(libs.androidx.espresso.core)
113107}
114108
115- if (keystoreProperties.containsKey(" centralUsername" ) && keystoreProperties.containsKey(" centralPassword" )) {
116- afterEvaluate {
117- publishing {
118- publications {
119- create<MavenPublication >(" release" ) {
120- from(components[" release" ])
121-
122- pom {
123- name = " Khronicle"
124- packaging = " aar"
125- description = " An SLF4J backend for Android."
126- url = " https://github.com/esri/khronicle"
127-
128- scm {
129- connection = " scm:git:https://github.com/esri/khronicle"
130- developerConnection = " scm:git:https://github.com/esri/khronicle"
131- url = " https://github.com/esri/khronicle"
132- }
133-
134- licenses {
135- license {
136- name = " Apache License 2.0"
137- url = " https://spdx.org/licenses/Apache-2.0.html"
138- }
139- }
140-
141- developers {
142- developer {
143- id = " award"
144- name = " Adam Ward"
145- 146- }
147- developer {
148- id = " jonasvautherin"
149- name = " Jonas Vautherin"
150- 151- }
152- }
153- }
154- }
109+ if (
110+ keystoreProperties.containsKey(" centralUsername" ) &&
111+ keystoreProperties.containsKey(" centralPassword" )
112+ ) {
113+ afterEvaluate {
114+ publishing {
115+ publications {
116+ create<MavenPublication >(" release" ) {
117+ from(components[" release" ])
118+
119+ pom {
120+ name = " Khronicle"
121+ packaging = " aar"
122+ description = " An SLF4J backend for Android."
123+ url = " https://github.com/esri/khronicle"
124+
125+ scm {
126+ connection = " scm:git:https://github.com/esri/khronicle"
127+ developerConnection = " scm:git:https://github.com/esri/khronicle"
128+ url = " https://github.com/esri/khronicle"
129+ }
130+
131+ licenses {
132+ license {
133+ name = " Apache License 2.0"
134+ url = " https://spdx.org/licenses/Apache-2.0.html"
135+ }
155136 }
156- repositories {
157- maven {
158- url = uri(layout.buildDirectory.dir(" target/staging-deploy" ))
159- }
137+
138+ developers {
139+ developer {
140+ id = " award"
141+ name = " Adam Ward"
142+ 143+ }
144+ developer {
145+ id = " jonasvautherin"
146+ name = " Jonas Vautherin"
147+ 148+ }
160149 }
150+ }
161151 }
152+ }
153+ repositories { maven { url = uri(layout.buildDirectory.dir(" target/staging-deploy" )) } }
162154 }
155+ }
163156
164- jreleaser {
165- signing {
166- setActive(" ALWAYS" )
167- armored.set(true )
168- setMode(" COMMAND" )
157+ jreleaser {
158+ signing {
159+ setActive(" ALWAYS" )
160+ armored.set(true )
161+ setMode(" COMMAND" )
169162
170- command {
171- keyName.set(" C8B1511EF991537875A649517D5F7A7C9542C299" )
172- }
163+ command { keyName.set(" C8B1511EF991537875A649517D5F7A7C9542C299" ) }
164+ }
165+ deploy {
166+ release {
167+ github {
168+ skipRelease = true
169+ skipTag = true
173170 }
174- deploy {
175- release {
176- github {
177- skipRelease = true
178- skipTag = true
179- }
180- }
181- maven {
182- mavenCentral {
183- create(" sonatype" ) {
184- verifyPom = false
185- setActive(" RELEASE" )
186- username = keystoreProperties[" centralUsername" ] as String
187- password = keystoreProperties[" centralPassword" ] as String
188- url = " https://central.sonatype.com/api/v1/publisher"
189- stagingRepository(" build/target/staging-deploy" )
190- }
191- }
192- nexus2 {
193- create(" snapshot-deploy" ) {
194- verifyPom = false
195- setActive(" SNAPSHOT" )
196- snapshotUrl.set(" https://central.sonatype.com/repository/maven-snapshots" )
197- url = " https://central.sonatype.com/repository/maven-snapshots"
198- applyMavenCentralRules = true
199- snapshotSupported = true
200- username = keystoreProperties[" centralUsername" ] as String
201- password = keystoreProperties[" centralPassword" ] as String
202- stagingRepository(" build/target/staging-deploy" )
203- }
204- }
205- }
171+ }
172+ maven {
173+ mavenCentral {
174+ create(" sonatype" ) {
175+ verifyPom = false
176+ setActive(" RELEASE" )
177+ username = keystoreProperties[" centralUsername" ] as String
178+ password = keystoreProperties[" centralPassword" ] as String
179+ url = " https://central.sonatype.com/api/v1/publisher"
180+ stagingRepository(" build/target/staging-deploy" )
181+ }
206182 }
183+ nexus2 {
184+ create(" snapshot-deploy" ) {
185+ verifyPom = false
186+ setActive(" SNAPSHOT" )
187+ snapshotUrl.set(" https://central.sonatype.com/repository/maven-snapshots" )
188+ url = " https://central.sonatype.com/repository/maven-snapshots"
189+ applyMavenCentralRules = true
190+ snapshotSupported = true
191+ username = keystoreProperties[" centralUsername" ] as String
192+ password = keystoreProperties[" centralPassword" ] as String
193+ stagingRepository(" build/target/staging-deploy" )
194+ }
195+ }
196+ }
207197 }
198+ }
208199}
209-
0 commit comments