Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,10 @@ class EditorBottomSheet

private val suppressedGradleWarnings =
listOf(
"The option setting 'android.aapt2FromMavenOverride=/data/data/com.itsaky.androidide/files/home/android-sdk/build-tools/35.0.0/aapt2' is experimental",
// Matched with contains(), so the build-tools version is deliberately left
// out: the path moves with Environment.BUILD_TOOLS_VERSION and a hardcoded
// version silently stops matching, resurfacing the warning to users.
"The option setting 'android.aapt2FromMavenOverride=",
"The org.gradle.api.plugins.BasePluginConvention type has been deprecated.",
"The org.gradle.api.plugins.Convention type has been deprecated.",
"The BasePluginExtension.archivesBaseName property has been deprecated.",
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
kotlin {
compilerOptions {
// This module's classes ship in the plugin-api coordinate that on-device plugins
// compile against, so emit metadata the on-device Kotlin (1.9.22) can read (<= 2.0.0).
// compile against, so emit metadata every supported on-device Kotlin can read (<= 2.0.0).
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final class Environment {
private static final String ANDROIDIDE_PROJECT_CACHE_DIR = SharedEnvironment.PROJECT_CACHE_DIR_NAME;
private static final String DATABASE_NAME = "documentation.db";

public static final String BUILD_TOOLS_VERSION = "35.0.0";
public static final String BUILD_TOOLS_VERSION = "36.0.0";

public static final String PLUGIN_API_JAR_RELATIVE_PATH = "libs/plugin-api.jar";

Expand Down
32 changes: 21 additions & 11 deletions docs/PLUGIN_AUTHORING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ in `build.gradle.kts`:
```kotlin
plugins {
id("com.android.application") version "8.8.2"
id("org.jetbrains.kotlin.android") version "2.1.21"
id("org.jetbrains.kotlin.android") version "2.3.0"
id("com.itsaky.androidide.plugins.build")
}

Expand All @@ -66,21 +66,31 @@ against — the `:plugin-api` module plus `common`, `eventbus-events`, and
`idetooltips`. The builder plugin applied above resolves the same way, from the
injected `com.itsaky.androidide.plugins.build` `1.0.0` marker.

#### Building on-device (offline) pins the AGP/Kotlin versions
#### Building on-device (offline) pins the AGP/Kotlin/Gradle versions

The `plugins {}` example above uses AGP `8.8.2` / Kotlin `2.1.21` — the versions the
dev/CI repo resolves online. A plugin built **on-device** resolves AGP and the Kotlin
Gradle plugin from the harvested on-device `localMvnRepository`, which currently ships
only **AGP `8.11.0`** and **Kotlin `1.9.22`**. Request those versions for an on-device
build, or offline resolution of the build plugins fails.
The `plugins {}` example above uses AGP `8.8.2` / Kotlin `2.3.0` — the versions the
dev/CI repo resolves online. A plugin built **on-device** resolves its build plugins from
the harvested on-device `localMvnRepository`, which ships only the versions pinned in
`org.adfa.constants` — `ANDROID_GRADLE_PLUGIN_VERSION`, `KOTLIN_VERSION` and
`GRADLE_DISTRIBUTION_VERSION`, currently **AGP `9.3.1`**, **Kotlin `2.3.21`** and
**Gradle `9.6.1`**. Request those, or offline resolution of the build plugins fails. That
constants file is authoritative; the numbers here are a snapshot of it.

Also declare AGP `apply false` in the **root** `build.gradle.kts` (as the standard CoGo
project template does):
AGP 9 compiles Kotlin itself and **refuses** the `org.jetbrains.kotlin.android` plugin, so
an on-device build drops it and pins Kotlin through the `kotlin-gradle-plugin` jar on the
**root** buildscript classpath, which is where AGP 9 takes its compiler from. Declare AGP
`apply false` in the same root file (as the standard CoGo project template does):

```kotlin
buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.21")
}
}

plugins {
id("com.android.application") apply false version "8.11.0"
id("com.android.library") apply false version "8.11.0"
id("com.android.application") apply false version "9.3.1"
id("com.android.library") apply false version "9.3.1"
}
```

Expand Down
2 changes: 1 addition & 1 deletion eventbus-events/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
kotlin {
compilerOptions {
// This module's classes ship in the plugin-api coordinate that on-device plugins
// compile against, so emit metadata the on-device Kotlin (1.9.22) can read (<= 2.0.0).
// compile against, so emit metadata every supported on-device Kotlin can read (<= 2.0.0).
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,13 @@ private fun RepositoryHandler.addMavenRepoIfMissing(
logger: Logger,
uri: URI,
) {
if (none { it is MavenArtifactRepository && it.url == uri }) {
logger.info("Adding maven repository: $uri")
maven { it.url = uri }
if (any { it is MavenArtifactRepository && it.url == uri }) {
return
}

logger.info("Adding maven repository: $uri")
val repo = maven { it.url = uri }

remove(repo)
add(0, repo)
}
2 changes: 1 addition & 1 deletion idetooltips/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
kotlin {
compilerOptions {
// This module's classes ship in the plugin-api coordinate that on-device plugins
// compile against, so emit metadata the on-device Kotlin (1.9.22) can read (<= 2.0.0).
// compile against, so emit metadata every supported on-device Kotlin can read (<= 2.0.0).
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
}
Expand Down
3 changes: 2 additions & 1 deletion plugin-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ android {
kotlin {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
// Emit metadata the on-device Kotlin compiler (1.9.22) can read (<= 2.0.0).
// Emit metadata every supported on-device Kotlin compiler can read (<= 2.0.0), so a
// device still on an older bundled toolchain keeps working after a KOTLIN_VERSION bump.
// This jar ships in the plugin-api coordinate on-device plugins compile against.
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0)
Expand Down
Loading