Browse Source

Use Maven to build vaadin-push

Change-Id: I244182abfe3b72c59786b520eafb663b5c1e5918
tags/7.7.0.alpha1
Henri Sara 8 years ago
parent
commit
16eae73295

+ 1
- 0
.gitignore View File

@@ -83,6 +83,7 @@ scripts/*.pyc
# build result folders
*/result
result
push/target/

.sass-cache
phantomjsdriver.log

+ 12
- 2
build/ide.xml View File

@@ -180,9 +180,19 @@
</java>
</target>
<target name="vaadinPush.js" depends="resolve">
<ant antfile="${basedir}/push/build.xml" target="vaadinPush.js" dir="${basedir}/push" />
<property name="project.root" location="."/>
<ivy:resolve log="download-only" file="${project.root}/ivy-taskdefs.xml" conf="taskdefs" />
<ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" />
<!-- ant contrib for Maven integration -->
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" />

<!-- Must fork to avoid ExitException -->
<artifact:mvn pom="${project.root}/push/pom.xml" fork="true" mavenVersion="3.0.4">
<arg value="package"/>
</artifact:mvn>

<property name="js.output.dir" location="WebContent" />
<property name="push.js.dir" location="${basedir}/push/result/js" />
<property name="push.js.dir" location="${basedir}/push/target/classes/" />
<copy todir="${js.output.dir}">
<fileset dir="${push.js.dir}" includes="VAADIN/vaadinPush*" excludes="**/*.gz">
</fileset>

+ 1
- 1
ivy-taskdefs.xml View File

@@ -14,7 +14,7 @@
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3"
conf="taskdefs ->master" />
<dependency org="org.apache.maven" name="maven-ant-tasks"
rev="2.0.10" conf="taskdefs ->master" />
rev="2.1.2" conf="taskdefs ->master" />
<dependency org="com.googlecode.jarjar" name="jarjar"
rev="1.3" conf="taskdefs ->master" />
<dependency org="com.puppycrawl.tools" name="checkstyle"

+ 3
- 1
ivysettings.xml View File

@@ -16,6 +16,8 @@
<filesystem name="local-maven" m2compatible="true">
<artifact
pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
<ivy
pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).pom" />
</filesystem>
<filesystem name="build-temp">
<ivy
@@ -48,7 +50,7 @@
<module organisation="com.vaadin" name="vaadin-themes"
resolver="build-temp" />
<module organisation="com.vaadin" name="vaadin-push"
resolver="build-temp" />
resolver="local-maven" />
<module organisation="com.vaadin" name="vaadin-widgets"
resolver="build-temp" />
<module organisation="com.vaadin" name="vaadin-bom"

+ 1
- 1
liferay/ivy.xml View File

@@ -22,7 +22,7 @@
<dependency org="com.vaadin" name="vaadin-themes"
rev="${vaadin.version}" conf="deps -> build" transitive="false"/>
<dependency org="com.vaadin" name="vaadin-push"
rev="${vaadin.version}" conf="deps -> build" transitive="false" />
rev="${vaadin.version}" conf="deps -> default" transitive="false" />
<dependency org="com.vaadin" name="vaadin-server"
rev="${vaadin.version}" conf="deps -> build" transitive="false" />
</dependencies>

+ 0
- 109
push/build.xml View File

@@ -1,109 +0,0 @@
<?xml version="1.0"?>

<project name="vaadin-push" basedir="." default="publish-local"
xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Meta package which defines dependencies needed for push
</description>
<include file="../build.xml" as="vaadin" />
<include file="../common.xml" as="common" />

<property name="module.name" value="vaadin-push" />
<property name="module.symbolic" value="com.vaadin.push" />
<property name="result.dir" location="result" />
<property name="temp.dir" location="${result.dir}/temp" />
<property name="jquery.unpack" location="${temp.dir}/jquery" />
<property name="vaadinPush.js" location="${result.dir}/js/VAADIN/vaadinPush.js" />
<property name="vaadinPush.debug.js"
location="${result.dir}/js/VAADIN/vaadinPush.debug.js" />

<!-- Keep the version number in sync with ivy.xml, server/src/com/vaadin/server/Constants.java -->
<property name="atmosphere.runtime.version" value="2.2.7.vaadin1" />
<property name="jquery.js" location="lib/jquery/jquery-1.11.0.js" />

<path id="classpath.compile.custom" />

