@@ -119,82 +119,84 @@ subprojects {
119119}
120120
121121@Suppress(" ExpiredTargetSdkVersion" )
122- fun Project.configureAndroid () = pluginManager.withPlugin(" com.android.library" ) {
123- val sdkVersionName = findProperty(" VERSION_NAME" ) ? : rootProject.findProperty(" VERSION_NAME" )
124-
122+ fun Project.configureAndroid () {
125123 if (hasProperty(" signingKeyId" )) {
126124 println (" Getting signing info from protected source." )
127125 extra[" signing.keyId" ] = findProperty(" signingKeyId" )
128126 extra[" signing.password" ] = findProperty(" signingPassword" )
129127 extra[" signing.inMemoryKey" ] = findProperty(" signingInMemoryKey" )
130128 }
131129
132- configure<LibraryExtension > {
133- buildToolsVersion = " 30.0.3"
134- compileSdk = 34
130+ pluginManager.withPlugin(" com.android.library" ) {
131+ val sdkVersionName = findProperty(" VERSION_NAME" ) ? : rootProject.findProperty(" VERSION_NAME" )
135132
136- buildFeatures {
137- // Allow specifying custom buildConfig fields
138- buildConfig = true
139- }
133+ configure<LibraryExtension > {
134+ buildToolsVersion = " 30.0.3"
135+ compileSdk = 34
140136
141- defaultConfig {
142- minSdk = 24
143- targetSdk = 30
144- testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
145- testInstrumentationRunnerArguments + = " clearPackageData" to " true"
146- consumerProguardFiles + = rootProject.file(" configuration/consumer-rules.pro" )
147-
148- testOptions {
149- animationsDisabled = true
150- unitTests {
151- isIncludeAndroidResources = true
152- }
137+ buildFeatures {
138+ // Allow specifying custom buildConfig fields
139+ buildConfig = true
153140 }
154141
155- buildConfigField(" String" , " VERSION_NAME" , " \" $sdkVersionName \" " )
156- }
142+ defaultConfig {
143+ minSdk = 24
144+ targetSdk = 30
145+ testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
146+ testInstrumentationRunnerArguments + = " clearPackageData" to " true"
147+ consumerProguardFiles + = rootProject.file(" configuration/consumer-rules.pro" )
148+
149+ testOptions {
150+ animationsDisabled = true
151+ unitTests {
152+ isIncludeAndroidResources = true
153+ }
154+ }
157155
158- lint {
159- warningsAsErrors = true
160- abortOnError = true
161- enable + = listOf (" UnusedResources" , " NewerVersionAvailable" )
162- }
156+ buildConfigField(" String" , " VERSION_NAME" , " \" $sdkVersionName \" " )
157+ }
163158
164- compileOptions {
165- isCoreLibraryDesugaringEnabled = true
166- sourceCompatibility = JavaVersion . VERSION_11
167- targetCompatibility = JavaVersion . VERSION_11
168- }
159+ lint {
160+ warningsAsErrors = true
161+ abortOnError = true
162+ enable + = listOf ( " UnusedResources " , " NewerVersionAvailable " )
163+ }
169164
170- tasks.withType<KotlinCompile >().configureEach {
171- kotlinOptions {
172- jvmTarget = JavaVersion .VERSION_11 .toString()
165+ compileOptions {
166+ isCoreLibraryDesugaringEnabled = true
167+ sourceCompatibility = JavaVersion .VERSION_11
168+ targetCompatibility = JavaVersion .VERSION_11
173169 }
174- }
175170
176- // Needed when running integration tests. The oauth2 library uses relies on two
177- // dependencies (Apache's httpcore and httpclient), both of which include
178- // META-INF/DEPENDENCIES. Tried a couple other options to no avail.
179- packagingOptions {
180- resources.excludes.addAll(
181- listOf (
182- " META-INF/DEPENDENCIES" ,
183- " META-INF/LICENSE.md" ,
184- " META-INF/LICENSE-notice.md"
171+ tasks.withType<KotlinCompile >().configureEach {
172+ kotlinOptions {
173+ jvmTarget = JavaVersion .VERSION_11 .toString()
174+ }
175+ }
176+
177+ // Needed when running integration tests. The oauth2 library uses relies on two
178+ // dependencies (Apache's httpcore and httpclient), both of which include
179+ // META-INF/DEPENDENCIES. Tried a couple other options to no avail.
180+ packagingOptions {
181+ resources.excludes.addAll(
182+ listOf (
183+ " META-INF/DEPENDENCIES" ,
184+ " META-INF/LICENSE.md" ,
185+ " META-INF/LICENSE-notice.md"
186+ )
185187 )
186- )
187- }
188+ }
188189
189- publishing {
190- singleVariant(" release" ) {
191- withSourcesJar()
190+ publishing {
191+ singleVariant(" release" ) {
192+ withSourcesJar()
193+ }
192194 }
193195 }
194- }
195196
196- dependencies {
197- add(" coreLibraryDesugaring" , libs.android.desugartools)
197+ dependencies {
198+ add(" coreLibraryDesugaring" , libs.android.desugartools)
199+ }
198200 }
199201}
200202
0 commit comments