diff --git a/Core/de.devboost.buildboost/.classpath b/Core/de.devboost.buildboost/.classpath
index ed2bc12..121e527 100644
--- a/Core/de.devboost.buildboost/.classpath
+++ b/Core/de.devboost.buildboost/.classpath
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/Core/de.devboost.buildboost/.settings/org.eclipse.jdt.core.prefs b/Core/de.devboost.buildboost/.settings/org.eclipse.jdt.core.prefs
index dabc9a9..497d40b 100644
--- a/Core/de.devboost.buildboost/.settings/org.eclipse.jdt.core.prefs
+++ b/Core/de.devboost.buildboost/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,12 @@
-#Thu Nov 10 23:39:13 CET 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-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.source=1.6
+#Thu Nov 10 23:39:13 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+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.source=1.6
diff --git a/Core/de.devboost.buildboost/build.properties b/Core/de.devboost.buildboost/build.properties
index a12d47e..b107977 100644
--- a/Core/de.devboost.buildboost/build.properties
+++ b/Core/de.devboost.buildboost/build.properties
@@ -1,3 +1,3 @@
-source.. = src/
-bin.includes = META-INF/,\
- .
+source.. = src/
+bin.includes = META-INF/,\
+ .
diff --git a/Core/de.devboost.buildboost/buildboost_bootstrap.xml b/Core/de.devboost.buildboost/buildboost_bootstrap.xml
index 80f68c4..edfe2af 100644
--- a/Core/de.devboost.buildboost/buildboost_bootstrap.xml
+++ b/Core/de.devboost.buildboost/buildboost_bootstrap.xml
@@ -1,39 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/de.devboost.buildboost/buildboost_compile_extensions.xml b/Core/de.devboost.buildboost/buildboost_compile_extensions.xml
index 4baf2cf..eede7d0 100644
--- a/Core/de.devboost.buildboost/buildboost_compile_extensions.xml
+++ b/Core/de.devboost.buildboost/buildboost_compile_extensions.xml
@@ -1,20 +1,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/de.devboost.buildboost/buildboost_generate.xml b/Core/de.devboost.buildboost/buildboost_generate.xml
index 7feb359..79a6e4e 100644
--- a/Core/de.devboost.buildboost/buildboost_generate.xml
+++ b/Core/de.devboost.buildboost/buildboost_generate.xml
@@ -1,15 +1,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ArtifactSorter.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ArtifactSorter.java
index 527af5a..f0a1139 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ArtifactSorter.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ArtifactSorter.java
@@ -1,80 +1,80 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import de.devboost.buildboost.model.AbstractBuildParticipant;
-import de.devboost.buildboost.model.BuildEventType;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IArtifactDiscoverer;
-import de.devboost.buildboost.model.IArtifactFilter;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildListener;
-import de.devboost.buildboost.model.IBuildParticipant;
-import de.devboost.buildboost.model.IDependable;
-import de.devboost.buildboost.util.ArtifactUtil;
-import de.devboost.buildboost.util.Sorter;
-
-public class ArtifactSorter extends AbstractBuildParticipant {
-
- @Override
- public boolean dependsOn(IBuildParticipant otherParticipant) {
- if (otherParticipant instanceof DependencyResolver) {
- return true;
- }
- if (otherParticipant instanceof UnresolvedDependencyChecker) {
- return true;
- }
- if (otherParticipant instanceof IArtifactDiscoverer) {
- return true;
- }
- if (otherParticipant instanceof IArtifactFilter) {
- return true;
- }
- return false;
- }
-
- @Override
- public void execute(IBuildContext context) throws BuildException {
- Collection discoveredArtifacts = context.getDiscoveredArtifacts();
- IBuildListener buildListener = context.getBuildListener();
- Sorter pluginSorter = new Sorter();
-
- // exclude dependencies that cannot be included while sorting
- Set discoveredDependables = new ArtifactUtil().getSetOfDependables(discoveredArtifacts);
- Set transientHull = pluginSorter.getTransientHull(discoveredDependables);
- transientHull.removeAll(discoveredArtifacts);
- for (IDependable artifact : transientHull) {
- buildListener.handleBuildEvent(
- BuildEventType.INFO,
- "Artifact " + artifact + " is excluded from topological sorting (artifact is a transitive dependency, but was not selected for build)."
- );
- }
-
- // sort artifacts topologically
- List sortedArtifacts = pluginSorter.topologicalSort(
- new ArrayList(discoveredArtifacts),
- transientHull);
-
- // replace artifacts
- context.removeDiscoveredArtifacts(discoveredArtifacts);
- context.addDiscoveredArtifacts(new ArtifactUtil().getConcreteList(sortedArtifacts, IArtifact.class));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import de.devboost.buildboost.model.AbstractBuildParticipant;
+import de.devboost.buildboost.model.BuildEventType;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IArtifactDiscoverer;
+import de.devboost.buildboost.model.IArtifactFilter;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildListener;
+import de.devboost.buildboost.model.IBuildParticipant;
+import de.devboost.buildboost.model.IDependable;
+import de.devboost.buildboost.util.ArtifactUtil;
+import de.devboost.buildboost.util.Sorter;
+
+public class ArtifactSorter extends AbstractBuildParticipant {
+
+ @Override
+ public boolean dependsOn(IBuildParticipant otherParticipant) {
+ if (otherParticipant instanceof DependencyResolver) {
+ return true;
+ }
+ if (otherParticipant instanceof UnresolvedDependencyChecker) {
+ return true;
+ }
+ if (otherParticipant instanceof IArtifactDiscoverer) {
+ return true;
+ }
+ if (otherParticipant instanceof IArtifactFilter) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void execute(IBuildContext context) throws BuildException {
+ Collection discoveredArtifacts = context.getDiscoveredArtifacts();
+ IBuildListener buildListener = context.getBuildListener();
+ Sorter pluginSorter = new Sorter();
+
+ // exclude dependencies that cannot be included while sorting
+ Set discoveredDependables = new ArtifactUtil().getSetOfDependables(discoveredArtifacts);
+ Set transientHull = pluginSorter.getTransientHull(discoveredDependables);
+ transientHull.removeAll(discoveredArtifacts);
+ for (IDependable artifact : transientHull) {
+ buildListener.handleBuildEvent(
+ BuildEventType.INFO,
+ "Artifact " + artifact + " is excluded from topological sorting (artifact is a transitive dependency, but was not selected for build)."
+ );
+ }
+
+ // sort artifacts topologically
+ List sortedArtifacts = pluginSorter.topologicalSort(
+ new ArrayList(discoveredArtifacts),
+ transientHull);
+
+ // replace artifacts
+ context.removeDiscoveredArtifacts(discoveredArtifacts);
+ context.addDiscoveredArtifacts(new ArtifactUtil().getConcreteList(sortedArtifacts, IArtifact.class));
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/AutoBuilder.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/AutoBuilder.java
index 6928f8f..a387407 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/AutoBuilder.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/AutoBuilder.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import de.devboost.buildboost.ant.AntTarget;
-import de.devboost.buildboost.model.BuildEventType;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildListener;
-import de.devboost.buildboost.model.IBuildParticipant;
-import de.devboost.buildboost.model.IDependable;
-import de.devboost.buildboost.util.ArtifactUtil;
-import de.devboost.buildboost.util.Sorter;
-
-/**
- * The {@link AutoBuilder} is a generic builder that can be configured with sets of
- * build participants. These participants can search for artifacts that must be
- * built and provide respective build scripts. The {@link AutoBuilder} class is the
- * main entry point to the BuildBoost system. A typical use of this class is to
- * configure an {@link IBuildContext} with appropriate discoverers, filters and
- * build step providers, pass this context to the constructor
- * {@link #AutoBuilder(IBuildContext)} and call {@link #generateAntTargets()}
- * to obtain scripts that implement the build.
- *
- * Alternatively, one can use build stages, which encapsulate typical
- * configurations, for example a discoverer for Eclipse plug-in projects and
- * a build step provider that creates a compile script for such projects. The
- * use of build stages is recommended, but only applicable if respective stages
- * are available.
- */
-public class AutoBuilder {
-
- private IBuildContext context;
-
- public AutoBuilder(IBuildContext context) {
- this.context = context;
- }
-
- public Collection generateAntTargets() throws BuildException {
- IBuildListener listener = context.getBuildListener();
- List participants = context.getBuildParticipants();
- participants = sort(participants);
- for (IBuildParticipant participant : participants) {
- listener.handleBuildEvent(BuildEventType.INFO, "Sorted participant order: " + participant);
- }
- for (IBuildParticipant participant : participants) {
- listener.handleBuildEvent(BuildEventType.INFO, "Executing build participant: " + participant);
- participant.execute(context);
- }
-
- Collection targets = new ArrayList();
- Collection discoveredArtifacts = context.getDiscoveredArtifacts();
- for (IArtifact artifact : discoveredArtifacts) {
- if (artifact instanceof AntTarget) {
- AntTarget antTarget = (AntTarget) artifact;
- targets.add(antTarget);
- }
- }
- return targets;
- }
-
- private List sort(List participants) {
- List dependables = new ArrayList();
- for (IBuildParticipant participant : participants) {
- dependables.add(new DependableBuildParticipant(participant));
- }
- for (DependableBuildParticipant dependable : dependables) {
- dependable.initializeDependencies(dependables);
- }
- List sorted = new Sorter().topologicalSort(new ArtifactUtil().getConcreteList(dependables, IDependable.class));
- return new ArtifactUtil().getConcreteList(sorted, IBuildParticipant.class);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import de.devboost.buildboost.ant.AntTarget;
+import de.devboost.buildboost.model.BuildEventType;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildListener;
+import de.devboost.buildboost.model.IBuildParticipant;
+import de.devboost.buildboost.model.IDependable;
+import de.devboost.buildboost.util.ArtifactUtil;
+import de.devboost.buildboost.util.Sorter;
+
+/**
+ * The {@link AutoBuilder} is a generic builder that can be configured with sets of
+ * build participants. These participants can search for artifacts that must be
+ * built and provide respective build scripts. The {@link AutoBuilder} class is the
+ * main entry point to the BuildBoost system. A typical use of this class is to
+ * configure an {@link IBuildContext} with appropriate discoverers, filters and
+ * build step providers, pass this context to the constructor
+ * {@link #AutoBuilder(IBuildContext)} and call {@link #generateAntTargets()}
+ * to obtain scripts that implement the build.
+ *
+ * Alternatively, one can use build stages, which encapsulate typical
+ * configurations, for example a discoverer for Eclipse plug-in projects and
+ * a build step provider that creates a compile script for such projects. The
+ * use of build stages is recommended, but only applicable if respective stages
+ * are available.
+ */
+public class AutoBuilder {
+
+ private IBuildContext context;
+
+ public AutoBuilder(IBuildContext context) {
+ this.context = context;
+ }
+
+ public Collection generateAntTargets() throws BuildException {
+ IBuildListener listener = context.getBuildListener();
+ List participants = context.getBuildParticipants();
+ participants = sort(participants);
+ for (IBuildParticipant participant : participants) {
+ listener.handleBuildEvent(BuildEventType.INFO, "Sorted participant order: " + participant);
+ }
+ for (IBuildParticipant participant : participants) {
+ listener.handleBuildEvent(BuildEventType.INFO, "Executing build participant: " + participant);
+ participant.execute(context);
+ }
+
+ Collection targets = new ArrayList();
+ Collection discoveredArtifacts = context.getDiscoveredArtifacts();
+ for (IArtifact artifact : discoveredArtifacts) {
+ if (artifact instanceof AntTarget) {
+ AntTarget antTarget = (AntTarget) artifact;
+ targets.add(antTarget);
+ }
+ }
+ return targets;
+ }
+
+ private List sort(List participants) {
+ List dependables = new ArrayList();
+ for (IBuildParticipant participant : participants) {
+ dependables.add(new DependableBuildParticipant(participant));
+ }
+ for (DependableBuildParticipant dependable : dependables) {
+ dependable.initializeDependencies(dependables);
+ }
+ List sorted = new Sorter().topologicalSort(new ArtifactUtil().getConcreteList(dependables, IDependable.class));
+ return new ArtifactUtil().getConcreteList(sorted, IBuildParticipant.class);
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java
index d139eef..392f77d 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java
@@ -1,88 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-import de.devboost.buildboost.ant.AntTargetGeneratorRunner;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildListener;
-import de.devboost.buildboost.model.IBuildParticipant;
-import de.devboost.buildboost.util.SystemOutListener;
-
-/**
- * A default implementation of the IBuildContext interface.
- */
-public class BuildContext implements IBuildContext {
-
- private Collection discoveredArtifacts = new LinkedHashSet();
- private IBuildListener buildListener;
- private boolean ignoreUnresolvedDependencies;
- private List buildParticipants = new ArrayList();
-
- public BuildContext() {
- super();
- // add default participants
- addBuildParticipant(new DependencyResolver());
- addBuildParticipant(new UnresolvedDependencyChecker());
- addBuildParticipant(new ArtifactSorter());
- addBuildParticipant(new AntTargetGeneratorRunner());
- }
-
- public Collection getDiscoveredArtifacts() {
- return Collections.unmodifiableCollection(discoveredArtifacts);
- }
-
- public IBuildListener getBuildListener() {
- if (buildListener == null) {
- buildListener = new SystemOutListener();
- }
- return buildListener;
- }
-
- public void setBuildListener(IBuildListener buildListener) {
- this.buildListener = buildListener;
- }
-
- public boolean ignoreUnresolvedDependencies() {
- return ignoreUnresolvedDependencies;
- }
-
- public void setIgnoreUnresolvedDependencies(boolean ignoreUnresolvedDependencies) {
- this.ignoreUnresolvedDependencies = ignoreUnresolvedDependencies;
- }
-
- public void addDiscoveredArtifacts(Collection artifactsToAdd) {
- discoveredArtifacts.addAll(artifactsToAdd);
- }
-
- public void removeDiscoveredArtifacts(Collection artifactsToRemove) {
- discoveredArtifacts.removeAll(artifactsToRemove);
- }
-
- public void addBuildParticipant(IBuildParticipant participant) {
- buildParticipants.add(participant);
- }
-
- public List getBuildParticipants() {
- return buildParticipants;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import de.devboost.buildboost.ant.AntTargetGeneratorRunner;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildListener;
+import de.devboost.buildboost.model.IBuildParticipant;
+import de.devboost.buildboost.util.SystemOutListener;
+
+/**
+ * A default implementation of the IBuildContext interface.
+ */
+public class BuildContext implements IBuildContext {
+
+ private final Collection discoveredArtifacts = new LinkedHashSet();
+ private IBuildListener buildListener;
+ private boolean ignoreUnresolvedDependencies;
+ private final List buildParticipants = new ArrayList();
+
+ public BuildContext() {
+ super();
+ // add default participants
+ addBuildParticipant(new DependencyResolver());
+ addBuildParticipant(new UnresolvedDependencyChecker());
+ addBuildParticipant(new ArtifactSorter());
+ addBuildParticipant(new AntTargetGeneratorRunner());
+ }
+
+ @Override
+ public Collection getDiscoveredArtifacts() {
+ return Collections.unmodifiableCollection(discoveredArtifacts);
+ }
+
+ @Override
+ public IBuildListener getBuildListener() {
+ if (buildListener == null) {
+ buildListener = new SystemOutListener();
+ }
+ return buildListener;
+ }
+
+ public void setBuildListener(IBuildListener buildListener) {
+ this.buildListener = buildListener;
+ }
+
+ @Override
+ public boolean ignoreUnresolvedDependencies() {
+ return ignoreUnresolvedDependencies;
+ }
+
+ public void setIgnoreUnresolvedDependencies(
+ boolean ignoreUnresolvedDependencies) {
+ this.ignoreUnresolvedDependencies = ignoreUnresolvedDependencies;
+ }
+
+ @Override
+ public void addDiscoveredArtifacts(Collection artifactsToAdd) {
+ discoveredArtifacts.addAll(artifactsToAdd);
+ }
+
+ @Override
+ public void removeDiscoveredArtifacts(
+ Collection artifactsToRemove) {
+ discoveredArtifacts.removeAll(artifactsToRemove);
+ }
+
+ @Override
+ public void addBuildParticipant(IBuildParticipant participant) {
+ buildParticipants.add(participant);
+ }
+
+ @Override
+ public List getBuildParticipants() {
+ return buildParticipants;
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildException.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildException.java
index dd591cb..a978740 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildException.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildException.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-/**
- * A {@link BuildException} can be thrown be participants of the BuildBoost
- * script generation process if unexpected situations are detected (e.g.
- * required artifacts are missing).
- */
-public class BuildException extends Exception {
-
- private static final long serialVersionUID = 6725403464736524958L;
-
- public BuildException(String message) {
- super(message);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+/**
+ * A {@link BuildException} can be thrown be participants of the BuildBoost
+ * script generation process if unexpected situations are detected (e.g.
+ * required artifacts are missing).
+ */
+public class BuildException extends Exception {
+
+ private static final long serialVersionUID = 6725403464736524958L;
+
+ public BuildException(String message) {
+ super(message);
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildScriptGenerator.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildScriptGenerator.java
index 9fa6b11..53ee87a 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildScriptGenerator.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildScriptGenerator.java
@@ -1,204 +1,204 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-import static de.devboost.buildboost.IConstants.ARTIFACTS_FOLDER;
-import static de.devboost.buildboost.IConstants.BUILD_BOOST_BIN_FOLDER;
-import static de.devboost.buildboost.IConstants.BUILD_BOOST_BUILD_PROJECT_ID_PATTERN;
-import static de.devboost.buildboost.IConstants.BUILD_BOOST_CORE_PROJECT_ID;
-import static de.devboost.buildboost.IConstants.BUILD_BOOST_GENEXT_PROJECT_ID_PATTERN;
-import static de.devboost.buildboost.IConstants.BUILD_FOLDER;
-import static de.devboost.buildboost.IConstants.REPOS_FOLDER;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import de.devboost.buildboost.ant.AbstractAntTargetGenerator;
-import de.devboost.buildboost.ant.AbstractAntTargetGeneratorProvider;
-import de.devboost.buildboost.ant.AntScript;
-import de.devboost.buildboost.ant.AntTarget;
-import de.devboost.buildboost.ant.IAntTargetGenerator;
-import de.devboost.buildboost.artifacts.Plugin;
-import de.devboost.buildboost.discovery.PluginFinder;
-import de.devboost.buildboost.filters.IdentifierFilter;
-import de.devboost.buildboost.filters.IdentifierRegexFilter;
-import de.devboost.buildboost.filters.OrFilter;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IBuildConfiguration;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildParticipant;
-import de.devboost.buildboost.model.IBuildStage;
-import de.devboost.buildboost.stages.AbstractBuildStage;
-import de.devboost.buildboost.stages.CloneRepositoriesStage;
-import de.devboost.buildboost.stages.CompileStage;
-import de.devboost.buildboost.stages.CopyProjectsStage;
-import de.devboost.buildboost.util.XMLContent;
-
-public class BuildScriptGenerator implements IBuildConfiguration {
-
- private class MergeBootstrapBinariesStage extends AbstractBuildStage {
-
- private String sourcePath;
- private String buildBoostBinDir;
-
- public MergeBootstrapBinariesStage(String sourcePath, String buildBoostBinDir) {
- super();
- this.sourcePath = sourcePath;
- this.buildBoostBinDir = buildBoostBinDir;
- }
-
- @Override
- public AntScript getScript() throws BuildException {
- File buildDir = new File(sourcePath);
-
- BuildContext context = createContext(true);
- context.addBuildParticipant(new PluginFinder(buildDir));
-
- context.addBuildParticipant(new MergeBinariesStepProvider(buildBoostBinDir));
- AutoBuilder builder = new AutoBuilder(context);
-
- AntScript script = new AntScript();
- script.setName("Merge bootstrapped binaries");
- script.addTargets(builder.generateAntTargets());
-
- return script;
- }
- }
-
- private class MergeBinariesStepProvider extends AbstractAntTargetGeneratorProvider {
-
- private String buildBoostBinDir;
-
- public MergeBinariesStepProvider(String buildBoostBinDir) {
- this.buildBoostBinDir = buildBoostBinDir;
- }
-
- @Override
- public List getAntTargetGenerators(IBuildContext context,
- IArtifact artifact) {
- if (artifact instanceof Plugin) {
- Plugin plugin = (Plugin) artifact;
- if (plugin.isProject()) {
- List steps = new ArrayList();
- steps.add(new MergeBinariesStep(plugin, buildBoostBinDir));
- return steps;
- }
- }
- return Collections.emptyList();
- }
- }
-
- private class MergeBinariesStep extends AbstractAntTargetGenerator {
-
- private Plugin plugin;
- private String buildBoostBinDir;
-
- public MergeBinariesStep(Plugin plugin, String buildBoostBinDir) {
- this.plugin = plugin;
- this.buildBoostBinDir = buildBoostBinDir;
- }
-
- @Override
- public Collection generateAntTargets() throws BuildException {
- XMLContent content = new XMLContent();
- Set dependencies = plugin.getAllDependencies();
- content.append("");
- copyToSharedBinFolder(content, plugin);
- for (Plugin dependency : dependencies) {
- copyToSharedBinFolder(content, dependency);
- }
-
- String identifier = plugin.getIdentifier();
- AntTarget target = new AntTarget("merge-bin-" + identifier, content);
- return Collections.singleton(target);
- }
-
- private void copyToSharedBinFolder(XMLContent content, Plugin plugin) {
- File pluginFile = plugin.getFile();
- File binFolder;
- File tempDir = new File(buildBoostBinDir, "temp");
- if (!plugin.isProject()) {
- content.append("");
- content.append("");
- binFolder = tempDir;
- } else {
- binFolder = pluginFile;
- }
- content.append("");
- content.append("");
- content.append("");
-
- Set libs = plugin.getLibs();
- for (String lib : libs) {
- if (plugin.isProject()) {
- String absoluteLibPath = plugin.getAbsoluteLibPath(lib);
- content.append("");
- } else {
- content.append("");
- }
- }
- content.append("");
- }
- }
-
- @Override
- public List getBuildStages(String workspace) {
- File buildFolder = new File(workspace, BUILD_FOLDER);
- File buildBoostBinFolder = new File(buildFolder, BUILD_BOOST_BIN_FOLDER);
- File reposFolder = new File(workspace, REPOS_FOLDER);
- File artifactsFolder = new File(buildFolder, ARTIFACTS_FOLDER);
-
- List stages = new ArrayList();
-
- CloneRepositoriesStage stage1 = new CloneRepositoriesStage();
- stage1.setReposFolder(reposFolder.getAbsolutePath());
-
- //update a second time, since the first update might have revealed new boost files
- CloneRepositoriesStage stage2 = new CloneRepositoriesStage();
- stage2.setReposFolder(reposFolder.getAbsolutePath());
-
- CopyProjectsStage stage3 = new CopyProjectsStage();
- stage3.setReposFolder(reposFolder.getAbsolutePath());
- stage3.setArtifactsFolder(artifactsFolder.getAbsolutePath());
- stage3.addBuildParticipant(createFilter());
-
- CompileStage stage4 = new CompileStage();
- stage4.setArtifactsFolder(artifactsFolder.getAbsolutePath());
- stage4.addBuildParticipant(createFilter());
-
- MergeBootstrapBinariesStage stage5 = new MergeBootstrapBinariesStage(
- artifactsFolder.getAbsolutePath(), buildBoostBinFolder.getAbsolutePath());
- stage5.addBuildParticipant(createFilter());
-
- stages.add(stage1);
- stages.add(stage2);
- stages.add(stage3);
- stages.add(stage4);
- stages.add(stage5);
- return stages;
- }
-
- private IBuildParticipant createFilter() {
- IdentifierFilter filter1 = new IdentifierFilter(BUILD_BOOST_CORE_PROJECT_ID);
- IdentifierRegexFilter filter2 = new IdentifierRegexFilter(BUILD_BOOST_GENEXT_PROJECT_ID_PATTERN);
- IdentifierRegexFilter filter3 = new IdentifierRegexFilter(BUILD_BOOST_BUILD_PROJECT_ID_PATTERN);
- return new OrFilter(filter1, filter2, filter3);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+import static de.devboost.buildboost.IConstants.ARTIFACTS_FOLDER;
+import static de.devboost.buildboost.IConstants.BUILD_BOOST_BIN_FOLDER;
+import static de.devboost.buildboost.IConstants.BUILD_BOOST_BUILD_PROJECT_ID_PATTERN;
+import static de.devboost.buildboost.IConstants.BUILD_BOOST_CORE_PROJECT_ID;
+import static de.devboost.buildboost.IConstants.BUILD_BOOST_GENEXT_PROJECT_ID_PATTERN;
+import static de.devboost.buildboost.IConstants.BUILD_FOLDER;
+import static de.devboost.buildboost.IConstants.REPOS_FOLDER;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import de.devboost.buildboost.ant.AbstractAntTargetGenerator;
+import de.devboost.buildboost.ant.AbstractAntTargetGeneratorProvider;
+import de.devboost.buildboost.ant.AntScript;
+import de.devboost.buildboost.ant.AntTarget;
+import de.devboost.buildboost.ant.IAntTargetGenerator;
+import de.devboost.buildboost.artifacts.Plugin;
+import de.devboost.buildboost.discovery.PluginFinder;
+import de.devboost.buildboost.filters.IdentifierFilter;
+import de.devboost.buildboost.filters.IdentifierRegexFilter;
+import de.devboost.buildboost.filters.OrFilter;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IBuildConfiguration;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildParticipant;
+import de.devboost.buildboost.model.IBuildStage;
+import de.devboost.buildboost.stages.AbstractBuildStage;
+import de.devboost.buildboost.stages.CloneRepositoriesStage;
+import de.devboost.buildboost.stages.CompileStage;
+import de.devboost.buildboost.stages.CopyProjectsStage;
+import de.devboost.buildboost.util.XMLContent;
+
+public class BuildScriptGenerator implements IBuildConfiguration {
+
+ private class MergeBootstrapBinariesStage extends AbstractBuildStage {
+
+ private String sourcePath;
+ private String buildBoostBinDir;
+
+ public MergeBootstrapBinariesStage(String sourcePath, String buildBoostBinDir) {
+ super();
+ this.sourcePath = sourcePath;
+ this.buildBoostBinDir = buildBoostBinDir;
+ }
+
+ @Override
+ public AntScript getScript() throws BuildException {
+ File buildDir = new File(sourcePath);
+
+ BuildContext context = createContext(true);
+ context.addBuildParticipant(new PluginFinder(buildDir));
+
+ context.addBuildParticipant(new MergeBinariesStepProvider(buildBoostBinDir));
+ AutoBuilder builder = new AutoBuilder(context);
+
+ AntScript script = new AntScript();
+ script.setName("Merge bootstrapped binaries");
+ script.addTargets(builder.generateAntTargets());
+
+ return script;
+ }
+ }
+
+ private class MergeBinariesStepProvider extends AbstractAntTargetGeneratorProvider {
+
+ private String buildBoostBinDir;
+
+ public MergeBinariesStepProvider(String buildBoostBinDir) {
+ this.buildBoostBinDir = buildBoostBinDir;
+ }
+
+ @Override
+ public List getAntTargetGenerators(IBuildContext context,
+ IArtifact artifact) {
+ if (artifact instanceof Plugin) {
+ Plugin plugin = (Plugin) artifact;
+ if (plugin.isProject()) {
+ List steps = new ArrayList();
+ steps.add(new MergeBinariesStep(plugin, buildBoostBinDir));
+ return steps;
+ }
+ }
+ return Collections.emptyList();
+ }
+ }
+
+ private class MergeBinariesStep extends AbstractAntTargetGenerator {
+
+ private Plugin plugin;
+ private String buildBoostBinDir;
+
+ public MergeBinariesStep(Plugin plugin, String buildBoostBinDir) {
+ this.plugin = plugin;
+ this.buildBoostBinDir = buildBoostBinDir;
+ }
+
+ @Override
+ public Collection generateAntTargets() throws BuildException {
+ XMLContent content = new XMLContent();
+ Set dependencies = plugin.getAllDependencies();
+ content.append("");
+ copyToSharedBinFolder(content, plugin);
+ for (Plugin dependency : dependencies) {
+ copyToSharedBinFolder(content, dependency);
+ }
+
+ String identifier = plugin.getIdentifier();
+ AntTarget target = new AntTarget("merge-bin-" + identifier, content);
+ return Collections.singleton(target);
+ }
+
+ private void copyToSharedBinFolder(XMLContent content, Plugin plugin) {
+ File pluginFile = plugin.getFile();
+ File binFolder;
+ File tempDir = new File(buildBoostBinDir, "temp");
+ if (!plugin.isProject()) {
+ content.append("");
+ content.append("");
+ binFolder = tempDir;
+ } else {
+ binFolder = pluginFile;
+ }
+ content.append("");
+ content.append("");
+ content.append("");
+
+ Set libs = plugin.getLibs();
+ for (String lib : libs) {
+ if (plugin.isProject()) {
+ String absoluteLibPath = plugin.getAbsoluteLibPath(lib);
+ content.append("");
+ } else {
+ content.append("");
+ }
+ }
+ content.append("");
+ }
+ }
+
+ @Override
+ public List getBuildStages(String workspace) {
+ File buildFolder = new File(workspace, BUILD_FOLDER);
+ File buildBoostBinFolder = new File(buildFolder, BUILD_BOOST_BIN_FOLDER);
+ File reposFolder = new File(workspace, REPOS_FOLDER);
+ File artifactsFolder = new File(buildFolder, ARTIFACTS_FOLDER);
+
+ List stages = new ArrayList();
+
+ CloneRepositoriesStage stage1 = new CloneRepositoriesStage();
+ stage1.setReposFolder(reposFolder.getAbsolutePath());
+
+ //update a second time, since the first update might have revealed new boost files
+ CloneRepositoriesStage stage2 = new CloneRepositoriesStage();
+ stage2.setReposFolder(reposFolder.getAbsolutePath());
+
+ CopyProjectsStage stage3 = new CopyProjectsStage();
+ stage3.setReposFolder(reposFolder.getAbsolutePath());
+ stage3.setArtifactsFolder(artifactsFolder.getAbsolutePath());
+ stage3.addBuildParticipant(createFilter());
+
+ CompileStage stage4 = new CompileStage();
+ stage4.setArtifactsFolder(artifactsFolder.getAbsolutePath());
+ stage4.addBuildParticipant(createFilter());
+
+ MergeBootstrapBinariesStage stage5 = new MergeBootstrapBinariesStage(
+ artifactsFolder.getAbsolutePath(), buildBoostBinFolder.getAbsolutePath());
+ stage5.addBuildParticipant(createFilter());
+
+ stages.add(stage1);
+ stages.add(stage2);
+ stages.add(stage3);
+ stages.add(stage4);
+ stages.add(stage5);
+ return stages;
+ }
+
+ private IBuildParticipant createFilter() {
+ IdentifierFilter filter1 = new IdentifierFilter(BUILD_BOOST_CORE_PROJECT_ID);
+ IdentifierRegexFilter filter2 = new IdentifierRegexFilter(BUILD_BOOST_GENEXT_PROJECT_ID_PATTERN);
+ IdentifierRegexFilter filter3 = new IdentifierRegexFilter(BUILD_BOOST_BUILD_PROJECT_ID_PATTERN);
+ return new OrFilter(filter1, filter2, filter3);
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildScriptGeneratorRunner.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildScriptGeneratorRunner.java
index 4f8735a..0bb9dd5 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildScriptGeneratorRunner.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildScriptGeneratorRunner.java
@@ -1,161 +1,161 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.List;
-
-import de.devboost.buildboost.model.IBuildConfiguration;
-import de.devboost.buildboost.model.IBuildStage;
-import de.devboost.buildboost.util.ScriptSaver;
-import de.devboost.buildboost.util.StreamUtil;
-
-public class BuildScriptGeneratorRunner {
-
- public static void main(String[] args) throws BuildException {
- if (args.length < 2) {
- System.out.println("Wrong call to BuildScriptGeneratorRunner.main().");
- System.out.println("Usage: BuildScriptGeneratorRunner.main(pathToWorkspace, classToRun).");
- System.exit(1);
- return;
- }
- new BuildScriptGeneratorRunner().run(args);
- }
-
- private void run(String[] args) throws BuildException {
- String workspace = args[0];
- String classToRun = args[1];
- File stageFile = getStageFile(workspace);
- String stage = readLastStage(stageFile);
- int stageNumber = Integer.parseInt(stage);
- writeNextStage(stageFile, stageNumber);
-
- Class> clazzToRun = loadClassToRun(classToRun);
-
- System.out.println("BuildScriptGeneratorRunner.run() stageNumber = " + stageNumber);
- System.out.println("BuildScriptGeneratorRunner.run() clazzToRun = " + clazzToRun.getName());
- Class>[] interfaces = clazzToRun.getInterfaces();
- for (Class> nextInterface : interfaces) {
- System.out.println("BuildScriptGeneratorRunner.run() implemented interface: " + nextInterface.getName());
- }
-
- boolean isBuildConfiguration = IBuildConfiguration.class.isAssignableFrom(clazzToRun);
- if (isBuildConfiguration) {
- // instantiate and call via interface
- callViaInterface(clazzToRun, workspace, stageNumber);
- } else {
- // call main method (for backward compatibility)
- callMainMethod(clazzToRun, args);
- }
- }
-
- private File getStageFile(String workspace) {
- return new File(new File(workspace, "build"), "current_stage");
- }
-
- private Class> loadClassToRun(String classToRun) throws BuildException {
- Class> clazzToRun;
- try {
- clazzToRun = Class.forName(classToRun);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- throw new BuildException("Can't find class " + classToRun);
- }
- return clazzToRun;
- }
-
- private void callViaInterface(Class> clazzToRun, String workspace, int stageNumber) throws BuildException {
- try {
- Object newInstance = clazzToRun.newInstance();
- IBuildConfiguration configuration = (IBuildConfiguration) newInstance;
- List buildStages = configuration.getBuildStages(workspace);
- IBuildStage currentStage = buildStages.get(stageNumber - 1);
- String buildDir = workspace + File.separator + "build";
- ScriptSaver scriptSaver = new ScriptSaver();
- File targetDir = new File(buildDir);
- scriptSaver.saveStage(targetDir, currentStage, scriptSaver.getStageFileName(stageNumber));
- scriptSaver.saveMasterScript(targetDir, buildStages);
- // if this is the last stage, we must remove the 'current_stage' stage file, because
- // otherwise subsequent builds will not start at the first stage. this particularly
- // applies to the bootstrapping build.
- if (stageNumber == buildStages.size()) {
- File stageFile = getStageFile(workspace);
- stageFile.delete();
- }
- } catch (InstantiationException e) {
- e.printStackTrace();
- throw new BuildException("Can't instantiate class " + clazzToRun.getName());
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- throw new BuildException("Can't access class " + clazzToRun.getName());
- }
- }
-
- private void callMainMethod(Class> clazzToRun, String[] args) throws BuildException {
- Method mainMethod;
- try {
- mainMethod = clazzToRun.getMethod("main", String[].class);
- } catch (SecurityException e) {
- e.printStackTrace();
- throw new BuildException("Can't access method main() in class " + clazzToRun.getName());
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- throw new BuildException("Can't find method main() in class " + clazzToRun.getName());
- }
-
- try {
- mainMethod.invoke(null, (Object) args);
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- throw new BuildException("Can't invoke main method in class " + clazzToRun.getName());
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- throw new BuildException("Can't invoke main method in class " + clazzToRun.getName());
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- throw new BuildException("Can't invoke main method in class " + clazzToRun.getName());
- }
- }
-
- private void writeNextStage(File stageFile, int stageNumber) throws BuildException {
- try {
- FileWriter writer = new FileWriter(stageFile);
- writer.write(Integer.toString(stageNumber + 1));
- writer.close();
- } catch (IOException ioe) {
- throw new BuildException("Can't write stage file (" + ioe.getMessage() + ").");
- }
- }
-
- private String readLastStage(File stageFile) throws BuildException {
- if (stageFile.exists()) {
- try {
- FileInputStream fis = new FileInputStream(stageFile);
- String stage = new StreamUtil().getContentAsString(fis);
- fis.close();
- return stage;
- } catch (IOException ioe) {
- throw new BuildException("Can't read stage file (" + ioe.getMessage() + ").");
- }
- }
- return "1";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import de.devboost.buildboost.model.IBuildConfiguration;
+import de.devboost.buildboost.model.IBuildStage;
+import de.devboost.buildboost.util.ScriptSaver;
+import de.devboost.buildboost.util.StreamUtil;
+
+public class BuildScriptGeneratorRunner {
+
+ public static void main(String[] args) throws BuildException {
+ if (args.length < 2) {
+ System.out.println("Wrong call to BuildScriptGeneratorRunner.main().");
+ System.out.println("Usage: BuildScriptGeneratorRunner.main(pathToWorkspace, classToRun).");
+ System.exit(1);
+ return;
+ }
+ new BuildScriptGeneratorRunner().run(args);
+ }
+
+ private void run(String[] args) throws BuildException {
+ String workspace = args[0];
+ String classToRun = args[1];
+ File stageFile = getStageFile(workspace);
+ String stage = readLastStage(stageFile);
+ int stageNumber = Integer.parseInt(stage);
+ writeNextStage(stageFile, stageNumber);
+
+ Class> clazzToRun = loadClassToRun(classToRun);
+
+ System.out.println("BuildScriptGeneratorRunner.run() stageNumber = " + stageNumber);
+ System.out.println("BuildScriptGeneratorRunner.run() clazzToRun = " + clazzToRun.getName());
+ Class>[] interfaces = clazzToRun.getInterfaces();
+ for (Class> nextInterface : interfaces) {
+ System.out.println("BuildScriptGeneratorRunner.run() implemented interface: " + nextInterface.getName());
+ }
+
+ boolean isBuildConfiguration = IBuildConfiguration.class.isAssignableFrom(clazzToRun);
+ if (isBuildConfiguration) {
+ // instantiate and call via interface
+ callViaInterface(clazzToRun, workspace, stageNumber);
+ } else {
+ // call main method (for backward compatibility)
+ callMainMethod(clazzToRun, args);
+ }
+ }
+
+ private File getStageFile(String workspace) {
+ return new File(new File(workspace, "build"), "current_stage");
+ }
+
+ private Class> loadClassToRun(String classToRun) throws BuildException {
+ Class> clazzToRun;
+ try {
+ clazzToRun = Class.forName(classToRun);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ throw new BuildException("Can't find class " + classToRun);
+ }
+ return clazzToRun;
+ }
+
+ private void callViaInterface(Class> clazzToRun, String workspace, int stageNumber) throws BuildException {
+ try {
+ Object newInstance = clazzToRun.newInstance();
+ IBuildConfiguration configuration = (IBuildConfiguration) newInstance;
+ List buildStages = configuration.getBuildStages(workspace);
+ IBuildStage currentStage = buildStages.get(stageNumber - 1);
+ String buildDir = workspace + File.separator + "build";
+ ScriptSaver scriptSaver = new ScriptSaver();
+ File targetDir = new File(buildDir);
+ scriptSaver.saveStage(targetDir, currentStage, scriptSaver.getStageFileName(stageNumber));
+ scriptSaver.saveMasterScript(targetDir, buildStages);
+ // if this is the last stage, we must remove the 'current_stage' stage file, because
+ // otherwise subsequent builds will not start at the first stage. this particularly
+ // applies to the bootstrapping build.
+ if (stageNumber == buildStages.size()) {
+ File stageFile = getStageFile(workspace);
+ stageFile.delete();
+ }
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ throw new BuildException("Can't instantiate class " + clazzToRun.getName());
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ throw new BuildException("Can't access class " + clazzToRun.getName());
+ }
+ }
+
+ private void callMainMethod(Class> clazzToRun, String[] args) throws BuildException {
+ Method mainMethod;
+ try {
+ mainMethod = clazzToRun.getMethod("main", String[].class);
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ throw new BuildException("Can't access method main() in class " + clazzToRun.getName());
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ throw new BuildException("Can't find method main() in class " + clazzToRun.getName());
+ }
+
+ try {
+ mainMethod.invoke(null, (Object) args);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new BuildException("Can't invoke main method in class " + clazzToRun.getName());
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ throw new BuildException("Can't invoke main method in class " + clazzToRun.getName());
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ throw new BuildException("Can't invoke main method in class " + clazzToRun.getName());
+ }
+ }
+
+ private void writeNextStage(File stageFile, int stageNumber) throws BuildException {
+ try {
+ FileWriter writer = new FileWriter(stageFile);
+ writer.write(Integer.toString(stageNumber + 1));
+ writer.close();
+ } catch (IOException ioe) {
+ throw new BuildException("Can't write stage file (" + ioe.getMessage() + ").");
+ }
+ }
+
+ private String readLastStage(File stageFile) throws BuildException {
+ if (stageFile.exists()) {
+ try {
+ FileInputStream fis = new FileInputStream(stageFile);
+ String stage = new StreamUtil().getContentAsString(fis);
+ fis.close();
+ return stage;
+ } catch (IOException ioe) {
+ throw new BuildException("Can't read stage file (" + ioe.getMessage() + ").");
+ }
+ }
+ return "1";
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/DependableBuildParticipant.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/DependableBuildParticipant.java
index 64d0b48..571bb53 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/DependableBuildParticipant.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/DependableBuildParticipant.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildParticipant;
-import de.devboost.buildboost.model.IDependable;
-
-public class DependableBuildParticipant implements IDependable,
- IBuildParticipant {
-
- private IBuildParticipant delegate;
- private Collection dependencies = new LinkedHashSet();
-
- public DependableBuildParticipant(IBuildParticipant participant) {
- this.delegate = participant;
- }
-
- public void initializeDependencies(List otherParticipants) {
- for (DependableBuildParticipant otherParticipant : otherParticipants) {
- if (dependsOn(otherParticipant)) {
- dependencies.add(otherParticipant);
- }
- if (isReqiredFor(otherParticipant)) {
- otherParticipant.dependencies.add(this);
- }
- }
- }
-
- @Override
- public void execute(IBuildContext context) throws BuildException {
- delegate.execute(context);
- }
-
- @Override
- public boolean dependsOn(IBuildParticipant otherParticipant) {
- if (otherParticipant instanceof DependableBuildParticipant) {
- DependableBuildParticipant dependableBuildParticipant = (DependableBuildParticipant) otherParticipant;
- return delegate.dependsOn(dependableBuildParticipant.delegate);
- } else {
- return delegate.dependsOn(otherParticipant);
- }
- }
-
- @Override
- public boolean isReqiredFor(IBuildParticipant otherParticipant) {
- if (otherParticipant instanceof DependableBuildParticipant) {
- DependableBuildParticipant dependableBuildParticipant = (DependableBuildParticipant) otherParticipant;
- return delegate.isReqiredFor(dependableBuildParticipant.delegate);
- } else {
- return delegate.isReqiredFor(otherParticipant);
- }
- }
-
- @Override
- public Collection getDependencies() {
- return dependencies;
- }
-
- @Override
- public String toString() {
- return delegate.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildParticipant;
+import de.devboost.buildboost.model.IDependable;
+
+public class DependableBuildParticipant implements IDependable,
+ IBuildParticipant {
+
+ private IBuildParticipant delegate;
+ private Collection dependencies = new LinkedHashSet();
+
+ public DependableBuildParticipant(IBuildParticipant participant) {
+ this.delegate = participant;
+ }
+
+ public void initializeDependencies(List otherParticipants) {
+ for (DependableBuildParticipant otherParticipant : otherParticipants) {
+ if (dependsOn(otherParticipant)) {
+ dependencies.add(otherParticipant);
+ }
+ if (isReqiredFor(otherParticipant)) {
+ otherParticipant.dependencies.add(this);
+ }
+ }
+ }
+
+ @Override
+ public void execute(IBuildContext context) throws BuildException {
+ delegate.execute(context);
+ }
+
+ @Override
+ public boolean dependsOn(IBuildParticipant otherParticipant) {
+ if (otherParticipant instanceof DependableBuildParticipant) {
+ DependableBuildParticipant dependableBuildParticipant = (DependableBuildParticipant) otherParticipant;
+ return delegate.dependsOn(dependableBuildParticipant.delegate);
+ } else {
+ return delegate.dependsOn(otherParticipant);
+ }
+ }
+
+ @Override
+ public boolean isReqiredFor(IBuildParticipant otherParticipant) {
+ if (otherParticipant instanceof DependableBuildParticipant) {
+ DependableBuildParticipant dependableBuildParticipant = (DependableBuildParticipant) otherParticipant;
+ return delegate.isReqiredFor(dependableBuildParticipant.delegate);
+ } else {
+ return delegate.isReqiredFor(otherParticipant);
+ }
+ }
+
+ @Override
+ public Collection getDependencies() {
+ return dependencies;
+ }
+
+ @Override
+ public String toString() {
+ return delegate.toString();
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/DependencyResolver.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/DependencyResolver.java
index 173a5e6..ab90aa6 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/DependencyResolver.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/DependencyResolver.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-import java.util.Collection;
-
-import de.devboost.buildboost.model.AbstractBuildParticipant;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IArtifactDiscoverer;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildParticipant;
-
-public class DependencyResolver extends AbstractBuildParticipant {
-
- @Override
- public boolean dependsOn(IBuildParticipant otherParticipant) {
- if (otherParticipant instanceof IArtifactDiscoverer) {
- return true;
- }
- return super.dependsOn(otherParticipant);
- }
-
- @Override
- public void execute(IBuildContext context) throws BuildException {
- Collection discoveredArtifacts = context.getDiscoveredArtifacts();
- // resolve dependencies
- for (IArtifact artifact : discoveredArtifacts) {
- artifact.resolveDependencies(discoveredArtifacts);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+import java.util.Collection;
+
+import de.devboost.buildboost.model.AbstractBuildParticipant;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IArtifactDiscoverer;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildParticipant;
+
+public class DependencyResolver extends AbstractBuildParticipant {
+
+ @Override
+ public boolean dependsOn(IBuildParticipant otherParticipant) {
+ if (otherParticipant instanceof IArtifactDiscoverer) {
+ return true;
+ }
+ return super.dependsOn(otherParticipant);
+ }
+
+ @Override
+ public void execute(IBuildContext context) throws BuildException {
+ Collection discoveredArtifacts = context.getDiscoveredArtifacts();
+ // resolve dependencies
+ for (IArtifact artifact : discoveredArtifacts) {
+ artifact.resolveDependencies(discoveredArtifacts);
+ }
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java
new file mode 100644
index 0000000..1d02d67
--- /dev/null
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java
@@ -0,0 +1,112 @@
+package de.devboost.buildboost;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * This class is a singleton!
+ *
+ */
+public class GlobalBuildConfiguration {
+
+ final private static Properties userProperties = new Properties();
+
+ // none extern instance creation support
+ private GlobalBuildConfiguration() {
+ System.out.println("GlobalUserConfig: set defaults");
+ setDefaultValues();
+ System.out.println("GlobalUserConfig: read config file");
+ readGlobalConfiguration();
+ }
+
+ // lazy init by static holder class
+ private static class Holder {
+ private static final GlobalBuildConfiguration INSTANCE = new GlobalBuildConfiguration();
+ }
+
+ public static GlobalBuildConfiguration getInstance() {
+ return Holder.INSTANCE;
+ }
+
+ private void setDefaultValues() {
+ // debugging support
+ userProperties.setProperty(GlobalBuildConfiguration.DEBUG,
+ GlobalBuildConfiguration.DEBUG_DEFAULT);
+ // remote debug option line
+ userProperties.setProperty(GlobalBuildConfiguration.JVMARG_DEBUG,
+ GlobalBuildConfiguration.JVMARG_DEBUG_DEFAULT);
+ // jvm mx para
+ userProperties.setProperty(GlobalBuildConfiguration.JVMARG_MX,
+ GlobalBuildConfiguration.JVMARG_MX_DEFAULT);
+ // jvm maxperm para
+ userProperties.setProperty(GlobalBuildConfiguration.JVMARG_MAXPERM,
+ GlobalBuildConfiguration.JVMARG_MAXPERM_DEFAULT);
+ }
+
+ private static void readGlobalConfiguration() {
+ final String userHomePath = System.getProperty("user.home");
+ final String globalConfigFileName = userHomePath + File.separator
+ + ".buildboost";
+ final File globalConfigFile = new File(globalConfigFileName);
+
+ if (globalConfigFile.exists() && globalConfigFile.length() > 1) {
+ System.out
+ .println("Loading user defined global configuration from .buildboost file.");
+ FileReader reader = null;
+ try {
+ reader = new FileReader(globalConfigFile);
+ userProperties.load(reader);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ } else {
+ System.out
+ .println("There was no user configuration found in the users .buildboost file");
+ }
+ }
+
+ public String getConfigItem(final String key) {
+ return userProperties.getProperty(key);
+ }
+
+ public String getConfigItem(final String key, final String defaultValue) {
+ return userProperties.getProperty(key, defaultValue);
+ }
+
+ public boolean isDebugEnabled() {
+ return !DEBUG_DEFAULT
+ .equals(getConfigItem(GlobalBuildConfiguration.DEBUG));
+ }
+
+ /* static constants for standard global entries and defaults */
+
+ // remote debugging support
+ public static final String DEBUG = "debug";
+ // 0=disabled, >0=remote debugging support && loglevel
+ // 1 = log level 1, 2 = log level 2, ...
+ public static final String DEBUG_DEFAULT = "0";
+
+ // jvm remote debug option line
+ final public static String JVMARG_DEBUG = "jvm_debugoption_line";
+ final public static String JVMARG_DEBUG_DEFAULT = "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000";
+
+ // jvm mx arg
+ final public static String JVMARG_MX = "jvmarg_mx";
+ final public static String JVMARG_MX_DEFAULT = "-Xmx2048m";
+
+ // jvm maxperm arg
+ final public static String JVMARG_MAXPERM = "jvm_maxperm";
+ final public static String JVMARG_MAXPERM_DEFAULT = "-XX:MaxPermSize=256m";
+
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java
index 495e4eb..0c9aef8 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-/**
- * A simple interface to holds constants that are required by the BuildBoost
- * system.
- */
-public interface IConstants {
-
- String BUILD_BOOST_REPOSITORY_URL = "https://github.com/DevBoost/BuildBoost.git";
- String BUILD_BOOST_CORE_PROJECT_ID = "de.devboost.buildboost";
- String BUILD_BOOST_GENEXT_PROJECT_ID_PATTERN = "de\\.devboost\\.buildboost\\.genext\\..*";
- String BUILD_BOOST_BUILD_PROJECT_ID_PATTERN = ".*\\.build";
-
- String REPOS_FOLDER = "repos";
- String BUILD_FOLDER = "build";
- String ARTIFACTS_FOLDER = "artifacts";
- String PROJECTS_FOLDER = "projects";
- String BUILD_BOOST_BIN_FOLDER = "build-boost-bin";
-
- String NL = System.getProperty("line.separator");
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+/**
+ * A simple interface to holds constants that are required by the BuildBoost
+ * system.
+ */
+public interface IConstants {
+
+ String BUILD_BOOST_REPOSITORY_URL = "https://github.com/DevBoost/BuildBoost.git";
+ String BUILD_BOOST_CORE_PROJECT_ID = "de.devboost.buildboost";
+ String BUILD_BOOST_GENEXT_PROJECT_ID_PATTERN = "de\\.devboost\\.buildboost\\.genext\\..*";
+ String BUILD_BOOST_BUILD_PROJECT_ID_PATTERN = ".*\\.build";
+
+ String REPOS_FOLDER = "repos";
+ String BUILD_FOLDER = "build";
+ String ARTIFACTS_FOLDER = "artifacts";
+ String PROJECTS_FOLDER = "projects";
+ String BUILD_BOOST_BIN_FOLDER = "build-boost-bin";
+
+ String NL = System.getProperty("line.separator");
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/UnresolvedDependencyChecker.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/UnresolvedDependencyChecker.java
index 774f520..fbd9773 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/UnresolvedDependencyChecker.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/UnresolvedDependencyChecker.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost;
-
-import java.util.Collection;
-
-import de.devboost.buildboost.model.AbstractBuildParticipant;
-import de.devboost.buildboost.model.BuildEventType;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildListener;
-import de.devboost.buildboost.model.IBuildParticipant;
-import de.devboost.buildboost.model.UnresolvedDependency;
-
-public class UnresolvedDependencyChecker extends AbstractBuildParticipant {
-
- @Override
- public boolean dependsOn(IBuildParticipant otherParticipant) {
- if (otherParticipant instanceof DependencyResolver) {
- return true;
- }
- return false;
- }
-
- @Override
- public void execute(IBuildContext context) throws BuildException {
- Collection discoveredArtifacts = context.getDiscoveredArtifacts();
- IBuildListener buildListener = context.getBuildListener();
- // check for unresolved dependencies
- boolean foundUnresolvedDependency = false;
- for (IArtifact artifact : discoveredArtifacts) {
- Collection unresolvedDependencies = artifact.getUnresolvedDependencies();
- for (UnresolvedDependency unresolvedDependency : unresolvedDependencies) {
- if (unresolvedDependency.isOptional()) {
- continue;
- }
- String message = "Found unresolved dependency in artifact " + artifact + ": " + unresolvedDependency;
- if (!context.ignoreUnresolvedDependencies()) {
- buildListener.handleBuildEvent(BuildEventType.ERROR, message);
- foundUnresolvedDependency = true;
- } else {
- buildListener.handleBuildEvent(BuildEventType.WARNING, message);
- }
- }
- }
- if (foundUnresolvedDependency) {
- throw new BuildException("Found unresolved dependencies");
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost;
+
+import java.util.Collection;
+
+import de.devboost.buildboost.model.AbstractBuildParticipant;
+import de.devboost.buildboost.model.BuildEventType;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildListener;
+import de.devboost.buildboost.model.IBuildParticipant;
+import de.devboost.buildboost.model.UnresolvedDependency;
+
+public class UnresolvedDependencyChecker extends AbstractBuildParticipant {
+
+ @Override
+ public boolean dependsOn(IBuildParticipant otherParticipant) {
+ if (otherParticipant instanceof DependencyResolver) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void execute(IBuildContext context) throws BuildException {
+ Collection discoveredArtifacts = context.getDiscoveredArtifacts();
+ IBuildListener buildListener = context.getBuildListener();
+ // check for unresolved dependencies
+ boolean foundUnresolvedDependency = false;
+ for (IArtifact artifact : discoveredArtifacts) {
+ Collection unresolvedDependencies = artifact.getUnresolvedDependencies();
+ for (UnresolvedDependency unresolvedDependency : unresolvedDependencies) {
+ if (unresolvedDependency.isOptional()) {
+ continue;
+ }
+ String message = "Found unresolved dependency in artifact " + artifact + ": " + unresolvedDependency;
+ if (!context.ignoreUnresolvedDependencies()) {
+ buildListener.handleBuildEvent(BuildEventType.ERROR, message);
+ foundUnresolvedDependency = true;
+ } else {
+ buildListener.handleBuildEvent(BuildEventType.WARNING, message);
+ }
+ }
+ }
+ if (foundUnresolvedDependency) {
+ throw new BuildException("Found unresolved dependencies");
+ }
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGenerator.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGenerator.java
index 75b4816..8ea9079 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGenerator.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGenerator.java
@@ -1,51 +1,75 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.ant;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IDependable;
-import de.devboost.buildboost.model.UnresolvedDependency;
-
-public abstract class AbstractAntTargetGenerator implements IAntTargetGenerator {
-
- @Override
- public String getIdentifier() {
- return toString();
- }
-
- @Override
- public Collection getDependencies() {
- return Collections.emptySet();
- }
-
- @Override
- public void resolveDependencies(Collection extends IArtifact> allArtifacts) {
- // do nothing
- }
-
- @Override
- public Collection getUnresolvedDependencies() {
- return Collections.emptySet();
- }
-
- @Override
- public long getTimestamp() {
- return -1;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.ant;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import de.devboost.buildboost.artifacts.Plugin;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IDependable;
+import de.devboost.buildboost.model.UnresolvedDependency;
+
+public abstract class AbstractAntTargetGenerator implements IAntTargetGenerator {
+
+ protected void writeParaFile(final String fileName,
+ final List plugins) {
+ final File paraPropFile = new File(fileName);
+ PrintWriter pw = null;
+ try {
+ pw = new PrintWriter(paraPropFile);
+ for (Plugin plugin : plugins) {
+ pw.println(plugin.getAbsolutePath());
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } finally {
+ if (pw != null) {
+ pw.close();
+ }
+ }
+
+ }
+
+ @Override
+ public String getIdentifier() {
+ return toString();
+ }
+
+ @Override
+ public Collection getDependencies() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public void resolveDependencies(Collection extends IArtifact> allArtifacts) {
+ // do nothing
+ }
+
+ @Override
+ public Collection getUnresolvedDependencies() {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public long getTimestamp() {
+ return -1;
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGeneratorProvider.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGeneratorProvider.java
index a5f5f4d..62b0e2b 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGeneratorProvider.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGeneratorProvider.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.ant;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import de.devboost.buildboost.BuildException;
-import de.devboost.buildboost.UnresolvedDependencyChecker;
-import de.devboost.buildboost.model.AbstractBuildParticipant;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IArtifactDiscoverer;
-import de.devboost.buildboost.model.IArtifactFilter;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildParticipant;
-
-public abstract class AbstractAntTargetGeneratorProvider
- extends AbstractBuildParticipant
- implements IAntTargetGeneratorProvider {
-
- @Override
- public void execute(IBuildContext context) throws BuildException {
- List antTargets = new ArrayList();
- Collection artifacts = context.getDiscoveredArtifacts();
- for (IArtifact artifact : artifacts) {
- antTargets.addAll(getAntTargetGenerators(context, artifact));
- }
- context.addDiscoveredArtifacts(antTargets);
- }
-
- public boolean dependsOn(IBuildParticipant otherParticipant) {
- if (otherParticipant instanceof IArtifactDiscoverer) {
- return true;
- }
- if (otherParticipant instanceof IArtifactFilter) {
- return true;
- }
- if (otherParticipant instanceof UnresolvedDependencyChecker) {
- return true;
- }
- return false;
- }
-
- public abstract Collection extends IArtifact> getAntTargetGenerators(
- IBuildContext context, IArtifact artifact);
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.ant;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import de.devboost.buildboost.BuildException;
+import de.devboost.buildboost.UnresolvedDependencyChecker;
+import de.devboost.buildboost.model.AbstractBuildParticipant;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IArtifactDiscoverer;
+import de.devboost.buildboost.model.IArtifactFilter;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildParticipant;
+
+public abstract class AbstractAntTargetGeneratorProvider
+ extends AbstractBuildParticipant
+ implements IAntTargetGeneratorProvider {
+
+ @Override
+ public void execute(IBuildContext context) throws BuildException {
+ List antTargets = new ArrayList();
+ Collection artifacts = context.getDiscoveredArtifacts();
+ for (IArtifact artifact : artifacts) {
+ antTargets.addAll(getAntTargetGenerators(context, artifact));
+ }
+ context.addDiscoveredArtifacts(antTargets);
+ }
+
+ public boolean dependsOn(IBuildParticipant otherParticipant) {
+ if (otherParticipant instanceof IArtifactDiscoverer) {
+ return true;
+ }
+ if (otherParticipant instanceof IArtifactFilter) {
+ return true;
+ }
+ if (otherParticipant instanceof UnresolvedDependencyChecker) {
+ return true;
+ }
+ return false;
+ }
+
+ public abstract Collection extends IArtifact> getAntTargetGenerators(
+ IBuildContext context, IArtifact artifact);
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntScript.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntScript.java
index bee8a63..42179ef 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntScript.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntScript.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.ant;
-
-import static de.devboost.buildboost.IConstants.NL;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import de.devboost.buildboost.util.XMLContent;
-
-/**
- * An {@link AntScript} is a representation of a generated Ant script.
- */
-public class AntScript {
-
- private String name;
- private StringBuffer content = new StringBuffer();
-
- private Collection targets = new ArrayList();
-
- public String getScript() {
- XMLContent script = new XMLContent();
- script.append("");
- script.append("");
- script.append("");
- script.append(content.toString());
-
- StringBuilder depends = new StringBuilder();
- for (AntTarget target : targets) {
- depends.append(target.getName());
- depends.append(", ");
- }
- String allDependencies = depends.toString();
- if (allDependencies.length() > 0) {
- allDependencies = allDependencies.substring(0, allDependencies.length() - 2);
- }
- script.append(" 0 ? "depends=\"" + allDependencies + "\"" : "") + " />");
- script.append(NL);
-
- // TODO make sure that names of the targets do not collide
- for (AntTarget target : targets) {
- StringBuilder deps = new StringBuilder();
- for (String dependency : target.getRequiredTargets()) {
- deps.append(dependency);
- deps.append(", ");
- }
- String allDeps = deps.toString();
- if (allDeps.length() > 0) {
- allDeps = allDeps.substring(0, allDeps.length() - 2);
- }
- script.append(" 0 ? "depends=\"" + allDeps + "\"" : "") + ">");
- script.append(target.getContent());
- script.append("");
- script.append(NL);
- }
-
- script.append("");
-
- return script.toString();
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Use {@link #addTarget(AntTarget)} or {@link #addTargets(Collection)}
- * instead.
- */
- @Deprecated // TODO remove this method once all references are removed
- public void addContent(StringBuffer content) {
- this.content.append(content);
- }
-
- public void addTargets(Collection targets) {
- this.targets.addAll(targets);
- }
-
- public void addTarget(AntTarget target) {
- this.targets.add(target);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.ant;
+
+import static de.devboost.buildboost.IConstants.NL;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import de.devboost.buildboost.util.XMLContent;
+
+/**
+ * An {@link AntScript} is a representation of a generated Ant script.
+ */
+public class AntScript {
+
+ private String name;
+ private StringBuffer content = new StringBuffer();
+
+ private Collection targets = new ArrayList();
+
+ public String getScript() {
+ XMLContent script = new XMLContent();
+ script.append("");
+ script.append("");
+ script.append("");
+ script.append(content.toString());
+
+ StringBuilder depends = new StringBuilder();
+ for (AntTarget target : targets) {
+ depends.append(target.getName());
+ depends.append(", ");
+ }
+ String allDependencies = depends.toString();
+ if (allDependencies.length() > 0) {
+ allDependencies = allDependencies.substring(0, allDependencies.length() - 2);
+ }
+ script.append(" 0 ? "depends=\"" + allDependencies + "\"" : "") + " />");
+ script.append(NL);
+
+ // TODO make sure that names of the targets do not collide
+ for (AntTarget target : targets) {
+ StringBuilder deps = new StringBuilder();
+ for (String dependency : target.getRequiredTargets()) {
+ deps.append(dependency);
+ deps.append(", ");
+ }
+ String allDeps = deps.toString();
+ if (allDeps.length() > 0) {
+ allDeps = allDeps.substring(0, allDeps.length() - 2);
+ }
+ script.append(" 0 ? "depends=\"" + allDeps + "\"" : "") + ">");
+ script.append(target.getContent());
+ script.append("");
+ script.append(NL);
+ }
+
+ script.append("");
+
+ return script.toString();
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Use {@link #addTarget(AntTarget)} or {@link #addTargets(Collection)}
+ * instead.
+ */
+ @Deprecated // TODO remove this method once all references are removed
+ public void addContent(StringBuffer content) {
+ this.content.append(content);
+ }
+
+ public void addTargets(Collection targets) {
+ this.targets.addAll(targets);
+ }
+
+ public void addTarget(AntTarget target) {
+ this.targets.add(target);
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntTarget.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntTarget.java
index f49c548..46ce199 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntTarget.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntTarget.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.ant;
-
-import java.util.Collection;
-import java.util.LinkedHashSet;
-
-import de.devboost.buildboost.artifacts.AbstractArtifact;
-import de.devboost.buildboost.util.XMLContent;
-
-/**
- * An {@link AntTarget} is a representation of a generated Ant script fragment.
- *
- * TODO Add parameter Class> creator to all constructors to avoid interfering
- * name for generated targets.
- */
-public class AntTarget extends AbstractArtifact {
-
- private static final long serialVersionUID = -7935166108004658132L;
-
- private String name;
- private String content;
- private Collection dependencies;
-
- // TODO the content must not change after calling this constructor as
- // changes will not be reflected because we call toString() right here.
- public AntTarget(String name, XMLContent content) {
- this(name, content.toString());
- }
-
- public AntTarget(String name, XMLContent content, Collection dependencies) {
- this(name, content.toString(), dependencies);
- }
-
- private AntTarget(String name, String content) {
- this(name, content, new LinkedHashSet());
- }
-
- private AntTarget(String name, String content, Collection dependencies) {
- this.name = name;
- this.content = content;
- this.dependencies = dependencies;
- }
-
- /**
- * Returns the name of this target.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the script content of this target as string.
- */
- public String getContent() {
- return content;
- }
-
- /**
- * Returns the targets this target depends on.
- */
- public Collection getRequiredTargets() {
- return dependencies;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.ant;
+
+import java.util.Collection;
+import java.util.LinkedHashSet;
+
+import de.devboost.buildboost.artifacts.AbstractArtifact;
+import de.devboost.buildboost.util.XMLContent;
+
+/**
+ * An {@link AntTarget} is a representation of a generated Ant script fragment.
+ *
+ * TODO Add parameter Class> creator to all constructors to avoid interfering
+ * name for generated targets.
+ */
+public class AntTarget extends AbstractArtifact {
+
+ private static final long serialVersionUID = -7935166108004658132L;
+
+ private String name;
+ private String content;
+ private Collection dependencies;
+
+ // TODO the content must not change after calling this constructor as
+ // changes will not be reflected because we call toString() right here.
+ public AntTarget(String name, XMLContent content) {
+ this(name, content.toString());
+ }
+
+ public AntTarget(String name, XMLContent content, Collection dependencies) {
+ this(name, content.toString(), dependencies);
+ }
+
+ private AntTarget(String name, String content) {
+ this(name, content, new LinkedHashSet());
+ }
+
+ private AntTarget(String name, String content, Collection dependencies) {
+ this.name = name;
+ this.content = content;
+ this.dependencies = dependencies;
+ }
+
+ /**
+ * Returns the name of this target.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the script content of this target as string.
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * Returns the targets this target depends on.
+ */
+ public Collection getRequiredTargets() {
+ return dependencies;
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntTargetGeneratorRunner.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntTargetGeneratorRunner.java
index 3e2d3f5..79d2ad7 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntTargetGeneratorRunner.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AntTargetGeneratorRunner.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.ant;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import de.devboost.buildboost.BuildException;
-import de.devboost.buildboost.model.AbstractBuildParticipant;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildParticipant;
-
-public class AntTargetGeneratorRunner extends AbstractBuildParticipant {
-
- @Override
- public boolean dependsOn(IBuildParticipant otherParticipant) {
- return otherParticipant instanceof IAntTargetGeneratorProvider;
- }
-
- @Override
- public void execute(IBuildContext context) throws BuildException {
- Collection antTargets = new ArrayList();
- Collection discoveredArtifacts = context.getDiscoveredArtifacts();
- for (IArtifact artifact : discoveredArtifacts) {
- if (artifact instanceof IAntTargetGenerator) {
- IAntTargetGenerator antTargetGenerator = (IAntTargetGenerator) artifact;
- Collection generatedAntTargets = antTargetGenerator.generateAntTargets();
- for (AntTarget antTarget : generatedAntTargets) {
- antTargets.add(antTarget);
- }
- }
- }
- context.addDiscoveredArtifacts(antTargets);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.ant;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import de.devboost.buildboost.BuildException;
+import de.devboost.buildboost.model.AbstractBuildParticipant;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildParticipant;
+
+public class AntTargetGeneratorRunner extends AbstractBuildParticipant {
+
+ @Override
+ public boolean dependsOn(IBuildParticipant otherParticipant) {
+ return otherParticipant instanceof IAntTargetGeneratorProvider;
+ }
+
+ @Override
+ public void execute(IBuildContext context) throws BuildException {
+ Collection antTargets = new ArrayList();
+ Collection discoveredArtifacts = context.getDiscoveredArtifacts();
+ for (IArtifact artifact : discoveredArtifacts) {
+ if (artifact instanceof IAntTargetGenerator) {
+ IAntTargetGenerator antTargetGenerator = (IAntTargetGenerator) artifact;
+ Collection generatedAntTargets = antTargetGenerator.generateAntTargets();
+ for (AntTarget antTarget : generatedAntTargets) {
+ antTargets.add(antTarget);
+ }
+ }
+ }
+ context.addDiscoveredArtifacts(antTargets);
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGenerator.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGenerator.java
index 14779bd..b5421e5 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGenerator.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGenerator.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.ant;
-
-import java.util.Collection;
-
-import de.devboost.buildboost.BuildException;
-import de.devboost.buildboost.model.IArtifact;
-
-public interface IAntTargetGenerator extends IArtifact {
-
- public Collection generateAntTargets() throws BuildException;
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.ant;
+
+import java.util.Collection;
+
+import de.devboost.buildboost.BuildException;
+import de.devboost.buildboost.model.IArtifact;
+
+public interface IAntTargetGenerator extends IArtifact {
+
+ public Collection generateAntTargets() throws BuildException;
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGeneratorProvider.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGeneratorProvider.java
index 06689c0..9c3249c 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGeneratorProvider.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGeneratorProvider.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.ant;
-
-import de.devboost.buildboost.model.IBuildParticipant;
-
-public interface IAntTargetGeneratorProvider extends IBuildParticipant {
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.ant;
+
+import de.devboost.buildboost.model.IBuildParticipant;
+
+public interface IAntTargetGeneratorProvider extends IBuildParticipant {
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/AbstractArtifact.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/AbstractArtifact.java
index df1f042..80bbab2 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/AbstractArtifact.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/AbstractArtifact.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.artifacts;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IDependable;
-import de.devboost.buildboost.model.UnresolvedDependency;
-
-/**
- * AbstractArtifact is a base class for implementing artifact types. It provides
- * common functionality shared across artifact type, for example, the resolution
- * of unresolved dependencies.
- *
- * This class is intended to be subclasses by clients.
- */
-@SuppressWarnings("serial")
-public abstract class AbstractArtifact implements IArtifact, Serializable {
-
- private String identifier;
- private Collection dependencies = new LinkedHashSet();
- private Collection unresolvedDependencies = new LinkedHashSet();
- private Collection resolvedDependencies = new LinkedHashSet();
-
- public String getIdentifier() {
- return identifier;
- }
-
- public Collection getDependencies() {
- return Collections.unmodifiableCollection(dependencies);
- }
-
- public void addDependency(IArtifact artifact) {
- dependencies.add(artifact);
- }
-
- public Collection getUnresolvedDependencies() {
- return unresolvedDependencies;
- }
-
- public Collection getResolvedDependencies() {
- return resolvedDependencies;
- }
-
- protected void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public void resolveDependencies(Collection extends IArtifact> allArtifacts) {
- List resolvedDependencies = new ArrayList();
- for (IArtifact artifact : allArtifacts) {
- for (UnresolvedDependency nextDependency : getUnresolvedDependencies()) {
- if (nextDependency.isFulfilledBy(artifact)) {
- resolvedDependencies.add(nextDependency);
- dependencies.add(artifact);
- }
- }
- getUnresolvedDependencies().removeAll(resolvedDependencies);
- }
- }
-
- @Override
- public long getTimestamp() {
- return -1;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " [" + getIdentifier() + "]";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.artifacts;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IDependable;
+import de.devboost.buildboost.model.UnresolvedDependency;
+
+/**
+ * AbstractArtifact is a base class for implementing artifact types. It provides
+ * common functionality shared across artifact type, for example, the resolution
+ * of unresolved dependencies.
+ *
+ * This class is intended to be subclasses by clients.
+ */
+@SuppressWarnings("serial")
+public abstract class AbstractArtifact implements IArtifact, Serializable {
+
+ private String identifier;
+ private Collection dependencies = new LinkedHashSet();
+ private Collection unresolvedDependencies = new LinkedHashSet();
+ private Collection resolvedDependencies = new LinkedHashSet();
+
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public Collection getDependencies() {
+ return Collections.unmodifiableCollection(dependencies);
+ }
+
+ public void addDependency(IArtifact artifact) {
+ dependencies.add(artifact);
+ }
+
+ public Collection getUnresolvedDependencies() {
+ return unresolvedDependencies;
+ }
+
+ public Collection getResolvedDependencies() {
+ return resolvedDependencies;
+ }
+
+ protected void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ public void resolveDependencies(Collection extends IArtifact> allArtifacts) {
+ List resolvedDependencies = new ArrayList();
+ for (IArtifact artifact : allArtifacts) {
+ for (UnresolvedDependency nextDependency : getUnresolvedDependencies()) {
+ if (nextDependency.isFulfilledBy(artifact)) {
+ resolvedDependencies.add(nextDependency);
+ dependencies.add(artifact);
+ }
+ }
+ getUnresolvedDependencies().removeAll(resolvedDependencies);
+ }
+ }
+
+ @Override
+ public long getTimestamp() {
+ return -1;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " [" + getIdentifier() + "]";
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/EclipseFeature.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/EclipseFeature.java
index 60785cc..ee39316 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/EclipseFeature.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/EclipseFeature.java
@@ -1,161 +1,161 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.artifacts;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import de.devboost.buildboost.model.IDependable;
-import de.devboost.buildboost.model.UnresolvedDependency;
-import de.devboost.buildboost.util.AbstractXMLReader;
-
-public class EclipseFeature extends AbstractArtifact implements Serializable {
-
- private static final long serialVersionUID = 8136940018246598015L;
-
- private static final String FEATURE_XML = "feature.xml";
-
- private File file;
-
- private Set containedPluginIDs = new LinkedHashSet();
-
- public EclipseFeature(File file) {
- super();
- this.file = file;
- if (file.getName().equals(FEATURE_XML)) {
- try {
- readFeatureInputStream(new FileInputStream(file));
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- } else {
- // this is JAR
- try {
- ZipFile jar = new ZipFile(file);
- ZipEntry entry = jar.getEntry(FEATURE_XML);
- InputStream is = jar.getInputStream(entry);
- readFeatureInputStream(is);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- private void readFeatureInputStream(InputStream is) {
- AbstractXMLReader xmlUtil = new AbstractXMLReader() {
-
- private boolean searchingContainedPlugins = false;
-
- @Override
- protected void process(Document document, XPath xpath)
- throws XPathExpressionException {
- findIdentifier(document, xpath);
- searchingContainedPlugins = true;
- findContainedPluginDependencies(document, xpath);
- searchingContainedPlugins = false;
- findFeatureDependencies(document, xpath);
- findPluginDependencies(document, xpath);
- }
-
- @Override
- protected void addUnresolvedDependencies(Element element,
- UnresolvedDependency unresolvedDependency) {
- // we exclude dependencies that are specific to a particular OS
- // or windowing system
- boolean isOsIndependent = isAttributeNotSet(element, "os");
- isOsIndependent &= isAttributeNotSet(element, "ws");
- if (isOsIndependent) {
- getUnresolvedDependencies().add(unresolvedDependency);
- if (searchingContainedPlugins) {
- containedPluginIDs.add(unresolvedDependency.getIdentifier());
- }
- }
- }
-
- private boolean isAttributeNotSet(Element element, String attributeName) {
- String value = element.getAttribute(attributeName);
- boolean isNotSet = value == null || "".equals(value.trim());
- return isNotSet;
- }
-
- private void findIdentifier(Document document, XPath xpath) throws XPathExpressionException {
- Element element = (Element) xpath.evaluate("//feature", document, XPathConstants.NODE);
- setIdentifier(element.getAttribute("id"));
- }
-
- private void findContainedPluginDependencies(Document document, XPath xpath)
- throws XPathExpressionException {
- findDependencies(document, xpath, "//plugin", "id", "fragment", Plugin.class);
- }
-
- private void findFeatureDependencies(Document document, XPath xpath)
- throws XPathExpressionException {
- // TODO deactivated, because this information only becomes important at installation time
- // and installation is (currently) always performed against external p2-repositories
- // and not against the artifacts that are discovered in the build process
- //findDependencies(document, xpath, "//import", "feature", null, EclipseFeature.class);
- }
-
- private void findPluginDependencies(Document document, XPath xpath)
- throws XPathExpressionException {
- // TODO deactivated (see above)
- //findDependencies(document, xpath, "//import", "plugin", null, Plugin.class);
- }
- };
-
- xmlUtil.readXMLStrem(is);
- }
-
- public Collection getPlugins() {
- Set plugins = new LinkedHashSet();
- Collection dependencies = getDependencies();
- for (IDependable dependency : dependencies) {
- if (dependency instanceof Plugin) {
- Plugin plugin = (Plugin) dependency;
- if (containedPluginIDs.contains(plugin.getIdentifier())) {
- plugins.add(plugin);
- }
- }
- }
- return Collections.unmodifiableSet(plugins);
- }
-
- public File getFile() {
- return file;
- }
-
- @Override
- public long getTimestamp() {
- return file.lastModified();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.artifacts;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import de.devboost.buildboost.model.IDependable;
+import de.devboost.buildboost.model.UnresolvedDependency;
+import de.devboost.buildboost.util.AbstractXMLReader;
+
+public class EclipseFeature extends AbstractArtifact implements Serializable {
+
+ private static final long serialVersionUID = 8136940018246598015L;
+
+ private static final String FEATURE_XML = "feature.xml";
+
+ private File file;
+
+ private Set containedPluginIDs = new LinkedHashSet();
+
+ public EclipseFeature(File file) {
+ super();
+ this.file = file;
+ if (file.getName().equals(FEATURE_XML)) {
+ try {
+ readFeatureInputStream(new FileInputStream(file));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ } else {
+ // this is JAR
+ try {
+ ZipFile jar = new ZipFile(file);
+ ZipEntry entry = jar.getEntry(FEATURE_XML);
+ InputStream is = jar.getInputStream(entry);
+ readFeatureInputStream(is);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void readFeatureInputStream(InputStream is) {
+ AbstractXMLReader xmlUtil = new AbstractXMLReader() {
+
+ private boolean searchingContainedPlugins = false;
+
+ @Override
+ protected void process(Document document, XPath xpath)
+ throws XPathExpressionException {
+ findIdentifier(document, xpath);
+ searchingContainedPlugins = true;
+ findContainedPluginDependencies(document, xpath);
+ searchingContainedPlugins = false;
+ findFeatureDependencies(document, xpath);
+ findPluginDependencies(document, xpath);
+ }
+
+ @Override
+ protected void addUnresolvedDependencies(Element element,
+ UnresolvedDependency unresolvedDependency) {
+ // we exclude dependencies that are specific to a particular OS
+ // or windowing system
+ boolean isOsIndependent = isAttributeNotSet(element, "os");
+ isOsIndependent &= isAttributeNotSet(element, "ws");
+ if (isOsIndependent) {
+ getUnresolvedDependencies().add(unresolvedDependency);
+ if (searchingContainedPlugins) {
+ containedPluginIDs.add(unresolvedDependency.getIdentifier());
+ }
+ }
+ }
+
+ private boolean isAttributeNotSet(Element element, String attributeName) {
+ String value = element.getAttribute(attributeName);
+ boolean isNotSet = value == null || "".equals(value.trim());
+ return isNotSet;
+ }
+
+ private void findIdentifier(Document document, XPath xpath) throws XPathExpressionException {
+ Element element = (Element) xpath.evaluate("//feature", document, XPathConstants.NODE);
+ setIdentifier(element.getAttribute("id"));
+ }
+
+ private void findContainedPluginDependencies(Document document, XPath xpath)
+ throws XPathExpressionException {
+ findDependencies(document, xpath, "//plugin", "id", "fragment", Plugin.class);
+ }
+
+ private void findFeatureDependencies(Document document, XPath xpath)
+ throws XPathExpressionException {
+ // TODO deactivated, because this information only becomes important at installation time
+ // and installation is (currently) always performed against external p2-repositories
+ // and not against the artifacts that are discovered in the build process
+ //findDependencies(document, xpath, "//import", "feature", null, EclipseFeature.class);
+ }
+
+ private void findPluginDependencies(Document document, XPath xpath)
+ throws XPathExpressionException {
+ // TODO deactivated (see above)
+ //findDependencies(document, xpath, "//import", "plugin", null, Plugin.class);
+ }
+ };
+
+ xmlUtil.readXMLStrem(is);
+ }
+
+ public Collection getPlugins() {
+ Set plugins = new LinkedHashSet();
+ Collection dependencies = getDependencies();
+ for (IDependable dependency : dependencies) {
+ if (dependency instanceof Plugin) {
+ Plugin plugin = (Plugin) dependency;
+ if (containedPluginIDs.contains(plugin.getIdentifier())) {
+ plugins.add(plugin);
+ }
+ }
+ }
+ return Collections.unmodifiableSet(plugins);
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return file.lastModified();
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/Plugin.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/Plugin.java
index 4e96c50..43b7803 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/Plugin.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/Plugin.java
@@ -1,426 +1,426 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.artifacts;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import de.devboost.buildboost.discovery.reader.DotClasspathReader;
-import de.devboost.buildboost.discovery.reader.ManifestReader;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IDependable;
-import de.devboost.buildboost.model.IFileArtifact;
-import de.devboost.buildboost.model.UnresolvedDependency;
-
-/**
- * A Plug-in represents an OSGi bundle (i.e., an Eclipse plug-in) that is either
- * found in a target platform (e.g., an Eclipse distribution) or that is part
- * of the workspace that is subject to the build process.
- */
-public class Plugin extends AbstractArtifact implements IFileArtifact, Serializable {
-
- private static final long serialVersionUID = 7995849293974638695L;
-
- /**
- * The set of plug-in fragments that complement this plug-in.
- */
- private Set fragments = new LinkedHashSet();
- private Plugin fragmentHost = null;
-
- /**
- * The plug-in that is complemented by this plug-in (if this plug-in is a
- * fragment).
- */
- private UnresolvedDependency unresolvedFragmentHost;
-
- /**
- * The libraries that are required by this plug-in.
- */
- private Set libs = new LinkedHashSet();
-
- /**
- * The location of this plug-in. This can be either a directory or a JAR
- * file.
- */
- protected File location;
-
- /**
- * The absolute path to the location of the plug-in. Stored for performance
- * reasons only.
- */
- private String absolutePath;
-
- private Set allLibs;
-
- private Set allDependencies;
-
- private Set exportedPackages;
-
- /**
- * Create a descriptor for the plug-in at the given location. Reads the
- * manifest and class path information if available.
- *
- * @param location
- * @throws IOException
- * @throws Exception
- */
- public Plugin(File location) throws IOException {
- super();
- this.location = location;
- analyzeManifest();
- analyzeClassPath();
- }
-
- private void analyzeManifest() throws IOException {
- InputStream manifestInputStream = getManifestInputStream();
- if (manifestInputStream == null) {
- setIdentifier(location.getName());
- exportedPackages = Collections.emptySet();
- } else {
- ManifestReader reader = new ManifestReader(manifestInputStream);
- manifestInputStream.close();
-
- Set unresolvedDependencies = reader.getDependencies();
- getUnresolvedDependencies().addAll(unresolvedDependencies);
- unresolvedFragmentHost = reader.getFragmentHost();
- libs.addAll(reader.getBundleClassPath());
- addWebLibraries();
-
- setIdentifier(reader.getSymbolicName());
-
- Set exportedPackageName = reader.getExportedPackages();
- exportedPackages = new LinkedHashSet();
- for (String packageName : exportedPackageName) {
- exportedPackages.add(new Package(packageName, this));
- }
- }
- }
-
- private void addWebLibraries() {
- // TODO this belongs somewhere else
- if (location.isDirectory()) {
- File webLibsDir = new File(new File(new File(location, "WebContent"), "WEB-INF"), "lib");
- if (webLibsDir.exists()) {
- File[] webLibs = webLibsDir.listFiles(new FileFilter() {
-
- public boolean accept(File file) {
- return file.isFile() && file.getName().endsWith(".jar");
- }
- });
- if (webLibs == null) {
- return;
- }
- for (File webLib : webLibs) {
- try {
- String relativePath = webLib.getCanonicalFile().getAbsolutePath().substring(location.getCanonicalFile().getAbsolutePath().length() + 1);
- libs.add(relativePath);
- } catch (IOException e) {
- // TODO handle exception
- System.out.println("IOException: " + e.getMessage());
- }
- }
- }
- }
- }
-
- /**
- * Resolves all unresolved dependencies (denoted by symbolic names) by
- * replacing them with actual references to plug-in objects in the given set
- * of available plug-ins.
- *
- * @param allArtifacts all artifacts that were discovered
- */
- @Override
- public void resolveDependencies(Collection extends IArtifact> allArtifacts) {
- for (IArtifact artifact : allArtifacts) {
- Collection resolvedDependencies = getResolvedDependencies();
- Collection unresolvedDependencies = getUnresolvedDependencies();
-
- for (UnresolvedDependency dependency : unresolvedDependencies) {
- if (dependency.isFulfilledBy(artifact)) {
- addDependency(artifact);
- resolvedDependencies.add(dependency);
- }
- }
- // --- inserted in superclass code ----
- if (artifact instanceof Plugin) {
- Plugin plugin = (Plugin) artifact;
- if (unresolvedFragmentHost != null && unresolvedFragmentHost.isFulfilledBy(plugin)) {
- plugin.addFragment(this);
- fragmentHost = plugin;
- addDependency(plugin);
- }
- }
- // ---
- unresolvedDependencies.removeAll(resolvedDependencies);
- }
- }
-
- private void addFragment(Plugin pluginFragment) {
- fragments.add(pluginFragment);
- }
-
- private Collection getPluginDependencies() {
- Collection result = new LinkedHashSet();
- for (IDependable artifact : getDependencies()) {
- if (artifact instanceof Plugin) {
- Plugin plugin = (Plugin) artifact;
- result.add(plugin);
- if (getFragmentHost() != null) {
- result.add(getFragmentHost());
- }
- }
- if (artifact instanceof Package) {
- Package p = (Package) artifact;
- result.add(p.getExportingPlugin());
- }
- }
- return Collections.unmodifiableCollection(result);
- }
-
- /**
- * Returns all plug-ins that this plug-in depends on, except the ones that
- * are part of the target platform.
- */
- public Set getDependenciesExcludingTargetPlatform() {
- Set result = new LinkedHashSet();
- for (IDependable dependency : getDependencies()) {
- if (dependency instanceof Plugin) {
- Plugin plugin = (Plugin) dependency;
- if (!plugin.isProject()) {
- continue;
- }
- result.add(plugin);
- }
- }
- return Collections.unmodifiableSet(result);
- }
-
- public Set getExportedPackages() {
- return exportedPackages;
- }
-
- public Set getLibs() {
- return libs;
- }
-
- /**
- * Returns all dependencies transitively.
- */
- public Set getAllDependencies() {
- if (allDependencies == null) {
- Collection pluginDependencies = getPluginDependencies();
-
- allDependencies = new LinkedHashSet();
- allDependencies.addAll(pluginDependencies);
- allDependencies.addAll(fragments);
-
- for (Plugin dependency : pluginDependencies) {
- allDependencies.addAll(dependency.getAllDependencies());
- }
- for (Plugin fragment : fragments) {
- allDependencies.addAll(fragment.getAllDependencies());
- }
- }
- return allDependencies;
- }
-
- /**
- * Returns the absolute paths of all libraries (transitively).
- */
- public Set getAllLibPaths() {
- if (allLibs == null) {
- allLibs = new LinkedHashSet();
- for (String lib : getLibs()) {
- allLibs.add(getAbsoluteLibPath(lib));
- }
- for (Plugin dependency : getPluginDependencies()) {
- allLibs.addAll(dependency.getAllLibPaths());
- }
- }
- return allLibs;
- }
-
- /**
- * Returns the absolute path of the given library.
- */
- public String getAbsoluteLibPath(String lib) {
- String prefix = getAbsolutePath() + "/";
- if (lib.startsWith("/")) {
- // absolute paths to libraries must be handled differently
- return prefix + ".." + lib;
- } else {
- return prefix + lib;
- }
- }
-
- public File getLocation() {
- return location;
- }
-
- public String getAbsolutePath() {
- if (absolutePath == null) {
- absolutePath = location.getAbsolutePath();
- }
- return absolutePath;
- }
-
- /**
- * Returns the source folders of this plug-in, if there are any.
- */
- public File[] getSourceFolders() {
- if (location.isFile()) {
- return new File[0];
- }
- File[] sourceFolders = location.listFiles(new FileFilter() {
-
- public boolean accept(File pathname) {
- return pathname.getName().equals("src") ||
- pathname.getName().startsWith("src-") ||
- pathname.getName().equals("xtend-gen");
- }
- });
- if (sourceFolders == null) {
- return new File[0];
- }
- return sourceFolders;
- }
-
- /**
- * Checks whether this plug-in depends on the given other plug-in.
- */
- public boolean dependsOn(Plugin otherPlugin) {
- // check direct dependency
- if (getDependencies().contains(otherPlugin)) {
- return true;
- }
- for (Plugin dependency : getPluginDependencies()) {
- if (dependency.dependsOn(otherPlugin)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((getIdentifier() == null) ? 0 : getIdentifier().hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Plugin other = (Plugin) obj;
- if (getIdentifier() == null) {
- if (other.getIdentifier() != null)
- return false;
- } else if (!getIdentifier().equals(other.getIdentifier()))
- return false;
- return true;
- }
-
- public boolean hasManifest() {
- return getManifestFile().exists();
- }
-
- /**
- * Returns an input stream to access the manifest of this plug-in.
- */
- private InputStream getManifestInputStream() throws IOException {
- File pluginLocation = getLocation();
- if (pluginLocation.isFile()) {
- ZipFile zipFile = new ZipFile(pluginLocation);
- ZipEntry manifestEntry = zipFile.getEntry("META-INF/MANIFEST.MF");
- if (manifestEntry == null) {
- return null;
- }
- InputStream inputStream = zipFile.getInputStream(manifestEntry);
- return inputStream;
- } else {
- File manifest = getManifestFile();
- if (!manifest.exists()) {
- System.out.println("INFO: Project without MANIFEST: " + getLocation().getName());
- return null;
- }
- return new FileInputStream(manifest);
- }
- }
-
- private File getManifestFile() {
- File manifest = new File(new File(getLocation(), "META-INF"), "MANIFEST.MF");
- return manifest;
- }
-
- private void analyzeClassPath() throws IOException {
- InputStream dotClassPathInputStream = getDotClasspathInputStream();
- if (dotClassPathInputStream != null) {
- this.libs.addAll(new DotClasspathReader(dotClassPathInputStream).getDependencies());
- dotClassPathInputStream.close();
- }
- }
-
- private InputStream getDotClasspathInputStream() throws FileNotFoundException {
- File pluginLocation = getLocation();
- if (pluginLocation.isDirectory()) {
- File dotClassPathFile = new File(pluginLocation, ".classpath");
- if (!dotClassPathFile.exists()) {
- return null;
- }
- return new FileInputStream(dotClassPathFile);
- } else {
- // JARs do usually not contain .classpath files since they contain
- // compiled plug-ins.
- return null;
- }
- }
-
- public boolean isExperimental() {
- return new File(getAbsolutePath(), "EXPERIMENTAL").exists();
- }
-
- public boolean isProject() {
- return true;
- }
-
- public Plugin getFragmentHost() {
- return fragmentHost;
- }
-
- public File getFile() {
- return getLocation();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.artifacts;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import de.devboost.buildboost.discovery.reader.DotClasspathReader;
+import de.devboost.buildboost.discovery.reader.ManifestReader;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IDependable;
+import de.devboost.buildboost.model.IFileArtifact;
+import de.devboost.buildboost.model.UnresolvedDependency;
+
+/**
+ * A Plug-in represents an OSGi bundle (i.e., an Eclipse plug-in) that is either
+ * found in a target platform (e.g., an Eclipse distribution) or that is part
+ * of the workspace that is subject to the build process.
+ */
+public class Plugin extends AbstractArtifact implements IFileArtifact, Serializable {
+
+ private static final long serialVersionUID = 7995849293974638695L;
+
+ /**
+ * The set of plug-in fragments that complement this plug-in.
+ */
+ private Set fragments = new LinkedHashSet();
+ private Plugin fragmentHost = null;
+
+ /**
+ * The plug-in that is complemented by this plug-in (if this plug-in is a
+ * fragment).
+ */
+ private UnresolvedDependency unresolvedFragmentHost;
+
+ /**
+ * The libraries that are required by this plug-in.
+ */
+ private Set libs = new LinkedHashSet();
+
+ /**
+ * The location of this plug-in. This can be either a directory or a JAR
+ * file.
+ */
+ protected File location;
+
+ /**
+ * The absolute path to the location of the plug-in. Stored for performance
+ * reasons only.
+ */
+ private String absolutePath;
+
+ private Set allLibs;
+
+ private Set allDependencies;
+
+ private Set exportedPackages;
+
+ /**
+ * Create a descriptor for the plug-in at the given location. Reads the
+ * manifest and class path information if available.
+ *
+ * @param location
+ * @throws IOException
+ * @throws Exception
+ */
+ public Plugin(File location) throws IOException {
+ super();
+ this.location = location;
+ analyzeManifest();
+ analyzeClassPath();
+ }
+
+ private void analyzeManifest() throws IOException {
+ InputStream manifestInputStream = getManifestInputStream();
+ if (manifestInputStream == null) {
+ setIdentifier(location.getName());
+ exportedPackages = Collections.emptySet();
+ } else {
+ ManifestReader reader = new ManifestReader(manifestInputStream);
+ manifestInputStream.close();
+
+ Set unresolvedDependencies = reader.getDependencies();
+ getUnresolvedDependencies().addAll(unresolvedDependencies);
+ unresolvedFragmentHost = reader.getFragmentHost();
+ libs.addAll(reader.getBundleClassPath());
+ addWebLibraries();
+
+ setIdentifier(reader.getSymbolicName());
+
+ Set exportedPackageName = reader.getExportedPackages();
+ exportedPackages = new LinkedHashSet();
+ for (String packageName : exportedPackageName) {
+ exportedPackages.add(new Package(packageName, this));
+ }
+ }
+ }
+
+ private void addWebLibraries() {
+ // TODO this belongs somewhere else
+ if (location.isDirectory()) {
+ File webLibsDir = new File(new File(new File(location, "WebContent"), "WEB-INF"), "lib");
+ if (webLibsDir.exists()) {
+ File[] webLibs = webLibsDir.listFiles(new FileFilter() {
+
+ public boolean accept(File file) {
+ return file.isFile() && file.getName().endsWith(".jar");
+ }
+ });
+ if (webLibs == null) {
+ return;
+ }
+ for (File webLib : webLibs) {
+ try {
+ String relativePath = webLib.getCanonicalFile().getAbsolutePath().substring(location.getCanonicalFile().getAbsolutePath().length() + 1);
+ libs.add(relativePath);
+ } catch (IOException e) {
+ // TODO handle exception
+ System.out.println("IOException: " + e.getMessage());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Resolves all unresolved dependencies (denoted by symbolic names) by
+ * replacing them with actual references to plug-in objects in the given set
+ * of available plug-ins.
+ *
+ * @param allArtifacts all artifacts that were discovered
+ */
+ @Override
+ public void resolveDependencies(Collection extends IArtifact> allArtifacts) {
+ for (IArtifact artifact : allArtifacts) {
+ Collection resolvedDependencies = getResolvedDependencies();
+ Collection unresolvedDependencies = getUnresolvedDependencies();
+
+ for (UnresolvedDependency dependency : unresolvedDependencies) {
+ if (dependency.isFulfilledBy(artifact)) {
+ addDependency(artifact);
+ resolvedDependencies.add(dependency);
+ }
+ }
+ // --- inserted in superclass code ----
+ if (artifact instanceof Plugin) {
+ Plugin plugin = (Plugin) artifact;
+ if (unresolvedFragmentHost != null && unresolvedFragmentHost.isFulfilledBy(plugin)) {
+ plugin.addFragment(this);
+ fragmentHost = plugin;
+ addDependency(plugin);
+ }
+ }
+ // ---
+ unresolvedDependencies.removeAll(resolvedDependencies);
+ }
+ }
+
+ private void addFragment(Plugin pluginFragment) {
+ fragments.add(pluginFragment);
+ }
+
+ private Collection getPluginDependencies() {
+ Collection result = new LinkedHashSet();
+ for (IDependable artifact : getDependencies()) {
+ if (artifact instanceof Plugin) {
+ Plugin plugin = (Plugin) artifact;
+ result.add(plugin);
+ if (getFragmentHost() != null) {
+ result.add(getFragmentHost());
+ }
+ }
+ if (artifact instanceof Package) {
+ Package p = (Package) artifact;
+ result.add(p.getExportingPlugin());
+ }
+ }
+ return Collections.unmodifiableCollection(result);
+ }
+
+ /**
+ * Returns all plug-ins that this plug-in depends on, except the ones that
+ * are part of the target platform.
+ */
+ public Set getDependenciesExcludingTargetPlatform() {
+ Set result = new LinkedHashSet();
+ for (IDependable dependency : getDependencies()) {
+ if (dependency instanceof Plugin) {
+ Plugin plugin = (Plugin) dependency;
+ if (!plugin.isProject()) {
+ continue;
+ }
+ result.add(plugin);
+ }
+ }
+ return Collections.unmodifiableSet(result);
+ }
+
+ public Set getExportedPackages() {
+ return exportedPackages;
+ }
+
+ public Set getLibs() {
+ return libs;
+ }
+
+ /**
+ * Returns all dependencies transitively.
+ */
+ public Set getAllDependencies() {
+ if (allDependencies == null) {
+ Collection pluginDependencies = getPluginDependencies();
+
+ allDependencies = new LinkedHashSet();
+ allDependencies.addAll(pluginDependencies);
+ allDependencies.addAll(fragments);
+
+ for (Plugin dependency : pluginDependencies) {
+ allDependencies.addAll(dependency.getAllDependencies());
+ }
+ for (Plugin fragment : fragments) {
+ allDependencies.addAll(fragment.getAllDependencies());
+ }
+ }
+ return allDependencies;
+ }
+
+ /**
+ * Returns the absolute paths of all libraries (transitively).
+ */
+ public Set getAllLibPaths() {
+ if (allLibs == null) {
+ allLibs = new LinkedHashSet();
+ for (String lib : getLibs()) {
+ allLibs.add(getAbsoluteLibPath(lib));
+ }
+ for (Plugin dependency : getPluginDependencies()) {
+ allLibs.addAll(dependency.getAllLibPaths());
+ }
+ }
+ return allLibs;
+ }
+
+ /**
+ * Returns the absolute path of the given library.
+ */
+ public String getAbsoluteLibPath(String lib) {
+ String prefix = getAbsolutePath() + "/";
+ if (lib.startsWith("/")) {
+ // absolute paths to libraries must be handled differently
+ return prefix + ".." + lib;
+ } else {
+ return prefix + lib;
+ }
+ }
+
+ public File getLocation() {
+ return location;
+ }
+
+ public String getAbsolutePath() {
+ if (absolutePath == null) {
+ absolutePath = location.getAbsolutePath();
+ }
+ return absolutePath;
+ }
+
+ /**
+ * Returns the source folders of this plug-in, if there are any.
+ */
+ public File[] getSourceFolders() {
+ if (location.isFile()) {
+ return new File[0];
+ }
+ File[] sourceFolders = location.listFiles(new FileFilter() {
+
+ public boolean accept(File pathname) {
+ return pathname.getName().equals("src") ||
+ pathname.getName().startsWith("src-") ||
+ pathname.getName().equals("xtend-gen");
+ }
+ });
+ if (sourceFolders == null) {
+ return new File[0];
+ }
+ return sourceFolders;
+ }
+
+ /**
+ * Checks whether this plug-in depends on the given other plug-in.
+ */
+ public boolean dependsOn(Plugin otherPlugin) {
+ // check direct dependency
+ if (getDependencies().contains(otherPlugin)) {
+ return true;
+ }
+ for (Plugin dependency : getPluginDependencies()) {
+ if (dependency.dependsOn(otherPlugin)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((getIdentifier() == null) ? 0 : getIdentifier().hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Plugin other = (Plugin) obj;
+ if (getIdentifier() == null) {
+ if (other.getIdentifier() != null)
+ return false;
+ } else if (!getIdentifier().equals(other.getIdentifier()))
+ return false;
+ return true;
+ }
+
+ public boolean hasManifest() {
+ return getManifestFile().exists();
+ }
+
+ /**
+ * Returns an input stream to access the manifest of this plug-in.
+ */
+ private InputStream getManifestInputStream() throws IOException {
+ File pluginLocation = getLocation();
+ if (pluginLocation.isFile()) {
+ ZipFile zipFile = new ZipFile(pluginLocation);
+ ZipEntry manifestEntry = zipFile.getEntry("META-INF/MANIFEST.MF");
+ if (manifestEntry == null) {
+ return null;
+ }
+ InputStream inputStream = zipFile.getInputStream(manifestEntry);
+ return inputStream;
+ } else {
+ File manifest = getManifestFile();
+ if (!manifest.exists()) {
+ System.out.println("INFO: Project without MANIFEST: " + getLocation().getName());
+ return null;
+ }
+ return new FileInputStream(manifest);
+ }
+ }
+
+ private File getManifestFile() {
+ File manifest = new File(new File(getLocation(), "META-INF"), "MANIFEST.MF");
+ return manifest;
+ }
+
+ private void analyzeClassPath() throws IOException {
+ InputStream dotClassPathInputStream = getDotClasspathInputStream();
+ if (dotClassPathInputStream != null) {
+ this.libs.addAll(new DotClasspathReader(dotClassPathInputStream).getDependencies());
+ dotClassPathInputStream.close();
+ }
+ }
+
+ private InputStream getDotClasspathInputStream() throws FileNotFoundException {
+ File pluginLocation = getLocation();
+ if (pluginLocation.isDirectory()) {
+ File dotClassPathFile = new File(pluginLocation, ".classpath");
+ if (!dotClassPathFile.exists()) {
+ return null;
+ }
+ return new FileInputStream(dotClassPathFile);
+ } else {
+ // JARs do usually not contain .classpath files since they contain
+ // compiled plug-ins.
+ return null;
+ }
+ }
+
+ public boolean isExperimental() {
+ return new File(getAbsolutePath(), "EXPERIMENTAL").exists();
+ }
+
+ public boolean isProject() {
+ return true;
+ }
+
+ public Plugin getFragmentHost() {
+ return fragmentHost;
+ }
+
+ public File getFile() {
+ return getLocation();
+ }
+
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/RepositoriesFile.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/RepositoriesFile.java
index ddc2442..cd67568 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/RepositoriesFile.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/RepositoriesFile.java
@@ -1,143 +1,143 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.artifacts;
-
-import static de.devboost.buildboost.IConstants.BUILD_BOOST_REPOSITORY_URL;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import de.devboost.buildboost.BuildException;
-
-@SuppressWarnings("serial")
-public class RepositoriesFile extends AbstractArtifact {
-
- public static String SUB_DIR_SEPARATOR = "!";
-
- public static String[] SUPPORTED_TYPES = { "svn:", "git:", "get:" };
-
- public class Location {
- private String type;
- private String url;
- private Set subDirectories;
-
- public Location(String type, String url) {
- super();
- this.type = type;
- this.url = url;
- this.subDirectories = new LinkedHashSet();
- //TODO we wouldn't need this if we create an extra repository for extensions
- if (BUILD_BOOST_REPOSITORY_URL.equals(url)) {
- subDirectories.add("Core/");
- subDirectories.add("Universal/");
- }
- }
-
- public String getType() {
- return type;
- }
-
- public String getUrl() {
- return url;
- }
-
- public Set getSubDirectories() {
- return subDirectories;
- }
-
- }
-
- private File file;
- private Map locations;
-
- public RepositoriesFile(File file) throws BuildException {
- this.file = file;
- setIdentifier(file.getName());
- readContent(file);
- }
-
- private void readContent(File file) throws BuildException {
- locations = new LinkedHashMap();
- try {
- BufferedReader reader = new BufferedReader(new FileReader(file));
- String locationString;
- readLine: while((locationString = reader.readLine()) != null) {
- locationString = locationString.trim();
- if (isComment(locationString)) {
- continue readLine;
- }
- for (String supportedType : SUPPORTED_TYPES) {
- if (locationString.startsWith(supportedType)) {
- String type = supportedType.substring(0, supportedType.length() - 1);
- String url = locationString.substring(supportedType.length()).trim();
- String subDirectory = null;
- int idx = url.lastIndexOf(SUB_DIR_SEPARATOR);
- if (idx != -1) {
- subDirectory = url.substring(idx + 1);
- url = url.substring(0, idx);
- }
- Location location = locations.get(url);
- if (location == null) {
- location = new Location(type, url);
- locations.put(url, location);
- }
- if (subDirectory != null) {
- location.getSubDirectories().add(subDirectory);
- }
- continue readLine;
- }
- }
-
- reader.close();
- throw new BuildException("Cannot handle repository location: " + locationString);
- }
- reader.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- private boolean isComment(String locationString) {
- if (locationString.isEmpty()) {
- return true;
- }
- if (locationString.startsWith("//")) {
- return true;
- }
- return false;
- }
-
- public File getFile() {
- return file;
- }
-
- @Override
- public long getTimestamp() {
- return file.lastModified();
- }
-
- public List getLocations() {
- return new ArrayList(locations.values());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.artifacts;
+
+import static de.devboost.buildboost.IConstants.BUILD_BOOST_REPOSITORY_URL;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import de.devboost.buildboost.BuildException;
+
+@SuppressWarnings("serial")
+public class RepositoriesFile extends AbstractArtifact {
+
+ public static String SUB_DIR_SEPARATOR = "!";
+
+ public static String[] SUPPORTED_TYPES = { "svn:", "git:", "get:" };
+
+ public class Location {
+ private String type;
+ private String url;
+ private Set subDirectories;
+
+ public Location(String type, String url) {
+ super();
+ this.type = type;
+ this.url = url;
+ this.subDirectories = new LinkedHashSet();
+ //TODO we wouldn't need this if we create an extra repository for extensions
+ if (BUILD_BOOST_REPOSITORY_URL.equals(url)) {
+ subDirectories.add("Core/");
+ subDirectories.add("Universal/");
+ }
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public Set getSubDirectories() {
+ return subDirectories;
+ }
+
+ }
+
+ private File file;
+ private Map locations;
+
+ public RepositoriesFile(File file) throws BuildException {
+ this.file = file;
+ setIdentifier(file.getName());
+ readContent(file);
+ }
+
+ private void readContent(File file) throws BuildException {
+ locations = new LinkedHashMap();
+ try {
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+ String locationString;
+ readLine: while((locationString = reader.readLine()) != null) {
+ locationString = locationString.trim();
+ if (isComment(locationString)) {
+ continue readLine;
+ }
+ for (String supportedType : SUPPORTED_TYPES) {
+ if (locationString.startsWith(supportedType)) {
+ String type = supportedType.substring(0, supportedType.length() - 1);
+ String url = locationString.substring(supportedType.length()).trim();
+ String subDirectory = null;
+ int idx = url.lastIndexOf(SUB_DIR_SEPARATOR);
+ if (idx != -1) {
+ subDirectory = url.substring(idx + 1);
+ url = url.substring(0, idx);
+ }
+ Location location = locations.get(url);
+ if (location == null) {
+ location = new Location(type, url);
+ locations.put(url, location);
+ }
+ if (subDirectory != null) {
+ location.getSubDirectories().add(subDirectory);
+ }
+ continue readLine;
+ }
+ }
+
+ reader.close();
+ throw new BuildException("Cannot handle repository location: " + locationString);
+ }
+ reader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private boolean isComment(String locationString) {
+ if (locationString.isEmpty()) {
+ return true;
+ }
+ if (locationString.startsWith("//")) {
+ return true;
+ }
+ return false;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return file.lastModified();
+ }
+
+ public List getLocations() {
+ return new ArrayList(locations.values());
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/TargetPlatformZip.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/TargetPlatformZip.java
index 9d12919..677c8f5 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/TargetPlatformZip.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/TargetPlatformZip.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.artifacts;
-
-import java.io.File;
-
-/**
- * A ConcreteSyntaxDefinition represents an EMFText syntax specification (a
- * file with extension 'cs').
- */
-@SuppressWarnings("serial")
-public class TargetPlatformZip extends AbstractArtifact {
-
- private File zipFile;
-
- public TargetPlatformZip(File zipFile) {
- super();
- this.zipFile = zipFile;
- setIdentifier(zipFile.getName());
- }
-
- public File getZipFile() {
- return zipFile;
- }
-
- @Override
- public long getTimestamp() {
- return zipFile.lastModified();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.artifacts;
+
+import java.io.File;
+
+/**
+ * A ConcreteSyntaxDefinition represents an EMFText syntax specification (a
+ * file with extension 'cs').
+ */
+@SuppressWarnings("serial")
+public class TargetPlatformZip extends AbstractArtifact {
+
+ private File zipFile;
+
+ public TargetPlatformZip(File zipFile) {
+ super();
+ this.zipFile = zipFile;
+ setIdentifier(zipFile.getName());
+ }
+
+ public File getZipFile() {
+ return zipFile;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return zipFile.lastModified();
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/AbstractArtifactDiscoverer.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/AbstractArtifactDiscoverer.java
index e8c13a6..fc86eb5 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/AbstractArtifactDiscoverer.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/AbstractArtifactDiscoverer.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.discovery;
-
-import java.util.Collection;
-
-import de.devboost.buildboost.BuildException;
-import de.devboost.buildboost.model.AbstractBuildParticipant;
-import de.devboost.buildboost.model.BuildEventType;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IArtifactDiscoverer;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildListener;
-
-public abstract class AbstractArtifactDiscoverer extends AbstractBuildParticipant
- implements IArtifactDiscoverer {
-
- @Override
- public void execute(IBuildContext context) throws BuildException {
- IBuildListener buildListener = context.getBuildListener();
- buildListener.handleBuildEvent(
- BuildEventType.INFO,
- "Running artifact discoverer: " + this);
- Collection discoveredArtifacts = discoverArtifacts(context);
- context.addDiscoveredArtifacts(discoveredArtifacts);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.discovery;
+
+import java.util.Collection;
+
+import de.devboost.buildboost.BuildException;
+import de.devboost.buildboost.model.AbstractBuildParticipant;
+import de.devboost.buildboost.model.BuildEventType;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IArtifactDiscoverer;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildListener;
+
+public abstract class AbstractArtifactDiscoverer extends AbstractBuildParticipant
+ implements IArtifactDiscoverer {
+
+ @Override
+ public void execute(IBuildContext context) throws BuildException {
+ IBuildListener buildListener = context.getBuildListener();
+ buildListener.handleBuildEvent(
+ BuildEventType.INFO,
+ "Running artifact discoverer: " + this);
+ Collection discoveredArtifacts = discoverArtifacts(context);
+ context.addDiscoveredArtifacts(discoveredArtifacts);
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/AbstractFileFinder.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/AbstractFileFinder.java
index d74e584..c05bfad 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/AbstractFileFinder.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/AbstractFileFinder.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.discovery;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.Collection;
-
-import de.devboost.buildboost.BuildException;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildParticipant;
-
-/**
- * An abstract base class for discoverers that search for files in the
- * workspace that is subject to the current build.
- *
- * @param the type of artifact that is searched for
- */
-public abstract class AbstractFileFinder
- extends AbstractArtifactDiscoverer {
-
- protected File directory;
-
- public AbstractFileFinder(File directory) {
- super();
- this.directory = directory;
- }
-
- protected void traverse(
- IBuildContext context,
- Collection artifacts) throws BuildException {
- traverse(context, directory, artifacts);
- }
-
- /**
- * Traverses the given directory and all its sub folders recursively to
- * find artifacts. Using the two template methods {@link #getFileFilter()}
- * and {@link #createArtifactFromFile(File)} sub classes can determine which
- * files are considered and how these are converted into artifact objects.
- *
- * @param context the context this build is performed in
- * @param directory the root directory where to start the traversal
- * @param artifacts a collection that is used to store the found artifacts
- * @throws BuildException
- */
- protected void traverse(
- IBuildContext context,
- File directory,
- Collection artifacts) throws BuildException {
-
- findFiles(directory, artifacts);
-
- File[] subDirectories = directory.listFiles(getDirectoryFilter());
- if (subDirectories == null) {
- return;
- }
- for (File subDirectory : subDirectories) {
- traverse(context, subDirectory, artifacts);
- }
- }
-
- private void findFiles(File directory, Collection artifacts) throws BuildException {
- File[] files = directory.listFiles(getFileFilter());
- if (files == null) {
- return;
- }
- for (File file : files) {
- artifacts.add(createArtifactFromFile(file));
- }
- }
-
- @Override
- public boolean dependsOn(IBuildParticipant otherParticipant) {
- return false;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "[" + directory.getAbsolutePath() + "]";
- }
-
- protected abstract ArtifactType createArtifactFromFile(File file) throws BuildException;
-
- protected FileFilter getDirectoryFilter() {
- return new FileFilter() {
- public boolean accept(File file) {
- return file.isDirectory();
- }
- };
- }
-
- protected abstract FileFilter getFileFilter();
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.discovery;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.Collection;
+
+import de.devboost.buildboost.BuildException;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.model.IBuildParticipant;
+
+/**
+ * An abstract base class for discoverers that search for files in the
+ * workspace that is subject to the current build.
+ *
+ * @param the type of artifact that is searched for
+ */
+public abstract class AbstractFileFinder
+ extends AbstractArtifactDiscoverer {
+
+ protected File directory;
+
+ public AbstractFileFinder(File directory) {
+ super();
+ this.directory = directory;
+ }
+
+ protected void traverse(
+ IBuildContext context,
+ Collection artifacts) throws BuildException {
+ traverse(context, directory, artifacts);
+ }
+
+ /**
+ * Traverses the given directory and all its sub folders recursively to
+ * find artifacts. Using the two template methods {@link #getFileFilter()}
+ * and {@link #createArtifactFromFile(File)} sub classes can determine which
+ * files are considered and how these are converted into artifact objects.
+ *
+ * @param context the context this build is performed in
+ * @param directory the root directory where to start the traversal
+ * @param artifacts a collection that is used to store the found artifacts
+ * @throws BuildException
+ */
+ protected void traverse(
+ IBuildContext context,
+ File directory,
+ Collection artifacts) throws BuildException {
+
+ findFiles(directory, artifacts);
+
+ File[] subDirectories = directory.listFiles(getDirectoryFilter());
+ if (subDirectories == null) {
+ return;
+ }
+ for (File subDirectory : subDirectories) {
+ traverse(context, subDirectory, artifacts);
+ }
+ }
+
+ private void findFiles(File directory, Collection artifacts) throws BuildException {
+ File[] files = directory.listFiles(getFileFilter());
+ if (files == null) {
+ return;
+ }
+ for (File file : files) {
+ artifacts.add(createArtifactFromFile(file));
+ }
+ }
+
+ @Override
+ public boolean dependsOn(IBuildParticipant otherParticipant) {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + "[" + directory.getAbsolutePath() + "]";
+ }
+
+ protected abstract ArtifactType createArtifactFromFile(File file) throws BuildException;
+
+ protected FileFilter getDirectoryFilter() {
+ return new FileFilter() {
+ public boolean accept(File file) {
+ return file.isDirectory();
+ }
+ };
+ }
+
+ protected abstract FileFilter getFileFilter();
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseFeatureFinder.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseFeatureFinder.java
index ece3c55..c7b7616 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseFeatureFinder.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseFeatureFinder.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.discovery;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-
-import de.devboost.buildboost.artifacts.EclipseFeature;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.util.ArtifactUtil;
-
-/**
- * An {@link EclipseFeatureFinder} can be used to discover Eclipse features
- * (i.e., files with name 'feature.xml').
- *
- * TODO inherit from {@link AbstractFileFinder}?
- */
-public class EclipseFeatureFinder extends AbstractArtifactDiscoverer {
-
- private File directory;
-
- public EclipseFeatureFinder(File directory) {
- this.directory = directory;
- }
-
- public Collection discoverArtifacts(IBuildContext context) {
- Collection features = discoverArtifacts(context, directory);
- return new ArtifactUtil().getSetOfArtifacts(features);
- }
-
- private Collection discoverArtifacts(
- IBuildContext context, File directory) {
-
- Collection features = new ArrayList();
- features.addAll(findFeatureFiles(directory));
- traverseSubDirectories(context, directory, features);
- return features;
- }
-
- private void traverseSubDirectories(IBuildContext context, File directory,
- Collection features) {
- File[] subDirectories = directory.listFiles(new FileFilter() {
-
- public boolean accept(File file) {
- return file.isDirectory();
- }
- });
- if (subDirectories == null) {
- return;
- }
- for (File subDirectory : subDirectories) {
- features.addAll(discoverArtifacts(context, subDirectory));
- }
- }
-
- private Collection findFeatureFiles(File directory) {
- File[] featureXmlFiles = directory.listFiles(new FileFilter() {
-
- public boolean accept(File file) {
- return file.getName().equals("feature.xml");
- }
- });
- if (featureXmlFiles == null) {
- return Collections.emptySet();
- }
-
- Collection features = new ArrayList(featureXmlFiles.length);
- for (File featureXmlFile : featureXmlFiles) {
- features.add(new EclipseFeature(featureXmlFile));
- }
- return features;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006-2012
+ * Software Technology Group, Dresden University of Technology
+ * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
+ *
+ * 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:
+ * Software Technology Group - TU Dresden, Germany;
+ * DevBoost GmbH - Berlin, Germany
+ * - initial API and implementation
+ ******************************************************************************/
+package de.devboost.buildboost.discovery;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import de.devboost.buildboost.artifacts.EclipseFeature;
+import de.devboost.buildboost.model.IArtifact;
+import de.devboost.buildboost.model.IBuildContext;
+import de.devboost.buildboost.util.ArtifactUtil;
+
+/**
+ * An {@link EclipseFeatureFinder} can be used to discover Eclipse features
+ * (i.e., files with name 'feature.xml').
+ *
+ * TODO inherit from {@link AbstractFileFinder}?
+ */
+public class EclipseFeatureFinder extends AbstractArtifactDiscoverer {
+
+ private File directory;
+
+ public EclipseFeatureFinder(File directory) {
+ this.directory = directory;
+ }
+
+ public Collection discoverArtifacts(IBuildContext context) {
+ Collection features = discoverArtifacts(context, directory);
+ return new ArtifactUtil().getSetOfArtifacts(features);
+ }
+
+ private Collection discoverArtifacts(
+ IBuildContext context, File directory) {
+
+ Collection features = new ArrayList();
+ features.addAll(findFeatureFiles(directory));
+ traverseSubDirectories(context, directory, features);
+ return features;
+ }
+
+ private void traverseSubDirectories(IBuildContext context, File directory,
+ Collection features) {
+ File[] subDirectories = directory.listFiles(new FileFilter() {
+
+ public boolean accept(File file) {
+ return file.isDirectory();
+ }
+ });
+ if (subDirectories == null) {
+ return;
+ }
+ for (File subDirectory : subDirectories) {
+ features.addAll(discoverArtifacts(context, subDirectory));
+ }
+ }
+
+ private Collection findFeatureFiles(File directory) {
+ File[] featureXmlFiles = directory.listFiles(new FileFilter() {
+
+ public boolean accept(File file) {
+ return file.getName().equals("feature.xml");
+ }
+ });
+ if (featureXmlFiles == null) {
+ return Collections.emptySet();
+ }
+
+ Collection features = new ArrayList(featureXmlFiles.length);
+ for (File featureXmlFile : featureXmlFiles) {
+ features.add(new EclipseFeature(featureXmlFile));
+ }
+ return features;
+ }
+}
diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseTargetPlatformAnalyzer.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseTargetPlatformAnalyzer.java
index 004f6a2..afc05ff 100644
--- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseTargetPlatformAnalyzer.java
+++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseTargetPlatformAnalyzer.java
@@ -1,270 +1,270 @@
-/*******************************************************************************
- * Copyright (c) 2006-2012
- * Software Technology Group, Dresden University of Technology
- * DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
- *
- * 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:
- * Software Technology Group - TU Dresden, Germany;
- * DevBoost GmbH - Berlin, Germany
- * - initial API and implementation
- ******************************************************************************/
-package de.devboost.buildboost.discovery;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import de.devboost.buildboost.artifacts.CompiledPlugin;
-import de.devboost.buildboost.artifacts.EclipseFeature;
-import de.devboost.buildboost.artifacts.Plugin;
-import de.devboost.buildboost.model.BuildEventType;
-import de.devboost.buildboost.model.IArtifact;
-import de.devboost.buildboost.model.IBuildContext;
-import de.devboost.buildboost.model.IBuildListener;
-import de.devboost.buildboost.util.ArtifactUtil;
-
-/**
- * The EclipseTargetPlatformAnalyzer can be used to scan an Eclipse instance
- * to detect all contained plug-ins. This is required to compile Eclipse
- * plug-in projects that depend on plug-in of an Eclipse target platform.
- */
-//TODO is there a overlap with FeatureFinder?
-public class EclipseTargetPlatformAnalyzer extends AbstractArtifactDiscoverer {
-
- public static final String ARTIFACT_CACHE_FILE_NAME = "artifact_cache.ser";
-
- private interface IArtifactCreator {
-
- public IArtifact create(File file) throws IOException;
- }
-
- private File targetPlatform;
-
- public EclipseTargetPlatformAnalyzer(File targetPlatform) {
- this.targetPlatform = targetPlatform;
- }
-
- //TODO the discover should traverse the folder hierarchy only once.
- // Could we optimize discovering in general such that there is only one traversal each time?
- public Collection discoverArtifacts(IBuildContext context) {
- IBuildListener buildListener = context.getBuildListener();
- buildListener.handleBuildEvent(BuildEventType.INFO, "Analyzing target platform...");
-
- //TODO activate cache
- /*Set cachedArtifacts = loadDiscoveredArtifacts();
- if (cachedArtifacts != null) {
- buildListener.handleBuildEvent(BuildEventType.INFO, "Loaded cached target platform info: " + cachedArtifacts);
- return cachedArtifacts;
- }*/
-
- LinkedHashSet artifacts = new LinkedHashSet();
-
- // first, find plug-ins
- Set pluginJarsAndDirs = findJarFilesAndPluginDirs(targetPlatform, new FileFilter() {
-
- @Override
- public boolean accept(File file) {
- // exclude JUnit 3, because this requires to check the bundle
- // version when resolving dependencies
- // TODO remove this once the versions are checked
- if (file.getName().contains("org.junit_3")) {
- return false;
- }
- if (file.isDirectory() && isPluginDir(file)) {
- return true;
- }
- if (file.isFile() && file.getName().endsWith(".jar")) {
- return true;
- }
- return false;
- }
- });
- Set foundPlugins = analyzeTargetPlatformJarFiles(pluginJarsAndDirs, "plug-in", buildListener, new IArtifactCreator() {
-
- @Override
- public IArtifact create(File file) throws IOException {
- return new CompiledPlugin(file);
- }
- });
- artifacts.addAll(foundPlugins);
-
- // second, find features
- Set featureJarsAndDirs = findJarFilesAndPluginDirs(targetPlatform, new FileFilter() {
-
- @Override
- public boolean accept(File file) {
- if (!file.getParentFile().getName().equals("features")) {
- return false;
- }
- return isFeatureDirOrJar(file);
- }
-
- });
-
- Set foundFeatures = analyzeTargetPlatformJarFiles(featureJarsAndDirs, "feature", buildListener, new IArtifactCreator() {
-
- @Override
- public IArtifact create(File fileDirectoryOrJar) throws IOException {
- if (fileDirectoryOrJar.isDirectory()) {
- return new EclipseFeature(new File(fileDirectoryOrJar, "feature.xml"));
- } else {
- return new EclipseFeature(fileDirectoryOrJar);
- }
- }
- });
-
- artifacts.addAll(foundFeatures);
- saveDiscoveredArtifacts(artifacts);
- return artifacts;
- }
-
- private void saveDiscoveredArtifacts(LinkedHashSet artifacts) {
- try {
- FileOutputStream fos = new FileOutputStream(new File(targetPlatform, ARTIFACT_CACHE_FILE_NAME));
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(artifacts);
- fos.close();
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @SuppressWarnings({ "unchecked", "unused" })
- private Set