Split JsInterop annotations into their own JAR when deploying to Maven
Change-Id: I4ccaff237a682ac45e6225f91908da605eff2aa5
diff --git a/maven/lib-gwt.sh b/maven/lib-gwt.sh
index fc237fb..edbb93c 100644
--- a/maven/lib-gwt.sh
+++ b/maven/lib-gwt.sh
@@ -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,30 @@
pushd $curExpandDir > /dev/null
rm -rf javafilelist
- find . -name "*.java" -print > javafilelist
+ find . -path "./jsinterop/*" -prune -o -name "*.java" -print > javafilelist
if [ -s javafilelist ]; then
jar cf $SOURCES_FILE @javafilelist
fi
+
+ if [[ "$i" == "user" ]]; then
+ # Get rid of JsInterop classes from gwt-user.jar
+ echo "Removing jsinterop/* from gwt-${i}"
+ zip -d $CUR_FILE "jsinterop/*"
+
+ # Create jsinterop jars
+ for i in $jsinteropLibs
+ do
+ rm -rf jsinterop-${i}-classfilelist jsinterop-${i}-javafilelist
+ find . -path "./jsinterop/$i/*" -name "*.class" -print > jsinterop-${i}-classfilelist
+ if [ -s jsinterop-${i}-classfilelist ]; then
+ jar cf jsinterop-${i}.jar @jsinterop-${i}-classfilelist
+ fi
+ find . -path "./jsinterop/$i/*" -name "*.java" -print > 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 +181,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..a372876 100644
--- a/maven/poms/gwt/gwt-user/pom-template.xml
+++ b/maven/poms/gwt/gwt-user/pom-template.xml
@@ -14,6 +14,10 @@
<version>${gwtVersion}</version>
<dependencies>
<dependency>
+ <groupId>com.google.jsinterop</groupId>
+ <artifactId>jsinterop-annotations</artifactId>
+ </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..71f171d
--- /dev/null
+++ b/maven/poms/jsinterop/pom-template.xml
@@ -0,0 +1,32 @@
+<?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>
+ </dependencies>
+ </dependencyManagement>
+</project>
diff --git a/maven/push-gwt.sh b/maven/push-gwt.sh
index c2064b9..09284ee 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}): " gwtVersion
+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"