diff options
author | Yigit Boyar <yboyar@google.com> | 2020-04-29 19:05:36 -0700 |
---|---|---|
committer | Chris Povirk <beigetangerine@gmail.com> | 2020-04-30 11:55:36 -0400 |
commit | bf370cd3a6be13883dffc204e6ae4ba524a9cb2b (patch) | |
tree | fe0d19d81816ab0d1ed6cd4d4c881aca301fad81 /util | |
parent | 01ee5aa03cc0d72dd6f7a758594537eeed4aa23b (diff) | |
download | dagger2-bf370cd3a6be13883dffc204e6ae4ba524a9cb2b.tar.gz |
Add support for JUnit tests with Hilt Plugin
Android transforms are not applied for JUnit tests which breaks when using
the Hilt Plugin and its transform. This CL adds a new custom test transform
task just for tests so that transformed classes are used in Android JUnit tests.
The task does not transform test sources, therefore temporarily allow specifying
a base class in @AndroidEntryPoint that will be used even if the superclass
validation option is given to the processor. This helps us still have test-only
Android Entry Points.
Closes https://github.com/google/dagger/pull/1811
RELNOTES=n/a
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=309143731
Diffstat (limited to 'util')
-rwxr-xr-x | util/run-local-tests.sh | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/util/run-local-tests.sh b/util/run-local-tests.sh index d7297a9e2..06208c082 100755 --- a/util/run-local-tests.sh +++ b/util/run-local-tests.sh @@ -7,19 +7,29 @@ readonly TEST_PARAMS="$@" # Run tests with bazel bazel test $TEST_PARAMS //... +# Install into local maven. +util/install-local-snapshot.sh + # Also run the gradle examples on the local maven snapshots. readonly _SIMPLE_EXAMPLE_DIR=java/dagger/example/gradle/simple readonly _ANDROID_EXAMPLE_DIR=java/dagger/example/gradle/android/simple - -util/install-local-snapshot.sh ./$_SIMPLE_EXAMPLE_DIR/gradlew -p $_SIMPLE_EXAMPLE_DIR build --no-daemon --stacktrace ./$_ANDROID_EXAMPLE_DIR/gradlew -p $_ANDROID_EXAMPLE_DIR build --no-daemon --stacktrace readonly _HILT_GRADLE_PLUGIN_DIR=java/dagger/hilt/android/plugin readonly _HILT_ANDROID_EXAMPLE_DIR=java/dagger/hilt/android/example/gradle/simple +readonly _HILT_KOTLIN_ANDROID_EXAMPLE_DIR=java/dagger/hilt/android/example/gradle/simpleKotlin ./$_HILT_GRADLE_PLUGIN_DIR/gradlew -p $_HILT_GRADLE_PLUGIN_DIR test --no-daemon --stacktrace -./$_HILT_ANDROID_EXAMPLE_DIR/gradlew -p $_HILT_ANDROID_EXAMPLE_DIR buildDebug --no-daemon --stacktrace -./$_HILT_ANDROID_EXAMPLE_DIR/gradlew -p $_HILT_ANDROID_EXAMPLE_DIR testDebug --no-daemon --stacktrace +# Run gradle tests with different versions of Android Gradle Plugin +agp_verions=("4.1.0-alpha07" "4.0.0-beta05" "3.6.3") +for version in "${agp_verions[@]}" +do + echo "Running tests with AGP $version" + AGP_VERSION=$version ./$_HILT_ANDROID_EXAMPLE_DIR/gradlew -p $_HILT_ANDROID_EXAMPLE_DIR buildDebug --no-daemon --stacktrace + AGP_VERSION=$version ./$_HILT_ANDROID_EXAMPLE_DIR/gradlew -p $_HILT_ANDROID_EXAMPLE_DIR testDebug --no-daemon --stacktrace + AGP_VERSION=$version ./$_HILT_KOTLIN_ANDROID_EXAMPLE_DIR/gradlew -p $_HILT_KOTLIN_ANDROID_EXAMPLE_DIR buildDebug --no-daemon --stacktrace + AGP_VERSION=$version ./$_HILT_KOTLIN_ANDROID_EXAMPLE_DIR/gradlew -p $_HILT_KOTLIN_ANDROID_EXAMPLE_DIR testDebug --no-daemon --stacktrace +done verify_version_file() { local m2_repo=$1 |