Skip to content

Commit 7a70260

Browse files
committed
Enable project isolation
Fixes #1842
1 parent d438a00 commit 7a70260

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

build-logic/convention/src/main/kotlin/RootPlugin.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@
1717
import com.google.samples.apps.nowinandroid.configureGraphTasks
1818
import org.gradle.api.Plugin
1919
import org.gradle.api.Project
20+
import org.gradle.api.configuration.BuildFeatures
21+
import javax.inject.Inject
22+
23+
abstract class RootPlugin : Plugin<Project> {
24+
@get:Inject abstract val buildFeatures: BuildFeatures
2025

21-
class RootPlugin : Plugin<Project> {
2226
override fun apply(target: Project) {
2327
require(target.path == ":")
24-
target.subprojects { configureGraphTasks() }
28+
if (!buildFeatures.isolatedProjects.active.orElse(false).get()) {
29+
target.subprojects { configureGraphTasks() }
30+
}
2531
}
2632
}

build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2727
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
2828
import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension
2929
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
30+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
3031

3132
/**
3233
* Configure base Kotlin with Android options
@@ -85,6 +86,8 @@ private inline fun <reified T : KotlinBaseExtension> Project.configureKotlin() =
8586
is KotlinJvmProjectExtension -> compilerOptions
8687
else -> TODO("Unsupported project extension $this ${T::class}")
8788
}.apply {
89+
languageVersion.set(KotlinVersion.KOTLIN_2_2)
90+
coreLibrariesVersion = "2.2.0"
8891
jvmTarget = JvmTarget.JVM_11
8992
allWarningsAsErrors = warningsAsErrors
9093
freeCompilerArgs.add(

build-logic/settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dependencyResolutionManagement {
3131
}
3232
}
3333
mavenCentral()
34+
maven("https://central.sonatype.com/repository/maven-snapshots/")
3435
}
3536
versionCatalogs {
3637
create("libs") {

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ org.gradle.configuration-cache.parallel=true
4444
# to generate the Configuration Cache regardless of incompatible tasks.
4545
# See https://github.com/android/nowinandroid/issues/1022 before using it.
4646
org.gradle.configuration-cache.problems=warn
47+
org.gradle.unsafe.isolated-projects=true
48+
org.gradle.internal.isolated-projects.parallel=false
49+
ksp.project.isolation.enabled=true
4750

4851
# AndroidX package structure to make it clearer which packages are bundled with the
4952
# Android operating system, and which are packaged with your app"s APK

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ hilt = "2.57.2"
4242
hiltExt = "1.2.0"
4343
jacoco = "0.8.12"
4444
junit4 = "4.13.2"
45-
kotlin = "2.2.21"
45+
kotlin = "2.3.0-Beta2"
4646
kotlinxCoroutines = "1.10.1"
4747
kotlinxDatetime = "0.6.1"
4848
kotlinxSerializationJson = "1.8.0"
49-
ksp = "2.3.1"
49+
ksp = "2.3.4-SNAPSHOT"
5050
okhttp = "4.12.0"
5151
protobuf = "4.29.2"
5252
protobufPlugin = "0.9.5"

settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pluginManagement {
2626
}
2727
mavenCentral()
2828
gradlePluginPortal()
29+
maven("https://central.sonatype.com/repository/maven-snapshots/")
2930
}
3031
}
3132

@@ -40,6 +41,7 @@ dependencyResolutionManagement {
4041
}
4142
}
4243
mavenCentral()
44+
maven("https://central.sonatype.com/repository/maven-snapshots/")
4345
}
4446
}
4547
rootProject.name = "nowinandroid"

0 commit comments

Comments
 (0)