aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authordanysantiago <danysantiago@google.com>2020-05-26 09:28:36 -0700
committerkevinb9n <kevinb@google.com>2020-05-26 13:14:22 -0700
commitc1ddd0cfeddaa286e6826d9527a108261f6d4fc3 (patch)
tree77329ac6c2b3ec66e1993929eb0db7539aea463f /util
parent65be940f84f1264a18d7b1f52b4f5d904cad869f (diff)
downloaddagger2-c1ddd0cfeddaa286e6826d9527a108261f6d4fc3.tar.gz
Update Hilt Gradle plugin to publish sources and javadoc jars.
RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=313205807
Diffstat (limited to 'util')
-rwxr-xr-xutil/deploy-hilt.sh33
1 files changed, 26 insertions, 7 deletions
diff --git a/util/deploy-hilt.sh b/util/deploy-hilt.sh
index 5d0f0c4eb..f857e1442 100755
--- a/util/deploy-hilt.sh
+++ b/util/deploy-hilt.sh
@@ -47,11 +47,30 @@ _deploy \
java/dagger/hilt/android/processor/artifact-src.jar \
java/dagger/hilt/android/processor/artifact-javadoc.jar
+# Builds and deploy the Gradle plugin.
+_deploy_plugin() {
+ local plugindir=java/dagger/hilt/android/plugin
+ ./$plugindir/gradlew -p $plugindir --no-daemon clean \
+ publishAllPublicationsToMavenRepository -PPublishVersion="$VERSION_NAME"
+ local outdir=$plugindir/build/repo/com/google/dagger/hilt-android-gradle-plugin/$VERSION_NAME
+ # When building '-SNAPSHOT' versions in gradle, the filenames replaces
+ # '-SNAPSHOT' with timestamps, so we need to disambiguate by finding each file
+ # to deploy. See: https://stackoverflow.com/questions/54182823/
+ local suffix
+ if [[ "$VERSION_NAME" == *"-SNAPSHOT" ]]; then
+ # Gets the timestamp part out of the name to be used as suffix.
+ # Timestamp format is ########.######-#.
+ suffix=$(find $outdir -name "*.pom" | grep -Eo '[0-9]{8}\.[0-9]{6}-[0-9]{1}')
+ else
+ suffix=$VERSION_NAME
+ fi
+ mvn "$MVN_GOAL" \
+ -Dfile="$(find $outdir -name "*-$suffix.jar")" \
+ -DpomFile="$(find $outdir -name "*-$suffix.pom")" \
+ -Dsources="$(find $outdir -name "*-$suffix-sources.jar")" \
+ -Djavadoc="$(find $outdir -name "*-$suffix-javadoc.jar")" \
+ "${EXTRA_MAVEN_ARGS[@]:+${EXTRA_MAVEN_ARGS[@]}}"
+}
+
# Gradle Plugin is built with Gradle, but still deployed via Maven (mvn)
-readonly _HILT_GRADLE_PLUGIN_DIR=java/dagger/hilt/android/plugin
-./$_HILT_GRADLE_PLUGIN_DIR/gradlew -p $_HILT_GRADLE_PLUGIN_DIR --no-daemon \
- jar generatePomFileForPluginPublication -PPublishVersion="$VERSION_NAME"
-mvn "$MVN_GOAL" \
- -Dfile=$_HILT_GRADLE_PLUGIN_DIR/build/libs/plugin.jar \
- -DpomFile=$_HILT_GRADLE_PLUGIN_DIR/build/publications/plugin/pom-default.xml \
- "${EXTRA_MAVEN_ARGS[@]:+${EXTRA_MAVEN_ARGS[@]}}"
+_deploy_plugin