diff --git a/.github/actions/artifact-android-local-tests/action.yml b/.github/actions/artifact-android-local-tests/action.yml
index 54109851f54..c4b24eb4814 100644
--- a/.github/actions/artifact-android-local-tests/action.yml
+++ b/.github/actions/artifact-android-local-tests/action.yml
@@ -5,6 +5,18 @@ inputs:
agp:
description: 'The version of AGP to test with.'
required: true
+ type: choice
+ options:
+ - '7.0.0'
+ - '7.1.2'
+ - '8.1.0'
+ jdk:
+ description: 'The version of JDK to test with.'
+ required: true
+ type: choice
+ options:
+ - '11'
+ - '17'
runs:
using: "composite"
@@ -25,11 +37,11 @@ runs:
with:
name: local-snapshot
path: ~/.m2/repository/com/google/dagger
- - name: 'Install Java ${{ env.USE_JAVA_VERSION }}'
+ - name: 'Install Java ${{ inputs.jdk }}'
uses: actions/setup-java@v3
with:
distribution: '${{ env.USE_JAVA_DISTRIBUTION }}'
- java-version: '${{ env.USE_JAVA_VERSION }}'
+ java-version: '${{ inputs.jdk }}'
- name: 'Gradle Android local tests (AGP ${{ inputs.agp }})'
run: ./util/run-local-gradle-android-tests.sh "${{ inputs.agp }}"
shell: bash
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 27c4f7f2777..8a0ccc4f04b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -63,12 +63,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- agp: ['7.0.0', '7.1.2']
+ include:
+ - agp: '7.0.0'
+ jdk: '11'
+ - agp: '7.1.2'
+ jdk: '11'
+ - agp: '8.1.0'
+ jdk: '17'
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/artifact-android-local-tests
with:
agp: '${{ matrix.agp }}'
+ jdk: '${{ matrix.jdk }}'
artifact-android-emulator-tests:
name: 'Artifact Android emulator tests (API 30)'
needs: bazel-build
diff --git a/javatests/artifacts/dagger-android-ksp/app/build.gradle b/javatests/artifacts/dagger-android-ksp/app/build.gradle
new file mode 100644
index 00000000000..9787926bb82
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/build.gradle
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ id 'com.android.application'
+ id 'org.jetbrains.kotlin.android'
+ id 'com.google.devtools.ksp'
+}
+
+android {
+ namespace 'dagger.android.ksp'
+ compileSdkVersion 33
+ defaultConfig {
+ applicationId 'dagger.android.ksp'
+ minSdk 21
+ targetSdk 33
+ versionCode 1
+ versionName "1.0"
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
+ }
+ testOptions {
+ unitTests.includeAndroidResources = true
+ }
+ sourceSets {
+ String sharedTestDir = 'src/sharedTest/java'
+ test {
+ java.srcDirs += sharedTestDir
+ }
+ androidTest {
+ java.srcDirs += sharedTestDir
+ }
+ }
+}
+
+dependencies {
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+
+ testImplementation 'com.google.truth:truth:1.0.1'
+ testImplementation 'org.robolectric:robolectric:4.11.1'
+ testImplementation 'androidx.core:core:1.3.2'
+ testImplementation 'androidx.test.ext:junit:1.1.5'
+ testImplementation 'androidx.test:runner:1.5.2'
+ testImplementation 'androidx.test.espresso:espresso-core:3.5.1'
+
+ androidTestImplementation 'com.google.truth:truth:1.0.1'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.5'
+ androidTestImplementation 'androidx.test:runner:1.5.2'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
+
+ // Dagger Android dependencies
+ implementation 'com.google.dagger:dagger:LOCAL-SNAPSHOT'
+ implementation 'com.google.dagger:dagger-android-support:LOCAL-SNAPSHOT'
+ implementation 'com.google.dagger:dagger-android:LOCAL-SNAPSHOT'
+ ksp 'com.google.dagger:dagger-android-processor:LOCAL-SNAPSHOT'
+ ksp "com.google.dagger:dagger-compiler:LOCAL-SNAPSHOT"
+}
\ No newline at end of file
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/AndroidManifest.xml b/javatests/artifacts/dagger-android-ksp/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000000..89b0dbfd9f9
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/AndroidManifest.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/Model .kt b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/Model .kt
new file mode 100644
index 00000000000..8dd333dd505
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/Model .kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dagger.android.ksp
+
+import javax.inject.Qualifier
+
+/** Qualifies bindings relating to [android.os.Build.MODEL]. */
+@Qualifier @Retention(AnnotationRetention.RUNTIME) internal annotation class Model
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/ModelModule.kt b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/ModelModule.kt
new file mode 100644
index 00000000000..25c0f72ba35
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/ModelModule.kt
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dagger.android.ksp
+
+import android.os.Build.MODEL
+import dagger.Module
+import dagger.Provides
+
+@Module
+object ModelModule {
+ @Provides @Model fun provideModel(): String = MODEL
+}
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/SimpleActivity.kt b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/SimpleActivity.kt
new file mode 100644
index 00000000000..5b9b84b0343
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/SimpleActivity.kt
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dagger.android.ksp
+
+import android.os.Bundle
+import android.util.Log
+import android.widget.TextView
+import dagger.Binds
+import dagger.Module
+import dagger.Subcomponent
+import dagger.android.AndroidInjector
+import dagger.android.support.DaggerAppCompatActivity
+import dagger.multibindings.ClassKey
+import dagger.multibindings.IntoMap
+import javax.inject.Inject
+
+/**
+ * The main activity of the application.
+ *
+ *
It can be injected with any binding from both {@link SimpleActivityComponent} and {@link
+ * SimpleApplication.SimpleComponent}.
+ */
+class SimpleActivity : DaggerAppCompatActivity() {
+ private val TAG: String = SimpleActivity::class.java.getSimpleName()
+
+ @Inject @UserName lateinit var userName: String
+ @Inject @Model lateinit var model: String
+
+ override protected fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ Log.i(TAG, "Injected with userName and model: " + userName + ", " + model)
+
+ setContentView(R.layout.activity_main)
+
+ val greeting = findViewById(R.id.greeting) as TextView
+ val text = getResources().getString(R.string.welcome, userName, model)
+ greeting.setText(text)
+ }
+}
+
+@Subcomponent
+interface SimpleActivityComponent : AndroidInjector {
+
+ @Subcomponent.Factory interface Factory : AndroidInjector.Factory {}
+}
+
+@Module(subcomponents = [SimpleActivityComponent::class], includes = [UserNameModule::class])
+interface InjectorModule {
+ @Binds
+ @IntoMap
+ @ClassKey(SimpleActivity::class)
+ fun bind(factory: SimpleActivityComponent.Factory): AndroidInjector.Factory<*>
+}
+
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/SimpleApplication.kt b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/SimpleApplication.kt
new file mode 100644
index 00000000000..37dfd050046
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/SimpleApplication.kt
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dagger.android.ksp
+
+import android.util.Log
+import dagger.Component
+import dagger.android.AndroidInjectionModule
+import dagger.android.AndroidInjector
+import dagger.android.DaggerApplication
+import javax.inject.Inject
+import javax.inject.Singleton
+
+/**
+ * A simple, skeletal application that demonstrates a dependency-injected application using the
+ * utilities in {@code dagger.android}.
+ */
+class SimpleApplication : DaggerApplication() {
+ private val TAG = SimpleApplication::class.java.getSimpleName()
+
+ @Inject @Model lateinit var model: String
+
+ override public fun onCreate() {
+ super.onCreate()
+ Log.i(TAG, "Injected with model: " + model)
+ }
+
+ override protected fun applicationInjector(): AndroidInjector {
+ return DaggerSimpleComponent.factory().create(this)
+ }
+}
+
+@Singleton
+@Component(
+ modules =
+ [AndroidInjectionModule::class, InjectorModule::class, ModelModule::class]
+)
+interface SimpleComponent : AndroidInjector {
+ @Component.Factory interface Factory : AndroidInjector.Factory {}
+}
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/UserName.kt b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/UserName.kt
new file mode 100644
index 00000000000..3388c09c05e
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/UserName.kt
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dagger.android.ksp
+
+import javax.inject.Qualifier
+
+/** Qualifies bindings relating to the user name. */
+@Qualifier @Retention(AnnotationRetention.RUNTIME) internal annotation class UserName
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/UserNameModule.kt b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/UserNameModule.kt
new file mode 100644
index 00000000000..2628398d23a
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/kotlin/dagger/android/ksp/UserNameModule.kt
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dagger.android.ksp
+
+import dagger.Module
+import dagger.Provides
+
+@Module
+object UserNameModule {
+ @UserName @Provides fun provideUserName(): String = "ProdUser"
+}
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/res/layout/activity_main.xml b/javatests/artifacts/dagger-android-ksp/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 00000000000..4693e55131e
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/main/res/values/strings.xml b/javatests/artifacts/dagger-android-ksp/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000000..4bf0e39bff8
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/main/res/values/strings.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Simple Dagger Android
+
+
+ Hello, %1$s! You are on build %2$s.
+
\ No newline at end of file
diff --git a/javatests/artifacts/dagger-android-ksp/app/src/sharedTest/kotlin/dagger/android/ksp/SimpleActivityTest.kt b/javatests/artifacts/dagger-android-ksp/app/src/sharedTest/kotlin/dagger/android/ksp/SimpleActivityTest.kt
new file mode 100644
index 00000000000..22a2efb2f3f
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/app/src/sharedTest/kotlin/dagger/android/ksp/SimpleActivityTest.kt
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package dagger.android.ksp
+
+import android.content.Context
+import androidx.test.core.app.ActivityScenario
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.assertion.ViewAssertions.matches
+import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.espresso.matcher.ViewMatchers.withText
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@RunWith(AndroidJUnit4::class)
+class SimpleActivityTest {
+ @Test
+ fun testActivityInject() {
+ ActivityScenario.launch(SimpleActivity::class.java).onActivity { activity ->
+ onView(withId(R.id.greeting))
+ .check(matches(withText("Hello, ProdUser! You are on build robolectric.")))
+ }
+ }
+
+ @Test
+ fun verifyApplicationInstance() {
+ assertThat((ApplicationProvider.getApplicationContext() as Context) is SimpleApplication)
+ .isTrue()
+ }
+}
diff --git a/javatests/artifacts/dagger-android-ksp/build.gradle b/javatests/artifacts/dagger-android-ksp/build.gradle
new file mode 100644
index 00000000000..18745285ae4
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/build.gradle
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2023 The Dagger Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+buildscript {
+ ext {
+ agp_version = "8.1.0"
+ kotlin_version = "1.9.0"
+ ksp_version = "$kotlin_version-1.0.12"
+ }
+ repositories {
+ google()
+ mavenCentral()
+ mavenLocal()
+ }
+ dependencies {
+ classpath "com.android.tools.build:gradle:$agp_version"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$ksp_version"
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ mavenLocal()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
\ No newline at end of file
diff --git a/javatests/artifacts/dagger-android-ksp/gradle.properties b/javatests/artifacts/dagger-android-ksp/gradle.properties
new file mode 100644
index 00000000000..c344b594be0
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/gradle.properties
@@ -0,0 +1,3 @@
+android.useAndroidX=true
+org.gradle.caching=true
+org.gradle.parallel=true
diff --git a/javatests/artifacts/dagger-android-ksp/gradle/wrapper/gradle-wrapper.jar b/javatests/artifacts/dagger-android-ksp/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 00000000000..7f93135c49b
Binary files /dev/null and b/javatests/artifacts/dagger-android-ksp/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/javatests/artifacts/dagger-android-ksp/gradle/wrapper/gradle-wrapper.properties b/javatests/artifacts/dagger-android-ksp/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000000..3fa8f862f75
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/javatests/artifacts/dagger-android-ksp/gradlew b/javatests/artifacts/dagger-android-ksp/gradlew
new file mode 100755
index 00000000000..1aa94a42690
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/javatests/artifacts/dagger-android-ksp/gradlew.bat b/javatests/artifacts/dagger-android-ksp/gradlew.bat
new file mode 100644
index 00000000000..93e3f59f135
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/javatests/artifacts/dagger-android-ksp/settings.gradle b/javatests/artifacts/dagger-android-ksp/settings.gradle
new file mode 100644
index 00000000000..ae4079cc230
--- /dev/null
+++ b/javatests/artifacts/dagger-android-ksp/settings.gradle
@@ -0,0 +1,9 @@
+/*
+ * This file was generated by the Gradle 'init' task.
+ *
+ * The settings file is used to specify which projects to include in your build.
+ * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.4/userguide/building_swift_projects.html in the Gradle documentation.
+ */
+
+rootProject.name = 'dagger-android-ksp'
+include('app')
diff --git a/util/run-local-gradle-android-tests.sh b/util/run-local-gradle-android-tests.sh
index 0b3a5f54b7a..9ae56f89215 100755
--- a/util/run-local-gradle-android-tests.sh
+++ b/util/run-local-gradle-android-tests.sh
@@ -9,18 +9,33 @@ readonly JAVA_ANDROID_GRADLE_PROJECTS=(
"javatests/artifacts/dagger-android/simple"
"javatests/artifacts/hilt-android/simple"
)
-for project in "${JAVA_ANDROID_GRADLE_PROJECTS[@]}"; do
- echo "Running gradle tests for $project with AGP $AGP_VERSION_INPUT"
- AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project assembleDebug $COMMON_GRADLE_ARGS
- AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project testDebug --continue $COMMON_GRADLE_ARGS
-done
-
readonly KOTLIN_ANDROID_GRADLE_PROJECTS=(
"javatests/artifacts/hilt-android/simpleKotlin"
)
-for project in "${KOTLIN_ANDROID_GRADLE_PROJECTS[@]}"; do
- echo "Running gradle tests for $project with AGP $AGP_VERSION_INPUT"
- AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project assembleDebug $COMMON_GRADLE_ARGS
- AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project testWithKaptDebugUnitTest --continue $COMMON_GRADLE_ARGS
- AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project testWithKspDebugUnitTest --continue $COMMON_GRADLE_ARGS
-done
+if [[ $AGP_VERSION_INPUT == "7.0.0" || $AGP_VERSION_INPUT == "7.1.2" ]]
+then
+ for project in "${JAVA_ANDROID_GRADLE_PROJECTS[@]}"; do
+ echo "Running gradle tests for $project with AGP $AGP_VERSION_INPUT"
+ AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project assembleDebug $COMMON_GRADLE_ARGS
+ AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project testDebug --continue $COMMON_GRADLE_ARGS
+ done
+
+ for project in "${KOTLIN_ANDROID_GRADLE_PROJECTS[@]}"; do
+ echo "Running gradle tests for $project with AGP $AGP_VERSION_INPUT"
+ AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project assembleDebug $COMMON_GRADLE_ARGS
+ AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project testWithKaptDebugUnitTest --continue $COMMON_GRADLE_ARGS
+ AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project testWithKspDebugUnitTest --continue $COMMON_GRADLE_ARGS
+ done
+fi
+
+readonly JAVA_ANDROID_GRADLE_JDK17_PROJECTS=(
+ "javatests/artifacts/dagger-android-ksp"
+)
+if [[ $AGP_VERSION_INPUT == "8.1.0" ]]
+then
+ for project in "${JAVA_ANDROID_GRADLE_JDK17_PROJECTS[@]}"; do
+ echo "Running gradle tests for $project with AGP $AGP_VERSION_INPUT"
+ AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project assembleDebug $COMMON_GRADLE_ARGS
+ AGP_VERSION=$AGP_VERSION_INPUT ./$project/gradlew -p $project testDebug --continue $COMMON_GRADLE_ARGS
+ done
+fi
diff --git a/util/run-local-tests.sh b/util/run-local-tests.sh
index 4e81e5fe119..2603346dc59 100755
--- a/util/run-local-tests.sh
+++ b/util/run-local-tests.sh
@@ -19,4 +19,4 @@ util/run-local-gradle-tests.sh
util/run-local-gradle-android-tests.sh "7.0.0"
util/run-local-gradle-android-tests.sh "7.1.2"
-
+# TODO: this script is not up-to-date with Dagger github actions