]> source.dussan.org Git - vaadin-framework.git/commitdiff
Created separate build.xml files for each module (#9299)
authorArtur Signell <artur@vaadin.com>
Thu, 23 Aug 2012 07:43:24 +0000 (10:43 +0300)
committerArtur Signell <artur@vaadin.com>
Sun, 9 Sep 2012 08:22:53 +0000 (11:22 +0300)
27 files changed:
.gitignore
build.properties [new file with mode: 0644]
build.xml [new file with mode: 0644]
build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java [deleted file]
build/buildhelpers/com/vaadin/buildhelpers/GeneratePackageExports.java [deleted file]
build/buildhelpers/com/vaadin/buildhelpers/ManifestWriter.java [deleted file]
build/package/META-INF/MANIFEST.MF
buildhelpers/build.xml [new file with mode: 0644]
buildhelpers/ivy.xml [new file with mode: 0644]
buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java [new file with mode: 0644]
buildhelpers/src/com/vaadin/buildhelpers/ManifestWriter.java [new file with mode: 0644]
client-compiler/build.xml [new file with mode: 0755]
client-compiler/ivy.xml [new file with mode: 0755]
client/build.xml [new file with mode: 0644]
client/ivy.xml [new file with mode: 0644]
common.xml [new file with mode: 0644]
gwt-files.xml [new file with mode: 0755]
ivysettings.xml [new file with mode: 0644]
pom-template.xml [new file with mode: 0644]
server/build.xml [new file with mode: 0644]
server/ivy.xml [new file with mode: 0644]
shared/build.xml [new file with mode: 0644]
shared/ivy.xml [new file with mode: 0644]
theme-compiler/build.xml [new file with mode: 0644]
theme-compiler/ivy.xml [new file with mode: 0644]
theme-compiler/ivymodule/smartsprites-ivy-0.2.3-itmill.xml [new file with mode: 0644]
theme-compiler/src/com/vaadin/buildhelpers/CompileDefaultTheme.java [new file with mode: 0755]

index 999a655cafcc69a6ea836a5ddd86794788a0dadc..fbc7eee0af72ab6e6dacce9afa5f76e81e371bcc 100644 (file)
@@ -59,3 +59,7 @@
 
 # Mac
 *.DS_Store
+
+# build result folders
+*/result
+result
\ No newline at end of file
diff --git a/build.properties b/build.properties
new file mode 100644 (file)
index 0000000..7da0205
--- /dev/null
@@ -0,0 +1,8 @@
+javadoc.doctitle=<h1>Vaadin</h1>
+javadoc.bottom=<i>Copyright &#169; 2000-2011 Vaadin Ltd. All Rights Reserved.</i>
+ivy.organisation=com.vaadin
+vaadin.vendor=Vaadin Ltd
+vaadin.java.version=6
+vaadin.version=0.0.0.noversion
+
+
diff --git a/build.xml b/build.xml
new file mode 100644 (file)
index 0000000..f735a6a
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<project name="vaadin" basedir="." default="all" xmlns:ivy="antlib:org.apache.ivy.ant">
+       <include file="common.xml" as="common" />
+
+       <path id="vaadin.buildhelpers.classpath" location="${vaadin.basedir}/buildhelpers/result/classes" />
+
+       <!-- ================================= 
+          target: all              
+         ================================= -->
+       <!--<target name="all" description="Compiles all parts of the project" depends="buildhelpers,theme-compiler,shared,server,client">-->
+       <target name="all" description="Compiles all parts of the project" depends="buildorder">
+
+               <subant buildpathref="build-path">
+               </subant>
+       </target>
+
+       <target name="buildorder">
+               <!-- Find out a good build order -->
+               <ivy:buildlist reference="build-path">
+                       <fileset dir="." includes="**/build.xml">
+                               <exclude name="build.xml" />
+                               <exclude name="build/**" />
+                       </fileset>
+               </ivy:buildlist>
+       </target>
+       <target name="clean" depends="buildorder">
+               <subant buildpathref="build-path" target="clean">
+               </subant>
+       </target>
+
+</project>
diff --git a/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java b/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java
deleted file mode 100644 (file)
index 5b17ae4..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.vaadin.buildhelpers;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-
-import com.vaadin.sass.ScssStylesheet;
-
-/**
- * Helper to combine css divided into separate per component dirs into one to
- * optimize http requests.
- */
-public class CompileDefaultTheme {
-
-    private static final String ARG_VERSION = "-version";
-
-    private static final String THEME_DIR = "./WebContent/VAADIN/themes/";
-    private static final String BASE = "base";
-    private static final String RUNO = "runo";
-    private static final String REINDEER = "reindeer";
-    private static final String LIFERAY = "liferay";
-    private static final String CHAMELEON = "chameleon";
-
-    /**
-     * @param args
-     * @throws IOException
-     */
-    public static void main(String[] args) throws IOException {
-        String ver = null;
-        for (int i = 0; i < args.length; i++) {
-            if (ARG_VERSION.equals(args[i])) {
-                if (args.length >= i) {
-                    ver = args[i + 1];
-                }
-                break;
-            }
-        }
-
-        for (String themeName : new String[] { BASE, RUNO, LIFERAY, CHAMELEON }) {
-            try {
-                processSassTheme(themeName, false, ver);
-                System.out.println("Compiling theme " + themeName
-                        + " successful");
-            } catch (Exception e) {
-                System.err.println("Compiling theme " + themeName + " failed");
-                e.printStackTrace();
-            }
-        }
-
-        // Compile Reindeer last, since it requires the spriting operation
-        // (makes testing the other themes a bit faster, since you don't need to
-        // wait for the spriting operation to finish before the theme CSS is
-        // compiled)
-        for (String themeName : new String[] { REINDEER }) {
-            try {
-                processSassTheme(themeName, true, ver);
-                System.out.println("Compiling theme " + themeName
-                        + " successful");
-            } catch (Exception e) {
-                System.err.println("Compiling theme " + themeName + " failed");
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private static void processSassTheme(String themeName,
-            boolean useSmartSprites, String version) throws Exception {
-
-        StringBuffer cssHeader = new StringBuffer();
-
-        // Theme version
-        if (version == null) {
-            version = "9.9.9.INTERNAL-DEBUG-BUILD";
-        }
-        version = version.replaceAll("\\.", "_");
-        cssHeader.append(".v-theme-version:after {content:\"" + version
-                + "\";}\n");
-        cssHeader.append(".v-theme-version-" + version + " {display: none;}\n");
-
-        String stylesCssDir = THEME_DIR + themeName + "/";
-        String stylesCssName = stylesCssDir + "styles.css";
-
-        // Process as SASS file
-        ScssStylesheet scss = ScssStylesheet.get(stylesCssDir + "styles.scss");
-        scss.compile();
-
-        BufferedWriter out = new BufferedWriter(new FileWriter(stylesCssName));
-        out.write(cssHeader.toString());
-        out.write(scss.toString());
-        out.close();
-
-        System.out.println("Compiled CSS to " + stylesCssName + " ("
-                + scss.toString().length() + " bytes)");
-
-        if (useSmartSprites) {
-            createSprites(themeName);
-            System.out.println("Used SmartSprites to create sprites");
-            File oldCss = new File(stylesCssName);
-            oldCss.delete();
-
-            File newCss = new File(stylesCssDir + "styles-sprite.css");
-            boolean ok = newCss.renameTo(oldCss);
-            if (!ok) {
-                System.out.println("Rename " + newCss + " -> " + oldCss
-                        + " failed");
-            }
-        }
-    }
-
-    private static void createSprites(String themeName)
-            throws FileNotFoundException, IOException {
-        String[] parameters = new String[] { "--sprite-png-depth", "AUTO",
-                "--css-file-suffix", "-sprite", "--css-file-encoding", "UTF-8",
-                "--root-dir-path", THEME_DIR + themeName, "--log-level", "WARN" };
-
-        org.carrot2.labs.smartsprites.SmartSprites.main(parameters);
-
-    }
-}
diff --git a/build/buildhelpers/com/vaadin/buildhelpers/GeneratePackageExports.java b/build/buildhelpers/com/vaadin/buildhelpers/GeneratePackageExports.java
deleted file mode 100644 (file)
index 0deebdc..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-package com.vaadin.buildhelpers;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Vector;
-import java.util.jar.Attributes;
-import java.util.jar.Attributes.Name;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-/**
- * Generates Export-Packages attribute for OSGi compatible manifest.
- * 
- * Reads the included Java packages in Vaadin JAR, generates a corresponding
- * MANIFEST.MF file, and replaces the dummy one in the JAR with the generated
- * one.
- * 
- * See #3521 for details.
- * 
- * @author magi
- */
-public class GeneratePackageExports {
-    public static final String VAADIN_PACKAGE_PATH_PREFIX = "com/vaadin/";
-    public static final String GOOGLE_PACKAGE_PATH_PREFIX = "com/google/";
-
-    public static void main(String[] args) {
-        if (args.length < 1) {
-            System.err.println("Invalid number of parameters\n"
-                    + "Usage: java -cp .. GenerateManifest <package.jar>");
-            System.exit(1);
-        }
-
-        // Open the JAR
-        String jarFilename = args[0];
-        JarFile jar = null;
-        try {
-            jar = new JarFile(jarFilename);
-        } catch (IOException e) {
-            System.err.println("Unable to open JAR '" + jarFilename + "'");
-            System.exit(1);
-        }
-
-        // List the included Java packages
-        HashSet<String> packages = new HashSet<String>();
-        for (Enumeration<JarEntry> it = jar.entries(); it.hasMoreElements();) {
-            JarEntry entry = it.nextElement();
-            if ((entry.getName().startsWith(VAADIN_PACKAGE_PATH_PREFIX) || entry
-                    .getName().startsWith(GOOGLE_PACKAGE_PATH_PREFIX))
-                    && entry.getName().endsWith(".class")) {
-                int lastSlash = entry.getName().lastIndexOf('/');
-                String pkg = entry.getName().substring(0, lastSlash)
-                        .replace('/', '.');
-                packages.add(pkg);
-            }
-        }
-
-        // List theme packages
-        for (Enumeration<JarEntry> it = jar.entries(); it.hasMoreElements();) {
-            JarEntry entry = it.nextElement();
-            if (entry.isDirectory()
-                    && entry.getName().startsWith("VAADIN/themes")) {
-                // Strip ending slash
-                int lastSlash = entry.getName().lastIndexOf('/');
-                String pkg = entry.getName().substring(0, lastSlash)
-                        .replace('/', '.');
-                packages.add(pkg);
-            }
-        }
-
-        // Replacement for the "Export-Package" attribute in the manifest
-        String exportPackage = "";
-
-        // Produce an ordered listing of the package names
-        String packageArray[] = new String[packages.size()];
-        packages.toArray(packageArray);
-        Arrays.sort(packageArray);
-        for (int i = 0; i < packageArray.length; i++) {
-            if (i == 0) {
-                exportPackage = packageArray[i];
-            } else {
-                exportPackage += ", " + packageArray[i];
-            }
-        }
-
-        // Read old manifest
-        Manifest oldMF = null;
-        try {
-            oldMF = jar.getManifest();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        // Read main attributes
-        Attributes mainAtts = oldMF.getMainAttributes();
-        Vector<String> keys = new Vector<String>(mainAtts.size());
-        for (Iterator<Object> attrit = mainAtts.keySet().iterator(); attrit
-                .hasNext();) {
-            Name name = (Name) attrit.next();
-            keys.add(name.toString());
-        }
-
-        // Jar must be closed before updating it below, as it's
-        // locked in Windows until closed. (#6045)
-        try {
-            jar.close();
-        } catch (IOException e) {
-            System.err.println("Unable to close JAR '" + jarFilename + "'");
-        }
-
-        // Put the manifest version as the first line
-        String orderedKeys[] = new String[keys.size()];
-        keys.toArray(orderedKeys);
-        Arrays.sort(orderedKeys); // Must sort to be able to search
-        int mvPos = Arrays.binarySearch(orderedKeys, "Manifest-Version");
-        orderedKeys[mvPos] = orderedKeys[0]; // Swap
-        orderedKeys[0] = "Manifest-Version";
-
-        // This final ordering is just for esthetic reasons and
-        // in practice unnecessary and will actually be messed up
-        // when the 'jar' command reads the manifest
-        Arrays.sort(orderedKeys, 1, orderedKeys.length - 1);
-
-        // Create the modified manifest
-        ManifestWriter manifest = new ManifestWriter();
-        for (int i = 0; i < orderedKeys.length; i++) {
-            // Skip an existing Export-Package attribute
-            if (orderedKeys[i].equals("Export-Package")) {
-                // Copy the attribute to the modified manifest
-                manifest.writeAttribute(orderedKeys[i],
-                        mainAtts.getValue(orderedKeys[i]));
-            }
-        }
-
-        // Add the Export-Package attribute at the end of the manifest.
-        // The alternative would be replacing an existing attribute in
-        // the loop above, but it's not guaranteed that it exists.
-        manifest.writeAttribute("Export-Package", exportPackage);
-
-        // Update the manifest in the Jar. The jar must be closed
-        // before this is done.
-        int status = manifest.updateJar(jarFilename);
-
-        if (status != 0) {
-            System.exit(status);
-        }
-    }
-
-}
diff --git a/build/buildhelpers/com/vaadin/buildhelpers/ManifestWriter.java b/build/buildhelpers/com/vaadin/buildhelpers/ManifestWriter.java
deleted file mode 100644 (file)
index a6130e2..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * 
- */
-package com.vaadin.buildhelpers;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Date;
-import java.util.jar.Manifest;
-
-public class ManifestWriter {
-    StringBuffer buffer = new StringBuffer();
-    
-    public ManifestWriter() {
-    }
-
-    /**
-     * Writes a manifest attribute to a temporary buffer.
-     * 
-     * @param name Attribute name
-     * @param value Attribute value
-     */
-    public void writeAttribute(String name, String value) {
-        int linelen = name.length() + 2;
-        buffer.append(name);
-        buffer.append(": ");
-        
-        String remainingValue = value;
-        while (linelen + remainingValue.length() > 72) {
-            int fitsLine = 72 - linelen;
-            buffer.append(remainingValue.substring(0, fitsLine) + "\n ");
-            remainingValue = remainingValue.substring(fitsLine);
-            linelen = 1;
-        }
-        buffer.append(remainingValue + "\n");
-    }
-    
-    /**
-     * Writes the manifest to given JAR file.
-     * 
-     * The manifest must be created with {@code #writeAttribute(String, String)}
-     * before calling this write. 
-     * 
-     * @param jarFilename File name of the JAR in which the manifest is written
-     * @return 0 on success, nonzero value on error
-     */
-    int updateJar(String jarFilename) {
-        int status = 0;
-        
-        // Determine a temporary file name
-        String newMfPrefix = "vaadin-manifest-" + (new Date()).getTime();
-        File newMfFile = null;
-        try {
-            newMfFile = File.createTempFile(newMfPrefix, ".mf");
-        } catch (IOException e) {
-            System.err.println("Creating temp file failed");
-            status = 1;
-        }
-        
-        // Write the manifest to the temporary file
-        if (status == 0) {
-            FileOutputStream fos = null;
-            try {
-                fos = new FileOutputStream(newMfFile);
-                fos.write(getBytes());
-                fos.close();
-            } catch (IOException e) {
-                System.err.println("Writing to file '"+newMfFile.getAbsolutePath() +"' failed because: " + e.getMessage());
-                status = 1;
-            }
-        }
-        
-        // Check that the manifest is OK
-        if (status == 0) {
-            Manifest checkMf = new Manifest();
-            FileInputStream is;
-            try {
-                is = new FileInputStream(newMfFile);
-                checkMf.read(is);
-            } catch (IOException e) {
-                System.err.println("Reading from file '"+newMfFile.getAbsolutePath() +"' failed because: " + e.getMessage());
-                status = 1;
-            }
-        }
-        
-        // Update the manifest in the Jar
-        if (status == 0) {
-            System.out.println("Updating manifest in JAR " + jarFilename);
-            try {
-                // The "mf" order must correspond with manifest-jarfile order
-                Process process = Runtime.getRuntime().exec(new String[]{"jar", "umf", newMfFile.getAbsolutePath(), jarFilename});
-                int exitValue = process.waitFor();
-                if (exitValue != 0) {
-                    InputStream jarErr = process.getErrorStream();
-                    BufferedReader reader = new BufferedReader(new InputStreamReader(jarErr));
-                    while (reader.ready()) {
-                        System.err.println("jar: " + reader.readLine());
-                    }
-                    System.err.println("The 'jar' command returned with exit value " + exitValue);
-                    status = 1;
-                }
-            } catch (IOException e) {
-                System.err.println("Failed to execute 'jar' command. " + e.getMessage());
-                status = 1;
-            } catch (InterruptedException e) {
-                System.err.println("Execution of 'jar' command was interrupted. " + e.getMessage());
-                status = 1;
-            }
-        }
-        
-        // Remove the temporary file
-        if (newMfFile != null)
-            newMfFile.delete();
-        
-        return status;
-    }
-
-    public String toString() {
-        return buffer.toString();
-    }
-    
-    public byte[] getBytes() {
-        return buffer.toString().getBytes();
-    }
-}
\ No newline at end of file
index ba28f96394b8b20639f2b9be652541d0f44d2a1e..5d2e13a4dada234e8aaab4b5f448b4432ae5c46a 100644 (file)
@@ -2,5 +2,5 @@ Bundle-ManifestVersion: 2
 Bundle-Name: Vaadin
 Bundle-SymbolicName: com.vaadin
 Bundle-Vendor: Vaadin Ltd
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Import-Package: javax.servlet; version="2.3.0",javax.servlet.http; version="2.3.0"
diff --git a/buildhelpers/build.xml b/buildhelpers/build.xml
new file mode 100644 (file)
index 0000000..6137082
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+
+<project name="vaadin-buildhelpers" basedir="." default="publish">
+       <description>
+               Compiles build helpers used when building other modules.
+       </description>
+       <include file="../build.xml" as="vaadin" />
+       <include file="../common.xml" as="common" />
+       
+       <property name="module.name" value="vaadin-buildhelpers" />
+       <property name="result.dir" location="result" />
+       <path id="classpath.compile.custom" />
+
+       <target name="jar">
+               <antcall target="common.jar">
+                       <reference torefid="extra.jar.includes" refid="empty.reference" />
+               </antcall>
+       </target>
+
+       <target name="publish" depends="jar">
+               <antcall target="common.publish-local" />
+       </target>
+
+       <target name="clean">
+               <antcall target="common.clean" />
+       </target>
+</project>
\ No newline at end of file
diff --git a/buildhelpers/ivy.xml b/buildhelpers/ivy.xml
new file mode 100644 (file)
index 0000000..63fee56
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+
+    <info organisation="com.vaadin" module="vaadin-buildhelpers"
+        revision="${vaadin.version}" />
+
+    <configurations>
+        <conf name="build" />
+        <conf name="ide" />
+    </configurations>
+    <publications>
+        <artifact type="jar" />
+    </publications>
+    <dependencies />
+
+</ivy-module>
diff --git a/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java b/buildhelpers/src/com/vaadin/buildhelpers/GeneratePackageExports.java
new file mode 100644 (file)
index 0000000..0deebdc
--- /dev/null
@@ -0,0 +1,152 @@
+package com.vaadin.buildhelpers;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Vector;
+import java.util.jar.Attributes;
+import java.util.jar.Attributes.Name;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+/**
+ * Generates Export-Packages attribute for OSGi compatible manifest.
+ * 
+ * Reads the included Java packages in Vaadin JAR, generates a corresponding
+ * MANIFEST.MF file, and replaces the dummy one in the JAR with the generated
+ * one.
+ * 
+ * See #3521 for details.
+ * 
+ * @author magi
+ */
+public class GeneratePackageExports {
+    public static final String VAADIN_PACKAGE_PATH_PREFIX = "com/vaadin/";
+    public static final String GOOGLE_PACKAGE_PATH_PREFIX = "com/google/";
+
+    public static void main(String[] args) {
+        if (args.length < 1) {
+            System.err.println("Invalid number of parameters\n"
+                    + "Usage: java -cp .. GenerateManifest <package.jar>");
+            System.exit(1);
+        }
+
+        // Open the JAR
+        String jarFilename = args[0];
+        JarFile jar = null;
+        try {
+            jar = new JarFile(jarFilename);
+        } catch (IOException e) {
+            System.err.println("Unable to open JAR '" + jarFilename + "'");
+            System.exit(1);
+        }
+
+        // List the included Java packages
+        HashSet<String> packages = new HashSet<String>();
+        for (Enumeration<JarEntry> it = jar.entries(); it.hasMoreElements();) {
+            JarEntry entry = it.nextElement();
+            if ((entry.getName().startsWith(VAADIN_PACKAGE_PATH_PREFIX) || entry
+                    .getName().startsWith(GOOGLE_PACKAGE_PATH_PREFIX))
+                    && entry.getName().endsWith(".class")) {
+                int lastSlash = entry.getName().lastIndexOf('/');
+                String pkg = entry.getName().substring(0, lastSlash)
+                        .replace('/', '.');
+                packages.add(pkg);
+            }
+        }
+
+        // List theme packages
+        for (Enumeration<JarEntry> it = jar.entries(); it.hasMoreElements();) {
+            JarEntry entry = it.nextElement();
+            if (entry.isDirectory()
+                    && entry.getName().startsWith("VAADIN/themes")) {
+                // Strip ending slash
+                int lastSlash = entry.getName().lastIndexOf('/');
+                String pkg = entry.getName().substring(0, lastSlash)
+                        .replace('/', '.');
+                packages.add(pkg);
+            }
+        }
+
+        // Replacement for the "Export-Package" attribute in the manifest
+        String exportPackage = "";
+
+        // Produce an ordered listing of the package names
+        String packageArray[] = new String[packages.size()];
+        packages.toArray(packageArray);
+        Arrays.sort(packageArray);
+        for (int i = 0; i < packageArray.length; i++) {
+            if (i == 0) {
+                exportPackage = packageArray[i];
+            } else {
+                exportPackage += ", " + packageArray[i];
+            }
+        }
+
+        // Read old manifest
+        Manifest oldMF = null;
+        try {
+            oldMF = jar.getManifest();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        // Read main attributes
+        Attributes mainAtts = oldMF.getMainAttributes();
+        Vector<String> keys = new Vector<String>(mainAtts.size());
+        for (Iterator<Object> attrit = mainAtts.keySet().iterator(); attrit
+                .hasNext();) {
+            Name name = (Name) attrit.next();
+            keys.add(name.toString());
+        }
+
+        // Jar must be closed before updating it below, as it's
+        // locked in Windows until closed. (#6045)
+        try {
+            jar.close();
+        } catch (IOException e) {
+            System.err.println("Unable to close JAR '" + jarFilename + "'");
+        }
+
+        // Put the manifest version as the first line
+        String orderedKeys[] = new String[keys.size()];
+        keys.toArray(orderedKeys);
+        Arrays.sort(orderedKeys); // Must sort to be able to search
+        int mvPos = Arrays.binarySearch(orderedKeys, "Manifest-Version");
+        orderedKeys[mvPos] = orderedKeys[0]; // Swap
+        orderedKeys[0] = "Manifest-Version";
+
+        // This final ordering is just for esthetic reasons and
+        // in practice unnecessary and will actually be messed up
+        // when the 'jar' command reads the manifest
+        Arrays.sort(orderedKeys, 1, orderedKeys.length - 1);
+
+        // Create the modified manifest
+        ManifestWriter manifest = new ManifestWriter();
+        for (int i = 0; i < orderedKeys.length; i++) {
+            // Skip an existing Export-Package attribute
+            if (orderedKeys[i].equals("Export-Package")) {
+                // Copy the attribute to the modified manifest
+                manifest.writeAttribute(orderedKeys[i],
+                        mainAtts.getValue(orderedKeys[i]));
+            }
+        }
+
+        // Add the Export-Package attribute at the end of the manifest.
+        // The alternative would be replacing an existing attribute in
+        // the loop above, but it's not guaranteed that it exists.
+        manifest.writeAttribute("Export-Package", exportPackage);
+
+        // Update the manifest in the Jar. The jar must be closed
+        // before this is done.
+        int status = manifest.updateJar(jarFilename);
+
+        if (status != 0) {
+            System.exit(status);
+        }
+    }
+
+}
diff --git a/buildhelpers/src/com/vaadin/buildhelpers/ManifestWriter.java b/buildhelpers/src/com/vaadin/buildhelpers/ManifestWriter.java
new file mode 100644 (file)
index 0000000..a6130e2
--- /dev/null
@@ -0,0 +1,130 @@
+/**
+ * 
+ */
+package com.vaadin.buildhelpers;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Date;
+import java.util.jar.Manifest;
+
+public class ManifestWriter {
+    StringBuffer buffer = new StringBuffer();
+    
+    public ManifestWriter() {
+    }
+
+    /**
+     * Writes a manifest attribute to a temporary buffer.
+     * 
+     * @param name Attribute name
+     * @param value Attribute value
+     */
+    public void writeAttribute(String name, String value) {
+        int linelen = name.length() + 2;
+        buffer.append(name);
+        buffer.append(": ");
+        
+        String remainingValue = value;
+        while (linelen + remainingValue.length() > 72) {
+            int fitsLine = 72 - linelen;
+            buffer.append(remainingValue.substring(0, fitsLine) + "\n ");
+            remainingValue = remainingValue.substring(fitsLine);
+            linelen = 1;
+        }
+        buffer.append(remainingValue + "\n");
+    }
+    
+    /**
+     * Writes the manifest to given JAR file.
+     * 
+     * The manifest must be created with {@code #writeAttribute(String, String)}
+     * before calling this write. 
+     * 
+     * @param jarFilename File name of the JAR in which the manifest is written
+     * @return 0 on success, nonzero value on error
+     */
+    int updateJar(String jarFilename) {
+        int status = 0;
+        
+        // Determine a temporary file name
+        String newMfPrefix = "vaadin-manifest-" + (new Date()).getTime();
+        File newMfFile = null;
+        try {
+            newMfFile = File.createTempFile(newMfPrefix, ".mf");
+        } catch (IOException e) {
+            System.err.println("Creating temp file failed");
+            status = 1;
+        }
+        
+        // Write the manifest to the temporary file
+        if (status == 0) {
+            FileOutputStream fos = null;
+            try {
+                fos = new FileOutputStream(newMfFile);
+                fos.write(getBytes());
+                fos.close();
+            } catch (IOException e) {
+                System.err.println("Writing to file '"+newMfFile.getAbsolutePath() +"' failed because: " + e.getMessage());
+                status = 1;
+            }
+        }
+        
+        // Check that the manifest is OK
+        if (status == 0) {
+            Manifest checkMf = new Manifest();
+            FileInputStream is;
+            try {
+                is = new FileInputStream(newMfFile);
+                checkMf.read(is);
+            } catch (IOException e) {
+                System.err.println("Reading from file '"+newMfFile.getAbsolutePath() +"' failed because: " + e.getMessage());
+                status = 1;
+            }
+        }
+        
+        // Update the manifest in the Jar
+        if (status == 0) {
+            System.out.println("Updating manifest in JAR " + jarFilename);
+            try {
+                // The "mf" order must correspond with manifest-jarfile order
+                Process process = Runtime.getRuntime().exec(new String[]{"jar", "umf", newMfFile.getAbsolutePath(), jarFilename});
+                int exitValue = process.waitFor();
+                if (exitValue != 0) {
+                    InputStream jarErr = process.getErrorStream();
+                    BufferedReader reader = new BufferedReader(new InputStreamReader(jarErr));
+                    while (reader.ready()) {
+                        System.err.println("jar: " + reader.readLine());
+                    }
+                    System.err.println("The 'jar' command returned with exit value " + exitValue);
+                    status = 1;
+                }
+            } catch (IOException e) {
+                System.err.println("Failed to execute 'jar' command. " + e.getMessage());
+                status = 1;
+            } catch (InterruptedException e) {
+                System.err.println("Execution of 'jar' command was interrupted. " + e.getMessage());
+                status = 1;
+            }
+        }
+        
+        // Remove the temporary file
+        if (newMfFile != null)
+            newMfFile.delete();
+        
+        return status;
+    }
+
+    public String toString() {
+        return buffer.toString();
+    }
+    
+    public byte[] getBytes() {
+        return buffer.toString().getBytes();
+    }
+}
\ No newline at end of file
diff --git a/client-compiler/build.xml b/client-compiler/build.xml
new file mode 100755 (executable)
index 0000000..71e15ca
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<project name="vaadin-client-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
+       <description>
+               Compiles build helpers used when building other modules.
+       </description>
+       <include file="../common.xml" as="common" />
+       <include file="../build.xml" as="vaadin" />
+       <include file="../gwt-files.xml" as="gwtfiles" />
+
+       <!-- global properties -->
+       <property name="module.name" value="vaadin-client-compiler" />
+       <property name="result.dir" value="result" />
+       <path id="classpath.compile.custom">
+               <fileset file="${gwt.dev.jar}"/>
+       </path>
+
+       <target name="jar">
+               <antcall target="common.jar">
+                       <reference refid="client-compiler.gwt.includes" torefid="extra.jar.includes" />
+               </antcall>
+
+       </target>
+
+       <target name="publish-local" depends="jar">
+               <antcall target="common.publish-local" />
+       </target>
+
+       <target name="clean">
+               <antcall target="common.clean" />
+       </target>
+</project>
\ No newline at end of file
diff --git a/client-compiler/ivy.xml b/client-compiler/ivy.xml
new file mode 100755 (executable)
index 0000000..79def69
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+
+    <info organisation="com.vaadin" module="vaadin-client-compiler"
+        revision="${vaadin.version}" />
+
+    <configurations>
+        <conf name="build" />
+        <conf name="ide" />
+    </configurations>
+    <publications>
+        <artifact></artifact>
+    </publications>
+    <dependencies>
+        <dependency org="com.vaadin" name="vaadin-shared"
+            rev="${vaadin.version}"></dependency>
+        <dependency org="com.vaadin" name="vaadin-server"
+            rev="${vaadin.version}"></dependency>
+        <dependency org="com.vaadin" name="vaadin-client"
+            rev="${vaadin.version}"></dependency>
+    </dependencies>
+
+</ivy-module>
diff --git a/client/build.xml b/client/build.xml
new file mode 100644 (file)
index 0000000..99dbb26
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<project name="vaadin-client" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
+       <description>
+               Compiles build helpers used when building other modules.
+       </description>
+       <include file="../common.xml" as="common" />
+       <include file="../build.xml" as="vaadin" />
+       <include file="../gwt-files.xml" as="gwtfiles" />
+
+       <!-- global properties -->
+       <property name="module.name" value="vaadin-client" />
+       <property name="result.dir" value="result" />
+
+       <path id="classpath.compile.custom">
+               <fileset file="${gwt.user.jar}"/>
+       </path>
+
+       <target name="jar">
+               <antcall target="common.jar">
+                       <reference refid="client.gwt.includes" torefid="extra.jar.includes" />
+               </antcall>
+       </target>
+
+       <target name="publish-local" depends="jar">
+               <antcall target="common.publish-local" />
+       </target>
+
+       <target name="clean">
+               <antcall target="common.clean" />
+       </target>
+</project>
\ No newline at end of file
diff --git a/client/ivy.xml b/client/ivy.xml
new file mode 100644 (file)
index 0000000..953ca51
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+
+    <info organisation="com.vaadin" module="vaadin-client"
+        revision="${vaadin.version}" />
+
+    <configurations>
+        <conf name="build" />
+        <conf name="ide" />
+    </configurations>
+    <publications>
+        <artifact></artifact>
+    </publications>
+    <dependencies>
+        <dependency org="com.vaadin" name="vaadin-shared"
+            rev="${vaadin.version}" conf="build"></dependency>
+        <dependency org="com.vaadin" name="vaadin-server"
+            rev="${vaadin.version}" conf="build"></dependency>
+
+        <!-- gwt-dev dependencies -->
+        <dependency org="net.sourceforge.cssparser" name="cssparser"
+            rev="0.9.5" />
+
+    </dependencies>
+
+</ivy-module>
diff --git a/common.xml b/common.xml
new file mode 100644 (file)
index 0000000..7eef3f1
--- /dev/null
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="common" basedir="." default="" xmlns:ivy="antlib:org.apache.ivy.ant">
+       <dirname property="vaadin.basedir" file="${ant.file.common}" />
+       <property file="${vaadin.basedir}/build.properties" />
+       <ivy:settings file="${vaadin.basedir}/ivysettings.xml" />
+
+       <union id="empty.reference" />
+
+       <!-- TODO Preprocess @version@ and more -->
+       <fileset dir="${vaadin.basedir}/WebContent" id="common.files.for.all.jars">
+               <patternset>
+                       <include name="release-notes.html" />
+                       <include name="license.html" />
+                       <include name="css/**" />
+                       <include name="img/**" />
+               </patternset>
+       </fileset>
+
+
+       <target name="pom.xml" description="Generates a pom.xml based on the Ivy configuration">
+               <fail unless="result.dir" message="No result.dir parameter given" />
+               <property name="ivy.xml" location="${result.dir}/../ivy.xml" />
+               <property name="pom.xml" location="${result.dir}/pom.xml" />
+               <ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml" ivyfile="${ivy.xml}" pomfile="${pom.xml}" conf="compile, runtime">
+                       <mapping conf="compile" scope="compile" />
+                       <mapping conf="runtime" scope="runtime" />
+               </ivy:makepom>
+       </target>
+
+
+       <target name="sources.jar" depends="compile">
+               <fail unless="result.dir" message="No result.dir parameter given" />
+               <fail unless="module.name" message="No module.name parameter given" />
+               <fail unless="src" message="No src directory parameter given" />
+
+               <property name="sources.jar" location="${result.dir}/${module.name}-${vaadin.version}-sources.jar" />
+
+               <jar file="${sources.jar}" compress="true">
+                       <fileset dir="${src}">
+                               <patternset>
+                                       <include name="**/*.java" />
+                               </patternset>
+                       </fileset>
+                       <fileset refid="common.files.for.all.jars" />
+               </jar>
+
+       </target>
+
+       <target name="javadoc.jar" depends="dependencies">
+               <fail unless="result.dir" message="No result.dir parameter given" />
+               <fail unless="module.name" message="No module.name parameter given" />
+               <fail unless="src" message="No src directory parameter given" />
+               <property name="javadoc.dir" value="${result.dir}/javadoc" />
+               <property name="javadoc.jar" location="${result.dir}/${module.name}-${vaadin.version}-javadoc.jar" />
+
+               <javadoc destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="${module.name}">
+                       <packageset dir="${src}" excludes="${classes.exclude}" />
+                       <doctitle>&lt;h1>${module.name}&lt;/h1></doctitle>
+                       <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
+                       <bottom>${javadoc.bottom}</bottom>
+                       <link offline="true" href="http://docs.oracle.com/javase/6/docs/api/" packagelistLoc="build/javadoc/j2se-1.6.0" />
+                       <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
+                       <classpath refid="classpath.compile.dependencies" />
+               </javadoc>
+
+               <!-- Create a javadoc jar -->
+               <jar file="${javadoc.jar}" compress="true">
+                       <fileset dir="${javadoc.dir}" />
+                       <fileset refid="common.files.for.all.jars" />
+               </jar>
+
+       </target>
+
+       <target name="jar" depends="compile, pom.xml">
+               <fail unless="result.dir" message="No result.dir parameter given" />
+               <fail unless="module.name" message="No module.name parameter given" />
+
+               <property name="result.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" />
+               <property name="module.symbolic" value="com.vaadin.${module.name}" />
+               <property name="classes" location="{$result.dir}/classes" />
+               <property name="src" location="{$result.dir}/../src" />
+
+               <union id="jar.files">
+                       <fileset dir="${classes}" excludes="${classes.exclude}" />
+                       <fileset dir="${src}" excludes="${jar.exclude}" />
+                       <fileset refid="common.files.for.all.jars" />
+                       <fileset file="${pom.xml}" />
+                       <union refid="extra.jar.includes" />
+               </union>
+               <jar destfile="${result.jar}" duplicate="fail" index="true">
+                       <manifest>
+                               <attribute name="Implementation-Vendor" value="Vaadin Ltd" />
+                               <attribute name="Implementation-URL" value="http://vaadin.com" />
+                               <attribute name="Implementation-Version" value="${vaadin.version}" />
+                               <attribute name="Bundle-Version" value="${vaadin.version}" />
+                               <attribute name="Bundle-ManifestVersion" value="2" />
+                               <attribute name="Bundle-Name" value="${module.name}" />
+                               <attribute name="Bundle-SymbolicName" value="${module.symbolic}" />
+                               <attribute name="Bundle-Vendor" value="${vaadin.vendor}" />
+                               <attribute name="Bundle-RequiredExecutionEnvironment" value="JavaSE-1.6" />
+                       </manifest>
+                       <union refid="jar.files" />
+               </jar>
+
+               <antcall target="common.generate-osgi-exports">
+                       <param name="jar" value="${result.jar}" />
+               </antcall>
+
+       </target>
+
+       <target name="generate-osgi-exports">
+               <fail unless="jar" message="No jar parameter given" />
+
+               <!-- Generate the Export-Package attribute in the manifest of the 
+            JAR -->
+               <java classname="com.vaadin.buildhelpers.GeneratePackageExports" failonerror="true" fork="yes">
+                       <arg value="${jar}" />
+                       <classpath refid="vaadin.buildhelpers.classpath" />
+               </java>
+       </target>
+
+       <target name="compile" description="Compiles the module" depends="dependencies">
+               <fail unless="module.name" message="No module name given" />
+               <property name="result.dir" location="result" />
+               <property name="src" location="${result.dir}/../src" />
+               <property name="classes" location="${result.dir}/classes" />
+
+               <mkdir dir="${classes}" />
+
+               <javac srcdir="${src}" destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
+                       <classpath refid="classpath.compile.dependencies" />
+                       <classpath refid="classpath.compile.custom" />
+               </javac>
+       </target>
+
+       <target name="dependencies" description="Resolves dependencies needed by this module">
+               <ivy:resolve resolveid="common" conf="build" />
+               <ivy:cachepath pathid="classpath.compile.dependencies" conf="build" />
+       </target>
+
+       <target name="clean">
+               <fail unless="result.dir" message="No result.dir parameter given" />
+               <delete dir="${result.dir}" />
+       </target>
+
+       <target name="publish-local" description="Publishes the given module to the local repository">
+               <fail unless="result.dir" message="No result.dir parameter given" />
+
+               <ivy:resolve />
+               <ivy:publish resolver="build-temp" overwrite="true">
+                       <!--                    <artifacts pattern="${result.dir}/[artifact]-[revision].[ext]" />-->
+                       <artifacts pattern="${result.dir}/lib/[artifact]-[revision](-[classifier]).[ext]" />
+
+               </ivy:publish>
+       </target>
+</project>
\ No newline at end of file
diff --git a/gwt-files.xml b/gwt-files.xml
new file mode 100755 (executable)
index 0000000..953a92b
--- /dev/null
@@ -0,0 +1,119 @@
+<?xml version="1.0"?>
+
+<project name="GWT files for Vaadin" basedir=".">
+       <include file="common.xml" as="common" />
+
+       <property name="gwt.lib.dir" location="${vaadin.basedir}/../gwt-libs" />
+
+       <property name="gwt.user.jar" location="${gwt.lib.dir}/gwt-user.jar" />
+       <property name="gwt.dev.jar" location="${gwt.lib.dir}/gwt-dev.jar" />
+       <property name="gwt.elemental.jar" location="${gwt.lib.dir}/gwt-elemental.jar" />
+       <property name="gwt.codeserver.jar" location="${gwt.lib.dir}/gwt-codeserver.jar" />
+
+       <available file="${gwt.dev.jar}" property="gwt.dev.jar.found" />
+       <available file="${gwt.user.jar}" property="gwt.user.jar.found" />
+       <available file="${gwt.elemental.jar}" property="gwt.elemental.jar.found" />
+       <available file="${gwt.codeserver.jar}" property="gwt.codeserver.jar.found" />
+
+       <fail unless="gwt.dev.jar.found" message="Could not find gwt-dev.jar" />
+       <fail unless="gwt.user.jar.found" message="Could not find gwt-user.jar" />
+       <fail unless="gwt.elemental.jar.found" message="Could not find gwt-elemental.jar" />
+       <fail unless="gwt.codeserver.jar.found" message="Could not find gwt-codeserver.jar" />
+
+       <property name="gwt.unpack.dir" location="${vaadin.basedir}/build/gwt" />
+
+       <property name="gwt.user.jar.files" location="${gwt.unpack.dir}/gwt-user.jar" />
+       <property name="gwt.dev.jar.files" location="${gwt.unpack.dir}/gwt-dev.jar" />
+       <property name="gwt.elemental.jar.files" location="${gwt.unpack.dir}/gwt-elemental.jar" />
+       <property name="gwt.codeserver.jar.files" location="${gwt.unpack.dir}/gwt-codeserver.jar" />
+
+       <target name="unpack.gwt">
+               <unzip dest="${gwt.user.jar.files}" src="${gwt.user.jar}" />
+               <unzip dest="${gwt.dev.jar.files}" src="${gwt.dev.jar}" />
+               <unzip dest="${gwt.elemental.jar.files}" src="${gwt.elemental.jar}" />
+               <unzip dest="${gwt.codeserver.jar.files}" src="${gwt.codeserver.jar}" />
+       </target>
+
+       <union id="client-compiler.gwt.includes">
+               <!-- GWT development JAR contents including many external dependencies (for now) -->
+               <fileset dir="${gwt.dev.jar.files}">
+                       <exclude name="META-INF/**" />
+                       <exclude name="/license*" />
+                       <exclude name="/LICENSE*" />
+
+                       <!-- Used by client and server apparently... -->
+                       <exclude name="com/google/gwt/thirdparty/guava/**" />
+
+                       <!-- Overridden in Vaadin -->
+                       <exclude name="com/google/gwt/dev/About.properties" />
+
+                       <!-- external dependencies declared in ixy.xml/pom.xml-->
+                       <exclude name="javax/servlet/**" />
+                       <exclude name="javax/xml/**" />
+               </fileset>
+
+               <!-- GWT SuperDevMode -->
+               <fileset dir="${gwt.codeserver.jar.files}">
+                       <exclude name="META-INF/**" />
+                       <include name="**/*.java" />
+                       <include name="**/*.classes" />
+               </fileset>
+       </union>
+
+       <union id="client-compiled.gwt.includes">
+               <!-- Precompiled GWT modules (.gwtar file) -->
+               <fileset dir="${gwt.user.jar.files}">
+                       <exclude name="META-INF/**" />
+
+                       <!-- precompiled GWT modules (.gwtar) -->
+                       <include name="**/*.gwtar" />
+                       <!-- external dependencies -->
+                       <exclude name="javax/servlet/**" />
+                       <exclude name="org/w3c/css/sac/**" />
+
+               </fileset>
+       </union>
+
+       <union id="client.gwt.includes">
+               <fileset dir="${gwt.user.jar.files}">
+                       <exclude name="META-INF/**" />
+                       <!-- precompiled GWT modules (.gwtar) goes into client-compiled -->
+                       <exclude name="**/*.gwtar" />
+                       <!-- These go into server -->
+                       <exclude name="com/google/gwt/*/server/**" />
+                       <!-- These go into shared -->
+                       <exclude name="com/google/gwt/*/shared/**" />
+                       <exclude name="com/google/gwt/*/*/shared/**" />
+                       <exclude name="com/google/web/bindery/*/shared/**" />
+
+
+                       <!-- external dependencies -->
+                       <exclude name="javax/servlet/**" />
+                       <exclude name="org/w3c/css/sac/**" />
+               </fileset>
+       </union>
+
+       <union id="shared.gwt.includes">
+               <fileset dir="${gwt.user.jar.files}">
+                       <!-- Shared files from user-->
+                       <include name="com/google/gwt/*/shared/**" />
+                       <include name="com/google/gwt/*/*/shared/**" />
+                       <include name="com/google/web/bindery/*/shared/**" />
+               </fileset>
+               <fileset dir="${gwt.dev.jar.files}">
+                       <!-- Used by client and server apparently... -->
+                       <include name="com/google/gwt/thirdparty/guava/**" />
+               </fileset>
+               <!-- GWT Elemental -->
+               <fileset dir="${gwt.elemental.jar.files}">
+                       <exclude name="META-INF/**" />
+               </fileset>
+       </union>
+
+       <union id="server.gwt.includes">
+               <fileset dir="${gwt.user.jar.files}">
+                       <!-- Server files from gwt-user-->
+                       <include name="com/google/gwt/*/server/**" />
+               </fileset>
+       </union>
+</project>
diff --git a/ivysettings.xml b/ivysettings.xml
new file mode 100644 (file)
index 0000000..63d97b3
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivysettings>
+    <!-- Default ivysettings.xml stuff -->
+    <include url="${ivy.default.settings.dir}/ivysettings-public.xml" />
+    <include url="${ivy.default.settings.dir}/ivysettings-shared.xml" />
+    <include url="${ivy.default.settings.dir}/ivysettings-local.xml" />
+    <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml" />
+    <include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml" />
+
+    <!-- Customized stuff -->
+    <settings defaultResolver="public" />
+    <resolvers>
+        <ibiblio name="public" m2compatible="true" />
+        <dual name="custom-smartsprites">
+            <filesystem name="smartsprites-ivy">
+                <ivy pattern="${basedir}/ivymodule/[module]-ivy-[revision].xml" />
+            </filesystem>
+            <url name="smartsprites-artifact">
+                <artifact
+                    pattern="http://dev.vaadin.com/svn/versions/6.8/build/smartsprites/lib/[artifact](-[revision]).[ext]" />
+            </url>
+        </dual>
+        <filesystem name="build-temp">
+            <ivy
+                pattern="${ivy.settings.dir}/result/artifacts/[revision]/[module]/ivy-[revision].xml" />
+            <artifact
+                pattern="${ivy.settings.dir}/result/artifacts/[revision]/[module]/[artifact]-[revision].[ext]" />
+        </filesystem>
+    </resolvers>
+    <modules>
+        <!-- IT Mill patched SmartSprites -->
+        <module organisation="com.carrotsearch" name="smartsprites"
+            revision="0.2.3-itmill" resolver="custom-smartsprites" />
+        <module organisation="com.vaadin" name="vaadin-buildhelpers"
+            resolver="build-temp" />
+        <module organisation="com.vaadin" name="vaadin-shared"
+            resolver="build-temp" />
+        <module organisation="com.vaadin" name="vaadin-server"
+            resolver="build-temp" />
+        <module organisation="com.vaadin" name="vaadin-client"
+            resolver="build-temp" />
+        <module organisation="com.vaadin" name="vaadin-client-compiler"
+            resolver="build-temp" />
+        <module organisation="com.vaadin" name="vaadin-theme-compiler"
+            resolver="build-temp" />
+    </modules>
+
+
+</ivysettings>
\ No newline at end of file
diff --git a/pom-template.xml b/pom-template.xml
new file mode 100644 (file)
index 0000000..cec0ca6
--- /dev/null
@@ -0,0 +1,62 @@
+<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>
+  <groupId>com.vaadin</groupId>
+  <artifactId>${module.name}</artifactId>
+  <version>${vaadin.version}</version>
+  <name>Vaadin</name>
+  <organization>
+    <name>Vaadin Ltd</name>
+    <url>http://vaadin.com</url>
+  </organization>
+  <url>http://vaadin.com</url>
+  <description>
+      Vaadin is a web application framework for Rich Internet Applications (RIA).
+
+      Vaadin enables easy development and maintenance of fast and secure rich web
+      applications with a stunning look and feel and a wide browser support.
+      It features a server-side architecture with the majority of the logic running
+      on the server. Ajax technology is used at the browser-side to ensure a rich
+      and interactive user experience.
+  </description>
+  <licenses>
+    <license>
+      <name>Apache License Version 2.0</name>
+      <distribution>repo</distribution>
+      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+    </license>
+  </licenses>
+  <distributionManagement>
+    <repository>
+      <id>vaadin-releases</id>
+      <name>Vaadin release repository</name>
+      <url>http://oss.sonatype.org/content/repositories/vaadin-releases/</url>
+    </repository>
+    <snapshotRepository>
+      <id>vaadin-snapshots</id>
+      <name>Vaadin snapshot repository</name>
+      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
+    </snapshotRepository>
+  </distributionManagement>
+  <repositories>
+    <repository>
+      <id>vaadin-snapshots</id>
+      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>vaadin-releases</id>
+      <url>http://oss.sonatype.org/content/repositories/vaadin-releases/</url>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+</project>
\ No newline at end of file
diff --git a/server/build.xml b/server/build.xml
new file mode 100644 (file)
index 0000000..b4609cd
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<project name="vaadin-server" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
+       <description>
+               Compiles build helpers used when building other modules.
+       </description>
+       <include file="../common.xml" as="common" />
+       <include file="../build.xml" as="vaadin" />
+       <include file="../gwt-files.xml" as="gwtfiles" />
+
+       <!-- global properties -->
+       <property name="module.name" value="vaadin-server" />
+       <property name="result.dir" value="result" />
+       <path id="classpath.compile.custom" />
+
+       <target name="jar">
+               <antcall target="common.jar">
+                       <reference torefid="extra.jar.includes" refid="server.gwt.includes" />
+               </antcall>
+       </target>
+
+       <target name="publish-local" depends="jar">
+               <antcall target="common.publish-local" />
+       </target>
+
+       <target name="clean">
+               <antcall target="common.clean" />
+       </target>
+</project>
\ No newline at end of file
diff --git a/server/ivy.xml b/server/ivy.xml
new file mode 100644 (file)
index 0000000..7e9c826
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+
+    <info organisation="com.vaadin" module="vaadin-server"
+        revision="${vaadin.version}" />
+
+    <configurations>
+        <conf name="build" />
+        <conf name="ide" />
+        <conf name="tests" />
+    </configurations>
+    <publications>
+        <artifact></artifact>
+    </publications>
+    <dependencies>
+        <!-- Liferay Portal Service -->
+        <dependency org="com.liferay.portal" name="portal-service"
+            rev="6.0.2" />
+        <!--Portlet API version 2.0 (JSR-286) -->
+        <dependency org="javax.portlet" name="portlet-api"
+            rev="2.0" />
+        <!-- Google App Engine -->
+        <dependency org="com.google.appengine" name="appengine-api-1.0-sdk"
+            rev="1.2.1" />
+        <dependency org="javax.validation" name="validation-api"
+            rev="1.0.0.GA" conf="build,ide->master,sources" />
+       <!-- Jsoup for BootstrapHandler -->
+       <dependency org="org.jsoup" name="jsoup" rev="1.6.3" />
+
+        <!-- TestBench tests -->
+        <dependency org="commons-codec" name="commons-codec"
+            rev="1.5" conf="tests,ide->master" />
+        <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.11"
+            conf="tests,ide->master" />
+        <dependency org="org.mortbay.jetty" name="jetty-util"
+            rev="6.1.11" conf="tests,ide->master" />
+
+        <!-- Test frameworks & related -->
+        <dependency org="junit" name="junit" rev="4.5"
+            conf="tests,ide -> master" />
+        <dependency org="org.easymock" name="easymock" rev="3.0"
+            conf="tests,ide-> master, runtime(*)" />
+        <dependency org="org.hsqldb" name="hsqldb" rev="2.2.6"
+            conf="tests,ide -> master, runtime(*)" />
+
+        <!-- Project modules -->
+        <dependency org="com.vaadin" name="vaadin-shared"
+            rev="${vaadin.version}" conf="build"></dependency>
+        <dependency org="com.vaadin" name="vaadin-buildhelpers"
+            rev="${vaadin.version}" conf="build"></dependency>
+    </dependencies>
+
+</ivy-module>
diff --git a/shared/build.xml b/shared/build.xml
new file mode 100644 (file)
index 0000000..83dbe61
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<project name="vaadin-shared" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
+       <description>
+               Compiles build helpers used when building other modules.
+       </description>
+       <include file="../common.xml" as="common" />
+       <include file="../build.xml" as="vaadin" />
+       <include file="../gwt-files.xml" as="gwtfiles" />
+
+       <!-- global properties -->
+       <property name="module.name" value="vaadin-shared" />
+       <property name="module.symbolic" value="com.vaadin.shared" />
+       <property name="result.dir" value="result" />
+       <path id="classpath.compile.custom" />
+
+
+       <target name="jar">
+               <antcall target="common.jar">
+                       <reference refid="shared.gwt.includes" torefid="extra.jar.includes" />
+               </antcall>
+       </target>
+
+       <target name="publish-local" depends="jar">
+               <antcall target="common.publish-local" />
+       </target>
+       <target name="clean">
+               <antcall target="common.clean">
+               </antcall>
+       </target>
+</project>
\ No newline at end of file
diff --git a/shared/ivy.xml b/shared/ivy.xml
new file mode 100644 (file)
index 0000000..857ca1e
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+
+    <info organisation="com.vaadin" module="vaadin-shared"
+        revision="${vaadin.version}" />
+
+    <configurations>
+        <conf name="build" />
+        <conf name="ide" />
+    </configurations>
+    <publications>
+        <artifact></artifact>
+    </publications>
+    <dependencies>
+        <dependency org="com.vaadin" name="vaadin-buildhelpers"
+            rev="${vaadin.version}" conf="build"></dependency>
+
+    </dependencies>
+
+</ivy-module>
diff --git a/theme-compiler/build.xml b/theme-compiler/build.xml
new file mode 100644 (file)
index 0000000..9c3e5f4
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<project name="vaadin-theme-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
+       <description>
+               Compiles build helpers used when building other modules.
+       </description>
+       <include file="../common.xml" as="common" />
+       <include file="../build.xml" as="vaadin" />
+
+       <!-- global properties -->
+       <property name="module.name" value="vaadin-theme-compiler" />
+       <property name="result.dir" value="result" />
+       <path id="classpath.compile.custom" />
+
+       <property name="classes.exclude" value="com/vaadin/buildhelpers/**" />
+
+       <target name="jar">
+               <antcall target="common.jar">
+                       <reference torefid="extra.jar.includes" refid="empty.reference"/>
+               </antcall>
+       </target>
+       <target name="publish-local" depends="jar">
+               <antcall target="common.publish-local" />
+       </target>
+
+       <target name="clean">
+               <antcall target="common.clean" />
+       </target>
+</project>
\ No newline at end of file
diff --git a/theme-compiler/ivy.xml b/theme-compiler/ivy.xml
new file mode 100644 (file)
index 0000000..9574328
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+
+    <info organisation="com.vaadin" module="vaadin-theme-compiler"
+        revision="${vaadin.version}" />
+
+    <configurations>
+        <conf name="build" />
+        <conf name="ide" />
+    </configurations>
+    <publications>
+        <artifact type="jar" />
+        <artifact type="sources" ext="jar" />
+        <artifact type="javadoc" ext="jar" />
+    </publications>
+    <dependencies defaultconf="*->default">
+        <dependency org="org.w3c.css" name="sac" rev="1.3"/>
+        <dependency org="milyn" name="flute" rev="1.3" conf="*->default"/>
+        <dependency org="javax.servlet" name="servlet-api"
+            rev="2.5" />
+        <dependency org="com.carrotsearch" name="smartsprites"
+            rev="0.2.3-itmill" />
+        <dependency org="com.vaadin" name="vaadin-buildhelpers"
+            rev="${vaadin.version}" conf="build"></dependency>
+
+    </dependencies>
+
+</ivy-module>
diff --git a/theme-compiler/ivymodule/smartsprites-ivy-0.2.3-itmill.xml b/theme-compiler/ivymodule/smartsprites-ivy-0.2.3-itmill.xml
new file mode 100644 (file)
index 0000000..495b6d0
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
+    <info organisation="com.carrotsearch"
+        module="smartsprites"
+        revision="0.2.3-itmill"
+        status="release"
+        publication="20111130000000">
+        <license name="BSD license" url="http://csssprites.org/smartsprites.LICENSE" />
+        <description homepage="http://csssprites.org">
+        CSS Sprites Generator Done Right. SmartSprites maintains CSS sprites in your designs, 
+    fully automatically. No tedious copying and pasting to your CSS when adding or changing 
+    sprited images.
+        </description>
+        </info>
+    <configurations>
+        <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
+        <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
+        <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
+        <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
+        <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
+        <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
+        <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
+        <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
+        <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
+        <conf name="optional" visibility="public" description="contains all optional dependencies"/>
+    </configurations>
+    <publications>
+        <artifact name="smartsprites" type="jar" ext="jar" conf="master"/>
+    </publications>
+    <dependencies>
+        <dependency org="com.google.collections" name="google-collections" rev="0.9" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+        <dependency org="args4j" name="args4j" rev="2.0.9" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+        <dependency org="commons-math" name="commons-math" rev="1.1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+        <dependency org="commons-io" name="commons-io" rev="1.4" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+        <dependency org="commons-lang" name="commons-lang" rev="2.3" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+        <dependency org="junit" name="junit" rev="4.4" force="true" conf="test->runtime(*),master(*)"/>
+    </dependencies>
+</ivy-module>
diff --git a/theme-compiler/src/com/vaadin/buildhelpers/CompileDefaultTheme.java b/theme-compiler/src/com/vaadin/buildhelpers/CompileDefaultTheme.java
new file mode 100755 (executable)
index 0000000..5b17ae4
--- /dev/null
@@ -0,0 +1,121 @@
+package com.vaadin.buildhelpers;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import com.vaadin.sass.ScssStylesheet;
+
+/**
+ * Helper to combine css divided into separate per component dirs into one to
+ * optimize http requests.
+ */
+public class CompileDefaultTheme {
+
+    private static final String ARG_VERSION = "-version";
+
+    private static final String THEME_DIR = "./WebContent/VAADIN/themes/";
+    private static final String BASE = "base";
+    private static final String RUNO = "runo";
+    private static final String REINDEER = "reindeer";
+    private static final String LIFERAY = "liferay";
+    private static final String CHAMELEON = "chameleon";
+
+    /**
+     * @param args
+     * @throws IOException
+     */
+    public static void main(String[] args) throws IOException {
+        String ver = null;
+        for (int i = 0; i < args.length; i++) {
+            if (ARG_VERSION.equals(args[i])) {
+                if (args.length >= i) {
+                    ver = args[i + 1];
+                }
+                break;
+            }
+        }
+
+        for (String themeName : new String[] { BASE, RUNO, LIFERAY, CHAMELEON }) {
+            try {
+                processSassTheme(themeName, false, ver);
+                System.out.println("Compiling theme " + themeName
+                        + " successful");
+            } catch (Exception e) {
+                System.err.println("Compiling theme " + themeName + " failed");
+                e.printStackTrace();
+            }
+        }
+
+        // Compile Reindeer last, since it requires the spriting operation
+        // (makes testing the other themes a bit faster, since you don't need to
+        // wait for the spriting operation to finish before the theme CSS is
+        // compiled)
+        for (String themeName : new String[] { REINDEER }) {
+            try {
+                processSassTheme(themeName, true, ver);
+                System.out.println("Compiling theme " + themeName
+                        + " successful");
+            } catch (Exception e) {
+                System.err.println("Compiling theme " + themeName + " failed");
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private static void processSassTheme(String themeName,
+            boolean useSmartSprites, String version) throws Exception {
+
+        StringBuffer cssHeader = new StringBuffer();
+
+        // Theme version
+        if (version == null) {
+            version = "9.9.9.INTERNAL-DEBUG-BUILD";
+        }
+        version = version.replaceAll("\\.", "_");
+        cssHeader.append(".v-theme-version:after {content:\"" + version
+                + "\";}\n");
+        cssHeader.append(".v-theme-version-" + version + " {display: none;}\n");
+
+        String stylesCssDir = THEME_DIR + themeName + "/";
+        String stylesCssName = stylesCssDir + "styles.css";
+
+        // Process as SASS file
+        ScssStylesheet scss = ScssStylesheet.get(stylesCssDir + "styles.scss");
+        scss.compile();
+
+        BufferedWriter out = new BufferedWriter(new FileWriter(stylesCssName));
+        out.write(cssHeader.toString());
+        out.write(scss.toString());
+        out.close();
+
+        System.out.println("Compiled CSS to " + stylesCssName + " ("
+                + scss.toString().length() + " bytes)");
+
+        if (useSmartSprites) {
+            createSprites(themeName);
+            System.out.println("Used SmartSprites to create sprites");
+            File oldCss = new File(stylesCssName);
+            oldCss.delete();
+
+            File newCss = new File(stylesCssDir + "styles-sprite.css");
+            boolean ok = newCss.renameTo(oldCss);
+            if (!ok) {
+                System.out.println("Rename " + newCss + " -> " + oldCss
+                        + " failed");
+            }
+        }
+    }
+
+    private static void createSprites(String themeName)
+            throws FileNotFoundException, IOException {
+        String[] parameters = new String[] { "--sprite-png-depth", "AUTO",
+                "--css-file-suffix", "-sprite", "--css-file-encoding", "UTF-8",
+                "--root-dir-path", THEME_DIR + themeName, "--log-level", "WARN" };
+
+        org.carrot2.labs.smartsprites.SmartSprites.main(parameters);
+
+    }
+}