Skip to content

Commit bcb5da2

Browse files
ADFA-2602: Move the on-device toolchain to Gradle 9.6.1, AGP 9.3.1, Kotlin 2.3.21 (#1647)
* ADFA-2602: Resolve buildscript classpaths from the on-device Maven repo COTGSettingsPlugin injects the bundled repo into pluginManagement and dependencyResolutionManagement only. A `buildscript { }` block resolves against its own repositories, which nothing reached, so any project declaring its build classpath that way could only be built online. That is why plugin-template builds required network. Inject the repo for both scopes, each before the script that consumes it is evaluated: - beforeSettings, for a buildscript block in settings.gradle.kts (the plugin template declares AGP and Kotlin there) - beforeProject, for a buildscript block in build.gradle.kts settingsEvaluated is too late: by then the settings buildscript classpath has already resolved. A missing repo is not fatal. The directory does not exist until onboarding has installed the assets, and failing there would break every build before that point. * ADFA-2602: Move the on-device toolchain to Gradle 9.6.1, AGP 9.3.1, Kotlin 2.3.21 Collapses the duplicate Kotlin compilers the device was shipping. Gradle 9.6.1 embeds Kotlin 2.3.21, and AGP 9's built-in Kotlin resolves the same 2.3.21 compiler, so the build-script compiler and the app compiler are one artifact instead of two at different versions. Version choice is constrained from both ends and is not free: - AGP 9.3.1 requires Gradle 9.5.0+ - AGP 8.x fails on Gradle 9.6.0+ (it uses InternalProblems, removed there) - Gradle's embedded Kotlin is fixed per version: 9.4.1 -> 2.3.0, 9.5.1 -> 2.3.20, 9.6.1 -> 2.3.21, 9.7.0 -> 2.4.0 Bumping agp-tooling to match the device forces a model migration, so it lands here rather than separately -- splitting it would leave a commit that does not compile. AGP 9 removed PrivacySandboxSdkInfo and AndroidProject.PROPERTY_ANDROID_SUPPORT_VERSION (value inlined as "android.injected.studio.version"), and added mappingR8TextFile, mappingR8PartitionFile, keepRulesDirectories and aarKeepRulesDirectories. app/build.gradle.kts now derives the bundled asset filenames from the version constants instead of repeating "8.14.3" in six string literals. Note the asset rename: builds resolve gradle-9.6.1-bin.zip, which must be published to dev-assets before this lands or local assetsDownloadDebug returns 404. * ADFA-2602: Reference the agp-tooling catalog version in plugin-builder Replace the hardcoded AGP 9.3.1 in plugin-builder's compileOnly with a tooling-agp catalog alias so the version is defined once. plugin-builder is also an included/standalone build, so import the root catalog in its settings (same pattern as composite-builds/build-logic). --------- Co-authored-by: Daniel Alome <astrocoder007@gmail.com>
1 parent 58200f5 commit bcb5da2

10 files changed

Lines changed: 235 additions & 208 deletions

File tree

app/build.gradle.kts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import com.itsaky.androidide.build.config.BuildConfig
44
import com.itsaky.androidide.desugaring.utils.JavaIOReplacements.applyJavaIOReplacements
55
import com.itsaky.androidide.plugins.AndroidIDEAssetsPlugin
6+
import org.adfa.constants.GRADLE_API_NAME_JAR_BR
7+
import org.adfa.constants.GRADLE_API_NAME_JAR_ZIP
8+
import org.adfa.constants.GRADLE_DISTRIBUTION_ARCHIVE_NAME
69
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
710
import org.json.JSONObject
811
import java.io.BufferedOutputStream
@@ -719,8 +722,8 @@ fun createAssetsZip(arch: String) {
719722
arrayOf(
720723
androidSdkName,
721724
"localMvnRepository.zip",
722-
"gradle-8.14.3-bin.zip",
723-
"gradle-api-8.14.3.jar.zip",
725+
"$GRADLE_DISTRIBUTION_ARCHIVE_NAME",
726+
"$GRADLE_API_NAME_JAR_ZIP",
724727
"documentation.db",
725728
bootstrapName,
726729
"plugin-artifacts.zip",
@@ -1364,15 +1367,15 @@ val debugAssets =
13641367
"debug",
13651368
),
13661369
Asset(
1367-
"assets/gradle-8.14.3-bin.zip",
1368-
"https://appdevforall.org/dev-assets/debug/gradle-8.14.3-bin.zip",
1369-
"gradle-8.14.3-bin.zip",
1370+
"assets/$GRADLE_DISTRIBUTION_ARCHIVE_NAME",
1371+
"https://appdevforall.org/dev-assets/debug/$GRADLE_DISTRIBUTION_ARCHIVE_NAME",
1372+
"$GRADLE_DISTRIBUTION_ARCHIVE_NAME",
13701373
"debug",
13711374
),
13721375
Asset(
1373-
"assets/gradle-api-8.14.3.jar.zip",
1374-
"https://appdevforall.org/dev-assets/debug/gradle-api-8.14.3.jar.zip",
1375-
"gradle-api-8.14.3.jar.zip",
1376+
"assets/$GRADLE_API_NAME_JAR_ZIP",
1377+
"https://appdevforall.org/dev-assets/debug/$GRADLE_API_NAME_JAR_ZIP",
1378+
"$GRADLE_API_NAME_JAR_ZIP",
13761379
"debug",
13771380
),
13781381
Asset(
@@ -1392,15 +1395,15 @@ val debugAssets =
13921395
val releaseAssets =
13931396
listOf(
13941397
Asset(
1395-
"assets/release/common/data/common/gradle-8.14.3-bin.zip.br",
1396-
"https://appdevforall.org/dev-assets/release/gradle-8.14.3-bin.zip.br",
1397-
"gradle-8.14.3-bin.zip.br",
1398+
"assets/release/common/data/common/$GRADLE_DISTRIBUTION_ARCHIVE_NAME.br",
1399+
"https://appdevforall.org/dev-assets/release/$GRADLE_DISTRIBUTION_ARCHIVE_NAME.br",
1400+
"$GRADLE_DISTRIBUTION_ARCHIVE_NAME.br",
13981401
"release",
13991402
),
14001403
Asset(
1401-
"assets/release/common/data/common/gradle-api-8.14.3.jar.br",
1402-
"https://appdevforall.org/dev-assets/release/gradle-api-8.14.3.jar.br",
1403-
"gradle-api-8.14.3.jar.br",
1404+
"assets/release/common/data/common/$GRADLE_API_NAME_JAR_BR",
1405+
"https://appdevforall.org/dev-assets/release/$GRADLE_API_NAME_JAR_BR",
1406+
"$GRADLE_API_NAME_JAR_BR",
14041407
"release",
14051408
),
14061409
Asset(

composite-builds/build-deps-common/constants/src/main/java/org/adfa/constants/constants.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
package org.adfa.constants
1919

20-
const val ANDROID_GRADLE_PLUGIN_VERSION = "8.11.0"
21-
const val GRADLE_DISTRIBUTION_VERSION = "8.14.3"
22-
const val KOTLIN_VERSION = "1.9.22"
20+
const val ANDROID_GRADLE_PLUGIN_VERSION = "9.3.1"
21+
const val GRADLE_DISTRIBUTION_VERSION = "9.6.1"
22+
const val KOTLIN_VERSION = "2.3.21"
2323

2424
val TARGET_SDK_VERSION = Sdk.Baklava
2525
val COMPILE_SDK_VERSION = Sdk.Baklava

gradle/libs.versions.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
22
activityKtx = "1.8.2"
33
agp = "8.8.2"
4-
agp-tooling = "8.11.0"
4+
agp-tooling = "9.3.1"
55
androidx-sqlite = "2.6.2"
66
appcompatVersion = "1.7.1"
77
colorpickerview = "2.3.0"
@@ -295,6 +295,7 @@ tests-junit-kts = { module = "androidx.test.ext:junit-ktx", version = "1.2.1" }
295295
tests-kotlinx-coroutines = {module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesCore"}
296296

297297
# Tooling
298+
tooling-agp = { module = "com.android.tools.build:gradle", version.ref = "agp-tooling" }
298299
tooling-builderModel = { module = "com.android.tools.build:builder-model", version.ref = "agp-tooling" }
299300
tooling-gradleApi = { module = "com.itsaky.androidide.gradle:gradle-tooling-api", version.ref = "gradle-tooling" }
300301
tooling-slf4j = { module = "org.slf4j:slf4j-api", version = "2.0.12" }

plugin-api/plugin-builder/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ version = "1.0.0"
88

99
dependencies {
1010
// AGP is provided at runtime by the plugin project's own `com.android.application`,
11-
// and on-device plugin builds use the tooling AGP (`agp-tooling` = 8.11.0), which is
12-
// what the harvested localMvnRepository ships. Keep it compileOnly so the published
11+
// and on-device plugin builds use the tooling AGP (`agp-tooling`), which is what
12+
// the harvested localMvnRepository ships. Keep it compileOnly so the published
1313
// POM stays dependency-free: forcing it as a transitive would make the coordinate
1414
// unresolvable offline whenever the harvested AGP differs from a pinned version.
15-
compileOnly("com.android.tools.build:gradle:8.11.0")
15+
compileOnly(libs.tooling.agp)
1616

1717
// Test-only, so it never reaches the published POM the on-device build resolves.
1818
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
rootProject.name = "plugin-builder"
22

33
dependencyResolutionManagement {
4-
repositories {
5-
google()
6-
mavenCentral()
7-
gradlePluginPortal()
8-
}
9-
}
4+
repositories {
5+
google()
6+
mavenCentral()
7+
gradlePluginPortal()
8+
}
9+
10+
versionCatalogs {
11+
create("libs") {
12+
from(files("../../gradle/libs.versions.toml"))
13+
}
14+
}
15+
}

subprojects/builder-model-impl/src/main/java/com/android/build/gradle/options/StringOption.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ enum class StringOption(
6767
IDE_ANDROID_CUSTOM_CLASS_TRANSFORMS("android.advanced.profiling.transforms", ApiStage.Stable),
6868

6969
// The exact version of Android Support plugin used, e.g. 2.4.0.6
70-
IDE_ANDROID_STUDIO_VERSION(AndroidProject.PROPERTY_ANDROID_SUPPORT_VERSION, ApiStage.Stable),
70+
// AGP 9 removed AndroidProject.PROPERTY_ANDROID_SUPPORT_VERSION; its value is inlined.
71+
IDE_ANDROID_STUDIO_VERSION("android.injected.studio.version", ApiStage.Stable),
7172

7273
// The version of Android Game Development Extension used to orchestrate the build
7374
IDE_AGDE_VERSION("agde.version", ApiStage.Stable),
Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,56 @@
1-
/*
2-
* This file is part of AndroidIDE.
3-
*
4-
* AndroidIDE is free software: you can redistribute it and/or modify
5-
* it under the terms of the GNU General Public License as published by
6-
* the Free Software Foundation, either version 3 of the License, or
7-
* (at your option) any later version.
8-
*
9-
* AndroidIDE is distributed in the hope that it will be useful,
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
* GNU General Public License for more details.
13-
*
14-
* You should have received a copy of the GNU General Public License
15-
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
16-
*/
17-
package com.itsaky.androidide.builder.model
18-
19-
import com.android.builder.model.v2.ide.AndroidArtifact
20-
import com.android.builder.model.v2.ide.BytecodeTransformation
21-
import com.android.builder.model.v2.ide.CodeShrinker
22-
import com.android.builder.model.v2.ide.PrivacySandboxSdkInfo
23-
import java.io.File
24-
import java.io.Serializable
25-
26-
/** @author Akash Yadav */
27-
class DefaultAndroidArtifact : AndroidArtifact, Serializable {
28-
29-
private val serialVersionUID = 1L
30-
override var applicationId: String? = ""
31-
override var resGenTaskName: String? = null
32-
override var abiFilters: Set<String>? = null
33-
override var assembleTaskOutputListingFile: File? = null
34-
override var bundleInfo: DefaultBundleInfo? = null
35-
override var codeShrinker: CodeShrinker? = null
36-
override var generatedResourceFolders: Collection<File> = emptyList()
37-
override var isSigned: Boolean = false
38-
override var maxSdkVersion: Int? = null
39-
override var minSdkVersion: DefaultApiVersion = DefaultApiVersion()
40-
override var signingConfigName: String? = null
41-
override var sourceGenTaskName: String = ""
42-
override var testInfo: DefaultTestInfo? = null
43-
override var assembleTaskName: String = ""
44-
override var classesFolders: Set<File> = emptySet()
45-
override var compileTaskName: String = ""
46-
override var generatedSourceFolders: Collection<File> = emptyList()
47-
override var ideSetupTaskNames: Set<String> = emptySet()
48-
override var targetSdkVersionOverride: DefaultApiVersion? = null
49-
override var modelSyncFiles: Collection<Void> = emptyList()
50-
override var privacySandboxSdkInfo: PrivacySandboxSdkInfo? = null
51-
override var desugaredMethodsFiles: Collection<File> = emptyList()
52-
override val generatedClassPaths: Map<String, File> = emptyMap()
53-
override val generatedAssetsFolders: Collection<File> = emptyList()
54-
override val bytecodeTransformations: Collection<BytecodeTransformation> = emptyList()
55-
}
1+
/*
2+
* This file is part of AndroidIDE.
3+
*
4+
* AndroidIDE is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* AndroidIDE is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package com.itsaky.androidide.builder.model
18+
19+
import com.android.builder.model.v2.ide.AndroidArtifact
20+
import com.android.builder.model.v2.ide.BytecodeTransformation
21+
import com.android.builder.model.v2.ide.CodeShrinker
22+
import java.io.File
23+
import java.io.Serializable
24+
25+
/** @author Akash Yadav */
26+
class DefaultAndroidArtifact :
27+
AndroidArtifact,
28+
Serializable {
29+
private val serialVersionUID = 1L
30+
override var applicationId: String? = ""
31+
override var resGenTaskName: String? = null
32+
override var abiFilters: Set<String>? = null
33+
override var assembleTaskOutputListingFile: File? = null
34+
override var bundleInfo: DefaultBundleInfo? = null
35+
override var codeShrinker: CodeShrinker? = null
36+
override var generatedResourceFolders: Collection<File> = emptyList()
37+
override var isSigned: Boolean = false
38+
override var maxSdkVersion: Int? = null
39+
override var minSdkVersion: DefaultApiVersion = DefaultApiVersion()
40+
override var signingConfigName: String? = null
41+
override var sourceGenTaskName: String = ""
42+
override var testInfo: DefaultTestInfo? = null
43+
override var assembleTaskName: String = ""
44+
override var classesFolders: Set<File> = emptySet()
45+
override var compileTaskName: String = ""
46+
override var generatedSourceFolders: Collection<File> = emptyList()
47+
override var ideSetupTaskNames: Set<String> = emptySet()
48+
override var targetSdkVersionOverride: DefaultApiVersion? = null
49+
override var modelSyncFiles: Collection<Void> = emptyList()
50+
override var desugaredMethodsFiles: Collection<File> = emptyList()
51+
override val generatedClassPaths: Map<String, File> = emptyMap()
52+
override val generatedAssetsFolders: Collection<File> = emptyList()
53+
override val bytecodeTransformations: Collection<BytecodeTransformation> = emptyList()
54+
override val mappingR8TextFile: File? = null
55+
override val mappingR8PartitionFile: File? = null
56+
}
Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,49 @@
1-
/*
2-
* This file is part of AndroidIDE.
3-
*
4-
* AndroidIDE is free software: you can redistribute it and/or modify
5-
* it under the terms of the GNU General Public License as published by
6-
* the Free Software Foundation, either version 3 of the License, or
7-
* (at your option) any later version.
8-
*
9-
* AndroidIDE is distributed in the hope that it will be useful,
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
* GNU General Public License for more details.
13-
*
14-
* You should have received a copy of the GNU General Public License
15-
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
16-
*/
17-
package com.itsaky.androidide.builder.model
18-
19-
import com.android.builder.model.v2.ide.SourceProvider
20-
import java.io.File
21-
import java.io.Serializable
22-
23-
/** @author Akash Yadav */
24-
class DefaultSourceProvider() : SourceProvider, Serializable {
25-
private val serialVersionUID = 1L
26-
override var aidlDirectories: Collection<File>? = null
27-
override var assetsDirectories: Collection<File>? = null
28-
override var customDirectories: Collection<DefaultCustomSourceDirectory>? = null
29-
override var javaDirectories: Collection<File> = emptyList()
30-
override var jniLibsDirectories: Collection<File> = emptyList()
31-
override var kotlinDirectories: Collection<File> = emptyList()
32-
override var manifestFile: File? = NoFile
33-
override var mlModelsDirectories: Collection<File>? = null
34-
override var name: String = ""
35-
override var renderscriptDirectories: Collection<File>? = null
36-
override var resDirectories: Collection<File>? = null
37-
override var resourcesDirectories: Collection<File> = emptyList()
38-
override var shadersDirectories: Collection<File>? = null
39-
override var baselineProfileDirectories: Collection<File>? = null
40-
41-
companion object {
42-
@JvmStatic val NoFile = File("<does-not-exist>")
43-
}
44-
}
1+
/*
2+
* This file is part of AndroidIDE.
3+
*
4+
* AndroidIDE is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* AndroidIDE is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package com.itsaky.androidide.builder.model
18+
19+
import com.android.builder.model.v2.ide.SourceProvider
20+
import java.io.File
21+
import java.io.Serializable
22+
23+
/** @author Akash Yadav */
24+
class DefaultSourceProvider :
25+
SourceProvider,
26+
Serializable {
27+
private val serialVersionUID = 1L
28+
override var aidlDirectories: Collection<File>? = null
29+
override var assetsDirectories: Collection<File>? = null
30+
override var customDirectories: Collection<DefaultCustomSourceDirectory>? = null
31+
override var javaDirectories: Collection<File> = emptyList()
32+
override var jniLibsDirectories: Collection<File> = emptyList()
33+
override var kotlinDirectories: Collection<File> = emptyList()
34+
override var manifestFile: File? = NoFile
35+
override var mlModelsDirectories: Collection<File>? = null
36+
override var name: String = ""
37+
override var renderscriptDirectories: Collection<File>? = null
38+
override var resDirectories: Collection<File>? = null
39+
override var resourcesDirectories: Collection<File> = emptyList()
40+
override var shadersDirectories: Collection<File>? = null
41+
override var baselineProfileDirectories: Collection<File>? = null
42+
43+
companion object {
44+
@JvmStatic val NoFile = File("<does-not-exist>")
45+
}
46+
47+
override val keepRulesDirectories: Collection<File>? = null
48+
override val aarKeepRulesDirectories: Collection<File>? = null
49+
}

0 commit comments

Comments
 (0)