Skip to content

Commit 2f57588

Browse files
committed
When updating signatures, copy buildSrc deps to root project
a workaround for gradle/gradle#24822 Bug: 278890578 Change-Id: I90d15bd8022880aa52afb11bf852875471734e12
1 parent cb1093f commit 2f57588

File tree

5 files changed

+67
-49
lines changed

5 files changed

+67
-49
lines changed

build.gradle

+6
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ buildscript {
2525
apply from: "buildSrc/dependencies.gradle"
2626

2727
apply plugin: AndroidXRootPlugin
28+
29+
// workaround for https://github.com/gradle/gradle/issues/24822
30+
if (project.hasProperty("androidx.update.signatures")) {
31+
apply plugin: "java-library"
32+
apply from: "buildSrc/shared-dependencies.gradle"
33+
}

buildSrc/private/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ const val XCODEGEN_DOWNLOAD_URI = "androidx.benchmark.darwin.xcodeGenDownloadUri
152152
*/
153153
const val ALLOW_CUSTOM_COMPILE_SDK = "androidx.allowCustomCompileSdk"
154154

155+
/**
156+
* Whether to update gradle signature verification metadata
157+
*/
158+
const val UPDATE_SIGNATURES = "androidx.update.signatures"
159+
155160
val ALL_ANDROIDX_PROPERTIES = setOf(
156161
ADD_GROUP_CONSTRAINTS,
157162
ALTERNATIVE_PROJECT_URL,
@@ -179,7 +184,8 @@ val ALL_ANDROIDX_PROPERTIES = setOf(
179184
ENABLED_KMP_TARGET_PLATFORMS,
180185
ALLOW_MISSING_LINT_CHECKS_PROJECT,
181186
XCODEGEN_DOWNLOAD_URI,
182-
ALLOW_CUSTOM_COMPILE_SDK
187+
ALLOW_CUSTOM_COMPILE_SDK,
188+
UPDATE_SIGNATURES
183189
)
184190

185191
/**

buildSrc/shared-dependencies.gradle

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// This file applies dependencies common to projects in buildSrc
2+
3+
apply from: "${buildscript.sourceFile.parent}/kotlin-dsl-dependency.gradle"
4+
dependencies {
5+
6+
// Gradle APIs
7+
implementation(gradleApi())
8+
compileOnly(findGradleKotlinDsl())
9+
10+
// Android Gradle Plugin APIs used by Stable AIDL
11+
implementation(libs.androidGradlePluginApi)
12+
13+
// Plugins we use and configure
14+
implementation(libs.androidGradlePluginz)
15+
implementation(libs.androidToolsCommon) // for com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
16+
implementation(libs.androidToolsRepository) // com.android.repository for Stable AIDL plugin
17+
implementation(libs.androidToolsSdkCommon) // com.android.ide.common for Stable AIDL plugin
18+
implementation(libs.kotlinGradlePluginz)
19+
20+
// variety of json parsers
21+
implementation(libs.gson)
22+
implementation(libs.jsonSimple)
23+
24+
// XML parsers used in MavenUploadHelper.kt
25+
implementation(libs.dom4j) {
26+
// Optional dependency where Ivy fails to parse the POM file.
27+
exclude(group:"net.java.dev.msv", module:"xsdlib")
28+
}
29+
implementation(libs.xerces)
30+
31+
implementation(libs.shadow) // used by BundleInsideHelper.kt
32+
implementation(libs.apacheAnt) // used in AarManifestTransformerTask.kt for unziping
33+
implementation(libs.toml)
34+
implementation(libs.apacheCommonIo) // used in CheckApiEquivalenceTask.kt
35+
implementation(libs.dexMemberList) // used in ReportLibraryMetricsTask.kt
36+
37+
implementation(libs.protobufGradlePluginz) // needed to compile inspection plugin
38+
implementation(libs.kotlinPoet) // needed to compile material-icon-generator
39+
implementation(libs.xmlpull) // needed to compile material-icon-generator
40+
41+
implementation(libs.protobuf) // needed to compile baseline-profile gradle plugins
42+
implementation(libs.agpTestingPlatformCoreProto) // needed to compile baseline-profile gradle plugins
43+
44+
// dependencies that aren't used by buildSrc directly but that we resolve here so that the
45+
// root project doesn't need to re-resolve them and their dependencies on every build
46+
runtimeOnly(libs.hiltAndroidGradlePluginz)
47+
runtimeOnly(libs.javapoet) // for hiltAndroidGradlePluginz to workaround https://github.com/google/dagger/issues/3068
48+
runtimeOnly(libs.kspGradlePluginz)
49+
runtimeOnly(libs.wireGradlePluginz)
50+
}

buildSrc/shared.gradle

+3-47
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
1+
// This file applies configuration common to projects in buildSrc
22
apply plugin: "kotlin"
3-
apply from: "../kotlin-dsl-dependency.gradle"
43
apply plugin: "java-gradle-plugin"
54

65
buildscript {
@@ -14,53 +13,10 @@ buildscript {
1413

1514
dependencies {
1615
implementation(project(":jetpad-integration"))
17-
18-
// Gradle APIs
19-
implementation(gradleApi())
20-
compileOnly(findGradleKotlinDsl())
21-
22-
// Android Gradle Plugin APIs used by Stable AIDL
23-
implementation(libs.androidGradlePluginApi)
24-
25-
// Plugins we use and configure
26-
implementation(libs.androidGradlePluginz)
27-
implementation(libs.androidToolsCommon) // for com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
28-
implementation(libs.androidToolsRepository) // com.android.repository for Stable AIDL plugin
29-
implementation(libs.androidToolsSdkCommon) // com.android.ide.common for Stable AIDL plugin
30-
implementation(libs.kotlinGradlePluginz)
31-
32-
// variety of json parsers
33-
implementation(libs.gson)
34-
implementation(libs.jsonSimple)
35-
36-
// XML parsers used in MavenUploadHelper.kt
37-
implementation(libs.dom4j) {
38-
// Optional dependency where Ivy fails to parse the POM file.
39-
exclude(group:"net.java.dev.msv", module:"xsdlib")
40-
}
41-
implementation(libs.xerces)
42-
43-
implementation(libs.shadow) // used by BundleInsideHelper.kt
44-
implementation(libs.apacheAnt) // used in AarManifestTransformerTask.kt for unziping
45-
implementation(libs.toml)
46-
implementation(libs.apacheCommonIo) // used in CheckApiEquivalenceTask.kt
47-
implementation(libs.dexMemberList) // used in ReportLibraryMetricsTask.kt
48-
49-
implementation(libs.protobufGradlePluginz) // needed to compile inspection plugin
50-
implementation(libs.kotlinPoet) // needed to compile material-icon-generator
51-
implementation(libs.xmlpull) // needed to compile material-icon-generator
52-
53-
implementation(libs.protobuf) // needed to compile baseline-profile gradle plugins
54-
implementation(libs.agpTestingPlatformCoreProto) // needed to compile baseline-profile gradle plugins
55-
56-
// dependencies that aren't used by buildSrc directly but that we resolve here so that the
57-
// root project doesn't need to re-resolve them and their dependencies on every build
58-
runtimeOnly(libs.hiltAndroidGradlePluginz)
59-
runtimeOnly(libs.javapoet) // for hiltAndroidGradlePluginz to workaround https://github.com/google/dagger/issues/3068
60-
runtimeOnly(libs.kspGradlePluginz)
61-
runtimeOnly(libs.wireGradlePluginz)
6216
}
6317

18+
apply from: "../shared-dependencies.gradle"
19+
6420
java {
6521
sourceCompatibility = JavaVersion.VERSION_11
6622
targetCompatibility = JavaVersion.VERSION_11

development/update-verification-metadata.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function regenerateVerificationMetadata() {
1717
echo "regenerating verification metadata and keyring"
1818
# regenerate metadata
1919
# Need to run a clean build, https://github.com/gradle/gradle/issues/19228
20-
runGradle --stacktrace --write-verification-metadata pgp,sha256 --export-keys --dry-run --clean bOS :docs-kmp:zipCombinedKmpDocs
20+
runGradle --stacktrace --write-verification-metadata pgp,sha256 --export-keys --dry-run --clean -Pandroidx.update.signatures=true bOS :docs-kmp:zipCombinedKmpDocs
2121

2222
# update verification metadata file
2323
# also remove 'version=' lines, https://github.com/gradle/gradle/issues/20192

0 commit comments

Comments
 (0)