[#6] Refactor kotlinOptions to build-conventions

This commit is contained in:
Carter Jernigan 2022-05-17 06:06:44 -04:00 committed by GitHub
parent 665042e6d9
commit 4f960d5bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 15 additions and 57 deletions

View File

@ -93,12 +93,6 @@ android {
}
}
}
// TODO [#6]: Figure out how to move this into the build-conventions
kotlinOptions {
jvmTarget = libs.versions.java.get()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
}
packagingOptions {
resources.excludes.addAll(

View File

@ -1,3 +1,6 @@
import com.android.build.api.dsl.CommonExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions
// Note: due to a few limitations with build-conventions, there is some common Android Gradle Plugin
// configuration happening in the root build.gradle.kts with a subprojects block.
@ -105,4 +108,16 @@ fun com.android.build.gradle.BaseExtension.configureBaseExtension() {
)
)
}
if (this is CommonExtension<*, *, *, *>) {
kotlinOptions {
jvmTarget = project.property("ANDROID_JVM_TARGET").toString()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
}
}
}
fun CommonExtension<*, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
(this as ExtensionAware).extensions.configure("kotlinOptions", block)
}

View File

@ -10,14 +10,6 @@ plugins {
val isOrchestratorEnabled = true
android {
// TODO [#6]: Figure out how to move this into the build-conventions
kotlinOptions {
jvmTarget = libs.versions.java.get()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
}
if (isOrchestratorEnabled) {
defaultConfig {
testInstrumentationRunnerArguments["clearPackageData"] = "true"

View File

@ -5,12 +5,6 @@ plugins {
}
android {
// TODO [#6]: Figure out how to move this into the build-conventions
kotlinOptions {
jvmTarget = libs.versions.java.get()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs.plus("-opt-in=kotlin.RequiresOptIn")
}
}
dependencies {

View File

@ -5,13 +5,6 @@ plugins {
}
android {
// TODO [#6]: Figure out how to move this into the build-conventions
kotlinOptions {
jvmTarget = libs.versions.java.get()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs.plus("-opt-in=kotlin.RequiresOptIn")
}
resourcePrefix = "co_electriccoin_zcash_"
}

View File

@ -6,13 +6,6 @@ plugins {
}
android {
// TODO [#6]: Figure out how to move this into the build-conventions
kotlinOptions {
jvmTarget = libs.versions.java.get()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
}
// Force orchestrator to be used for this module, because we need the preference files
// to be purged between tests
defaultConfig {

View File

@ -5,13 +5,6 @@ plugins {
}
android {
// TODO [#6]: Figure out how to move this into the build-conventions
kotlinOptions {
jvmTarget = libs.versions.java.get()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs.plus("-opt-in=kotlin.RequiresOptIn")
}
resourcePrefix = "co_electriccoin_zcash_"
}

View File

@ -7,7 +7,6 @@ plugins {
android {
buildFeatures {
viewBinding = true
compose = true
}
@ -15,13 +14,6 @@ android {
kotlinCompilerExtensionVersion = libs.androidx.compose.compiler.get().versionConstraint.displayName
}
// TODO [#6]: Figure out how to move this into the build-conventions
kotlinOptions {
jvmTarget = libs.versions.java.get()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs.plus("-opt-in=kotlin.RequiresOptIn")
}
sourceSets {
getByName("main").apply {
res.setSrcDirs(

View File

@ -15,7 +15,6 @@ android {
}
buildFeatures {
viewBinding = true
compose = true
}
@ -23,13 +22,6 @@ android {
kotlinCompilerExtensionVersion = libs.androidx.compose.compiler.get().versionConstraint.displayName
}
// TODO [#6]: Figure out how to move this into the build-conventions
kotlinOptions {
jvmTarget = libs.versions.java.get()
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
freeCompilerArgs = freeCompilerArgs.plus("-opt-in=kotlin.RequiresOptIn")
}
sourceSets {
getByName("main").apply {
res.setSrcDirs(