Skip to content

Commit

Permalink
[1.69.*] Pre-release merge (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Mar 6, 2024
2 parents 0658fcf + 32a59d0 commit 38139e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 38 deletions.
22 changes: 0 additions & 22 deletions build-logic/lint-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 8.3.0" type="baseline" client="gradle" dependencies="false" name="AGP (8.3.0)" variant="all" version="8.3.0">

<issue
id="InternalGradleApiUsage"
message="Avoid using internal Android Gradle Plugin APIs"
errorLine1="import com.android.build.gradle.internal.dsl.BaseAppModuleExtension"
errorLine2="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/kotlin/dev/msfjarvis/claw/gradle/signing/AppSigning.kt"
line="9"
column="1"/>
</issue>

<issue
id="InternalGradleApiUsage"
message="Avoid using internal Android Gradle Plugin APIs"
errorLine1="import com.android.build.gradle.internal.plugins.AppPlugin"
errorLine2="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/kotlin/dev/msfjarvis/claw/gradle/versioning/VersioningPlugin.kt"
line="11"
column="1"/>
</issue>

</issues>
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,29 @@
*/
package dev.msfjarvis.claw.gradle.signing

import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import com.android.build.api.dsl.ApplicationBuildType
import com.android.build.api.dsl.CommonExtension
import java.util.Properties
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

private const val KEYSTORE_CONFIG_PATH = "keystore.properties"

/** Configure signing for all build types. */
@Suppress("UnstableApiUsage")
internal fun Project.configureBuildSigning() {
val keystoreConfigFile = rootProject.layout.projectDirectory.file(KEYSTORE_CONFIG_PATH)
if (keystoreConfigFile.asFile.exists()) {
extensions.configure<BaseAppModuleExtension> {
extensions.configure<CommonExtension<*, ApplicationBuildType, *, *, *, *>>("android") {
val contents = providers.fileContents(keystoreConfigFile).asText
val keystoreProperties = Properties()
keystoreProperties.load(contents.get().byteInputStream())
signingConfigs {
register("release") {
val releaseSigningConfig =
signingConfigs.register("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = rootProject.file(keystoreProperties["storeFile"] as String)
storePassword = keystoreProperties["storePassword"] as String
}
}
val signingConfig = signingConfigs.getByName("release")
buildTypes.configureEach { setSigningConfig(signingConfig) }
buildTypes.configureEach { signingConfig = releaseSigningConfig.get() }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ package dev.msfjarvis.claw.gradle.versioning

import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.api.variant.VariantOutputConfiguration
import com.android.build.gradle.internal.plugins.AppPlugin
import com.github.zafarkhaja.semver.Version
import java.util.Properties
import java.util.concurrent.atomic.AtomicBoolean
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.withType

/**
* A Gradle [Plugin] that takes a [Project] with the [AppPlugin] applied and dynamically sets the
* versionCode and versionName properties based on values read from a [VERSIONING_PROP_FILE] file in
* the [Project.getProjectDir] directory. It also adds Gradle tasks to bump the major, minor, and
* patch versions along with one to prepare the next snapshot.
* A Gradle [Plugin] that takes a [Project] with the `com.android.application` applied and
* dynamically sets the versionCode and versionName properties based on values read from a
* [VERSIONING_PROP_FILE] file in the [Project.getProjectDir] directory. It also adds Gradle tasks
* to bump the major, minor, and patch versions along with one to prepare the next snapshot.
*/
@Suppress("Unused")
class VersioningPlugin : Plugin<Project> {
Expand Down Expand Up @@ -54,7 +52,7 @@ class VersioningPlugin : Plugin<Project> {
)
.map(String::toInt)

project.plugins.withType<AppPlugin> {
project.pluginManager.withPlugin("com.android.application") {
androidAppPluginApplied.set(true)
extensions.configure<ApplicationAndroidComponentsExtension> {
onVariants { variant ->
Expand Down

0 comments on commit 38139e0

Please sign in to comment.