<union id="jar.includes">
<fileset dir="${result.dir}/js">
<include name="VAADIN/vaadinPush.js" />
<include name="VAADIN/vaadinPush.js.gz" />
<include name="VAADIN/vaadinPush.debug.js" />
<include name="VAADIN/vaadinPush.debug.js.gz" />
</fileset>
</union>

<target name="vaadinPush.js">
<mkdir dir="${result.dir}/js/VAADIN" />
<ivy:resolve log="download-only" file="ivy.xml"
conf="push.js" />
<ivy:cachepath pathid="atmosphere.jquery.deps"
conf="push.js" />

<delete dir="${temp.dir}" />
<copy flatten="true" tofile="${temp.dir}/jquery.war">
<path refid="atmosphere.jquery.deps" />
</copy>

<!-- Unzip to temp dir -->
<unzip src="${temp.dir}/jquery.war" dest="${jquery.unpack}">
<patternset>
<include name="**/jquery.atmosphere.js" />
</patternset>
<mapper type="flatten" />
</unzip>
<loadfile srcfile="${jquery.js}" property="jquery.js.contents" />
<loadfile srcfile="${jquery.unpack}/jquery.atmosphere.js"
property="jquery.atmosphere.js.contents" />

<loadfile
srcfile="${vaadin.basedir}/WebContent/VAADIN/vaadinPush.js.tpl"
property="vaadinPush.js.contents">
<filterchain>
<replacetokens begintoken="@" endtoken="@">
<token key="jquery.js" value="${jquery.js.contents}" />
<token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
</replacetokens>
</filterchain>
</loadfile>

<!-- Non-obfuscated version for debugging -->
<echo file="${vaadinPush.debug.js}">${vaadinPush.js.contents}</echo>

<!-- Minify -->
<ivy:retrieve organisation="com.yahoo.platform.yui"
module="yuicompressor" revision="2.4.7" inline="true" type="jar"
pattern="${result.dir}/compressor.jar" />
<java jar="${result.dir}/compressor.jar" fork="true">
<arg value="-v" />
<arg value="-o" />
<arg file="${vaadinPush.js}" />
<arg file="${vaadinPush.debug.js}" />
</java>
<!-- Gzipped versions -->
<gzip src="${vaadinPush.js}" destfile="${vaadinPush.js}.gz" />
<gzip src="${vaadinPush.debug.js}" destfile="${vaadinPush.debug.js}.gz" />
</target>

<target name="jar" depends="vaadinPush.js">
<antcall target="common.jar">
<param name="osgi.extra.package.prefixes" value="VAADIN" />
<param name="require-bundle"
value="com.vaadin.external.atmosphere.runtime;bundle-version=&quot;${atmosphere.runtime.version}&quot;;visibility:=reexport" />
<reference torefid="extra.jar.includes" refid="jar.includes" />
</antcall>
</target>

<target name="publish-local" depends="jar">
<antcall target="common.publish-local" />
</target>

<target name="clean">
<antcall target="common.clean" />
</target>
<target name="checkstyle">
</target>

<target name="test" depends="checkstyle">
</target>
</project>

+ 0
- 44
push/ivy.xml View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ivy-module [
<!-- Keep the version number in sync with build.xml -->
<!ENTITY atmosphere.runtime.version "2.2.7.vaadin1">

<!ENTITY atmosphere.js.version "2.2.13.vaadin3">
]>
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
xmlns:m="http://ant.apache.org/ivy/maven">

<info organisation="com.vaadin" module="vaadin-push" revision="${vaadin.version}" />

<configurations>
<conf name="build" />
<conf name="build-provided" />
<conf name="ide" visibility="private" />
<conf name="test" visibility="private" />
<!-- Used for building push.js only -->
<conf name="push.js" visibility="private" />
</configurations>
<publications>
<artifact type="jar" ext="jar" />
<!-- <artifact type="source" ext="jar" m:classifier="sources" />
<artifact type="javadoc" ext="jar" m:classifier="javadoc" /> -->
<artifact type="pom" ext="pom" />
</publications>
<dependencies>
<!-- API DEPENDENCIES -->

<!-- @WebListener is used for JSR356 websockets so we need to compile with servlet 3 API -->
<dependency org="javax.servlet" name="javax.servlet-api"
rev="3.0.1" conf="build-provided,ide,test -> default" />

<!-- Atmosphere -->
<dependency org="com.vaadin.external.atmosphere"
name="atmosphere-runtime" rev="&atmosphere.runtime.version;"
conf="build,ide,test -> default" />
<dependency org="com.vaadin.external.atmosphere.client"
name="jquery" rev="&atmosphere.js.version;" conf="push.js -> default" />
</dependencies>

