Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/tooling/org.eclipse.fx.ide.ant')
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.ant/.classpath26
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.ant/.gitignore1
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.ant/.project23
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.ant/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.ant/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.ant/pom.xml25
-rw-r--r--bundles/tooling/org.eclipse.fx.ide.ant/src/main/java/org/eclipse/fx/ide/ant/FXOsgiLaunchTask.java110
7 files changed, 201 insertions, 0 deletions
diff --git a/bundles/tooling/org.eclipse.fx.ide.ant/.classpath b/bundles/tooling/org.eclipse.fx.ide.ant/.classpath
new file mode 100644
index 000000000..007e9818c
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.ant/.classpath
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/bundles/tooling/org.eclipse.fx.ide.ant/.gitignore b/bundles/tooling/org.eclipse.fx.ide.ant/.gitignore
new file mode 100644
index 000000000..ea8c4bf7f
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.ant/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/bundles/tooling/org.eclipse.fx.ide.ant/.project b/bundles/tooling/org.eclipse.fx.ide.ant/.project
new file mode 100644
index 000000000..11376dc30
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.ant/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fx.ide.ant</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/tooling/org.eclipse.fx.ide.ant/.settings/org.eclipse.jdt.core.prefs b/bundles/tooling/org.eclipse.fx.ide.ant/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..62492222a
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.ant/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/bundles/tooling/org.eclipse.fx.ide.ant/.settings/org.eclipse.m2e.core.prefs b/bundles/tooling/org.eclipse.fx.ide.ant/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 000000000..f897a7f1c
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.ant/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/bundles/tooling/org.eclipse.fx.ide.ant/pom.xml b/bundles/tooling/org.eclipse.fx.ide.ant/pom.xml
new file mode 100644
index 000000000..9e2801d86
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.ant/pom.xml
@@ -0,0 +1,25 @@
+<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>
+ <groupId>org.eclipse.fx.ide.ant</groupId>
+ <artifactId>org.eclipse.fx.ide.ant</artifactId>
+ <version>0.9.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.8.4</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/bundles/tooling/org.eclipse.fx.ide.ant/src/main/java/org/eclipse/fx/ide/ant/FXOsgiLaunchTask.java b/bundles/tooling/org.eclipse.fx.ide.ant/src/main/java/org/eclipse/fx/ide/ant/FXOsgiLaunchTask.java
new file mode 100644
index 000000000..a5724a13c
--- /dev/null
+++ b/bundles/tooling/org.eclipse.fx.ide.ant/src/main/java/org/eclipse/fx/ide/ant/FXOsgiLaunchTask.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2012 BestSolution.at and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.ide.ant;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import java.util.jar.Attributes;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.util.ClasspathUtils;
+import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.ResourceUtils;
+
+public class FXOsgiLaunchTask extends Task {
+ private String classpathRef;
+ private String outDir;
+ private String equinoxLauncherJarRef;
+
+ private static final String PREFIX = "resources/classes/";
+
+ private static final String[] LAUNCHER_FILES = new String[] {
+ "com/javafx/main/Main.class",
+ "com/javafx/main/Main$1.class",
+ "com/javafx/main/Main$2.class",
+ "com/javafx/main/NoJavaFXFallback.class"
+ };
+
+ public void setClasspathRef(String classpathRef) {
+ this.classpathRef = classpathRef;
+ }
+
+ public void setOutDir(String outDir) {
+ this.outDir = outDir;
+ }
+
+ public void setEquinoxLauncherJarRef(String equinoxLauncherJarRef) {
+ this.equinoxLauncherJarRef = equinoxLauncherJarRef;
+ }
+
+ public void execute() throws BuildException {
+ try {
+ ClassLoader cl = ClasspathUtils.getClassLoaderForPath(getProject(), (Path) getProject().getReference(classpathRef), UUID.randomUUID().toString());
+
+ FileSet p = (FileSet) getProject().getReference(equinoxLauncherJarRef);
+ FileResource r = (FileResource) p.iterator().next();
+ String equinoxLauncherJar = "plugins/"+r.getFile().getName();
+
+ Manifest m = new Manifest();
+ m.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+ m.getMainAttributes().put(new Attributes.Name("JavaFX-Version"), "2.2");
+ m.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VENDOR, "BestSolution.at");
+ m.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_TITLE, "JavaFX App");
+ m.getMainAttributes().put(Attributes.Name.IMPLEMENTATION_VERSION, "1.0.0");
+ m.getMainAttributes().put(new Attributes.Name("JavaFX-Application-Class"), "org.eclipse.equinox.launcher.Main");
+ m.getMainAttributes().put(new Attributes.Name("JavaFX-Class-Path"), equinoxLauncherJar);
+ m.getMainAttributes().put(new Attributes.Name("Main-Class"), "com/javafx/main/Main");
+
+ FileOutputStream out = new FileOutputStream(new File(outDir,"fx-osgi-launcher.jar"));
+
+ JarOutputStream jOut = new JarOutputStream(out,m);
+ jOut.putNextEntry(new JarEntry("com/"));
+ jOut.closeEntry();
+
+ jOut.putNextEntry(new JarEntry("com/javafx/"));
+ jOut.closeEntry();
+
+ jOut.putNextEntry(new JarEntry("com/javafx/main"));
+ jOut.closeEntry();
+
+ for( String f : LAUNCHER_FILES ) {
+ JarEntry e = new JarEntry(f);
+ jOut.putNextEntry(e);
+
+ byte[] buf = new byte[1024];
+ int len;
+ InputStream in = cl.getResourceAsStream(PREFIX+f);
+
+ while( (len = in.read(buf)) != -1 ) {
+ jOut.write(buf, 0, len);
+ }
+ jOut.closeEntry();
+ }
+ jOut.close();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}

Back to the top