diff --git a/buildSrc/src/main/kotlin/dagger/gradle/build/KotlinJvmConventionPlugin.kt b/buildSrc/src/main/kotlin/dagger/gradle/build/KotlinJvmConventionPlugin.kt index e5dd52df9df..cf5ee41651f 100644 --- a/buildSrc/src/main/kotlin/dagger/gradle/build/KotlinJvmConventionPlugin.kt +++ b/buildSrc/src/main/kotlin/dagger/gradle/build/KotlinJvmConventionPlugin.kt @@ -16,8 +16,10 @@ package dagger.gradle.build +import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.plugins.JavaPluginExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.dsl.JvmTarget @@ -30,7 +32,6 @@ class KotlinJvmConventionPlugin : Plugin { project.plugins.withId(project.getPluginIdByName("kotlinJvm")) { val kotlinProject = project.extensions.getByName("kotlin") as KotlinJvmProjectExtension - kotlinProject.explicitApi() kotlinProject.jvmToolchain { languageVersion.set(JavaLanguageVersion.of(project.getVersionByName("jdk"))) } @@ -39,6 +40,10 @@ class KotlinJvmConventionPlugin : Plugin { apiVersion.set(KotlinVersion.fromVersion(project.getVersionByName("kotlinTarget"))) jvmTarget.set(JvmTarget.fromTarget(project.getVersionByName("jvmTarget"))) } + + val javaProject = project.extensions.getByName("java") as JavaPluginExtension + javaProject.sourceCompatibility = JavaVersion.toVersion(project.getVersionByName("jvmTarget")) + javaProject.targetCompatibility = JavaVersion.toVersion(project.getVersionByName("jvmTarget")) } } } \ No newline at end of file diff --git a/gradle-projects/dagger-runtime/build.gradle.kts b/gradle-projects/dagger-runtime/build.gradle.kts index fa1bf61c929..9a479901d67 100644 --- a/gradle-projects/dagger-runtime/build.gradle.kts +++ b/gradle-projects/dagger-runtime/build.gradle.kts @@ -37,4 +37,8 @@ dependencies { testImplementation(libs.junit) testImplementation(libs.truth) testImplementation(libs.guava.jre) +} + +kotlin { + explicitApi() } \ No newline at end of file diff --git a/gradle-projects/dagger-spi/build.gradle.kts b/gradle-projects/dagger-spi/build.gradle.kts new file mode 100644 index 00000000000..38fde9b5429 --- /dev/null +++ b/gradle-projects/dagger-spi/build.gradle.kts @@ -0,0 +1,32 @@ +import dagger.gradle.build.daggerSources + +plugins { + alias(libs.plugins.dagger.kotlinJvm) + alias(libs.plugins.dagger.publish) +} + +daggerSources { + main.setPackages( + listOf( + "dagger/internal/codegen/extension", + "dagger/model", + "dagger/spi", + "dagger/spi/model", + ) + ) +} + +// TODO(danysantiago): Shadow / jarjar: 1. xprocessing, 2. auto-common and 3. kotlin-metadata-jvm +dependencies { + implementation(project(":dagger")) + + implementation(libs.auto.common) + implementation(libs.auto.value.annotations) + annotationProcessor(libs.auto.value.compiler) + implementation(libs.findBugs) + implementation(libs.javaPoet) + implementation(libs.javax.inject) + implementation(libs.guava.failureAccess) + implementation(libs.guava.jre) + implementation(libs.ksp.api) +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 57cd6a02e6f..1ba180db4e8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,21 +1,30 @@ [versions] +autoValue = "1.9" guava = "33.0.0-jre" jdk = "18" junit = "4.13" jvmTarget = "1.8" kotlin = "2.0.21" kotlinTarget = "1.9" +ksp = "2.0.21-1.0.28" publish = "0.30.0" truth = "1.4.0" [libraries] +auto-common = { module = "com.google.auto:auto-common", version = "1.2.1" } +auto-value-annotations = { module = "com.google.auto.value:auto-value-annotations", version.ref = "autoValue" } +auto-value-compiler = { module = "com.google.auto.value:auto-value", version.ref = "autoValue" } +findBugs = { module = "com.google.code.findbugs:jsr305", version = "3.0.1" } guava-jre = { module = "com.google.guava:guava", version.ref = "guava" } +guava-failureAccess = { module = "com.google.guava:failureaccess", version = "1.0.1" } jakarta-inject = { module = "jakarta.inject:jakarta.inject-api", version = "2.0.1" } +javaPoet = { module = "com.squareup:javapoet", version = "1.13.0" } javax-inject = { module = "javax.inject:javax.inject", version = "1" } jspecify = { module = "org.jspecify:jspecify", version = "1.0.0" } junit = { module = "junit:junit", version.ref = "junit" } kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } +ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } publishPlugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "publish" } truth = { module = "com.google.truth:truth", version.ref = "truth" } @@ -24,4 +33,4 @@ binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibilit dagger-kotlinJvm = { id = "dagger.gradle.build.jvm" } dagger-publish = { id = "dagger.gradle.build.publish" } kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" } \ No newline at end of file +publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" } diff --git a/settings.gradle.kts b/settings.gradle.kts index c9bbf356bbc..d185ed1843d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,3 +21,4 @@ fun includeProject(name: String, path: String) { } includeProject(":dagger", "gradle-projects/dagger-runtime") +includeProject(":dagger-spi", "gradle-projects/dagger-spi")