Skip to content

[build] Bump Bouncy Castle to 1.87 in Gradle projects - #13622

Merged
jonathanpeppers merged 2 commits into
mainfrom
jonathanpeppers-fix-bouncycastle-gradle
Nov 19, 2026
Merged

jonathanpeppers merged 2 commits into
mainfrom
jonathanpeppers-fix-bouncycastle-gradle

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Three Gradle projects use Bouncy Castle 1.80.2 as a transitive dependency:

  • src/manifestmerger: from com.android.tools:sdk-common:32.5.1. This JAR ships in the SDK.
  • src/proguard-android and the JavaLib test project: from the Android Gradle Plugin 9.5.1.

manifest-merger 32.5.1 and AGP 9.5.1 are the latest stable versions, so a direct dependency bump cannot update Bouncy Castle.

Add eng/gradle/dependency-constraints.gradle, which sets bcprov-jdk18on and bcpkix-jdk18on to at least 1.87, and apply it from each affected settings.gradle. It adds the constraints to the buildscript classpath and to all project configurations, so it covers plugin dependencies too. Dependabot does not read this file, so its versions must be updated manually.

Version 1.87 is already in the dnceng dotnet-public-maven mirror.

Validation, with JDK 17 and RUNNINGONCI=true: each command gives BUILD SUCCESSFUL, and Bouncy Castle resolves only to 1.87.

  • src/manifestmerger: gradlew build dependencies buildEnvironment -PjavaSourceVer=17 -PjavaTargetVer=17
  • src/proguard-android: gradlew extractProguardFiles dependencies buildEnvironment
  • JavaLib: gradlew assembleDebug buildEnvironment :library:dependencies

Co-authored-by: Copilot App [email protected]

Three Gradle projects use Bouncy Castle 1.80.2 as a transitive dependency:

  * `src/manifestmerger`: from `com.android.tools:sdk-common:32.5.1`. This JAR ships in the SDK.
  * `src/proguard-android` and the `JavaLib` test project: from the Android Gradle Plugin 9.5.1.

`manifest-merger` 32.5.1 and AGP 9.5.1 are the latest stable versions, so a direct dependency bump cannot update Bouncy Castle.

Add `eng/gradle/dependency-constraints.gradle`, which sets `bcprov-jdk18on` and `bcpkix-jdk18on` to at least 1.87, and apply it from each affected `settings.gradle`. It adds the constraints to the buildscript classpath and to all project configurations, so it covers plugin dependencies too. Dependabot does not read this file, so its versions must be updated manually.

Version 1.87 is already in the dnceng `dotnet-public-maven` mirror.

Validation, with JDK 17 and `RUNNINGONCI=true`: each command gives BUILD SUCCESSFUL, and Bouncy Castle resolves only to 1.87.

  * `src/manifestmerger`: `gradlew build dependencies buildEnvironment -PjavaSourceVer=17 -PjavaTargetVer=17`
  * `src/proguard-android`: `gradlew extractProguardFiles dependencies buildEnvironment`
  * `JavaLib`: `gradlew assembleDebug buildEnvironment :library:dependencies`

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The imported dependency constraints file is missing from _BuildManifestMerger inputs, so changing only the centralized Bouncy Castle versions can leave the shipped JAR with stale dependencies.

1 open issue
What changed in this PR

Updates transitive Bouncy Castle dependencies across three Gradle projects, including the manifest merger shipped in the .NET for Android SDK.

Changes:

  • Adds shared minimum-version constraints of 1.87 for bcprov-jdk18on and bcpkix-jdk18on, covering buildscript and project dependencies.
  • Applies the constraints to manifestmerger, proguard-android, and the JavaLib test project.
  • Documents centralized version maintenance and Dependabot limitations.
File Description
tests/​CodeGen-Binding/​Xamarin.Android.LibraryProjectZip-LibBinding/​java/​JavaLib/​settings.gradle Applies shared constraints to JavaLib.
src/​proguard-android/​settings.gradle Applies shared constraints to proguard-android.
src/​manifestmerger/​settings.gradle Applies shared constraints to the shipped manifest merger.
eng/​gradle/​dependency-constraints.gradle Defines Bouncy Castle minimum versions for buildscript and project configurations.
.github/​instructions/​gradle.instructions.md Documents how to apply and maintain transitive dependency constraints.

Review effort: Balanced

Comment thread src/manifestmerger/settings.gradle Resolved
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Nov 18, 2026
@jonathanpeppers

Copy link
Copy Markdown
Member Author

@dalexsoto review

@jonathanpeppers
jonathanpeppers enabled stacked auto-merge (squash) November 18, 2026 22:28

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5a8adb37 against main at 13a3e7d4 (merge-base 0402b6bd). This was a static, read-only review; I didn't build or run anything.

