Repository navigation
Fix #6229, part of #6233: Prepare for Bazel 7 upgrade - #6234
BenHenning wants to merge 8 commits into
Conversation
This upgrades key dependencies to prepare for the Bazel 7.x upgrade without actually including that step. Cursory testing including with the actual app has been done to verify things are working at a high-level.
I think this mainly just calls right through to the native rules so it's basically a no-op other than setting precedent. Note that Gemini CLI basically generated this entire commit though it will probably benefit from some small tweaking later on.
|
Hi @BenHenning, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
|
Hi @BenHenning, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
|
Hi @BenHenning, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
Conflicts: WORKSPACE scripts/src/java/org/oppia/android/scripts/lint/AndroidLintRunner.kt third_party/maven_install.json third_party/versions.bzl tools/kotlin/BUILD.bazel utility/src/main/java/org/oppia/android/util/parser/html/MathTagHandler.kt
It actually does need to stay (per a Gemini analysis using AntiGravity).
This entire commit was done by AntiGravity using Gemini models.
|
PTAL @adhiamboperes. Note that I still need to self review the file changes, double check offline builds, run the app, and update the PR description with the latest (and fix anything else that comes in from the next CI run). That being said, I strongly suspect this is very close to being ready to go and is definitely ready for review. |
|
@BenHenning this PR is being marked as draft because you are not assigned to referenced issue #6233 (or it does not exist). You may only fix issues that you are assigned to to help avoid multiple team members duplicating work on the same issue. |
|
Forgot to self assign #6233 (thought it was, my bad). I've pulled in the latest CI did fail before on |
adhiamboperes
left a comment
There was a problem hiding this comment.
Thanks @BenHenning and apologies for the delay in review.
I found the diff to be LGTM, but I have concerns about the PR descriptions. It says that rules_kotlin moves to 2.1.3, the bundled compiler replaces the explicit pin, and Compose compiler becomes 1.4.7. The actual code retains rules_kotlin v1.7.1, Kotlin 1.6.10, and Compose compiler 1.1.1.
Also Suppress("WrongConstant") is removed from MathTagHandler, but it isn't explained why it is nolonger neccessary(it was previously added for suppression of a lint false positive.)
|
Thanks @adhiamboperes. That's part of the PR description being slightly out of date and needing updating. Will take a look and at the handler (plus the rest of the code). |
Explanation
Fixes #6229
Fixes part of #6233
Written by AI and edited by @BenHenning
This PR upgrades key Bazel workspace & Maven dependencies to versions compatible with both Bazel
6.5.0and Bazel7.x, and introduces initial Starlarkrules_androidsupport while keeping the repository on Bazel6.5.0.Per #6021, Android Studio Otter and newer require a Bazel plugin rewrite that drops support for Bazel
6.xin favor of Bazel7.x+. Building on the offline pre-fetching & build stability groundwork in #6164, this PR pulls forward the Bazel6.5.0-compatible dependency and rule updates so each high-risk layer of the #6233 migration can land and settle independently ahead of migrating to Kotlin 1.9 & KSP (#6235), switching from Proguard to R8 (#6236), and upgrading Bazel itself to7.7.1(#6237).Specific Bazel rule & toolchain changes to note (using versions that work together under Bazel
6.5.0alongside ouroppia_proto_api/protobuf & JDK setup while also falling within Bazel 7-compatible release lines and avoiding the Turbine JDK resolution failures hit with some other rule combinations during the #6021 investigation):rules_javais upgraded from5.3.5to7.3.1, andrules_protois moved from pinned commitc0b62f2f46c85c16cb3b5e9e921f0d00e3101934to release7.1.0(switching itshttp_archiveto the release tarball).rules_jvm_external(rules_jvm) is upgraded from5.1to6.9(also switching from a GitHub source zip to the release tarball).rules_kotlinis upgraded fromv1.7.1to2.1.3(the final release supporting Bazel6.x), updatingkotlin_repositories()inWORKSPACEto userules_kotlin's bundled compiler rather than pinningkotlinc1.6.10separately. To avoid coupling a full Kotlin language upgrade into this PR,build_vars.bzlreplacesKOTLIN_COMPILER_VERSIONwithKOTLIN_LANGUAGE_VERSION = "1.6"fordefine_kt_toolchainintools/kotlin/BUILD.bazel, andAndroidBuildSdkProperties&AndroidLintRunner(plus their unit tests) now read this language version directly instead of stripping the patch segment off a compiler version.bazel_features(1.25.0) andrules_license(1.0.0) are added toWORKSPACE&third_party/versions.bzlto satisfy transitive repository dependencies required by the upgraded rule sets.rules_android(0.1.1, the version compatible with Bazel6.5.0) is introduced inWORKSPACE(android_sdk_repository),instrumentation/oppia_instrumentation_test.bzl(android_binary&android_instrumentation_test), and theBUILD.bazelfiles that directly invokeandroid_libraryorandroid_binary(e.g.app/BUILD.bazel,third_party/BUILD.bazel, andutility/BUILD.bazel).oppia_android_application.bzlandoppia_android_test.bzlremain onnative.android_binaryandnative.android_local_testfor now because migrating those central macros hit compatibility issues withrules_android0.1.1on Bazel6.5.0and requiresrules_android0.7.1plus patches in Fix #6233: Migrate to Bazel 7 [Blocked: #6236] #6237. Since0.1.1largely delegates through to Bazel's built-in Android rules anyway, this partial migration is effectively a build no-op that sets up the@rules_androidload pattern ahead of Fix #6228, part of #6233: Migrate to Kotlin 1.9 [Blocked: #6234] #6235 and Fix #6233: Migrate to Bazel 7 [Blocked: #6236] #6237.Other Maven & build adjustments required by these upgrades (or cleaned up while repinning):
androidx.compose.compiler:compileris bumped from1.1.1to1.4.7for compatibility with the newer Kotlin compiler bundled inrules_kotlin2.1.3(while keeping the Compose runtime/UI libraries at1.1.1and the Kotlin language level at1.6).:jarpackaging suffixes are dropped fromjavax.annotation:javax.annotation-api,org.jetbrains.kotlin:kotlin-stdlib-jdk8, andorg.jetbrains:annotationsinthird_party/versions.bzlas required byrules_jvm_external6.9, updating the corresponding//third_party:*target references inapp/BUILD.bazelandscripts/src/java/org/oppia/android/scripts/common/BUILD.bazel.https://maven.fabric.io/publicwas removed fromMAVEN_REPOSITORIESsince it is defunct, andhttps://repo1.maven.org/maven2was ordered ahead ofhttps://maven.google.com(partially an attempt to improve 404 artifact errors but there's more work needed here in a future PR). Repinningthird_party/maven_install.jsonalso addsrules_jvm_external6.9's"services"metadata block and picks up minor transitive shifts (org.bouncycastle2.73.12->2.73.13andcom.google.guava:guavain the lockfile, though Android builds still resolve Guava to31.0.1-androidviaWORKSPACE'soverride_targetsmapping to//third_party:com_google_guava_guava)..bazelrcaddsbuild --javacopt="-Xlint:-options" --host_javacopt="-Xlint:-options"to suppress unavoidable obsolete source/target option warnings under Bazel6.xthat would otherwise fail Java builds with-Werrorenabled.MathTagHandleradds@Deprecatedand@Suppress("DeprecatedCallableAddReplaceWith")onLatexImageSpan'sDrawable.getOpacity()override so the newer Kotlin compiler doesn't fail on an unannotated override of a Java-deprecated method under warnings-as-errors.I've verified these changes locally on Bazel
6.5.0via cursory app smoke testing (//:oppia_dev), release/Proguard builds (//:oppia_alpha), key Robolectric tests, and offline dependency pre-fetching (bazel sync&bazel fetch //...).Essential Checklist
Disclosure of LLM Usage
rules_androidsupport commit (3cb9042bf), and Gemini was used briefly during the [BUG]: Android Studio Otter+ no longer compatible with project (must upgrade to Bazel 7.x+) [Blocked: #6233] #6021 investigation to double-check Bazel rule version compatibility ranges. All other commits on this branch (the main dependency & toolchain upgrades, merge conflict resolution, and Bazel lint fixes) and local verification were authored and verified entirely by me without AI (though much of these changes were pulled in from downstream PRs that were heavily AI generated as mentioned in those PRs). Separately, this PR description was drafted with an AI agent (using the a work-in-progresswrite-pr-descriptionskill I'm building) from the branch diff and my answers to its questions, and then reviewed and edited by me.For UI-specific PRs only
N/A -- Build & dependency infrastructure-only change that shouldn't impact the UI or UX of the app (outside of bumping the Compose compiler plugin for compatibility with the newer Kotlin toolchain).