Split JsInterop annotations into their own JAR when deploying to Maven This reapplies I4ccaff237a682ac45e6225f91908da605eff2aa5 with fixes Change-Id: I6e5c07e97bbba7d93c03de445c21e0970f527227
diff --git a/maven/lib-gwt.sh b/maven/lib-gwt.sh index fc237fb..092a375 100644 --- a/maven/lib-gwt.sh +++ b/maven/lib-gwt.sh
@@ -20,7 +20,7 @@ rm -rf $jarExpandDir-${i} done # Remove POMs & ASCs, leaving only templates - find $pomDir -name pom.xml -o -name pom.xml.asc | xargs rm + find $pomDir -name pom.xml -o -name pom.xml.asc -delete fi } @@ -44,6 +44,8 @@ function maven-gwt() { local gwtMavenVersion=$1 shift + local jsinteropMavenVersion=$1 + shift local gwtSdkArchive=$1 shift local mavenRepoUrl=$1 @@ -75,6 +77,10 @@ JAVADOC_FILE_PATH=$RANDOM_DIR/gwt-javadoc.jar jar cf $JAVADOC_FILE_PATH -C $GWT_EXTRACT_DIR/doc/javadoc . + # Create a dummy javadoc JAR for JsInterop (gwt-javadoc is too heavy) + JSINTEROP_JAVADOC_FILE_PATH=$RANDOM_DIR/jsinterop-javadoc.jar + jar cf $JSINTEROP_JAVADOC_FILE_PATH -C $pomDir/jsinterop README.javadoc + jarExpandDir=/tmp/tmp-jar-expand-dir-$RANDOM # Generate POMs with correct version @@ -82,7 +88,7 @@ do dir=`dirname $template` pushd $dir > /dev/null - sed "s|\${gwtVersion}|$gwtMavenVersion|g" pom-template.xml >pom.xml + sed -e "s|\${gwtVersion}|$gwtMavenVersion|g" -e "s|\${jsinteropVersion}|$jsinteropMavenVersion|g" pom-template.xml >pom.xml popd > /dev/null done @@ -96,6 +102,8 @@ gwtLibs="${gwtLibs} elemental" fi + jsinteropLibs='annotations' + for i in $gwtLibs do CUR_FILE=`ls $GWT_EXTRACT_DIR/gwt-${i}.jar` @@ -115,10 +123,32 @@ pushd $curExpandDir > /dev/null rm -rf javafilelist - find . -name "*.java" -print > javafilelist + find . -name "*.java" > javafilelist if [ -s javafilelist ]; then jar cf $SOURCES_FILE @javafilelist fi + + if [[ "$i" == "user" ]]; then + # Create jsinterop jars + for i in $jsinteropLibs + do + # Get rid of JsInterop classes from gwt-user.jar and gwt-user-sources + echo "Removing jsinterop/${i} from gwt-user" + zip -d $CUR_FILE "jsinterop/${i}/*" + echo "Removing jsinterop/${i} from gwt-user-sources" + zip -d $SOURCES_FILE "jsinterop/${i}/*" + + rm -rf jsinterop-${i}-classfilelist jsinterop-${i}-javafilelist + find "./jsinterop/${i}" -type f -not -name "*.java" -not -name "*.gwt.xml" > jsinterop-${i}-classfilelist + if [ -s jsinterop-${i}-classfilelist ]; then + jar cf jsinterop-${i}.jar @jsinterop-${i}-classfilelist + fi + find "./jsinterop/${i}" -name "*.java" -o -name "*.gwt.xml" > jsinterop-${i}-javafilelist + if [ -s jsinterop-${i}-javafilelist ]; then + jar cf jsinterop-${i}-sources.jar @jsinterop-${i}-javafilelist + fi + done + fi popd > /dev/null done @@ -153,6 +183,15 @@ || die done + # Deploy jsInterop jars + maven-deploy-file $mavenRepoUrl $mavenRepoId $pomDir/jsinterop/pom.xml $pomDir/jsinterop/pom.xml || die + + for i in $jsinteropLibs + do + maven-deploy-file $mavenRepoUrl $mavenRepoId $jarExpandDir-user/jsinterop-${i}.jar $pomDir/jsinterop/${i}/pom.xml \ + $JSINTEROP_JAVADOC_FILE_PATH $jarExpandDir-user/jsinterop-${i}-sources.jar \ + || die + done + finishAndCleanup } -
diff --git a/maven/poms/gwt/gwt-user/pom-template.xml b/maven/poms/gwt/gwt-user/pom-template.xml index 44562ee..577a821 100644 --- a/maven/poms/gwt/gwt-user/pom-template.xml +++ b/maven/poms/gwt/gwt-user/pom-template.xml
@@ -14,6 +14,15 @@ <version>${gwtVersion}</version> <dependencies> <dependency> + <groupId>com.google.jsinterop</groupId> + <artifactId>jsinterop-annotations</artifactId> + </dependency> + <dependency> + <groupId>com.google.jsinterop</groupId> + <artifactId>jsinterop-annotations</artifactId> + <classifier>sources</classifier> + </dependency> + <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> </dependency>
diff --git a/maven/poms/gwt/pom-template.xml b/maven/poms/gwt/pom-template.xml index 43f2423..901ee93 100644 --- a/maven/poms/gwt/pom-template.xml +++ b/maven/poms/gwt/pom-template.xml
@@ -55,6 +55,13 @@ <scope>import</scope> </dependency> <dependency> + <groupId>com.google.jsinterop</groupId> + <artifactId>jsinterop</artifactId> + <version>${jsinteropVersion}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.0.0.GA</version>
diff --git a/maven/poms/jsinterop/README.javadoc b/maven/poms/jsinterop/README.javadoc new file mode 100644 index 0000000..6994981 --- /dev/null +++ b/maven/poms/jsinterop/README.javadoc
@@ -0,0 +1,5 @@ +This is an empty javadoc JAR in accordance with +http://central.sonatype.org/pages/requirements.html + +Please refer to the sources for documentation, +or the com.google.gwt:gwt-user javadoc.
diff --git a/maven/poms/jsinterop/annotations/pom-template.xml b/maven/poms/jsinterop/annotations/pom-template.xml new file mode 100644 index 0000000..f7d31d4 --- /dev/null +++ b/maven/poms/jsinterop/annotations/pom-template.xml
@@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.google.jsinterop</groupId> + <artifactId>jsinterop</artifactId> + <version>${jsinteropVersion}</version> + </parent> + <groupId>com.google.jsinterop</groupId> + <artifactId>jsinterop-annotations</artifactId> + <packaging>jar</packaging> + <version>${jsinteropVersion}</version> +</project>
diff --git a/maven/poms/jsinterop/pom-template.xml b/maven/poms/jsinterop/pom-template.xml new file mode 100644 index 0000000..fe7ec80 --- /dev/null +++ b/maven/poms/jsinterop/pom-template.xml
@@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>org.sonatype.oss</groupId> + <artifactId>oss-parent</artifactId> + <version>4</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>com.google.jsinterop</groupId> + <artifactId>jsinterop</artifactId> + <packaging>pom</packaging> + <name>JsInterop</name> + <url>http://www.gwtproject.org/</url> + <version>${jsinteropVersion}</version> + <licenses> + <license> + <name>GWT Terms</name> + <url>http://www.gwtproject.org/terms.html</url> + </license> + </licenses> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>com.google.jsinterop</groupId> + <artifactId>jsinterop-annotations</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.google.jsinterop</groupId> + <artifactId>jsinterop-annotations</artifactId> + <version>${project.version}</version> + <classifier>sources</classifier> + </dependency> + </dependencies> + </dependencyManagement> +</project>
diff --git a/maven/push-gwt.sh b/maven/push-gwt.sh index c2064b9..9fe55f5 100755 --- a/maven/push-gwt.sh +++ b/maven/push-gwt.sh
@@ -6,7 +6,7 @@ # GWT_MAVEN_REPO_ID = a server id in your .m2/settings.xml with remote repo username and password # # Sonatype staging repo (promotes to Maven Central) -# GWT_MAVEN_REPO_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/ +# GWT_MAVEN_REPO_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/ # # Sonatype Google SNAPSHOTs repo (can only deploy SNAPSHOTs here, and they are immediately public) # GWT_MAVEN_REPO_URL=https://oss.sonatype.org/content/repositories/google-snapshots/ @@ -35,6 +35,7 @@ # use GWT_VERSION to specify the default version or get it from the file name gwtVersionDefault=${GWT_VERSION:=$(expr "$gwtPathDefault" : '.*gwt-\('$VERSION_REGEX'\)\.zip')} +jsinteropVersionDefault=${JSINTEROP_VERSION:=1.0.0-SNAPSHOT} # prompt for info read -e -p"GWT version for Maven (${gwtVersionDefault:-ex: 2.8.0-SNAPSHOT}): " gwtVersion @@ -44,6 +45,13 @@ exit 1 fi +read -e -p"JsInterop version for Maven (${jsinteropVersionDefault:-ex: 1.0.0-SNAPSHOT}): " jsinteropVersion +jsinteropVersion=${jsinteropVersion:=$jsinteropVersionDefault} +if ! expr "$jsinteropVersion" : "$VERSION_REGEX" >/dev/null; then + echo "Please enter a version of the form x.y.z or x.y.z-abc" + exit 1 +fi + read -e -p"Path to GWT distro zip $gwtPathPrompt: " gwtPath gwtPath=${gwtPath:=$gwtPathDefault} if [[ ! -f $gwtPath ]]; then @@ -65,6 +73,7 @@ gpgPassphrase=${gpgPassphrase:=$GWT_GPG_PASS} maven-gwt "$gwtVersion" \ + "$jsinteropVersion" \ "$gwtPath" \ "$repoUrl" \ "$repoId"
diff --git a/user/src/com/google/gwt/core/Core.gwt.xml b/user/src/com/google/gwt/core/Core.gwt.xml index 9a64da2..fdd1522 100644 --- a/user/src/com/google/gwt/core/Core.gwt.xml +++ b/user/src/com/google/gwt/core/Core.gwt.xml
@@ -38,6 +38,7 @@ <inherits name="com.google.gwt.emul.Emulation" /> <inherits name="com.google.gwt.core.StackTrace" /> <inherits name="com.google.gwt.core.AsyncFragmentLoader" /> + <inherits name="jsinterop.annotations.Annotations" /> <source path="client" /> <source path="shared" />
diff --git a/user/src/jsinterop/annotations/Annotations.gwt.xml b/user/src/jsinterop/annotations/Annotations.gwt.xml new file mode 100644 index 0000000..2b4b77e --- /dev/null +++ b/user/src/jsinterop/annotations/Annotations.gwt.xml
@@ -0,0 +1,3 @@ +<module> + <source path="" /> +</module>