LGTM. What I checked:

  • eng/gradle/dependency-constraints.gradle: it's applied from settings.gradle and only uses gradle.beforeProject, which works there. The classpath constraint also reaches plugins from the plugins {} block, including the Android Gradle Plugin's dependencies. The canBeDeclared guard limits it to declarable configurations and is available in the repo's Gradle 9.6.0 wrapper. A plain constraint is a required version, so conflict resolution upgrades 1.80.2 to 1.87.
  • apply from paths: ../.. for the two src/* projects and ../../../../.. for JavaLib both resolve to the repo root, the same way each file's existing repository includes do.
  • manifestmerger.jar: it's a fat jar built from runtimeClasspath, so the shipped jar picks up 1.87. Copilot's earlier finding is fixed: _BuildManifestMerger now lists dependency-constraints.gradle as an input, and the path resolves correctly from src/manifestmerger/.
  • bcutil-jdk18on: the bcpkix-jdk18on 1.87 POM depends on bcutil-jdk18on 1.87, so the Bouncy Castle versions can't end up mixed. All three 1.87 artifacts are in the dnceng dotnet-public-maven mirror.
  • proguard-android and JavaLib: their targets don't list the new file as an input. That's fine: proguard-android only extracts ProGuard rule files from AGP, and JavaLib is a test project.
  • No notices or packaging file pins a Bouncy Castle version, the new docs match the implementation, and none of the 13 commits on main since the merge-base touch these paths.

Since I didn't run anything, your local Gradle results are the only build validation behind this review.

@jonathanpeppers
jonathanpeppers merged commit 4ced751 into main Nov 19, 2026
47 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-fix-bouncycastle-gradle branch November 19, 2026 11:55
jonathanpeppers added a commit that referenced this pull request Nov 19, 2026
Context: #13622

Guava is a transitive dependency of four Gradle projects:

  * `src/java-source-utils`: 33.6.0-jre, from javaparser 3.28.2
  * `src/manifestmerger`: 33.4.0-jre, from `manifest-merger` 32.5.1
  * `src/proguard-android` and `JavaLib`: 33.4.0-jre, from AGP 9.5.1

These direct dependencies are already the latest stable versions, so add Guava to `eng/gradle/dependency-constraints.gradle` and apply that file from `src/java-source-utils/settings.gradle`.

Guava 33.7 no longer depends on `jsr305` and calls signature-polymorphic `VarHandle` methods, so ProGuard fails in `src/manifestmerger`:

    Warning: com.google.common.jimfs.AbstractWatchService: can't find referenced class javax.annotation.Nullable
    Warning: com.google.common.hash.LittleEndianByteArray$VarHandleLittleEndianBytes$1: can't find referenced method 'long get(byte[],int)' in library class java.lang.invoke.VarHandle

Ignore both in `proguard.pro`. jimfs only uses the JSR 305 annotations, which are not needed at run time, and `VarHandle` is the same case as the existing `MethodHandle` rule.

Validation, with JDK 17: each build succeeds, and Guava resolves only to 33.7.2-jre.

  * `src/java-source-utils`: `gradlew jar test` (18 tests passed)
  * `src/manifestmerger`: `gradlew build dependencies`
  * `src/proguard-android`: `gradlew extractProguardFiles buildEnvironment dependencies`
  * `JavaLib`: `gradlew assembleDebug buildEnvironment :library:dependencies`

Co-authored-by: Copilot App <[email protected]>
jonathanpeppers added a commit that referenced this pull request Nov 19, 2026
Context: #13622

Guava is a transitive dependency of four Gradle projects:

  * `src/java-source-utils`: 33.6.0-jre, from javaparser 3.28.2
  * `src/manifestmerger`: 33.4.0-jre, from `manifest-merger` 32.5.1
  * `src/proguard-android` and `JavaLib`: 33.4.0-jre, from AGP 9.5.1

These direct dependencies are already the latest stable versions, so add Guava to `eng/gradle/dependency-constraints.gradle` and apply that file from `src/java-source-utils/settings.gradle`.

Guava 33.7 no longer depends on `jsr305` and calls signature-polymorphic `VarHandle` methods, so ProGuard fails in `src/manifestmerger`:

    Warning: com.google.common.jimfs.AbstractWatchService: can't find referenced class javax.annotation.Nullable
    Warning: com.google.common.hash.LittleEndianByteArray$VarHandleLittleEndianBytes$1: can't find referenced method 'long get(byte[],int)' in library class java.lang.invoke.VarHandle

Ignore both in `proguard.pro`. jimfs only uses the JSR 305 annotations, which are not needed at run time, and `VarHandle` is the same case as the existing `MethodHandle` rule.

Validation, with JDK 17: each build succeeds, and Guava resolves only to 33.7.2-jre.

  * `src/java-source-utils`: `gradlew jar test` (18 tests passed)
  * `src/manifestmerger`: `gradlew build dependencies`
  * `src/proguard-android`: `gradlew extractProguardFiles buildEnvironment dependencies`
  * `JavaLib`: `gradlew assembleDebug buildEnvironment :library:dependencies`

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants