Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskovalsky2015-11-24 06:17:38 -0500
committerskovalsky2015-11-24 06:23:36 -0500
commitdd878ae9a77bee481549bd68515d201d4c03dff5 (patch)
treefe2e91c0b67e4c6418f27878df8d35adb6fa2507
parent9e8c38134eb666d6a5679615e777721819b72f5e (diff)
downloadorg.eclipse.gmf-tooling-dd878ae9a77bee481549bd68515d201d4c03dff5.tar.gz
org.eclipse.gmf-tooling-dd878ae9a77bee481549bd68515d201d4c03dff5.tar.xz
org.eclipse.gmf-tooling-dd878ae9a77bee481549bd68515d201d4c03dff5.zip
Bug 354145 - Provide a Tycho plugin for code generation
- add plugin to ability run diagram generation from maven build Change-Id: I53d5afc9c1fea117a1ec5d628c0d7433053ec8f6 Signed-off-by: skovalsky <kovalsky@montages.com>
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/.classpath26
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/.gitignore1
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/.project23
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/pom.xml128
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/CodegenEquinoxInstallationFactory.java18
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateDependencyResolverLocator.java17
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateEquinoxLauncher.java18
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateToolchainProvider.java17
-rw-r--r--extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/MavenGenerator.java318
-rw-r--r--extra/pom.xml27
-rw-r--r--pom.xml1
-rwxr-xr-xrepository/rename-metadata.sh18
14 files changed, 624 insertions, 0 deletions
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/.classpath b/extra/org.eclipse.gmf.tooling.codegen.maven/.classpath
new file mode 100644
index 000000000..dfca853d3
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/.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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
+ <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="output" path="target/classes"/>
+</classpath>
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/.gitignore b/extra/org.eclipse.gmf.tooling.codegen.maven/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/.project b/extra/org.eclipse.gmf.tooling.codegen.maven/.project
new file mode 100644
index 000000000..ccc12c896
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.gmf.tooling.codegen.maven</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/.settings/org.eclipse.jdt.core.prefs b/extra/org.eclipse.gmf.tooling.codegen.maven/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..45a6e0e0d
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+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.5
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/.settings/org.eclipse.m2e.core.prefs b/extra/org.eclipse.gmf.tooling.codegen.maven/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 000000000..f897a7f1c
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/pom.xml b/extra/org.eclipse.gmf.tooling.codegen.maven/pom.xml
new file mode 100644
index 000000000..50c52adbf
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/pom.xml
@@ -0,0 +1,128 @@
+<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.gmf-tooling</groupId>
+ <artifactId>generate-maven-plugin</artifactId>
+ <version>0.0.10-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>GMFT Generate Maven Plugin</name>
+
+ <parent>
+ <groupId>org.eclipse.gmf-tooling</groupId>
+ <artifactId>extra</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+ <properties>
+ <surefire-version>2.17</surefire-version>
+ <plexusVersion>1.5.5</plexusVersion>
+ <maven-version>3.0</maven-version>
+ <plexusUtilsVersion>3.0.7</plexusUtilsVersion>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-metadata</artifactId>
+ <version>${plexusVersion}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-metadata</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>${maven-version}</version>
+ <executions>
+ <execution>
+ <id>default-descriptor</id>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ <phase>process-classes</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.gmf-tooling.plugins</groupId>
+ <artifactId>org.eclipse.gmf.tooling.codegen.launcher</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>${maven-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>${plexusUtilsVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-core</artifactId>
+ <version>${tycho-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>sisu-equinox-launching</artifactId>
+ <version>${tycho-version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>org.eclipse.tycho.surefire.osgibooter</artifactId>
+ <version>${tycho-version}</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-api</artifactId>
+ <version>${surefire-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-facade</artifactId>
+ <version>${tycho-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>maven-surefire-common</artifactId>
+ <version>${surefire-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.8.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-testing-harness</artifactId>
+ <version>${tycho-version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/CodegenEquinoxInstallationFactory.java b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/CodegenEquinoxInstallationFactory.java
new file mode 100644
index 000000000..606ec18ed
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/CodegenEquinoxInstallationFactory.java
@@ -0,0 +1,18 @@
+/**
+ * Copyright (c) 2015 Montages AG
+ *
+ * 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
+ */
+package org.eclipse.gmf.tooling.codegen.maven;
+
+import org.codehaus.plexus.component.annotations.Component;
+import org.eclipse.sisu.equinox.launching.EquinoxInstallationFactory;
+import org.eclipse.sisu.equinox.launching.internal.DefaultEquinoxInstallationFactory;
+
+@Component(role=EquinoxInstallationFactory.class)
+public class CodegenEquinoxInstallationFactory extends DefaultEquinoxInstallationFactory {
+
+}
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateDependencyResolverLocator.java b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateDependencyResolverLocator.java
new file mode 100644
index 000000000..96af70857
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateDependencyResolverLocator.java
@@ -0,0 +1,17 @@
+/**
+ * Copyright (c) 2015 Montages AG
+ *
+ * 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
+ */
+package org.eclipse.gmf.tooling.codegen.maven;
+
+import org.codehaus.plexus.component.annotations.Component;
+import org.eclipse.tycho.core.resolver.DefaultDependencyResolverFactory;
+
+@Component(role=DefaultDependencyResolverFactory.class)
+public class GenerateDependencyResolverLocator extends DefaultDependencyResolverFactory {
+
+}
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateEquinoxLauncher.java b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateEquinoxLauncher.java
new file mode 100644
index 000000000..80d18eaf7
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateEquinoxLauncher.java
@@ -0,0 +1,18 @@
+/**
+ * Copyright (c) 2015 Montages AG
+ *
+ * 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
+ */
+package org.eclipse.gmf.tooling.codegen.maven;
+
+import org.codehaus.plexus.component.annotations.Component;
+import org.eclipse.sisu.equinox.launching.EquinoxLauncher;
+import org.eclipse.sisu.equinox.launching.internal.DefaultEquinoxLauncher;
+
+@Component(role=EquinoxLauncher.class)
+public class GenerateEquinoxLauncher extends DefaultEquinoxLauncher {
+
+}
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateToolchainProvider.java b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateToolchainProvider.java
new file mode 100644
index 000000000..cef2aa3cd
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/GenerateToolchainProvider.java
@@ -0,0 +1,17 @@
+/**
+ * Copyright (c) 2015 Montages AG
+ *
+ * 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
+ */
+package org.eclipse.gmf.tooling.codegen.maven;
+
+import org.codehaus.plexus.component.annotations.Component;
+import org.eclipse.tycho.core.maven.ToolchainProvider;
+
+@Component(role=ToolchainProvider.class)
+public class GenerateToolchainProvider extends ToolchainProvider {
+
+} \ No newline at end of file
diff --git a/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/MavenGenerator.java b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/MavenGenerator.java
new file mode 100644
index 000000000..859728d4e
--- /dev/null
+++ b/extra/org.eclipse.gmf.tooling.codegen.maven/src/main/java/org/eclipse/gmf/tooling/codegen/maven/MavenGenerator.java
@@ -0,0 +1,318 @@
+/**
+ * Copyright (c) 2015 Montages AG
+ *
+ * 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
+ *
+ * Inspired by org.eclipse.tycho.surefire.TestMojo
+ */
+package org.eclipse.gmf.tooling.codegen.maven;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.toolchain.Toolchain;
+import org.apache.maven.toolchain.ToolchainManager;
+import org.eclipse.gmf.tooling.codegen.launcher.GMFLauncherConstants;
+import org.eclipse.sisu.equinox.launching.BundleStartLevel;
+import org.eclipse.sisu.equinox.launching.DefaultEquinoxInstallationDescription;
+import org.eclipse.sisu.equinox.launching.EquinoxInstallation;
+import org.eclipse.sisu.equinox.launching.EquinoxInstallationDescription;
+import org.eclipse.sisu.equinox.launching.EquinoxInstallationFactory;
+import org.eclipse.sisu.equinox.launching.EquinoxLauncher;
+import org.eclipse.sisu.equinox.launching.internal.EquinoxLaunchConfiguration;
+import org.eclipse.tycho.ArtifactDescriptor;
+import org.eclipse.tycho.ArtifactType;
+import org.eclipse.tycho.ReactorProject;
+import org.eclipse.tycho.artifacts.DependencyArtifacts;
+import org.eclipse.tycho.core.DependencyResolver;
+import org.eclipse.tycho.core.DependencyResolverConfiguration;
+import org.eclipse.tycho.core.TargetPlatformConfiguration;
+import org.eclipse.tycho.core.TychoConstants;
+import org.eclipse.tycho.core.maven.ToolchainProvider;
+import org.eclipse.tycho.core.maven.ToolchainProvider.JDKUsage;
+import org.eclipse.tycho.core.osgitools.DefaultReactorProject;
+import org.eclipse.tycho.core.resolver.DefaultDependencyResolverFactory;
+import org.eclipse.tycho.core.resolver.shared.OptionalResolutionAction;
+import org.eclipse.tycho.core.resolver.shared.PlatformPropertiesUtils;
+import org.eclipse.tycho.core.utils.TychoProjectUtils;
+
+@Mojo(name = "generate", defaultPhase=LifecyclePhase.GENERATE_SOURCES, requiresProject=true)
+public class MavenGenerator extends AbstractMojo {
+
+ public static final String SEPARATOR = File.separator;
+
+ @Parameter(property = "session", readonly = true, required = true)
+ private MavenSession session;
+
+ @Parameter(defaultValue = "SYSTEM")
+ private JDKUsage useJDK;
+
+ @Parameter
+ private BundleStartLevel defaultStartLevel;
+
+ @Parameter(required = true)
+ private String gmfgen;
+
+ @Parameter(defaultValue = "${basedir}")
+ private String output;
+
+ @Parameter
+ private File[] relatedProjects;
+
+ @Parameter
+ private File formatter;
+
+ @Parameter
+ private String customEmitter;
+
+ @Parameter
+ private String customEmitterBundle;
+
+ @Parameter(property = "project", readonly = true)
+ private MavenProject project;
+
+ @Parameter(defaultValue = "${basedir}/../target/work")
+ private File work;
+
+ @Parameter(defaultValue = "${basedir}/../target/osgi/")
+ private File osgiDataDirectory;
+
+ @Component
+ private ToolchainManager toolchainManager;
+
+ @Component
+ private ToolchainProvider toolchainProvider;
+
+ @Component
+ private EquinoxInstallationFactory installationFactory;
+
+ @Component
+ private DefaultDependencyResolverFactory dependencyResolverLocator;
+
+ @Parameter
+ private Dependency[] dependencies;
+
+ @Component
+ private EquinoxLauncher launcher;
+
+ public void execute() throws MojoExecutionException {
+ checkOverlapPath(work, project.getBasedir(), "Work dir", "Project dir");
+ checkOverlapPath(osgiDataDirectory, project.getBasedir(), "OSGi dir", "Project dir");
+
+ checkOverlapPath(work, output, "Work dir", "Path to generated plugin");
+ checkOverlapPath(osgiDataDirectory, output, "OSGi dir", "Path to generated plugin");
+
+ EquinoxInstallation gmfGenerationInstallation = createGMFGenerationIntallation();
+ EquinoxLaunchConfiguration cli = new EquinoxLaunchConfiguration(gmfGenerationInstallation);
+
+ String executable = null;
+ Toolchain tc = getToolchain();
+ if (tc != null) {
+ executable = tc.findTool("java");
+ }
+ cli.setJvmExecutable(executable);
+ cli.setWorkingDirectory(project.getBasedir());
+
+ Properties properties = (Properties) project.getContextValue(TychoConstants.CTX_MERGED_PROPERTIES);
+ cli.addVMArguments("-Dosgi.os=" + PlatformPropertiesUtils.getOS(properties), //
+ "-Dosgi.ws=" + PlatformPropertiesUtils.getWS(properties), //
+ "-Dosgi.arch=" + PlatformPropertiesUtils.getArch(properties));
+
+ cli.addProgramArguments("-data", osgiDataDirectory.getAbsolutePath(), //
+ "-install", gmfGenerationInstallation.getLocation().getAbsolutePath(), //
+ "-application", "org.eclipse.gmf.tooling.codegen.launcher.GMFGenerateApplication",
+ "-configuration", gmfGenerationInstallation.getConfigurationLocation().getAbsolutePath());
+
+ String workDirPath = work.getAbsolutePath();
+ StringBuilder tempFile = new StringBuilder(workDirPath);
+ if (!workDirPath.endsWith(SEPARATOR)) {
+ tempFile.append(SEPARATOR);
+ }
+ tempFile.append("gmflauncher.properties");
+ String tempFilePath = tempFile.toString();
+ prepareGeneratePropertyFile(tempFilePath);
+
+ cli.addProgramArguments(GMFLauncherConstants.KEY_GENERATION_PROPERTIES, tempFilePath);
+
+ int result = launcher.execute(cli, 0);
+
+ if (result != 0) {
+ throw new MojoExecutionException("Generation error");
+ }
+ }
+
+ protected Toolchain getToolchain() throws MojoExecutionException {
+ if (JDKUsage.SYSTEM.equals(useJDK)) {
+ if (toolchainManager != null) {
+ return toolchainManager.getToolchainFromBuildContext("jdk", session);
+ }
+ return null;
+ }
+ String profileName = TychoProjectUtils.getExecutionEnvironmentConfiguration(project).getProfileName();
+ Toolchain toolChain = toolchainProvider.findMatchingJavaToolChain(session, profileName);
+ if (toolChain == null) {
+ throw new MojoExecutionException("useJDK = BREE configured, but no toolchain of type 'jdk' with id '"
+ + profileName + "' found. See http://maven.apache.org/guides/mini/guide-using-toolchains.html");
+ }
+ return toolChain;
+ }
+
+ EquinoxInstallation createGMFGenerationIntallation() throws MojoExecutionException {
+ DependencyResolver platformResolver = dependencyResolverLocator.lookupDependencyResolver(project);
+ final List<Dependency> extraDependencies = getExtraDependencies();
+ List<ReactorProject> reactorProjects = getReactorProjects();
+
+ final DependencyResolverConfiguration resolverConfiguration = new DependencyResolverConfiguration() {
+ @Override
+ public OptionalResolutionAction getOptionalResolutionAction() {
+ return OptionalResolutionAction.IGNORE;
+ }
+
+ @Override
+ public List<Dependency> getExtraRequirements() {
+ return extraDependencies;
+ }
+ };
+
+ DependencyArtifacts generateRuntimeArtifacts = platformResolver.resolveDependencies(session, project, null,
+ reactorProjects, resolverConfiguration);
+
+ if (generateRuntimeArtifacts == null) {
+ throw new MojoExecutionException("Cannot determinate build target platform location -- code not generated");
+ }
+
+ work.mkdirs();
+
+ EquinoxInstallationDescription generateAppDescr = new DefaultEquinoxInstallationDescription();
+ generateAppDescr.setDefaultBundleStartLevel(defaultStartLevel);
+ generateAppDescr.addBundlesToExplode(new LinkedList<String>());
+ generateAppDescr.addFrameworkExtensions(new LinkedList<File>());
+ for (ArtifactDescriptor artifact : generateRuntimeArtifacts.getArtifacts(ArtifactType.TYPE_ECLIPSE_PLUGIN)) {
+
+ ReactorProject otherProject = artifact.getMavenProject();
+ if (otherProject != null) {
+ if (otherProject.sameProject(project)) {
+ generateAppDescr.addBundle(artifact.getKey(), project.getBasedir());
+ continue;
+ }
+ File file = otherProject.getArtifact(artifact.getClassifier());
+ if (file != null) {
+ generateAppDescr.addBundle(artifact.getKey(), file);
+ continue;
+ }
+ }
+ generateAppDescr.addBundle(artifact);
+ }
+
+ return installationFactory.createInstallation(generateAppDescr, work);
+ }
+
+ private List<Dependency> getExtraDependencies() {
+ final List<Dependency> dependencies = new ArrayList<Dependency>();
+ if (this.dependencies != null) {
+ dependencies.addAll(Arrays.asList(this.dependencies));
+ }
+ TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(project);
+ dependencies.addAll(configuration.getDependencyResolverConfiguration().getExtraRequirements());
+ dependencies.add(newBundleDependency("org.eclipse.osgi"));
+ dependencies.add(newBundleDependency(EquinoxInstallationDescription.EQUINOX_LAUNCHER));
+ dependencies.add(newBundleDependency("org.eclipse.core.runtime"));
+ dependencies.add(newBundleDependency("org.eclipse.gmf.tooling.codegen.launcher"));
+ return dependencies;
+ }
+
+ protected Dependency newBundleDependency(String bundleId) {
+ Dependency ideapp = new Dependency();
+ ideapp.setArtifactId(bundleId);
+ ideapp.setType(ArtifactType.TYPE_ECLIPSE_PLUGIN);
+ return ideapp;
+ }
+
+ private List<ReactorProject> getReactorProjects() {
+ return DefaultReactorProject.adapt(session);
+ }
+
+ private void checkOverlapPath(File containerDir, File overlapDir, String containerName, String overlapDirName) throws MojoExecutionException {
+ checkOverlapPath(containerDir, overlapDir.getAbsolutePath(), containerName, overlapDirName);
+ }
+
+ private void checkOverlapPath(File containerDir, String overlapDirPath, String containerName, String overlapDirName) throws MojoExecutionException {
+ String containerDirPath = containerDir.getAbsolutePath();
+ if (containerDirPath.startsWith(overlapDirPath)) {
+ throw new MojoExecutionException(containerDir + ":" + containerDir + " cannot be located in:" + overlapDirName +":"+ overlapDirPath);
+ }
+ }
+
+ public void prepareGeneratePropertyFile(String tempFile) throws MojoExecutionException {
+ Properties prop = new Properties();
+ OutputStream outputStrem = null;
+
+ try {
+ File outputFile = new File(tempFile);
+ outputStrem = new FileOutputStream(outputFile);
+
+ // set the properties value
+ prop.setProperty(GMFLauncherConstants.PROPERTY_GMFGEN_MODEL, gmfgen);
+ prop.setProperty(GMFLauncherConstants.PROPERTY_GENERATE_PROJECT_LOCATION, output);
+ prop.setProperty(GMFLauncherConstants.PROPERTY_GMFGEN_PROJECT_LOCATION, project.getBasedir().getAbsolutePath());
+
+ if (relatedProjects != null && relatedProjects.length > 0) {
+ StringBuilder sb = new StringBuilder(relatedProjects[0].getAbsolutePath());
+ for (int i = 1; i < relatedProjects.length; i++) {
+ sb.append(',');
+ sb.append(relatedProjects[i].getAbsolutePath());
+ }
+ prop.setProperty(GMFLauncherConstants.PROPERTY_RELATED_PROJECTS, sb.toString());
+ }
+
+ if (formatter.exists()) {
+ prop.setProperty(GMFLauncherConstants.PROPERTY_FORMATTER, formatter.getAbsolutePath());
+ }
+
+ if (customEmitterBundle != null && !customEmitterBundle.isEmpty()
+ && customEmitter != null && !customEmitter.isEmpty()) {
+ prop.setProperty(GMFLauncherConstants.PROPERTY_CUSTOM_EMITTER, customEmitter);
+ prop.setProperty(GMFLauncherConstants.PROPERTY_CUSTOM_EMITTER_BUNDLE, customEmitterBundle);
+ }
+
+ prop.setProperty(GMFLauncherConstants.PROPERTY_TRACE, new Boolean(getLog().isDebugEnabled()).toString());
+
+ prop.store(outputStrem, null);
+
+ } catch (FileNotFoundException e) {
+ throw new MojoExecutionException(e.getMessage());
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage());
+ } finally {
+ if (outputStrem != null) {
+ try {
+ outputStrem.close();
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage());
+ }
+ }
+
+ }
+ }
+} \ No newline at end of file
diff --git a/extra/pom.xml b/extra/pom.xml
new file mode 100644
index 000000000..b4ad4a5e9
--- /dev/null
+++ b/extra/pom.xml
@@ -0,0 +1,27 @@
+<!--
+ * Copyright (c) 2012 Montages AG
+ * 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
+ *
+-->
+<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.gmf-tooling</groupId>
+ <artifactId>extra</artifactId>
+ <packaging>pom</packaging>
+
+ <parent>
+ <groupId>org.eclipse.gmf-tooling</groupId>
+ <artifactId>parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+ <modules>
+ <module>org.eclipse.gmf.tooling.codegen.maven</module>
+ </modules>
+
+</project>
diff --git a/pom.xml b/pom.xml
index 35bb10990..f32fb7cfa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,7 @@
<module>plugins</module>
<!-- <module>gwt-plugins</module> -->
<module>examples</module>
+ <module>extra</module>
<module>doc</module>
<module>features</module>
<module>tests</module>
diff --git a/repository/rename-metadata.sh b/repository/rename-metadata.sh
new file mode 100755
index 000000000..c42b499af
--- /dev/null
+++ b/repository/rename-metadata.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+#mvn install -DperformRelease=true -DcreateChecksum=true
+
+metadata="$1"
+metadata_local="$1"
+
+#remove old sum
+rm -f "$metadata_local.md5"
+rm -f "$metadata_local.sha1"
+
+empty=""
+metadata="${metadata/-local.xml/$empty}".xml
+
+#create new sum
+mv "$metadata_local" "$metadata"
+md5sum "$metadata" > "$metadata".md5
+sha1sum "$metadata" > "$metadata".sha1

Back to the top