</ivy-module>

+ 220
- 0
push/pom.xml View File

@@ -0,0 +1,220 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<name>Vaadin Push</name>
<packaging>jar</packaging>
<version>7.7.0-SNAPSHOT</version>
<properties>
<atmosphere.runtime.version>2.2.7.vaadin1</atmosphere.runtime.version>
<atmosphere.js.version>2.2.6.vaadin4</atmosphere.js.version>
</properties>
<organization>
<name>Vaadin Ltd</name>
</organization>
<url>https://vaadin.com/</url>
<description>Vaadin server push support</description>

<dependencies>
<!-- Atmosphere -->
<dependency>
<groupId>com.vaadin.external.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>${atmosphere.runtime.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin.external.atmosphere.client</groupId>
<artifactId>jquery</artifactId>
<version>${atmosphere.js.version}</version>
<type>war</type>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>default-cli</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<!-- <inherited>false</inherited> -->
<configuration>
<target>
<property name="jquery.unpack" location="${project.build.directory}/temp" />
<property name="vaadinPush.js"
location="${project.build.outputDirectory}/VAADIN/vaadinPush.debug.js" />
<property name="templates.dir"
location="${project.build.sourceDirectory}/../templates" />

<!-- Unzip to temp dir -->
<unzip
src="${maven.dependency.com.vaadin.external.atmosphere.client.jquery.war.path}"
dest="${jquery.unpack}">
<patternset>
<include name="**/jquery.atmosphere.js" />
</patternset>
<mapper type="flatten" />
</unzip>
<loadfile srcfile="${templates.dir}/jquery-1.11.0.js"
property="jquery.js.contents" />
<loadfile srcfile="${jquery.unpack}/jquery.atmosphere.js"
property="jquery.atmosphere.js.contents" />

<loadfile srcfile="${templates.dir}/vaadinPush.js.tpl"
property="vaadinPush.js.contents">
<filterchain>
<replacetokens begintoken="@" endtoken="@">
<token key="jquery.js" value="${jquery.js.contents}" />
<token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
</replacetokens>
</filterchain>
</loadfile>
<!-- Non-obfuscated version for debugging -->
<echo file="${vaadinPush.js}">${vaadinPush.js.contents}</echo>

</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<id>minifyjs</id>
<phase>process-resources</phase>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>${project.build.outputDirectory}/VAADIN</sourceDirectory>
<includes>
<include>vaadinPush.debug.js</include>
</includes>
<outputDirectory>${project.build.outputDirectory}/VAADIN</outputDirectory>
</configuration>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>compresspush</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<property name="vaadinPush.debug.js"
location="${project.build.outputDirectory}/VAADIN/vaadinPush.debug.js" />
<property name="vaadinPush-min.js"
location="${project.build.outputDirectory}/VAADIN/vaadinPush.debug-min.js" />
<property name="vaadinPush.js"
location="${project.build.outputDirectory}/VAADIN/vaadinPush.js" />

<move file="${vaadinPush-min.js}" tofile="${vaadinPush.js}" />

<!-- Gzipped versions -->
<gzip src="${vaadinPush.debug.js}" destfile="${vaadinPush.debug.js}.gz" />
<gzip src="${vaadinPush.js}" destfile="${vaadinPush.js}.gz" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment>
<Export-Package>VAADIN</Export-Package>
<Require-Bundle>com.vaadin.external.atmosphere.runtime;bundle-version="${atmosphere.runtime.version}";visibility:=reexport</Require-Bundle>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<index>false</index>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<versionRange>
[1.8,)
</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>

push/lib/jquery/jquery-1.11.0.js → push/src/main/templates/jquery-1.11.0.js View File


WebContent/VAADIN/vaadinPush.js.tpl → push/src/main/templates/vaadinPush.js.tpl View File


+ 1
- 1
server/ivy.xml View File

@@ -55,7 +55,7 @@
<exclude type="pom" conf="test" />
</dependency>
<dependency org="com.vaadin" name="vaadin-push" rev="${vaadin.version}"
conf="build-provided,test->build">
conf="build-provided,test->compile">
<exclude type="pom" conf="test" />
</dependency>


+ 1
- 1
uitest/ivy.xml View File

@@ -53,7 +53,7 @@
<exclude type="pom" />
</dependency>
<dependency org="com.vaadin" name="vaadin-push" rev="${vaadin.version}"
conf="build->build">
conf="build->default">
<exclude org="javax.servlet"></exclude>
<exclude type="pom" />
</dependency>

Loading…
Cancel
Save