From 9f01315132540ef8e615201f7e675cc2913db268 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Wed, 19 Sep 2012 22:24:51 +0200 Subject: [PATCH 01/41] change repository to clone --- .../de/devboost/buildboost/IConstants.java | 72 ++--- .../artifacts/RepositoriesFile.java | 286 +++++++++--------- 2 files changed, 179 insertions(+), 179 deletions(-) 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..aeda57c 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/FunThomas424242/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/artifacts/RepositoriesFile.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/RepositoriesFile.java index ddc2442..b583732 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()); + } +} From bde51e43433f3e4ab916537c3b7e331317e9a1ed Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Wed, 19 Sep 2012 22:39:39 +0200 Subject: [PATCH 02/41] Debug message added --- .../src/de/devboost/buildboost/artifacts/RepositoriesFile.java | 1 + 1 file changed, 1 insertion(+) 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 b583732..ebdf512 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 @@ -110,6 +110,7 @@ private void readContent(File file) throws BuildException { } reader.close(); + System.out.println("INVALID Location:>"+locationString+"<"); //throw new BuildException("Cannot handle repository location: " + locationString); } reader.close(); From 7f9dc28c1c22a84f55b54d11e382f2dec55c87f4 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Wed, 19 Sep 2012 23:47:26 +0200 Subject: [PATCH 03/41] refactoring while / for loops --- .../artifacts/RepositoriesFile.java | 89 +++++++++++-------- 1 file changed, 53 insertions(+), 36 deletions(-) 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 ebdf512..3278d4b 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 @@ -29,26 +29,28 @@ import java.util.Set; import de.devboost.buildboost.BuildException; +import de.devboost.buildboost.artifacts.RepositoriesFile.Location; @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)) { + // 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/"); } @@ -57,15 +59,15 @@ public Location(String type, String url) { public String getType() { return type; } - + public String getUrl() { return url; } - + public Set getSubDirectories() { return subDirectories; } - + } private File file; @@ -82,36 +84,20 @@ private void readContent(File file) throws BuildException { try { BufferedReader reader = new BufferedReader(new FileReader(file)); String locationString; - readLine: while((locationString = reader.readLine()) != null) { + 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; + if (!isComment(locationString)) { + boolean supportedTypeDetect = isSupportedProtocolTyp( + locationString, locations); + if (!supportedTypeDetect) { + reader.close(); + System.out.println("INVALID Location:>" + + locationString + "<"); + throw new BuildException( + "Cannot handle repository location: " + + locationString); } } - - reader.close(); - System.out.println("INVALID Location:>"+locationString+"<"); - //throw new BuildException("Cannot handle repository location: " + locationString); } reader.close(); } catch (IOException e) { @@ -119,6 +105,37 @@ private void readContent(File file) throws BuildException { } } + private boolean isSupportedProtocolTyp(String locationString, + Map locationsMap) { + boolean supportedTypeDetect = false; + 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 = locationsMap.get(url); + if (location == null) { + location = new Location(type, url); + locationsMap.put(url, location); + } + if (subDirectory != null) { + location.getSubDirectories().add(subDirectory); + } + // if valid location then return true + supportedTypeDetect = true; + break; + } + } + return supportedTypeDetect; + } + private boolean isComment(String locationString) { if (locationString.isEmpty()) { return true; From e4dd5e3d93561b1cea1a87450fa66045260495e3 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Sep 2012 00:05:54 +0200 Subject: [PATCH 04/41] refactoring while / for loops --- .../artifacts/RepositoriesFile.java | 83 ++++++++++--------- 1 file changed, 46 insertions(+), 37 deletions(-) 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 ebdf512..33847f4 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 @@ -30,25 +30,27 @@ 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)) { + // 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/"); } @@ -57,15 +59,15 @@ public Location(String type, String url) { public String getType() { return type; } - + public String getUrl() { return url; } - + public Set getSubDirectories() { return subDirectories; } - + } private File file; @@ -82,36 +84,11 @@ private void readContent(File file) throws BuildException { try { BufferedReader reader = new BufferedReader(new FileReader(file)); String locationString; - readLine: while((locationString = reader.readLine()) != null) { + 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; - } + if (!isComment(locationString)) { + addSupportedLocation(locations, locationString); } - - reader.close(); - System.out.println("INVALID Location:>"+locationString+"<"); - //throw new BuildException("Cannot handle repository location: " + locationString); } reader.close(); } catch (IOException e) { @@ -119,6 +96,38 @@ private void readContent(File file) throws BuildException { } } + private void addSupportedLocation(Map locationsMap, + String locationString) throws BuildException { + + 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 = locationsMap.get(url); + if (location == null) { + location = new Location(type, url); + locationsMap.put(url, location); + } + if (subDirectory != null) { + location.getSubDirectories().add(subDirectory); + } + // if valid location then return + return; + } + } + System.out.println("INVALID Location:>" + locationString + "<"); + throw new BuildException("Cannot handle repository location: " + + locationString); + } + private boolean isComment(String locationString) { if (locationString.isEmpty()) { return true; From 10db251c735f86fa05c4bed77691a7ebd42945da Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Sep 2012 00:23:55 +0200 Subject: [PATCH 05/41] Debug info added --- .../src/de/devboost/buildboost/artifacts/RepositoriesFile.java | 1 + 1 file changed, 1 insertion(+) 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 b416c48..dd26ff9 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 @@ -87,6 +87,7 @@ private void readContent(File file) throws BuildException { String locationString; while ((locationString = reader.readLine()) != null) { locationString = locationString.trim(); + System.out.println("Process Location:" + locationString); if (!isComment(locationString)) { addSupportedLocation(locations, locationString); } From c74ea326381e71ef4d9c1c643cc1bfd26462f4dc Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Sep 2012 22:10:39 +0200 Subject: [PATCH 06/41] correct Logger added --- .../buildboost/artifacts/RepositoriesFile.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 dd26ff9..84b8c03 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 @@ -27,13 +27,16 @@ import java.util.List; import java.util.Map; import java.util.Set; - +import java.util.logging.Level; +import java.util.logging.Logger; import de.devboost.buildboost.BuildException; -import de.devboost.buildboost.artifacts.RepositoriesFile.Location; + @SuppressWarnings("serial") public class RepositoriesFile extends AbstractArtifact { + + private static final Logger logger = Logger.getLogger(RepositoriesFile.class.getName()); public static String SUB_DIR_SEPARATOR = "!"; @@ -87,7 +90,7 @@ private void readContent(File file) throws BuildException { String locationString; while ((locationString = reader.readLine()) != null) { locationString = locationString.trim(); - System.out.println("Process Location:" + locationString); + logger.info("Process Location:>" + locationString+"<"); if (!isComment(locationString)) { addSupportedLocation(locations, locationString); } @@ -126,7 +129,7 @@ private void addSupportedLocation(Map locationsMap, return; } } - System.out.println("INVALID Location:>" + locationString + "<"); + logger.log(Level.SEVERE,"INVALID Location:>" + locationString + "<"); throw new BuildException("Cannot handle repository location: " + locationString); } From fa958e0a8542b8332681e0b314fdbf932852abeb Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Sep 2012 22:25:20 +0200 Subject: [PATCH 07/41] Only correct locations to check will by logged --- .../src/de/devboost/buildboost/artifacts/RepositoriesFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 84b8c03..2b253c0 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 @@ -90,8 +90,8 @@ private void readContent(File file) throws BuildException { String locationString; while ((locationString = reader.readLine()) != null) { locationString = locationString.trim(); - logger.info("Process Location:>" + locationString+"<"); if (!isComment(locationString)) { + logger.info("Process Location:>" + locationString+"<"); addSupportedLocation(locations, locationString); } } From 7f226029b20e7655d346322cd940e078f027e06f Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 20 Oct 2012 15:37:30 +0200 Subject: [PATCH 08/41] fork get a update from upstream/master via fetch and merge --- .../de/devboost/buildboost/IConstants.java | 2 +- .../artifacts/RepositoriesFile.java | 88 ++++----- .../.classpath | 7 + .../.project | 28 +++ .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 12 ++ .../build.properties | 4 + .../product/artifacts/EclipseProduct.java | 104 +++++++++++ .../discovery/EclipseProductFinder.java | 67 +++++++ .../product/stages/BuildProductStage.java | 74 ++++++++ .../product/steps/BuildProductStep.java | 170 ++++++++++++++++++ .../steps/BuildProductStepProvider.java | 45 +++++ .../pom.xml.hudson | 29 +++ 13 files changed, 584 insertions(+), 53 deletions(-) create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/.classpath create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/.project create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/.settings/org.eclipse.jdt.core.prefs create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/META-INF/MANIFEST.MF create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/build.properties create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/artifacts/EclipseProduct.java create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/discovery/EclipseProductFinder.java create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/stages/BuildProductStage.java create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStep.java create mode 100644 Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStepProvider.java create mode 100644 JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/pom.xml.hudson 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 aeda57c..b801716 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -21,7 +21,7 @@ */ public interface IConstants { - String BUILD_BOOST_REPOSITORY_URL = "https://github.com/FunThomas424242/BuildBoost.git"; + 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"; 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 2b253c0..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 @@ -27,34 +27,28 @@ import java.util.List; import java.util.Map; import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import de.devboost.buildboost.BuildException; - +import de.devboost.buildboost.BuildException; @SuppressWarnings("serial") public class RepositoriesFile extends AbstractArtifact { - private static final Logger logger = Logger.getLogger(RepositoriesFile.class.getName()); - 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)) { + //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/"); } @@ -63,15 +57,15 @@ public Location(String type, String url) { public String getType() { return type; } - + public String getUrl() { return url; } - + public Set getSubDirectories() { return subDirectories; } - + } private File file; @@ -88,12 +82,35 @@ private void readContent(File file) throws BuildException { try { BufferedReader reader = new BufferedReader(new FileReader(file)); String locationString; - while ((locationString = reader.readLine()) != null) { + readLine: while((locationString = reader.readLine()) != null) { locationString = locationString.trim(); - if (!isComment(locationString)) { - logger.info("Process Location:>" + locationString+"<"); - addSupportedLocation(locations, locationString); + 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) { @@ -101,39 +118,6 @@ private void readContent(File file) throws BuildException { } } - - private void addSupportedLocation(Map locationsMap, - String locationString) throws BuildException { - - 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 = locationsMap.get(url); - if (location == null) { - location = new Location(type, url); - locationsMap.put(url, location); - } - if (subDirectory != null) { - location.getSubDirectories().add(subDirectory); - } - // if valid location then return - return; - } - } - logger.log(Level.SEVERE,"INVALID Location:>" + locationString + "<"); - throw new BuildException("Cannot handle repository location: " - + locationString); - } - private boolean isComment(String locationString) { if (locationString.isEmpty()) { return true; diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/.classpath b/Extensions/Product/de.devboost.buildboost.genext.product/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/.project b/Extensions/Product/de.devboost.buildboost.genext.product/.project new file mode 100644 index 0000000..6d205ff --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/.project @@ -0,0 +1,28 @@ + + + de.devboost.buildboost.genext.product + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/.settings/org.eclipse.jdt.core.prefs b/Extensions/Product/de.devboost.buildboost.genext.product/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +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.compliance=1.6 +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/Extensions/Product/de.devboost.buildboost.genext.product/META-INF/MANIFEST.MF b/Extensions/Product/de.devboost.buildboost.genext.product/META-INF/MANIFEST.MF new file mode 100644 index 0000000..3902997 --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Updatesite +Bundle-SymbolicName: de.devboost.buildboost.genext.product +Bundle-Version: 1.0.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: de.devboost.buildboost.genext.product.artifacts, + de.devboost.buildboost.genext.product.discovery, + de.devboost.buildboost.genext.product.stages, + de.devboost.buildboost.genext.product.steps +Require-Bundle: de.devboost.buildboost, + de.devboost.buildboost.genext.updatesite diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/build.properties b/Extensions/Product/de.devboost.buildboost.genext.product/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/artifacts/EclipseProduct.java b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/artifacts/EclipseProduct.java new file mode 100644 index 0000000..4c5e2a3 --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/artifacts/EclipseProduct.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * 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.genext.product.artifacts; + +import java.io.File; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.Set; + +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathExpressionException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import de.devboost.buildboost.artifacts.AbstractArtifact; +import de.devboost.buildboost.artifacts.EclipseFeature; +import de.devboost.buildboost.genext.updatesite.artifacts.EclipseUpdateSiteDeploymentSpec; +import de.devboost.buildboost.model.IDependable; +import de.devboost.buildboost.model.UnresolvedDependency; +import de.devboost.buildboost.util.AbstractXMLReader; + +@SuppressWarnings("serial") +public class EclipseProduct extends AbstractArtifact { + + private File file; + + public EclipseProduct(File file) { + this.file = file; + readProductFile(); + setIdentifier(file.getName()); + String parentIdentifier = file.getParentFile().getName(); + getUnresolvedDependencies().add(new UnresolvedDependency(EclipseUpdateSiteDeploymentSpec.class, parentIdentifier, null, true, null, true, false, false)); + } + + private void readProductFile() { + AbstractXMLReader xmlUtil = new AbstractXMLReader() { + + @Override + protected void process(Document document, XPath xpath) + throws XPathExpressionException { + findFeatureDependencies(document, xpath); + } + + @Override + protected void addUnresolvedDependencies(Element element, + UnresolvedDependency unresolvedDependency) { + getUnresolvedDependencies().add(unresolvedDependency); + } + + private void findFeatureDependencies(Document document, XPath xpath) + throws XPathExpressionException { + findDependencies(document, xpath, "//feature", "id", null, EclipseFeature.class); + } + }; + + xmlUtil.readXMLFile(file); + } + + public Collection getFeatures() { + Set features = new LinkedHashSet(); + Collection dependencies = getDependencies(); + for (IDependable dependency : dependencies) { + if (dependency instanceof EclipseFeature) { + EclipseFeature feature = (EclipseFeature) dependency; + features.add(feature); + } + } + return Collections.unmodifiableSet(features); + } + + public File getFile() { + return file; + } + + @Override + public long getTimestamp() { + return file.lastModified(); + } + + public EclipseUpdateSiteDeploymentSpec getDeploymentSpec() { + for (IDependable dependency : getDependencies()) { + if (dependency instanceof EclipseUpdateSiteDeploymentSpec) { + EclipseUpdateSiteDeploymentSpec spec = (EclipseUpdateSiteDeploymentSpec) dependency; + return spec; + } + } + return null; + } +} diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/discovery/EclipseProductFinder.java b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/discovery/EclipseProductFinder.java new file mode 100644 index 0000000..33aa5e2 --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/discovery/EclipseProductFinder.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * 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.genext.product.discovery; + +import java.io.File; +import java.io.FileFilter; +import java.util.ArrayList; +import java.util.Collection; + +import de.devboost.buildboost.BuildException; +import de.devboost.buildboost.discovery.AbstractFileFinder; +import de.devboost.buildboost.genext.product.artifacts.EclipseProduct; +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; + +public class EclipseProductFinder extends AbstractFileFinder { + + private IBuildListener buildListener; + + public EclipseProductFinder(File directory) { + super(directory); + } + + public Collection discoverArtifacts(IBuildContext context) throws BuildException { + buildListener = context.getBuildListener(); + Collection updateSites = new ArrayList(); + traverse(context, updateSites); + return new ArtifactUtil().getSetOfArtifacts(updateSites); + } + + protected EclipseProduct createArtifactFromFile(File file) { + if (buildListener != null) { + buildListener.handleBuildEvent(BuildEventType.INFO, "Discovered product spec: " + file.getAbsolutePath()); + } + return new EclipseProduct(file); + } + + protected FileFilter getFileFilter() { + return new FileFilter() { + + public boolean accept(File file) { + return file.getName().endsWith(".product") && file.isFile(); + } + }; + } + + @Override + public String toString() { + return getClass().getSimpleName() + " [" + directory.getAbsolutePath() + "]"; + } +} diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/stages/BuildProductStage.java b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/stages/BuildProductStage.java new file mode 100644 index 0000000..5d7a004 --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/stages/BuildProductStage.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * 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.genext.product.stages; + +import java.io.File; + +import de.devboost.buildboost.AutoBuilder; +import de.devboost.buildboost.BuildContext; +import de.devboost.buildboost.BuildException; +import de.devboost.buildboost.ant.AntScript; +import de.devboost.buildboost.discovery.EclipseFeatureFinder; +import de.devboost.buildboost.discovery.EclipseTargetPlatformAnalyzer; +import de.devboost.buildboost.discovery.PluginFinder; +import de.devboost.buildboost.genext.product.discovery.EclipseProductFinder; +import de.devboost.buildboost.genext.product.steps.BuildProductStepProvider; +import de.devboost.buildboost.genext.updatesite.discovery.EclipseUpdateSiteDeploymentSpecFinder; +import de.devboost.buildboost.genext.updatesite.discovery.EclipseUpdateSiteFinder; +import de.devboost.buildboost.model.IUniversalBuildStage; +import de.devboost.buildboost.stages.AbstractBuildStage; + +public class BuildProductStage extends AbstractBuildStage implements IUniversalBuildStage { + + private String artifactsFolder; + + public void setArtifactsFolder(String artifactsFolder) { + this.artifactsFolder = artifactsFolder; + } + + @Override + public AntScript getScript() throws BuildException { + File buildDir = new File(artifactsFolder); + + BuildContext context = createContext(false); + + context.addBuildParticipant(new EclipseTargetPlatformAnalyzer(buildDir)); + + context.addBuildParticipant(new PluginFinder(buildDir)); + context.addBuildParticipant(new EclipseFeatureFinder(buildDir)); + context.addBuildParticipant(new EclipseProductFinder(buildDir)); + + context.addBuildParticipant(new EclipseUpdateSiteDeploymentSpecFinder(buildDir)); + + File distDir = new File(buildDir, "dist"); + context.addBuildParticipant(new EclipseUpdateSiteFinder(distDir)); + + context.addBuildParticipant(new BuildProductStepProvider(buildDir)); + + AutoBuilder builder = new AutoBuilder(context); + + AntScript script = new AntScript(); + script.setName("Build Eclipse product(s)"); + script.addTargets(builder.generateAntTargets()); + + return script; + } + + @Override + public int getPriority() { + return 15000; + } +} diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStep.java b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStep.java new file mode 100644 index 0000000..df77c05 --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStep.java @@ -0,0 +1,170 @@ +/******************************************************************************* + * 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.genext.product.steps; + +import java.io.File; +import java.util.Collection; +import java.util.Collections; + +import de.devboost.buildboost.BuildException; +import de.devboost.buildboost.ant.AbstractAntTargetGenerator; +import de.devboost.buildboost.ant.AntTarget; +import de.devboost.buildboost.genext.product.artifacts.EclipseProduct; +import de.devboost.buildboost.genext.updatesite.artifacts.EclipseUpdateSiteDeploymentSpec; +import de.devboost.buildboost.util.XMLContent; + +public class BuildProductStep extends AbstractAntTargetGenerator { + + private EclipseProduct productSpec; + private File targetDir; + + public BuildProductStep(EclipseProduct productSpec, File targetDir) { + super(); + this.productSpec = productSpec; + this.targetDir = targetDir; + } + + @Override + public Collection generateAntTargets() throws BuildException { + AntTarget updateSiteTarget = generateUpdateSiteAntTarget(); + return Collections.singletonList(updateSiteTarget); + } + + protected AntTarget generateUpdateSiteAntTarget() throws BuildException { + EclipseUpdateSiteDeploymentSpec deploymentSpec = productSpec.getDeploymentSpec(); + if (deploymentSpec == null) { + throw new BuildException("Can't find deployment spec site for product specification."); + } + + XMLContent content = new XMLContent(); + + String siteVersion = deploymentSpec.getSiteVersion(); + String productSpecPath = productSpec.getFile().getAbsolutePath(); + + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.appendLineBreak(); + + //TODO this is not good, because the tstamp should not be stage dependent + content.append(""); + content.append(""); + content.append(""); + content.appendLineBreak(); + + //set version in product file + content.append(""); + + String updateSiteID = deploymentSpec.getUpdateSite().getIdentifier(); + + File repoBaseFolder = deploymentSpec.getUpdateSite().getFile().getParentFile().getParentFile(); + + File tempDirFile = new File(targetDir.getParentFile(), "pde-build-temp"); + tempDirFile.mkdir(); + String tempDir = tempDirFile.getAbsolutePath(); + String eclipseDir = new File(new File(targetDir, "target-platform"), "eclipse").getAbsolutePath(); + String p2ProductRepo = new File(new File(repoBaseFolder.getParentFile(), "products-p2"), updateSiteID).getAbsolutePath(); + String productsDir = new File(repoBaseFolder.getParentFile(), "products-zip").getAbsolutePath(); + + //call PDE product build + content.append(""); //TODO this is a platform dependent executable in the PATH + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); //TODO pde.build version might differ + + content.append(""); + + content.append(""); + + content.append(""); + content.append(""); + + content.append(""); + + content.append(""); + content.append(""); + content.append(""); + content.append(""); + + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + + String configs = deploymentSpec.getValue("site", "configs"); + content.append(""); + + content.append(""); + + //call director for publishing + String[] configArray = configs.split("\\&"); + for (String conf : configArray) { + String[] split = conf.split(","); + String os = split[0]; + String ws = split[1]; + String arch = split[2]; + + String productFileName = productSpec.getIdentifier() + "-" + os + "-" + ws + "-" + arch; + + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + + String siteDependencies = deploymentSpec.getValue("site", "dependencies"); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + + content.append(""); + } + + AntTarget target = new AntTarget("build-eclipse-product-" + updateSiteID, content); + return target; + } + + + +} diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStepProvider.java b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStepProvider.java new file mode 100644 index 0000000..b9ab323 --- /dev/null +++ b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStepProvider.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * 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.genext.product.steps; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import de.devboost.buildboost.ant.AbstractAntTargetGeneratorProvider; +import de.devboost.buildboost.ant.IAntTargetGenerator; +import de.devboost.buildboost.genext.product.artifacts.EclipseProduct; +import de.devboost.buildboost.model.IArtifact; +import de.devboost.buildboost.model.IBuildContext; + +public class BuildProductStepProvider extends AbstractAntTargetGeneratorProvider { + + private File targetDir; + + public BuildProductStepProvider(File targetDir) { + super(); + this.targetDir = targetDir; + } + + public List getAntTargetGenerators(IBuildContext context, IArtifact artifact) { + if (artifact instanceof EclipseProduct) { + EclipseProduct productSpec = (EclipseProduct) artifact; + IAntTargetGenerator step = new BuildProductStep(productSpec, targetDir); + return Collections.singletonList(step); + } + return Collections.emptyList(); + } +} diff --git a/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/pom.xml.hudson b/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/pom.xml.hudson new file mode 100644 index 0000000..8d680ae --- /dev/null +++ b/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/pom.xml.hudson @@ -0,0 +1,29 @@ + + 4.0.0 + + org.jvnet.hudson.plugins + hudson-plugin-parent + 2.2.1 + ../pom.xml + + + org.buildboost.hudson.plugins + boostscm + 1.0-SNAPSHOT + hpi + + + + + repo.hudson-ci.org + http://mvnrepository.com/artifact/org.jvnet.hudson.plugins + + + + + + repo.hudson-ci.org + http://mvnrepository.com/artifact/org.jvnet.hudson.plugins + + + From a2fe7e80e90a063a9bb152f5f5deb0dee4e363f8 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 20 Oct 2012 15:40:04 +0200 Subject: [PATCH 09/41] Conflicts: Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGeneratorProvider.java Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/IAntTargetGeneratorProvider.java Core/de.devboost.buildboost/src/de/devboost/buildboost/artifacts/EclipseFeature.java Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/EclipseTargetPlatformAnalyzer.java Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/RepositoriesFileFinder.java Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/TargetPlatformZipFinder.java Core/de.devboost.buildboost/src/de/devboost/buildboost/model/UnresolvedDependency.java Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStepProvider.java Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/CopyPluginsAndFeaturesBuildStep.java Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/ExtractZipFileBuildStep.java Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/artifacts/EclipseUpdateSiteDeploymentSpec.java Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostRepository.java JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostSCM.java Universal/de.devboost.buildboost.universal.build/boost/build.xml --- .../AbstractAntTargetGeneratorProvider.java | 3 + .../ant/IAntTargetGeneratorProvider.java | 12 - .../buildboost/artifacts/EclipseFeature.java | 8 +- .../EclipseTargetPlatformAnalyzer.java | 3 - .../discovery/RepositoriesFileFinder.java | 1 - .../discovery/TargetPlatformZipFinder.java | 3 +- .../model/UnresolvedDependency.java | 11 +- .../clone/CloneRepositoriesBuildStep.java | 230 ++++++++++-------- .../CloneRepositoriesBuildStepProvider.java | 90 +++++-- .../copy/CopyPluginsAndFeaturesBuildStep.java | 2 +- .../steps/copy/ExtractZipFileBuildStep.java | 37 ++- .../EclipseUpdateSiteDeploymentSpec.java | 14 +- .../updatesite/steps/BuildUpdateSiteStep.java | 65 +++-- .../boostscm/BuildBoostRepository.java | 4 + .../plugins/boostscm/BuildBoostSCM.java | 10 +- .../boost/build.xml | 42 +++- 16 files changed, 353 insertions(+), 182 deletions(-) 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 b5ac5d5..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 @@ -54,4 +54,7 @@ public boolean dependsOn(IBuildParticipant otherParticipant) { } return false; } + + public abstract Collection getAntTargetGenerators( + IBuildContext context, IArtifact artifact); } 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 1eb500b..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 @@ -15,19 +15,7 @@ ******************************************************************************/ package de.devboost.buildboost.ant; -import java.util.List; - -import de.devboost.buildboost.model.IArtifact; -import de.devboost.buildboost.model.IBuildContext; import de.devboost.buildboost.model.IBuildParticipant; public interface IAntTargetGeneratorProvider extends IBuildParticipant { - - /** - * Returns all build steps that are required to build - * the given artifact. - * - * @param context the context in which the artifact is built - */ - public List getAntTargetGenerators(IBuildContext context, IArtifact artifact); } 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 f2d35cf..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 @@ -120,12 +120,16 @@ private void findContainedPluginDependencies(Document document, XPath xpath) private void findFeatureDependencies(Document document, XPath xpath) throws XPathExpressionException { - findDependencies(document, xpath, "//import", "feature", null, EclipseFeature.class); + // 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 { - findDependencies(document, xpath, "//import", "plugin", null, Plugin.class); + // TODO deactivated (see above) + //findDependencies(document, xpath, "//import", "plugin", null, Plugin.class); } }; 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 2a61ed0..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 @@ -78,9 +78,6 @@ public Collection discoverArtifacts(IBuildContext context) { @Override public boolean accept(File file) { - if (!file.getParentFile().getName().equals("plugins")) { - return false; - } // exclude JUnit 3, because this requires to check the bundle // version when resolving dependencies // TODO remove this once the versions are checked diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/RepositoriesFileFinder.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/RepositoriesFileFinder.java index 209d9c5..d0cb9dd 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/RepositoriesFileFinder.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/RepositoriesFileFinder.java @@ -37,7 +37,6 @@ public RepositoriesFileFinder(File directory) { public Collection discoverArtifacts(IBuildContext context) throws BuildException { Collection boostFiles = new ArrayList(); traverse(context, boostFiles); - // TODO merge all repository files as one artifact return new ArtifactUtil().getSetOfArtifacts(boostFiles); } diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/TargetPlatformZipFinder.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/TargetPlatformZipFinder.java index afcca5b..fd0d1f5 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/TargetPlatformZipFinder.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/discovery/TargetPlatformZipFinder.java @@ -64,7 +64,8 @@ protected FileFilter getFileFilter() { return new FileFilter() { public boolean accept(File file) { - return !file.isDirectory() && file.getName().endsWith(".zip"); + return !file.isDirectory() && + (file.getName().endsWith(".zip") || file.getName().endsWith(".tar.gz")); } }; } diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/model/UnresolvedDependency.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/model/UnresolvedDependency.java index e36e182..08b7e14 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/model/UnresolvedDependency.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/model/UnresolvedDependency.java @@ -109,11 +109,20 @@ public boolean equals(Object obj) { if (getClass() != obj.getClass()) return false; UnresolvedDependency other = (UnresolvedDependency) obj; + if (type == null) { + if (other.type != null) + return false; + } if (identifier == null) { if (other.identifier != null) return false; - } else if (!identifier.equals(other.identifier)) + } + if (!type.equals(other.type)) { return false; + } + if (!identifier.equals(other.identifier)) { + return false; + } if (minVersion == null) { if (other.minVersion != null) return false; diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java index 5c9e156..17d2c56 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java @@ -16,8 +16,8 @@ package de.devboost.buildboost.steps.clone; import java.io.File; +import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import de.devboost.buildboost.ant.AbstractAntTargetGenerator; import de.devboost.buildboost.ant.AntTarget; @@ -28,125 +28,150 @@ public class CloneRepositoriesBuildStep extends AbstractAntTargetGenerator { private File reposFolder; - private Location location; + private Collection locations; - public CloneRepositoriesBuildStep(File reposFolder, Location location) { + public CloneRepositoriesBuildStep(File reposFolder, Collection locations) { super(); this.reposFolder = reposFolder; - this.location = location; + this.locations = locations; } public Collection generateAntTargets() { - String locationURL = location.getUrl(); - String localRepositoryFolderName = url2FolderName(locationURL); + Collection result = new ArrayList(); + result.add(writeRepositoryList()); - String rootName = url2FolderName(locationURL.substring(locationURL.lastIndexOf("/") + 1)); + for (Location location : locations) { + String locationURL = location.getUrl(); + String localRepositoryFolderName = url2FolderName(locationURL); + + String rootName = url2FolderName(locationURL.substring(locationURL.lastIndexOf("/") + 1)); - File localRepo = new File(new File(reposFolder, localRepositoryFolderName), rootName); - - XMLContent content = new XMLContent(); - - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - - boolean isGit = location.getType().equals("git"); - boolean isSVN = location.getType().equals("svn"); - - String localRepositoryPath = localRepo.getAbsolutePath(); - writeRepositoryList(locationURL, content, isGit, isSVN, localRepositoryPath); - if (isGit) { - if (localRepo.exists()) { - content.append(""); - content.append(""); - content.append(""); - } else { - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - } - if (!location.getSubDirectories().isEmpty()) { - //enable sparse checkout - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - String dirList = ".gitignore${line.separator}"; - for (String subDir : location.getSubDirectories()) { - dirList += subDir; - dirList += "${line.separator}"; + File localRepo = new File(new File(reposFolder, localRepositoryFolderName), rootName); + + XMLContent content = new XMLContent(); + + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + + boolean isGit = location.getType().equals("git"); + boolean isSVN = location.getType().equals("svn"); + + String localRepositoryPath = getLocalRepositoryPath(location); + + if (isGit) { + if (localRepo.exists()) { + content.append(""); + content.append(""); + content.append(""); + } else { + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); } - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - } - } else if (isSVN) { - if (localRepo.exists()) { - // execute update - content.append(""); - content.append(""); - content.append(""); - } else { - // execute checkout - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - } - } else /* isGet */ { - if (!localRepo.exists()) { - content.append(""); if (!location.getSubDirectories().isEmpty()) { - if (localRepo.getName().endsWith(".zip")) { - String zipFilePath = new File(localRepo, rootName).getAbsolutePath() ; - content.append(""); - content.append(""); - content.append(""); - for (String zipEntry : location.getSubDirectories()) { - content.append(""); - } - content.append(""); - content.append(""); - content.append(""); - } else /* folder */ { - for (String subPath : location.getSubDirectories()) { - content.append(""); - } + //enable sparse checkout + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + String dirList = ".gitignore${line.separator}"; + for (String subDir : location.getSubDirectories()) { + dirList += subDir; + dirList += "${line.separator}"; } + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + } + } else if (isSVN) { + if (localRepo.exists()) { + // execute update + content.append(""); + content.append(""); + content.append(""); } else { - content.append(""); + // execute checkout + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + } + } else /* isGet */ { + if (!localRepo.exists()) { + content.append(""); + if (!location.getSubDirectories().isEmpty()) { + if (localRepo.getName().endsWith(".zip")) { + String zipFilePath = new File(localRepo, rootName).getAbsolutePath() ; + content.append(""); + content.append(""); + content.append(""); + for (String zipEntry : location.getSubDirectories()) { + content.append(""); + } + content.append(""); + content.append(""); + content.append(""); + } else /* folder */ { + for (String subPath : location.getSubDirectories()) { + content.append(""); + } + } + } else { + content.append(""); + } } } + result.add(new AntTarget("update-" + localRepositoryFolderName, content)); } - - return Collections.singleton(new AntTarget("update-" + localRepositoryFolderName, content)); + return result; } - private void writeRepositoryList(String locationURL, XMLContent content, - boolean isGit, boolean isSVN, String localRepositoryPath) { + private AntTarget writeRepositoryList() { + XMLContent content = new XMLContent(); String revisionFile = new File(reposFolder, "buildboost_repository_list.txt").getAbsolutePath(); - if (isSVN || isGit) { - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); + content.append(""); + content.append(""); + for (Location location : locations) { + boolean isGit = location.getType().equals("git"); + boolean isSVN = location.getType().equals("svn"); + + String locationURL = location.getUrl(); + + String localRepositoryPath = getLocalRepositoryPath(location); + + if (isSVN || isGit) { + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + } } + + return new AntTarget("write-repository-list", content); + } + + protected String getLocalRepositoryPath(Location location) { + String locationURL = location.getUrl(); + String localRepositoryFolderName = url2FolderName(locationURL); + String rootName = url2FolderName(locationURL.substring(locationURL.lastIndexOf("/") + 1)); + return new File(new File(reposFolder, localRepositoryFolderName), rootName).getAbsolutePath(); } protected String url2FolderName(String url) { @@ -162,7 +187,10 @@ protected String url2FolderName(String url) { if (idx != -1) { folderName = folderName.substring(0, idx); } + folderName = folderName.replace(":", ""); + folderName = folderName.replace("~", "_"); folderName = folderName.replace("/", "_"); + folderName = folderName.replace("\\", "_"); folderName = folderName.replace(" ", "-"); return folderName; } diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStepProvider.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStepProvider.java index ba5da46..a564052 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStepProvider.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStepProvider.java @@ -17,21 +17,29 @@ import java.io.File; import java.util.ArrayList; -import java.util.Collections; +import java.util.Collection; +import java.util.Iterator; import java.util.List; -import de.devboost.buildboost.ant.AbstractAntTargetGeneratorProvider; +import de.devboost.buildboost.BuildException; +import de.devboost.buildboost.UnresolvedDependencyChecker; import de.devboost.buildboost.ant.IAntTargetGenerator; +import de.devboost.buildboost.ant.IAntTargetGeneratorProvider; import de.devboost.buildboost.artifacts.RepositoriesFile; import de.devboost.buildboost.artifacts.RepositoriesFile.Location; +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; /** * The {@link CloneRepositoriesBuildStepProvider} add a {@link CloneRepositoriesBuildStep} * for each {@link RepositoriesFile}. */ -public class CloneRepositoriesBuildStepProvider extends AbstractAntTargetGeneratorProvider { +public class CloneRepositoriesBuildStepProvider extends AbstractBuildParticipant + implements IAntTargetGeneratorProvider { private File reposFolder; @@ -39,19 +47,73 @@ public CloneRepositoriesBuildStepProvider(File reposFolder) { super(); this.reposFolder = reposFolder; } + + public void execute(IBuildContext context) throws BuildException { + List antTargets = new ArrayList(); + Collection artifacts = context.getDiscoveredArtifacts(); + antTargets.add(getAntTargetGenerators(context, artifacts)); + context.addDiscoveredArtifacts(antTargets); + } - public List getAntTargetGenerators(IBuildContext context, IArtifact artifact) { - if (artifact instanceof RepositoriesFile) { - RepositoriesFile repositoriesFile = (RepositoriesFile) artifact; - List steps = new ArrayList(); - List locations = repositoriesFile.getLocations(); - for (Location location : locations) { - CloneRepositoriesBuildStep step = new CloneRepositoriesBuildStep( - reposFolder, location); - steps.add(step); + public IAntTargetGenerator getAntTargetGenerators(IBuildContext context, Collection artifacts) { + Collection locations = new ArrayList(); + for (IArtifact artifact : artifacts) { + if (artifact instanceof RepositoriesFile) { + RepositoriesFile repositoriesFile = (RepositoriesFile) artifact; + for (Location location : repositoriesFile.getLocations()) { + boolean locationDuplicate = false; + for (Location locationInList : locations) { + if (locationInList.getUrl().equals(location.getUrl())) { + locationDuplicate = true; + locationInList.getSubDirectories().addAll(location.getSubDirectories()); + break; + } + } + if (!locationDuplicate) { + locations.add(location); + } + } + } + } + + removeOverlapsInSVNLocations(locations); + + CloneRepositoriesBuildStep step = new CloneRepositoriesBuildStep(reposFolder, locations); + return step; + } + + private void removeOverlapsInSVNLocations(Collection locations) { + for (Location location1 : new ArrayList(locations)) { + if (!"svn".equals(location1.getType())) { + continue; + } + for (Iterator i = locations.iterator(); i.hasNext();) { + Location location2 = i.next(); + if (!"svn".equals(location2.getType())) { + continue; + } + String location1URL = location1.getUrl(); + if (!location1URL.endsWith("/")) { + location1URL = location1URL + "/"; + } + if (!location1.equals(location2) && location2.getUrl().startsWith(location1URL)) { + i.remove(); + } } - return steps; } - return Collections.emptyList(); } + + 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; + } + } diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/CopyPluginsAndFeaturesBuildStep.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/CopyPluginsAndFeaturesBuildStep.java index 49f83de..aea2b86 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/CopyPluginsAndFeaturesBuildStep.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/CopyPluginsAndFeaturesBuildStep.java @@ -39,7 +39,7 @@ public class CopyPluginsAndFeaturesBuildStep extends AbstractAntTargetGenerator public CopyPluginsAndFeaturesBuildStep(IArtifact pluginOrFeature, File targetDir) { super(); this.pluginOrFeature = pluginOrFeature; - this.targetDir = new File(targetDir, "target-platform"); + this.targetDir = new File(new File(targetDir, "target-platform"), "eclipse"); } public Collection generateAntTargets() throws BuildException { diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/ExtractZipFileBuildStep.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/ExtractZipFileBuildStep.java index e3e7d5e..90fdcab 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/ExtractZipFileBuildStep.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/copy/ExtractZipFileBuildStep.java @@ -16,8 +16,12 @@ package de.devboost.buildboost.steps.copy; import java.io.File; +import java.io.IOException; import java.util.Collection; import java.util.Collections; +import java.util.Enumeration; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; import de.devboost.buildboost.BuildException; import de.devboost.buildboost.ant.AbstractAntTargetGenerator; @@ -38,7 +42,38 @@ public ExtractZipFileBuildStep(TargetPlatformZip zip, File targetDir) { public Collection generateAntTargets() throws BuildException { XMLContent content = new XMLContent(); - content.append(""); + File file = zip.getZipFile(); + String targetPathPrefix = determineEclipseTargetStructurePrefix(file); + if (file.getName().endsWith(".zip")) { + content.append(""); + } else { + content.append(""); + content.append(""); + content.append(""); + content.append(""); + } return Collections.singleton(new AntTarget("unzip-target-platform-" + zip.getIdentifier(), content)); } + + public String determineEclipseTargetStructurePrefix(File file) { + if (!file.getName().endsWith(".zip")) { + return ""; + } + try { + Enumeration entries = new ZipFile(file).entries(); + while (entries.hasMoreElements()) { + String entryName = entries.nextElement().getName(); + if (entryName.startsWith("eclipse/plugins/")) { + return ""; + } + if (entryName.startsWith("plugins/")) { + return "/eclipse"; + } + } + } catch (IOException e) { + //ignore + e.printStackTrace(); + } + return "/eclipse/plugins"; + } } diff --git a/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/artifacts/EclipseUpdateSiteDeploymentSpec.java b/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/artifacts/EclipseUpdateSiteDeploymentSpec.java index 12f403f..181ae96 100644 --- a/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/artifacts/EclipseUpdateSiteDeploymentSpec.java +++ b/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/artifacts/EclipseUpdateSiteDeploymentSpec.java @@ -85,10 +85,14 @@ public EclipseUpdateSite getUpdateSite() { } + public String getSiteVendor() { + return getValue("site", "vendor"); + } + public String getFeatureVendor(String featureID) { String featureVendor = getValue("feature", featureID, "vendor"); if (featureVendor == null) { - featureVendor = getValue("site", "vendor"); + featureVendor = getSiteVendor(); } if (featureVendor == null) { featureVendor = "Unknown vendor"; @@ -96,17 +100,21 @@ public String getFeatureVendor(String featureID) { return featureVendor; } + public String getSiteVersion() { + return getValue("site", "version"); + } + public String getFeatureVersion(String featureID) { String featureVersion = getValue("feature", featureID, "version"); if (featureVersion == null) { - featureVersion = getValue("site", "version"); + featureVersion = getSiteVersion(); } if (featureVersion == null) { featureVersion = "0.0.1"; } return featureVersion; } - + @Override public long getTimestamp() { return file.lastModified(); diff --git a/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java b/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java index 1a3fe3f..8d7f311 100644 --- a/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java +++ b/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java @@ -45,11 +45,9 @@ public BuildUpdateSiteStep(EclipseUpdateSiteDeploymentSpec updateSiteSpec, File public Collection generateAntTargets() throws BuildException { if (usernameProperty == null) { usernameProperty = updateSiteSpec.getValue("site", "usernameProperty"); - System.out.println("Using user: " + usernameProperty); } if (passwordProperty == null) { passwordProperty = updateSiteSpec.getValue("site", "passwordProperty"); - System.out.println("Using password: " + passwordProperty); } AntTarget updateSiteTarget = generateUpdateSiteAntTarget(); @@ -97,6 +95,10 @@ protected AntTarget generateUpdateSiteAntTarget() throws BuildException { if (updateSiteVendor == null) { updateSiteVendor = "Unknown vendor"; } + String excludeSrc = updateSiteSpec.getValue("site", "excludeSources"); + if (excludeSrc == null) { + excludeSrc = "false"; + } Collection features = updateSite.getFeatures(); for (EclipseFeature feature : features) { @@ -114,6 +116,7 @@ protected AntTarget generateUpdateSiteAntTarget() throws BuildException { content.append(""); content.append(""); content.append(""); + content.append(""); content.append(""); content.append(""); content.append(""); @@ -144,6 +147,7 @@ protected AntTarget generateUpdateSiteAntTarget() throws BuildException { if (pluginName == null) { pluginName = "Unknown"; } + // package plugin(s) content.append(""); content.append(""); @@ -154,38 +158,45 @@ protected AntTarget generateUpdateSiteAntTarget() throws BuildException { content.append(""); content.appendLineBreak(); content.append(""); - // TODO make this configurable / or read the build.properties file for this - content.append(""); + content.append(""); + // TODO make this configurable or read the build.properties file for this + content.append(""); + if (Boolean.parseBoolean(excludeSrc)) { + content.append(""); + } + content.append(""); content.append(""); content.appendLineBreak(); } } String targetPath = updateSiteSpec.getValue("site", "uploadPath"); - // TODO this requires that jsch-0.1.48.jar is in ANTs classpath. we - // should figure out a way to provide this JAR together with BuildBoost. - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); - content.append(""); + if (targetPath != null) { + // TODO this requires that jsch-0.1.48.jar is in ANTs classpath. we + // should figure out a way to provide this JAR together with BuildBoost. + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); + } - AntTarget target = new AntTarget("build-update-site", content); + AntTarget target = new AntTarget("build-update-site-" + updateSiteID, content); return target; } diff --git a/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostRepository.java b/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostRepository.java index 591facc..3b9ed17 100644 --- a/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostRepository.java +++ b/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostRepository.java @@ -44,4 +44,8 @@ public boolean isGit() { public boolean isSvn() { return "svn".equals(type); } + + public String toString() { + return type + ": " + remoteURL + " - " + localPath; + } } diff --git a/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostSCM.java b/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostSCM.java index e722bdd..e18c508 100644 --- a/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostSCM.java +++ b/JenkinsPlugin/org.buildboost.hudson.plugins.boostscm/src/main/java/org/buildboost/hudson/plugins/boostscm/BuildBoostSCM.java @@ -73,8 +73,8 @@ public class BuildBoostSCM extends SCM { private static final String LOCAL_PREFIX = "BuildBoost-Repository-Local: "; private static final String COMMIT_PREFIX = "commit "; - private static final String SVN_REVISION_PREFIX = "Revision: "; - private static final String SVN_REVISION_REGEX = "^r[0-9]+ "; + private static final String SVN_REVISION_PREFIX = " Rev: "; + private static final String SVN_REVISION_REGEX = "^r[0-9]+ .*"; public static class DescriptorImpl extends SCMDescriptor { @@ -336,11 +336,11 @@ private String executeSvnInfo(String localPath) { command.add("info"); final String[] revision = new String[1]; - executeNativeBinary(null, command, new IFunction() { + executeNativeBinary(localPath, command, new IFunction() { public Boolean call(String line) { - if (line.startsWith(SVN_REVISION_PREFIX)) { - revision[0] = line.substring(0, line.indexOf(" ")); + if (line.contains(SVN_REVISION_PREFIX)) { + revision[0] = "r" + line.substring(line.indexOf(SVN_REVISION_PREFIX) + SVN_REVISION_PREFIX.length()); return false; } return true; diff --git a/Universal/de.devboost.buildboost.universal.build/boost/build.xml b/Universal/de.devboost.buildboost.universal.build/boost/build.xml index c4b9e73..191ebd5 100644 --- a/Universal/de.devboost.buildboost.universal.build/boost/build.xml +++ b/Universal/de.devboost.buildboost.universal.build/boost/build.xml @@ -2,7 +2,7 @@ - + @@ -34,16 +34,16 @@ - - + + - + - + - + @@ -59,10 +59,32 @@ - + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -88,4 +110,4 @@ - + \ No newline at end of file From 4f506201ebfe78c0d74bede58d604496def1ff2b Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sun, 21 Oct 2012 14:40:24 +0200 Subject: [PATCH 10/41] url changed to local buildboostrepo --- .../src/de/devboost/buildboost/IConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b801716..f6ba41c 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -21,7 +21,7 @@ */ public interface IConstants { - String BUILD_BOOST_REPOSITORY_URL = "https://github.com/DevBoost/BuildBoost.git"; + String BUILD_BOOST_REPOSITORY_URL = "\\Users\\SchubertT006\\git\\BuildBoost"; 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"; From 07db28589a5556eddc965671beba3fb2740ba86e Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sun, 21 Oct 2012 14:52:14 +0200 Subject: [PATCH 11/41] buildboost repo url fixed to local correct form file:/// --- .../src/de/devboost/buildboost/IConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f6ba41c..4726f2f 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -21,7 +21,7 @@ */ public interface IConstants { - String BUILD_BOOST_REPOSITORY_URL = "\\Users\\SchubertT006\\git\\BuildBoost"; + String BUILD_BOOST_REPOSITORY_URL = "file:///c:/Users/SchubertT006/git/BuildBoost"; 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"; From 4a993ff7bc6529bcb5c1df685d0cc07e4d8428cd Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sun, 25 Nov 2012 17:48:43 +0100 Subject: [PATCH 12/41] original master merged into forked master --- .../buildboost/genext/product/stages/BuildProductStage.java | 2 +- .../buildboost/genext/product/steps/BuildProductStep.java | 5 +++-- .../genext/updatesite/steps/BuildUpdateSiteStep.java | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/stages/BuildProductStage.java b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/stages/BuildProductStage.java index 5d7a004..6365746 100644 --- a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/stages/BuildProductStage.java +++ b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/stages/BuildProductStage.java @@ -71,4 +71,4 @@ public AntScript getScript() throws BuildException { public int getPriority() { return 15000; } -} +} \ No newline at end of file diff --git a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStep.java b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStep.java index df77c05..b2812fd 100644 --- a/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStep.java +++ b/Extensions/Product/de.devboost.buildboost.genext.product/src/de/devboost/buildboost/genext/product/steps/BuildProductStep.java @@ -95,12 +95,12 @@ protected AntTarget generateUpdateSiteAntTarget() throws BuildException { content.append(""); content.append(""); + content.append(""); content.append(""); content.append(""); content.append(""); - content.append(""); content.append(""); content.append(""); @@ -110,7 +110,8 @@ protected AntTarget generateUpdateSiteAntTarget() throws BuildException { content.append(""); content.append(""); content.append(""); - + content.append(""); + String configs = deploymentSpec.getValue("site", "configs"); content.append(""); diff --git a/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java b/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java index 8d7f311..4ebe0d7 100644 --- a/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java +++ b/Extensions/UpdateSite/de.devboost.buildboost.genext.updatesite/src/de/devboost/buildboost/genext/updatesite/steps/BuildUpdateSiteStep.java @@ -203,3 +203,4 @@ protected AntTarget generateUpdateSiteAntTarget() throws BuildException { } + From 762d10ffa90ea69c66a53d1aea95ce0246389d52 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sun, 25 Nov 2012 18:01:40 +0100 Subject: [PATCH 13/41] repository url changed to local folder --- .../src/de/devboost/buildboost/IConstants.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 4726f2f..22fd15e 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -20,12 +20,12 @@ * system. */ public interface IConstants { - - String BUILD_BOOST_REPOSITORY_URL = "file:///c:/Users/SchubertT006/git/BuildBoost"; + + String BUILD_BOOST_REPOSITORY_URL = "\\Users\\SchubertT006\\git\\BuildBoost"; 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"; From 7bfa56f5c6897a4a7b04e64a45d6c7c3654cb7b4 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sun, 25 Nov 2012 18:38:12 +0100 Subject: [PATCH 14/41] url changed --- .../src/de/devboost/buildboost/IConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 22fd15e..cf58879 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -20,7 +20,7 @@ * system. */ public interface IConstants { - + String BUILD_BOOST_REPOSITORY_URL = "\\Users\\SchubertT006\\git\\BuildBoost"; String BUILD_BOOST_CORE_PROJECT_ID = "de.devboost.buildboost"; String BUILD_BOOST_GENEXT_PROJECT_ID_PATTERN = "de\\.devboost\\.buildboost\\.genext\\..*"; From ede483e9a0093e008f05b7d61730c35d2a8d0d31 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sun, 25 Nov 2012 19:53:33 +0100 Subject: [PATCH 15/41] url changed to equal command line url --- .../src/de/devboost/buildboost/IConstants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 cf58879..67352b0 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -20,8 +20,8 @@ * system. */ public interface IConstants { - - String BUILD_BOOST_REPOSITORY_URL = "\\Users\\SchubertT006\\git\\BuildBoost"; + + String BUILD_BOOST_REPOSITORY_URL = "C:\\Users\\SchubertT006\\git\\BuildBoost"; 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"; From 6e6ce1dc184a103800fc10d2cd68ec3ccceae1d3 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Wed, 19 Dec 2012 18:23:41 +0100 Subject: [PATCH 16/41] URL changed to my github home --- .../src/de/devboost/buildboost/IConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 67352b0..adc6422 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -21,7 +21,7 @@ */ public interface IConstants { - String BUILD_BOOST_REPOSITORY_URL = "C:\\Users\\SchubertT006\\git\\BuildBoost"; + String BUILD_BOOST_REPOSITORY_URL = "https://github.com/FunThomas424242/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"; From 1a005530c79dbc83d21ad5d8cdbe248cc0daa957 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Wed, 19 Dec 2012 18:30:08 +0100 Subject: [PATCH 17/41] extension pattern changed --- .../src/de/devboost/buildboost/IConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 adc6422..d5a93b7 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -23,7 +23,7 @@ public interface IConstants { String BUILD_BOOST_REPOSITORY_URL = "https://github.com/FunThomas424242/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_GENEXT_PROJECT_ID_PATTERN = ".*\\.buildboost\\.genext\\..*"; String BUILD_BOOST_BUILD_PROJECT_ID_PATTERN = ".*\\.build"; String REPOS_FOLDER = "repos"; From 1430ca78e2939abdbd1e17d6839efae46108e7be Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Dec 2012 13:39:58 +0100 Subject: [PATCH 18/41] =?UTF-8?q?Parameter=C3=BCbergabe=20per=20File=20vor?= =?UTF-8?q?bereitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../emf/steps/GenerateGenModelCodeStep.java | 64 ++++++++++++++----- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index 2cbff26..5c53414 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -18,6 +18,8 @@ import static de.devboost.buildboost.IConstants.NL; import java.io.File; +import java.io.FileNotFoundException; +import java.io.PrintWriter; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -34,26 +36,30 @@ /** * The {@link GenerateGenModelCodeStep} generates a script that calls the EMF - * code generators to obtain code from Ecore models. + * code generators to obtain code from Ecore models. */ public class GenerateGenModelCodeStep extends AbstractAntTargetGenerator { public final static String MAIN_TASK = "generate-emf-code"; - private List plugins; - private GeneratorModel generatorModel; + private final List plugins; + private final GeneratorModel generatorModel; - public GenerateGenModelCodeStep(List plugins, GeneratorModel generatorModel) { + public GenerateGenModelCodeStep(List plugins, + GeneratorModel generatorModel) { this.plugins = plugins; this.generatorModel = generatorModel; } + @Override public Collection generateAntTargets() throws BuildException { Collection dependencies = generatorModel.getDependencies(); if (dependencies.isEmpty()) { - throw new BuildException("Generator models are expected to have a dependency to the BuildBoost EMF plug-in."); + throw new BuildException( + "Generator models are expected to have a dependency to the BuildBoost EMF plug-in."); } - XMLContent classpath = new ClasspathHelper().getClasspath(generatorModel, true); + XMLContent classpath = new ClasspathHelper().getClasspath( + generatorModel, true); File genModelFile = generatorModel.getFile(); String genModelPath = genModelFile.getAbsolutePath(); @@ -62,26 +68,50 @@ public Collection generateAntTargets() throws BuildException { sb.append(""); sb.append(""); sb.append(NL); - - sb.append(""); + + sb.append(""); // TODO use constant here - sb.append(""); + sb.append(""); sb.append(""); sb.append(""); sb.append(""); - sb.append(""); + sb.append(""); sb.append(""); - for (Plugin plugin : plugins) { - sb.append(""); - } + String genModelID = genModelPath.toString() + .replace(File.separator, "-"); + String paraFileName = genModelID + ".properties"; + sb.append(""); sb.append(""); sb.append(classpath); sb.append(""); sb.append(""); sb.append(NL); - - String genModelID = genModelPath.toString().replace(File.separator, "-"); - - return Collections.singleton(new AntTarget("emf-codegen-" + genModelID, sb)); + + writeParaFile(paraFileName, plugins); + + return Collections.singleton(new AntTarget("emf-codegen-" + genModelID, + sb)); + } + + private 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(); + } + } + } } From 13c7b3199ce4b1e94af7b2de20f891dc8fc27f26 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Dec 2012 15:00:13 +0100 Subject: [PATCH 19/41] read the para file --- .../buildext/emf/HeadlessCodeGenerator.java | 123 +++++++++++------- 1 file changed, 75 insertions(+), 48 deletions(-) diff --git a/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java b/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java index 50ed307..8379cee 100644 --- a/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java +++ b/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java @@ -15,7 +15,10 @@ ******************************************************************************/ package de.devboost.buildboost.buildext.emf; +import java.io.BufferedReader; import java.io.File; +import java.io.FileReader; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -43,37 +46,62 @@ /** * The {@link HeadlessCodeGenerator} is executed by build scripts that are - * generated by the {@link GenerateEMFCodeStage} or the + * generated by the {@link GenerateEMFCodeStage} or the * {@link GenerateGenModelCodeStep}. It uses the EMF code generators to obtain - * Java code for given generator models. + * Java code for given generator models. */ public class HeadlessCodeGenerator { public static void main(String[] args) throws Exception { // TODO use properties file to pass arguments instead // TODO add property 'generateEditCode' the is set to true by the - // build script generator if there is a respective edit plug-in. + // build script generator if there is a respective edit plug-in. String pathToGenModel = args[0]; String projectName = args[1]; String projectPath = args[2]; - List pluginPaths = new ArrayList(); - for (int i = 3; i < args.length; i++) { - pluginPaths.add(args[i]); + List pluginPaths = readPluginPaths(args[3]); + new HeadlessCodeGenerator().run(pathToGenModel, projectName, + projectPath, pluginPaths); + } + + private static List readPluginPaths(final String paraFileName) { + List paths = new ArrayList(); + BufferedReader reader = null; + try { + final FileReader fin = new FileReader(paraFileName); + reader = new BufferedReader(fin); + String line = reader.readLine(); + while (line != null) { + paths.add(line); + line = reader.readLine(); + } + } catch (IOException ex) { + // TODO Auto-generated catch block + ex.printStackTrace(); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } - new HeadlessCodeGenerator().run(pathToGenModel, projectName, projectPath, pluginPaths); + + return paths; } - private void run(String pathToGenModel, String projectName, String projectPath, List pluginPaths) throws Exception { + private void run(String pathToGenModel, String projectName, + String projectPath, List pluginPaths) throws Exception { ResourceSet rs = new ResourceSetImpl(); - + registerFactoriesAndPackages(rs); registerURIMappings(rs, pluginPaths); - - EcorePlugin.getPlatformResourceMap().put( - projectName, - URI.createFileURI(projectPath + File.separator) - ); - + + EcorePlugin.getPlatformResourceMap().put(projectName, + URI.createFileURI(projectPath + File.separator)); + GenModel genModel = loadGenModel(pathToGenModel, rs); registerCodeGenAdapter(); generateCode(genModel, projectPath); @@ -84,24 +112,22 @@ private void generateCode(GenModel genModel, String projectPath) { Generator generator = new Generator(); generator.setInput(genModel); genModel.setFacadeHelperClass(getClass().getName()); - + // Generator model code. - // EMF 2.8: This logs an exception to the console which is not a problem in our case. - // The logging was introduced in 2.8: https://bugs.eclipse.org/bugs/show_bug.cgi?id=359551 - Diagnostic result = generator.generate( - genModel, - GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, - new BasicMonitor.Printing(System.out) - ); + // EMF 2.8: This logs an exception to the console which is not a problem + // in our case. + // The logging was introduced in 2.8: + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=359551 + Diagnostic result = generator.generate(genModel, + GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE, + new BasicMonitor.Printing(System.out)); printDiagnostic(result); - + if (generateEditCode(genModel, projectPath)) { - result = generator.generate( - genModel, + result = generator.generate(genModel, GenBaseGeneratorAdapter.EDIT_PROJECT_TYPE, - new BasicMonitor.Printing(System.out) - ); - printDiagnostic(result); + new BasicMonitor.Printing(System.out)); + printDiagnostic(result); } } @@ -111,28 +137,29 @@ private boolean generateEditCode(GenModel genModel, String projectPath) { if (!editDirectory.endsWith("src-gen")) { return false; } - + if (editDirectory.startsWith("/")) { editDirectory = editDirectory.substring(1); } - String editProjectName = editDirectory.substring(0, editDirectory.indexOf("/")); + String editProjectName = editDirectory.substring(0, + editDirectory.indexOf("/")); File editProjectDir = new File(workDir, editProjectName); if (!editProjectDir.exists()) { return false; } - + EcorePlugin.getPlatformResourceMap().put( editProjectName, - URI.createFileURI(editProjectDir.getAbsolutePath() + File.separator) - ); - - + URI.createFileURI(editProjectDir.getAbsolutePath() + + File.separator)); + return editProjectDir.exists(); } private void registerCodeGenAdapter() { Registry adapterRegistry = GeneratorAdapterFactory.Descriptor.Registry.INSTANCE; - adapterRegistry.addDescriptor(GenModelPackage.eNS_URI, GenModelGeneratorAdapterFactory.DESCRIPTOR); + adapterRegistry.addDescriptor(GenModelPackage.eNS_URI, + GenModelGeneratorAdapterFactory.DESCRIPTOR); } private GenModel loadGenModel(String pathToGenModel, ResourceSet rs) { @@ -140,15 +167,16 @@ private GenModel loadGenModel(String pathToGenModel, ResourceSet rs) { Resource resource = rs.getResource(uri, true); // TODO add checks GenModel genModel = (GenModel) resource.getContents().get(0); - // reconcile the GenModel: Since the IDE does also do this in the - // background on opening a GenModel, it can happen, that the model + // reconcile the GenModel: Since the IDE does also do this in the + // background on opening a GenModel, it can happen, that the model // is not up-to-date w.r.t. the underlying Ecore model. genModel.reconcile(); genModel.setCanGenerate(true); return genModel; } - private void registerURIMappings(ResourceSet rs, List pluginPaths) throws Exception { + private void registerURIMappings(ResourceSet rs, List pluginPaths) + throws Exception { Map uriMap = rs.getURIConverter().getURIMap(); for (String pluginPath : pluginPaths) { File pluginFile = new File(pluginPath); @@ -164,23 +192,22 @@ private void registerURIMappings(ResourceSet rs, List pluginPaths) throw } else if (!"".equals(to.lastSegment())) { to = to.appendSegment(""); } - //System.out.println("Mapping URI " + from + " to " + to); - uriMap.put( - from, - to - ); + // System.out.println("Mapping URI " + from + " to " + to); + uriMap.put(from, to); } } private void registerFactoriesAndPackages(ResourceSet rs) { - // TODO we must search the target platform for registered resource factories, + // TODO we must search the target platform for registered resource + // factories, // generator models and EPackages. Currently we do solely register the // resource factories and EPackages for the Ecore and the GenModel // metamodels. - Map extensionToFactoryMap = rs.getResourceFactoryRegistry().getExtensionToFactoryMap(); + Map extensionToFactoryMap = rs + .getResourceFactoryRegistry().getExtensionToFactoryMap(); extensionToFactoryMap.put("ecore", new EcoreResourceFactoryImpl()); extensionToFactoryMap.put("genmodel", new EcoreResourceFactoryImpl()); - + GenModelPackage.eINSTANCE.getGenModel(); EcorePackage.eINSTANCE.getEPackage(); } From cb7a6d8bfdb596973537d74d13c3cd4eb1d88a0c Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Dec 2012 16:17:38 +0100 Subject: [PATCH 20/41] Encoding of file and folder names extracted to a separate method -> parameter file name will be encoded by the new method --- .../clone/CloneRepositoriesBuildStep.java | 151 ++++++++++++------ .../emf/steps/GenerateGenModelCodeStep.java | 7 +- 2 files changed, 105 insertions(+), 53 deletions(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java index bd4258a..5fe002d 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/steps/clone/CloneRepositoriesBuildStep.java @@ -25,32 +25,35 @@ import de.devboost.buildboost.util.AntScriptUtil; import de.devboost.buildboost.util.XMLContent; - public class CloneRepositoriesBuildStep extends AbstractAntTargetGenerator { - private File reposFolder; - private Collection locations; + private final File reposFolder; + private final Collection locations; - public CloneRepositoriesBuildStep(File reposFolder, Collection locations) { + public CloneRepositoriesBuildStep(File reposFolder, + Collection locations) { super(); this.reposFolder = reposFolder; this.locations = locations; } + @Override public Collection generateAntTargets() { Collection result = new ArrayList(); result.add(writeRepositoryList()); - + for (Location location : locations) { String locationURL = location.getUrl(); String localRepositoryFolderName = url2FolderName(locationURL); - - String rootName = url2FolderName(locationURL.substring(locationURL.lastIndexOf("/") + 1)); - File localRepo = new File(new File(reposFolder, localRepositoryFolderName), rootName); - + String rootName = url2FolderName(locationURL.substring(locationURL + .lastIndexOf("/") + 1)); + + File localRepo = new File(new File(reposFolder, + localRepositoryFolderName), rootName); + XMLContent content = new XMLContent(); - + content.append(""); content.append(""); content.append(""); @@ -59,29 +62,35 @@ public Collection generateAntTargets() { content.append(""); content.append(""); content.append(""); - + boolean isGit = location.getType().equals("git"); boolean isSVN = location.getType().equals("svn"); - + String localRepositoryPath = getLocalRepositoryPath(location); - + if (isGit) { if (localRepo.exists()) { - content.append(""); + content.append(""); content.append(""); content.append(""); } else { - content.append(""); + content.append(""); content.append(""); - content.append(""); + content.append(""); content.append(""); content.append(""); - content.append(""); + content.append(""); content.append(""); } if (!location.getSubDirectories().isEmpty()) { - //enable sparse checkout - content.append(""); + // enable sparse checkout + content.append(""); content.append(""); content.append(""); content.append(""); @@ -91,8 +100,11 @@ public Collection generateAntTargets() { dirList += subDir; dirList += "${line.separator}"; } - content.append(""); - content.append(""); + content.append(""); + content.append(""); content.append(""); content.append(""); content.append(""); @@ -101,93 +113,132 @@ public Collection generateAntTargets() { } else if (isSVN) { if (localRepo.exists()) { // execute update - content.append(""); + content.append(""); content.append(""); content.append(""); } else { // execute checkout - content.append(""); + content.append(""); content.append(""); content.append(""); - content.append(""); + content.append(""); content.append(""); } - } else /* isGet */ { + } else /* isGet */{ if (!localRepo.exists()) { - content.append(""); + content.append(""); if (!location.getSubDirectories().isEmpty()) { if (localRepo.getName().endsWith(".zip")) { - String zipFilePath = new File(localRepo, rootName).getAbsolutePath() ; - content.append(""); - content.append(""); + String zipFilePath = new File(localRepo, rootName) + .getAbsolutePath(); + content.append(""); + content.append(""); content.append(""); for (String zipEntry : location.getSubDirectories()) { - content.append(""); + content.append(""); } content.append(""); content.append(""); - content.append(""); - } else /* folder */ { + content.append(""); + } else /* folder */{ for (String subPath : location.getSubDirectories()) { - content.append(""); - } + content.append(""); + } } } else { - AntScriptUtil.addDownloadFileScript(content, locationURL, localRepositoryPath); + AntScriptUtil.addDownloadFileScript(content, + locationURL, localRepositoryPath); } } } - result.add(new AntTarget("update-" + localRepositoryFolderName, content)); + result.add(new AntTarget("update-" + localRepositoryFolderName, + content)); } return result; } private AntTarget writeRepositoryList() { XMLContent content = new XMLContent(); - String revisionFile = new File(reposFolder, "buildboost_repository_list.txt").getAbsolutePath(); - content.append(""); + String revisionFile = new File(reposFolder, + "buildboost_repository_list.txt").getAbsolutePath(); + content.append(""); content.append(""); for (Location location : locations) { boolean isGit = location.getType().equals("git"); boolean isSVN = location.getType().equals("svn"); - + String locationURL = location.getUrl(); - - String localRepositoryPath = getLocalRepositoryPath(location); - + + String localRepositoryPath = getLocalRepositoryPath(location); + if (isSVN || isGit) { - content.append(""); + content.append(""); content.append(""); - content.append(""); + content.append(""); content.append(""); - content.append(""); + content.append(""); content.append(""); } } - + return new AntTarget("write-repository-list", content); } protected String getLocalRepositoryPath(Location location) { String locationURL = location.getUrl(); String localRepositoryFolderName = url2FolderName(locationURL); - String rootName = url2FolderName(locationURL.substring(locationURL.lastIndexOf("/") + 1)); - return new File(new File(reposFolder, localRepositoryFolderName), rootName).getAbsolutePath(); + String rootName = url2FolderName(locationURL.substring(locationURL + .lastIndexOf("/") + 1)); + return new File(new File(reposFolder, localRepositoryFolderName), + rootName).getAbsolutePath(); } protected String url2FolderName(String url) { int idx; String folderName = url; - //cut leading protocol + // cut leading protocol idx = folderName.indexOf("//"); if (idx != -1) { folderName = folderName.substring(idx + 2); } - //cut arguments + // cut arguments idx = folderName.indexOf("?"); if (idx != -1) { folderName = folderName.substring(0, idx); } + folderName = encodeFileOrFolderName(folderName); + return folderName; + } + + /** + * @param folderName + * Name of file or folder (os dependend) + * @return encoded Folder name as new object (copy) + */ + public static String encodeFileOrFolderName(String orgFolderName) { + // explicit copy to avoid the same object in a special case without + // special chars. + String folderName = new String(orgFolderName); folderName = folderName.replace(":", ""); folderName = folderName.replace("~", "_"); folderName = folderName.replace("/", "_"); diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index 5c53414..82354a5 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -32,6 +32,7 @@ import de.devboost.buildboost.genext.emf.artifacts.GeneratorModel; import de.devboost.buildboost.model.IDependable; import de.devboost.buildboost.steps.ClasspathHelper; +import de.devboost.buildboost.steps.clone.CloneRepositoriesBuildStep; import de.devboost.buildboost.util.XMLContent; /** @@ -82,7 +83,8 @@ public Collection generateAntTargets() throws BuildException { sb.append(""); String genModelID = genModelPath.toString() .replace(File.separator, "-"); - String paraFileName = genModelID + ".properties"; + String paraFileName = CloneRepositoriesBuildStep + .encodeFileOrFolderName(genModelID + ".properties"); sb.append(""); sb.append(""); sb.append(classpath); @@ -96,8 +98,7 @@ public Collection generateAntTargets() throws BuildException { sb)); } - private void writeParaFile(final String fileName, - final List plugins) { + private void writeParaFile(final String fileName, final List plugins) { final File paraPropFile = new File(fileName); PrintWriter pw = null; try { From 6f89d0d05dda3ab03c695dd110768b2257023b75 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Dec 2012 17:09:30 +0100 Subject: [PATCH 21/41] mem heap to large -> set from 2048 -> 1024 --- .../buildboost/genext/emf/steps/GenerateGenModelCodeStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index 82354a5..760a3e1 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -76,7 +76,7 @@ public Collection generateAntTargets() throws BuildException { sb.append(""); sb.append(""); - sb.append(""); + sb.append(""); sb.append(""); sb.append(""); From ade88f542082298b0ded6a733731b56b7b5bbc03 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Dec 2012 17:44:49 +0100 Subject: [PATCH 22/41] JVMARGs extracted as constants --- .../ant/AbstractAntTargetGenerator.java | 7 ++- .../emf/steps/GenerateGenModelCodeStep.java | 4 +- .../steps/GenerateResourcePluginsStep.java | 45 ++++++++++++------- 3 files changed, 35 insertions(+), 21 deletions(-) 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 fb4cb98..ed351ff 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 @@ -24,11 +24,14 @@ public abstract class AbstractAntTargetGenerator implements IAntTargetGenerator { + final public static String JVMARG_MX = "-Xmx1024m"; + final public static String JVMARG_MAXPERM = "-XX:MaxPermSize=256m"; + @Override public String getIdentifier() { return toString(); } - + @Override public Collection getDependencies() { return Collections.emptySet(); @@ -43,7 +46,7 @@ public void resolveDependencies(Collection allArtifacts) { public Collection getUnresolvedDependencies() { return Collections.emptySet(); } - + @Override public long getTimestamp() { return -1; diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index 760a3e1..8aab53c 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -75,8 +75,8 @@ public Collection generateAntTargets() throws BuildException { // TODO use constant here sb.append(""); - sb.append(""); - sb.append(""); + sb.append(""); + sb.append(""); sb.append(""); sb.append(""); diff --git a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java index 5a3c670..a949fa5 100644 --- a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java +++ b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java @@ -15,13 +15,13 @@ ******************************************************************************/ package de.devboost.buildboost.genext.emftext.steps; +import static de.devboost.buildboost.genext.emftext.IConstants.BUILDEXT_EXECUTABLE; + import java.io.File; import java.util.Collection; import java.util.Collections; import java.util.List; -import static de.devboost.buildboost.genext.emftext.IConstants.*; - import de.devboost.buildboost.BuildException; import de.devboost.buildboost.IConstants; import de.devboost.buildboost.ant.AbstractAntTargetGenerator; @@ -38,41 +38,52 @@ */ public class GenerateResourcePluginsStep extends AbstractAntTargetGenerator { - private ConcreteSyntaxDefinition syntaxDefinition; - private List plugins; + private final ConcreteSyntaxDefinition syntaxDefinition; + private final List plugins; - public GenerateResourcePluginsStep(List plugins, ConcreteSyntaxDefinition syntaxDefinition) { + public GenerateResourcePluginsStep(List plugins, + ConcreteSyntaxDefinition syntaxDefinition) { this.plugins = plugins; this.syntaxDefinition = syntaxDefinition; } + @Override public Collection generateAntTargets() throws BuildException { - Collection dependencies = syntaxDefinition.getDependencies(); + Collection dependencies = syntaxDefinition + .getDependencies(); if (dependencies.isEmpty()) { - throw new BuildException("Concrete syntax definitions are expected to have a dependency to the EMFText SDK."); + throw new BuildException( + "Concrete syntax definitions are expected to have a dependency to the EMFText SDK."); } - XMLContent classpath = new ClasspathHelper().getClasspath(syntaxDefinition, true); + XMLContent classpath = new ClasspathHelper().getClasspath( + syntaxDefinition, true); String csFilePath = syntaxDefinition.getFile().getAbsolutePath(); XMLContent content = new XMLContent(); - content.append(""); - content.append(""); - content.append(""); - content.append(""); + content.append(""); + content.append(""); + content.append(""); + content.append(""); content.append(""); - content.append(""); - content.append(""); + content.append(""); + content.append(""); for (Plugin plugin : plugins) { - content.append(""); + content.append(""); } content.append(""); content.append(classpath); content.append(""); content.append(""); content.append(IConstants.NL); - + String csID = csFilePath.replace(File.separator, "-"); - return Collections.singleton(new AntTarget("emftext-codegen-" + csID, content)); + return Collections.singleton(new AntTarget("emftext-codegen-" + csID, + content)); } } From 370cb4a769ced27b728816ed5e8ac588f75ceb84 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Dec 2012 19:28:35 +0100 Subject: [PATCH 23/41] emftext extension changed to + use parameter file --- .../ant/AbstractAntTargetGenerator.java | 24 ++++ .../emf/steps/GenerateGenModelCodeStep.java | 19 --- .../emftext/TextResourcePluginGenerator.java | 126 +++++++++++------- .../META-INF/MANIFEST.MF | 1 + .../steps/GenerateResourcePluginsStep.java | 17 ++- 5 files changed, 118 insertions(+), 69 deletions(-) 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 ed351ff..ccca580 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 @@ -15,9 +15,14 @@ ******************************************************************************/ 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; @@ -27,6 +32,25 @@ public abstract class AbstractAntTargetGenerator implements IAntTargetGenerator final public static String JVMARG_MX = "-Xmx1024m"; final public static String JVMARG_MAXPERM = "-XX:MaxPermSize=256m"; + 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(); diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index 8aab53c..accbdd4 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -18,8 +18,6 @@ import static de.devboost.buildboost.IConstants.NL; import java.io.File; -import java.io.FileNotFoundException; -import java.io.PrintWriter; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -98,21 +96,4 @@ public Collection generateAntTargets() throws BuildException { sb)); } - private 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(); - } - } - - } } diff --git a/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java b/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java index 27c014b..a6a2b62 100644 --- a/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java +++ b/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java @@ -15,7 +15,10 @@ ******************************************************************************/ package de.devboost.buildboost.buildext.emftext; +import java.io.BufferedReader; import java.io.File; +import java.io.FileReader; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -43,10 +46,11 @@ import de.devboost.buildboost.BuildException; import de.devboost.buildboost.artifacts.Plugin; +import de.devboost.buildboost.genext.emftext.steps.GenerateResourcePluginsStep; /** - * The {@link TextResourcePluginGenerator} is executed by build scripts that are - * generated by the {@link GenerateEMFTextCodeStage} or the + * The {@link TextResourcePluginGenerator} is executed by build scripts that are + * generated by the {@link GenerateEMFTextCodeStage} or the * {@link GenerateResourcePluginsStep}. It runs the EMFText code generation for * a given syntax specification. */ @@ -57,21 +61,50 @@ public static void main(String[] args) throws Exception { String pathToCsFile = args[0]; String projectName = args[1]; String buildDirPath = args[2]; - List pluginPaths = new ArrayList(); - for (int i = 3; i < args.length; i++) { - pluginPaths.add(args[i]); + List pluginPaths = readPluginPaths(args[3]); + // TODO remove before pull request + // for (int i = 3; i < args.length; i++) { + // pluginPaths.add(args[i]); + // } + new TextResourcePluginGenerator().run(pathToCsFile, projectName, + buildDirPath, pluginPaths); + } + + // TODO Duplicate code + // @see de.devboost.buildboost.buildext.emf.HeadlessCodeGenerator + private static List readPluginPaths(final String paraFileName) { + List paths = new ArrayList(); + BufferedReader reader = null; + try { + final FileReader fin = new FileReader(paraFileName); + reader = new BufferedReader(fin); + String line = reader.readLine(); + while (line != null) { + paths.add(line); + line = reader.readLine(); + } + } catch (IOException ex) { + // TODO Auto-generated catch block + ex.printStackTrace(); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } - new TextResourcePluginGenerator().run(pathToCsFile, projectName, buildDirPath, pluginPaths); + + return paths; } - public void run( - String pathToCsFile, - String projectName, - String buildDirPath, - List pluginPaths) throws Exception { - + public void run(String pathToCsFile, String projectName, + String buildDirPath, List pluginPaths) throws Exception { + final File rootFolder = new File(buildDirPath); - + URI uri = URI.createFileURI(pathToCsFile); ResourceSet rs = new ResourceSetImpl(); registerFactoriesAndPackages(); @@ -80,41 +113,41 @@ public void run( Resource resource = rs.getResource(uri, true); ConcreteSyntax syntax = (ConcreteSyntax) resource.getContents().get(0); if (syntax == null) { - throw new BuildException("Generation failed, because the syntax file could not be loaded. Probably it contains syntactical errors."); + throw new BuildException( + "Generation failed, because the syntax file could not be loaded. Probably it contains syntactical errors."); } EcoreUtil.resolveAll(resource); - - Set unresolvedProxies = CsResourceUtil.findUnresolvedProxies(rs); + + Set unresolvedProxies = CsResourceUtil + .findUnresolvedProxies(rs); for (EObject unresolvedProxy : unresolvedProxies) { System.out.println("Found unresolved proxy: " + unresolvedProxy); } if (unresolvedProxies.size() > 0) { - throw new BuildException("Generation failed, because the syntax file contains unresolved proxy objects."); + throw new BuildException( + "Generation failed, because the syntax file contains unresolved proxy objects."); } - + IFileSystemConnector folderConnector = new IFileSystemConnector() { - + + @Override public File getProjectFolder(IPluginDescriptor plugin) { - return new File(rootFolder.getAbsolutePath() + File.separator + plugin.getName()); + return new File(rootFolder.getAbsolutePath() + File.separator + + plugin.getName()); } }; - + BuildBoostGenerationContext context = new BuildBoostGenerationContext( - folderConnector, - new BuildBoostProblemCollector(), - syntax, - rootFolder, - pathToCsFile, - projectName); - Result result = new BuildBoostGenerator().run( - context, - new BuildBoostLogMarker(), - new BuildBoostProgressMonitor() - ); + folderConnector, new BuildBoostProblemCollector(), syntax, + rootFolder, pathToCsFile, projectName); + Result result = new BuildBoostGenerator().run(context, + new BuildBoostLogMarker(), new BuildBoostProgressMonitor()); if (result != Result.SUCCESS) { if (result == Result.ERROR_FOUND_UNRESOLVED_PROXIES) { for (EObject unresolvedProxy : result.getUnresolvedProxies()) { - System.out.println("Found unresolved proxy \"" + ((InternalEObject) unresolvedProxy).eProxyURI() + "\" in " + unresolvedProxy.eResource()); + System.out.println("Found unresolved proxy \"" + + ((InternalEObject) unresolvedProxy).eProxyURI() + + "\" in " + unresolvedProxy.eResource()); } throw new BuildException("Generation failed " + result); } else { @@ -140,31 +173,32 @@ private void registerURIMappings(List pluginPaths) throws Exception { } else if (!"".equals(to.lastSegment())) { to = to.appendSegment(""); } - //System.out.println("Mapping URI " + from + " to " + to); - uriMap.put( - from, - to - ); + // System.out.println("Mapping URI " + from + " to " + to); + uriMap.put(from, to); } } - + private void registerFactoriesAndPackages() { - // TODO we must search the target platform for registered resource factories, + // TODO we must search the target platform for registered resource + // factories, // generator models and EPackages - // TODO this is a MODIFIED copy of this method from class HeadlessCodeGenerator - Map extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); + // TODO this is a MODIFIED copy of this method from class + // HeadlessCodeGenerator + Map extensionToFactoryMap = Resource.Factory.Registry.INSTANCE + .getExtensionToFactoryMap(); extensionToFactoryMap.put("ecore", new EcoreResourceFactoryImpl()); extensionToFactoryMap.put("genmodel", new EcoreResourceFactoryImpl()); - extensionToFactoryMap.put(new CsMetaInformation().getSyntaxName(), new CsResourceFactory()); - + extensionToFactoryMap.put(new CsMetaInformation().getSyntaxName(), + new CsResourceFactory()); + GenModelPackage genModelPackage = GenModelPackage.eINSTANCE; EcorePackage ecorePackage = EcorePackage.eINSTANCE; - + URI ecoreGenModelURI = URI.createPlatformPluginURI( "org.eclipse.emf.ecore/model/Ecore.genmodel", true); URI genmodelGenModelURI = URI.createPlatformPluginURI( "org.eclipse.emf.codegen.ecore/model/GenModel.genmodel", true); - + EcorePlugin.getEPackageNsURIToGenModelLocationMap().put( ecorePackage.getNsURI(), ecoreGenModelURI); EcorePlugin.getEPackageNsURIToGenModelLocationMap().put( diff --git a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/META-INF/MANIFEST.MF b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/META-INF/MANIFEST.MF index 3131937..0392854 100644 --- a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/META-INF/MANIFEST.MF +++ b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/META-INF/MANIFEST.MF @@ -5,3 +5,4 @@ Bundle-SymbolicName: de.devboost.buildboost.genext.emftext Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: de.devboost.buildboost +Export-Package: de.devboost.buildboost.genext.emftext.steps diff --git a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java index a949fa5..7a1b219 100644 --- a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java +++ b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java @@ -30,6 +30,7 @@ import de.devboost.buildboost.genext.emftext.artifacts.ConcreteSyntaxDefinition; import de.devboost.buildboost.model.IDependable; import de.devboost.buildboost.steps.ClasspathHelper; +import de.devboost.buildboost.steps.clone.CloneRepositoriesBuildStep; import de.devboost.buildboost.util.XMLContent; /** @@ -73,16 +74,24 @@ public Collection generateAntTargets() throws BuildException { content.append(""); - for (Plugin plugin : plugins) { - content.append(""); - } + + String csID = csFilePath.replace(File.separator, "-"); + String paraFileName = CloneRepositoriesBuildStep + .encodeFileOrFolderName(csID + ".properties"); + content.append(""); + + // for (Plugin plugin : plugins) { + // content.append(""); + // } + content.append(""); content.append(classpath); content.append(""); content.append(""); content.append(IConstants.NL); - String csID = csFilePath.replace(File.separator, "-"); + writeParaFile(paraFileName, plugins); + return Collections.singleton(new AntTarget("emftext-codegen-" + csID, content)); } From fe180fd459f3c2c18103bed6cca6a966f46a7ae3 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Dec 2012 21:05:41 +0100 Subject: [PATCH 24/41] testonly logging added --- .../buildext/emftext/TextResourcePluginGenerator.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java b/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java index a6a2b62..241970b 100644 --- a/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java +++ b/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java @@ -188,9 +188,12 @@ private void registerFactoriesAndPackages() { .getExtensionToFactoryMap(); extensionToFactoryMap.put("ecore", new EcoreResourceFactoryImpl()); extensionToFactoryMap.put("genmodel", new EcoreResourceFactoryImpl()); - extensionToFactoryMap.put(new CsMetaInformation().getSyntaxName(), - new CsResourceFactory()); + // TESTONLY + final String syntaxName = new CsMetaInformation().getSyntaxName(); + System.out.println("SYNTAX-NAME>" + syntaxName + "<"); + + extensionToFactoryMap.put(syntaxName, new CsResourceFactory()); GenModelPackage genModelPackage = GenModelPackage.eINSTANCE; EcorePackage ecorePackage = EcorePackage.eINSTANCE; From a797c6bab783fb00709828efc2bc9bc0ab937d47 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Thu, 20 Dec 2012 22:00:42 +0100 Subject: [PATCH 25/41] os specific file.separator removed --- .../buildext/emf/HeadlessCodeGenerator.java | 9 +++++---- .../emftext/TextResourcePluginGenerator.java | 17 +++++------------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java b/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java index 8379cee..24ba1e8 100644 --- a/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java +++ b/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java @@ -138,11 +138,11 @@ private boolean generateEditCode(GenModel genModel, String projectPath) { return false; } - if (editDirectory.startsWith("/")) { + if (editDirectory.startsWith(File.separator)) { editDirectory = editDirectory.substring(1); } String editProjectName = editDirectory.substring(0, - editDirectory.indexOf("/")); + editDirectory.indexOf(File.separator)); File editProjectDir = new File(workDir, editProjectName); if (!editProjectDir.exists()) { return false; @@ -180,8 +180,9 @@ private void registerURIMappings(ResourceSet rs, List pluginPaths) Map uriMap = rs.getURIConverter().getURIMap(); for (String pluginPath : pluginPaths) { File pluginFile = new File(pluginPath); - if (pluginFile.isDirectory() && !pluginPath.endsWith("/")) { - pluginPath = pluginPath + "/"; + if (pluginFile.isDirectory() + && !pluginPath.endsWith(File.separator)) { + pluginPath = pluginPath + File.separator; } Plugin plugin = new Plugin(pluginFile); String identifier = plugin.getIdentifier(); diff --git a/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java b/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java index 241970b..e209ded 100644 --- a/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java +++ b/Extensions/EMFText/de.devboost.buildboost.buildext.emftext/src/de/devboost/buildboost/buildext/emftext/TextResourcePluginGenerator.java @@ -62,10 +62,6 @@ public static void main(String[] args) throws Exception { String projectName = args[1]; String buildDirPath = args[2]; List pluginPaths = readPluginPaths(args[3]); - // TODO remove before pull request - // for (int i = 3; i < args.length; i++) { - // pluginPaths.add(args[i]); - // } new TextResourcePluginGenerator().run(pathToCsFile, projectName, buildDirPath, pluginPaths); } @@ -161,8 +157,9 @@ private void registerURIMappings(List pluginPaths) throws Exception { Map uriMap = URIConverter.URI_MAP; for (String pluginPath : pluginPaths) { File pluginFile = new File(pluginPath); - if (pluginFile.isDirectory() && !pluginPath.endsWith("/")) { - pluginPath = pluginPath + "/"; + if (pluginFile.isDirectory() + && !pluginPath.endsWith(File.separator)) { + pluginPath = pluginPath + File.separator; } Plugin plugin = new Plugin(pluginFile); String identifier = plugin.getIdentifier(); @@ -188,12 +185,8 @@ private void registerFactoriesAndPackages() { .getExtensionToFactoryMap(); extensionToFactoryMap.put("ecore", new EcoreResourceFactoryImpl()); extensionToFactoryMap.put("genmodel", new EcoreResourceFactoryImpl()); - - // TESTONLY - final String syntaxName = new CsMetaInformation().getSyntaxName(); - System.out.println("SYNTAX-NAME>" + syntaxName + "<"); - - extensionToFactoryMap.put(syntaxName, new CsResourceFactory()); + extensionToFactoryMap.put(new CsMetaInformation().getSyntaxName(), + new CsResourceFactory()); GenModelPackage genModelPackage = GenModelPackage.eINSTANCE; EcorePackage ecorePackage = EcorePackage.eINSTANCE; From e63afdf454781f62401d89c01f834628ecbafe01 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Fri, 21 Dec 2012 21:55:17 +0100 Subject: [PATCH 26/41] debug option added by generating sub tasks emf and emftext --- .../de/devboost/buildboost/ant/AbstractAntTargetGenerator.java | 1 + .../buildboost/genext/emf/steps/GenerateGenModelCodeStep.java | 1 + .../genext/emftext/steps/GenerateResourcePluginsStep.java | 1 + 3 files changed, 3 insertions(+) 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 ccca580..86042db 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 @@ -31,6 +31,7 @@ public abstract class AbstractAntTargetGenerator implements IAntTargetGenerator final public static String JVMARG_MX = "-Xmx1024m"; final public static String JVMARG_MAXPERM = "-XX:MaxPermSize=256m"; + final public static String JVMARG_DEBUG = "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"; protected void writeParaFile(final String fileName, final List plugins) { diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index accbdd4..b67bea5 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -75,6 +75,7 @@ public Collection generateAntTargets() throws BuildException { + IConstants.BUILDEXT_EXECUTABLE + "\" failonerror=\"true\">"); sb.append(""); sb.append(""); + sb.append(""); sb.append(""); sb.append(""); diff --git a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java index 7a1b219..154339f 100644 --- a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java +++ b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java @@ -68,6 +68,7 @@ public Collection generateAntTargets() throws BuildException { + "\" failonerror=\"true\">"); content.append(""); content.append(""); + content.append(""); content.append(""); content.append(""); From 307b2de787059f9b59f8c2a4129fc75b66ef69e1 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Fri, 21 Dec 2012 22:32:16 +0100 Subject: [PATCH 27/41] sub task become port 8001 --- .../de/devboost/buildboost/ant/AbstractAntTargetGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 86042db..e43a090 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 @@ -31,7 +31,7 @@ public abstract class AbstractAntTargetGenerator implements IAntTargetGenerator final public static String JVMARG_MX = "-Xmx1024m"; final public static String JVMARG_MAXPERM = "-XX:MaxPermSize=256m"; - final public static String JVMARG_DEBUG = "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"; + final public static String JVMARG_DEBUG = "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8001"; protected void writeParaFile(final String fileName, final List plugins) { From e0423251f0e06c6abbed3d45eb433d6f194303d2 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Fri, 21 Dec 2012 23:04:00 +0100 Subject: [PATCH 28/41] manually reset changes for file.separator to commit 71487d0 (only changes for "/" replacement in HeadlessCodeGenerator) --- .../buildboost/buildext/emf/HeadlessCodeGenerator.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java b/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java index 24ba1e8..5b36544 100644 --- a/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java +++ b/Extensions/EMF/de.devboost.buildboost.buildext.emf/src/de/devboost/buildboost/buildext/emf/HeadlessCodeGenerator.java @@ -138,11 +138,10 @@ private boolean generateEditCode(GenModel genModel, String projectPath) { return false; } - if (editDirectory.startsWith(File.separator)) { + if (editDirectory.startsWith("/")) { editDirectory = editDirectory.substring(1); } - String editProjectName = editDirectory.substring(0, - editDirectory.indexOf(File.separator)); + String editProjectName = editDirectory.substring(0, editDirectory.indexOf("/")); File editProjectDir = new File(workDir, editProjectName); if (!editProjectDir.exists()) { return false; @@ -180,9 +179,8 @@ private void registerURIMappings(ResourceSet rs, List pluginPaths) Map uriMap = rs.getURIConverter().getURIMap(); for (String pluginPath : pluginPaths) { File pluginFile = new File(pluginPath); - if (pluginFile.isDirectory() - && !pluginPath.endsWith(File.separator)) { - pluginPath = pluginPath + File.separator; + if (pluginFile.isDirectory() && !pluginPath.endsWith("/")) { + pluginPath = pluginPath + "/"; } Plugin plugin = new Plugin(pluginFile); String identifier = plugin.getIdentifier(); From e74ec627be0f26743b03df01b1f990d9c719c4fa Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 01:16:21 +0100 Subject: [PATCH 29/41] first attempt to support a global config file --- .../de/devboost/buildboost/BuildContext.java | 9 ++++ .../buildboost/GlobalBuildConfiguration.java | 52 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java 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 098106c..7cb891d 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java @@ -33,11 +33,20 @@ */ public class BuildContext implements IBuildContext { + // Singleton: only one instance in a jvm is needed (user changes during the build are not permitted) + private static GlobalBuildConfiguration globalBuildConfiguration=new GlobalBuildConfiguration(); + + public static GlobalBuildConfiguration getGlobalBuildConfiguration() { + return globalBuildConfiguration; + } + private Collection discoveredArtifacts = new LinkedHashSet(); private IBuildListener buildListener; private boolean ignoreUnresolvedDependencies; private List buildParticipants = new ArrayList(); + + public BuildContext() { super(); // add default participants 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..b4a4a4c --- /dev/null +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -0,0 +1,52 @@ +package de.devboost.buildboost; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * Used as Singleton: only one instance in a jvm is needed (user changes during + * the build are not permitted) + * + */ +public class GlobalBuildConfiguration { + + final private Properties userProperties = new Properties(); + + private Boolean wasRead = Boolean.FALSE; + + // the one and only instance should be created by BuildContext + GlobalBuildConfiguration() { + userProperties.setProperty("debug", "0"); + readGlobalConfiguration(); + } + + private void readGlobalConfiguration() { + final String userHomePath = System.getProperty("user.home"); + final String globalConfigFileName = userHomePath + File.separator + + ".buildboost"; + final File globalConfigFile = new File(globalConfigFileName); + + // not thread safe ! + // but it is ok, because changes of configuration are permitted + if (Boolean.FALSE.equals(this.wasRead)) { + + if (globalConfigFile.exists()) { + System.out + .println("Loading user defined global configuration from .buildboost file."); + InputStream in = this.getClass().getClassLoader() + .getResourceAsStream(globalConfigFileName); + try { + userProperties.load(in); + this.wasRead = Boolean.TRUE; + } catch (IOException e) { + e.printStackTrace(); + } + } else { + System.out + .println("There was no user configuration found in the users .buildboost file"); + } + } + } +} From 73709b23c62c2562baba4b2b0d3c49e91eece793 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 01:29:06 +0100 Subject: [PATCH 30/41] global config file must be have a length >0 to read --- .../src/de/devboost/buildboost/GlobalBuildConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index b4a4a4c..6eab637 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -32,7 +32,7 @@ private void readGlobalConfiguration() { // but it is ok, because changes of configuration are permitted if (Boolean.FALSE.equals(this.wasRead)) { - if (globalConfigFile.exists()) { + if (globalConfigFile.exists() && globalConfigFile.length() > 1) { System.out .println("Loading user defined global configuration from .buildboost file."); InputStream in = this.getClass().getClassLoader() From 3da15767a499b63b8d2a52daeda3861e622f8c70 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 01:47:38 +0100 Subject: [PATCH 31/41] changes inputStream to filereader --- .../buildboost/GlobalBuildConfiguration.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index 6eab637..238e0be 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -1,8 +1,8 @@ package de.devboost.buildboost; import java.io.File; +import java.io.FileReader; import java.io.IOException; -import java.io.InputStream; import java.util.Properties; /** @@ -35,13 +35,22 @@ private void readGlobalConfiguration() { if (globalConfigFile.exists() && globalConfigFile.length() > 1) { System.out .println("Loading user defined global configuration from .buildboost file."); - InputStream in = this.getClass().getClassLoader() - .getResourceAsStream(globalConfigFileName); + FileReader reader = null; try { - userProperties.load(in); + reader = new FileReader(globalConfigFile); + userProperties.load(reader); this.wasRead = Boolean.TRUE; } 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 From 2b91487dadf6ee45d604f526f8c234e7e3d0d5be Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 02:22:04 +0100 Subject: [PATCH 32/41] change GlobalBuildConfiguration to a singleton with holder --- .../de/devboost/buildboost/BuildContext.java | 30 ++++--- .../buildboost/GlobalBuildConfiguration.java | 87 +++++++++++-------- 2 files changed, 72 insertions(+), 45 deletions(-) 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 7cb891d..fa457c2 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java @@ -33,20 +33,19 @@ */ public class BuildContext implements IBuildContext { - // Singleton: only one instance in a jvm is needed (user changes during the build are not permitted) - private static GlobalBuildConfiguration globalBuildConfiguration=new GlobalBuildConfiguration(); - + // singleton only one instance in one jvm + private static GlobalBuildConfiguration globalBuildConfiguration = GlobalBuildConfiguration + .getInstance(); + public static GlobalBuildConfiguration getGlobalBuildConfiguration() { return globalBuildConfiguration; } - private Collection discoveredArtifacts = new LinkedHashSet(); + private final Collection discoveredArtifacts = new LinkedHashSet(); private IBuildListener buildListener; private boolean ignoreUnresolvedDependencies; - private List buildParticipants = new ArrayList(); + private final List buildParticipants = new ArrayList(); - - public BuildContext() { super(); // add default participants @@ -55,11 +54,13 @@ public BuildContext() { addBuildParticipant(new ArtifactSorter()); addBuildParticipant(new AntTargetGeneratorRunner()); } - + + @Override public Collection getDiscoveredArtifacts() { return Collections.unmodifiableCollection(discoveredArtifacts); } + @Override public IBuildListener getBuildListener() { if (buildListener == null) { buildListener = new SystemOutListener(); @@ -71,26 +72,33 @@ public void setBuildListener(IBuildListener buildListener) { this.buildListener = buildListener; } + @Override public boolean ignoreUnresolvedDependencies() { return ignoreUnresolvedDependencies; } - public void setIgnoreUnresolvedDependencies(boolean ignoreUnresolvedDependencies) { + public void setIgnoreUnresolvedDependencies( + boolean ignoreUnresolvedDependencies) { this.ignoreUnresolvedDependencies = ignoreUnresolvedDependencies; } + @Override public void addDiscoveredArtifacts(Collection artifactsToAdd) { discoveredArtifacts.addAll(artifactsToAdd); } - - public void removeDiscoveredArtifacts(Collection artifactsToRemove) { + + @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/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index 238e0be..f120c50 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -6,56 +6,75 @@ import java.util.Properties; /** - * Used as Singleton: only one instance in a jvm is needed (user changes during - * the build are not permitted) + * This class is a singleton! * */ public class GlobalBuildConfiguration { - final private Properties userProperties = new Properties(); + final private static Properties userProperties = new Properties(); - private Boolean wasRead = Boolean.FALSE; - - // the one and only instance should be created by BuildContext - GlobalBuildConfiguration() { + // none extern instance creation support + private GlobalBuildConfiguration() { + System.out.println("GlobalUserConfig: set defaults"); userProperties.setProperty("debug", "0"); - readGlobalConfiguration(); } - private void readGlobalConfiguration() { + // lazy init by static holder class + private static class Holder { + private static final GlobalBuildConfiguration INSTANCE = new GlobalBuildConfiguration(); + + private Holder() { + System.out.println("GlobalUserConfig: read config file"); + readGlobalConfiguration(); + } + } + + public static GlobalBuildConfiguration getInstance() { + return Holder.INSTANCE; + } + + private static void readGlobalConfiguration() { final String userHomePath = System.getProperty("user.home"); final String globalConfigFileName = userHomePath + File.separator + ".buildboost"; final File globalConfigFile = new File(globalConfigFileName); - // not thread safe ! - // but it is ok, because changes of configuration are permitted - if (Boolean.FALSE.equals(this.wasRead)) { - - 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); - this.wasRead = Boolean.TRUE; - } catch (IOException e) { - e.printStackTrace(); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + 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"); } + } else { + System.out + .println("There was no user configuration found in the users .buildboost file"); } } + + public String getConfigItem(final String key) { + + readGlobalConfiguration(); + return userProperties.getProperty(key); + + } + + public String getConfigItem(final String key, final String defaultValue) { + readGlobalConfiguration(); + return userProperties.getProperty(key, defaultValue); + + } + } From 21f9ed3529d804a9a5bf321af6dfbda590cee3d8 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 02:28:33 +0100 Subject: [PATCH 33/41] move read config file to outer constructor --- .../devboost/buildboost/GlobalBuildConfiguration.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index f120c50..262238e 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -16,7 +16,9 @@ public class GlobalBuildConfiguration { // none extern instance creation support private GlobalBuildConfiguration() { System.out.println("GlobalUserConfig: set defaults"); - userProperties.setProperty("debug", "0"); + setDefaultValues(); + System.out.println("GlobalUserConfig: read config file"); + readGlobalConfiguration(); } // lazy init by static holder class @@ -24,8 +26,7 @@ private static class Holder { private static final GlobalBuildConfiguration INSTANCE = new GlobalBuildConfiguration(); private Holder() { - System.out.println("GlobalUserConfig: read config file"); - readGlobalConfiguration(); + } } @@ -33,6 +34,10 @@ public static GlobalBuildConfiguration getInstance() { return Holder.INSTANCE; } + private void setDefaultValues() { + userProperties.setProperty("debug", "0"); + } + private static void readGlobalConfiguration() { final String userHomePath = System.getProperty("user.home"); final String globalConfigFileName = userHomePath + File.separator From f91bd13c3116c87f30892c6d12e4e1ecb4dd4d18 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 02:36:39 +0100 Subject: [PATCH 34/41] global config test --- .../de/devboost/buildboost/GlobalBuildConfiguration.java | 5 ++++- .../genext/emf/steps/GenerateGenModelCodeStep.java | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index 262238e..300567f 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -35,7 +35,7 @@ public static GlobalBuildConfiguration getInstance() { } private void setDefaultValues() { - userProperties.setProperty("debug", "0"); + userProperties.setProperty(GlobalBuildConfiguration.DEBUG, "0"); } private static void readGlobalConfiguration() { @@ -82,4 +82,7 @@ public String getConfigItem(final String key, final String defaultValue) { } + /* static constants for default global entries */ + public static final String DEBUG = "debug"; + } diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index b67bea5..f31955a 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -23,6 +23,7 @@ import java.util.List; import de.devboost.buildboost.BuildException; +import de.devboost.buildboost.GlobalBuildConfiguration; import de.devboost.buildboost.ant.AbstractAntTargetGenerator; import de.devboost.buildboost.ant.AntTarget; import de.devboost.buildboost.artifacts.Plugin; @@ -52,6 +53,13 @@ public GenerateGenModelCodeStep(List plugins, @Override public Collection generateAntTargets() throws BuildException { + + final GlobalBuildConfiguration globalConfig = GlobalBuildConfiguration + .getInstance(); + final String debugConfig = globalConfig + .getConfigItem(GlobalBuildConfiguration.DEBUG); + System.out.println("DEBUG-FLAG:" + debugConfig); + Collection dependencies = generatorModel.getDependencies(); if (dependencies.isEmpty()) { throw new BuildException( From af4686025cd5654e46b09c30686599d0b3e3a869 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 03:24:07 +0100 Subject: [PATCH 35/41] obsolete holder constructor removed --- .../src/de/devboost/buildboost/GlobalBuildConfiguration.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index 300567f..a1db89b 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -24,10 +24,6 @@ private GlobalBuildConfiguration() { // lazy init by static holder class private static class Holder { private static final GlobalBuildConfiguration INSTANCE = new GlobalBuildConfiguration(); - - private Holder() { - - } } public static GlobalBuildConfiguration getInstance() { From f33d8325370e04f407365ab2aa925416a2343013 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 14:42:59 +0100 Subject: [PATCH 36/41] debug option computed depend of global configuration --- .../src/de/devboost/buildboost/BuildContext.java | 8 -------- .../de/devboost/buildboost/GlobalBuildConfiguration.java | 8 +++++++- .../genext/emf/steps/GenerateGenModelCodeStep.java | 7 +++---- .../emftext/steps/GenerateResourcePluginsStep.java | 9 ++++++++- 4 files changed, 18 insertions(+), 14 deletions(-) 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 fa457c2..392f77d 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/BuildContext.java @@ -33,14 +33,6 @@ */ public class BuildContext implements IBuildContext { - // singleton only one instance in one jvm - private static GlobalBuildConfiguration globalBuildConfiguration = GlobalBuildConfiguration - .getInstance(); - - public static GlobalBuildConfiguration getGlobalBuildConfiguration() { - return globalBuildConfiguration; - } - private final Collection discoveredArtifacts = new LinkedHashSet(); private IBuildListener buildListener; private boolean ignoreUnresolvedDependencies; diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index a1db89b..1e485d6 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -78,7 +78,13 @@ public String getConfigItem(final String key, final String defaultValue) { } - /* static constants for default global entries */ + public boolean isDebugEnabled() { + return DEBUG_DEFAULT + .equals(getConfigItem(GlobalBuildConfiguration.DEBUG)); + } + + /* static constants for standard global entries and defaults */ public static final String DEBUG = "debug"; + public static final String DEBUG_DEFAULT = "0"; // 0=disabled } diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index f31955a..cde4fbb 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -56,9 +56,6 @@ public Collection generateAntTargets() throws BuildException { final GlobalBuildConfiguration globalConfig = GlobalBuildConfiguration .getInstance(); - final String debugConfig = globalConfig - .getConfigItem(GlobalBuildConfiguration.DEBUG); - System.out.println("DEBUG-FLAG:" + debugConfig); Collection dependencies = generatorModel.getDependencies(); if (dependencies.isEmpty()) { @@ -83,7 +80,9 @@ public Collection generateAntTargets() throws BuildException { + IConstants.BUILDEXT_EXECUTABLE + "\" failonerror=\"true\">"); sb.append(""); sb.append(""); - sb.append(""); + if (globalConfig.isDebugEnabled()) { + sb.append(""); + } sb.append(""); sb.append(""); diff --git a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java index 154339f..4245512 100644 --- a/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java +++ b/Extensions/EMFText/de.devboost.buildboost.genext.emftext/src/de/devboost/buildboost/genext/emftext/steps/GenerateResourcePluginsStep.java @@ -23,6 +23,7 @@ import java.util.List; import de.devboost.buildboost.BuildException; +import de.devboost.buildboost.GlobalBuildConfiguration; import de.devboost.buildboost.IConstants; import de.devboost.buildboost.ant.AbstractAntTargetGenerator; import de.devboost.buildboost.ant.AntTarget; @@ -50,6 +51,10 @@ public GenerateResourcePluginsStep(List plugins, @Override public Collection generateAntTargets() throws BuildException { + + final GlobalBuildConfiguration globalConfig = GlobalBuildConfiguration + .getInstance(); + Collection dependencies = syntaxDefinition .getDependencies(); if (dependencies.isEmpty()) { @@ -68,7 +73,9 @@ public Collection generateAntTargets() throws BuildException { + "\" failonerror=\"true\">"); content.append(""); content.append(""); - content.append(""); + if (globalConfig.isDebugEnabled()) { + content.append(""); + } content.append(""); content.append(""); From f88b86ebcf283917eeb30ff401373cb25ffdc1ab Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 15:26:58 +0100 Subject: [PATCH 37/41] Default initialization fixed --- .../de/devboost/buildboost/GlobalBuildConfiguration.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index 1e485d6..a7eeada 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -31,7 +31,8 @@ public static GlobalBuildConfiguration getInstance() { } private void setDefaultValues() { - userProperties.setProperty(GlobalBuildConfiguration.DEBUG, "0"); + userProperties.setProperty(GlobalBuildConfiguration.DEBUG, + GlobalBuildConfiguration.DEBUG_DEFAULT); } private static void readGlobalConfiguration() { @@ -84,7 +85,11 @@ public boolean isDebugEnabled() { } /* static constants for standard global entries and defaults */ + + // remote debugging support public static final String DEBUG = "debug"; - public static final String DEBUG_DEFAULT = "0"; // 0=disabled + // 0=disabled, >0=remote debugging support && loglevel + // 1 = log level 1, 2 = log level 2, ... + public static final String DEBUG_DEFAULT = "0"; } From 4ea72cf0e89bd257aa081abed6d5c3abf33b92a6 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 15:47:02 +0100 Subject: [PATCH 38/41] logic for debugging fixed --- .../src/de/devboost/buildboost/GlobalBuildConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index a7eeada..f690950 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -80,7 +80,7 @@ public String getConfigItem(final String key, final String defaultValue) { } public boolean isDebugEnabled() { - return DEBUG_DEFAULT + return !DEBUG_DEFAULT .equals(getConfigItem(GlobalBuildConfiguration.DEBUG)); } From 4f5df2c0808fda00d3f6f56aad15a5a7f620382d Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sat, 22 Dec 2012 16:48:55 +0100 Subject: [PATCH 39/41] JVMARGs changeable via global config --- .../buildboost/GlobalBuildConfiguration.java | 22 +++++++++++++++++++ .../ant/AbstractAntTargetGenerator.java | 4 ---- .../emf/steps/GenerateGenModelCodeStep.java | 15 ++++++++++--- .../steps/GenerateResourcePluginsStep.java | 15 ++++++++++--- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index f690950..6b6c2c6 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -31,8 +31,18 @@ public static GlobalBuildConfiguration getInstance() { } 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() { @@ -92,4 +102,16 @@ public boolean isDebugEnabled() { // 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/ant/AbstractAntTargetGenerator.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/ant/AbstractAntTargetGenerator.java index e43a090..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 @@ -29,10 +29,6 @@ public abstract class AbstractAntTargetGenerator implements IAntTargetGenerator { - final public static String JVMARG_MX = "-Xmx1024m"; - final public static String JVMARG_MAXPERM = "-XX:MaxPermSize=256m"; - final public static String JVMARG_DEBUG = "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8001"; - protected void writeParaFile(final String fileName, final List plugins) { final File paraPropFile = new File(fileName); diff --git a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java index cde4fbb..b484c1a 100644 --- a/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java +++ b/Extensions/EMF/de.devboost.buildboost.genext.emf/src/de/devboost/buildboost/genext/emf/steps/GenerateGenModelCodeStep.java @@ -78,10 +78,19 @@ public Collection generateAntTargets() throws BuildException { // TODO use constant here sb.append(""); - sb.append(""); - sb.append(""); + sb.append(""); + sb.append(""); if (globalConfig.isDebugEnabled()) { - sb.append(""); + sb.append(""); } sb.append(""); sb.append(" generateAntTargets() throws BuildException { + csFilePath + "\" />"); content.append(""); - content.append(""); - content.append(""); + content.append(""); + content.append(""); if (globalConfig.isDebugEnabled()) { - content.append(""); + content.append(""); } content.append(""); content.append(" Date: Sat, 22 Dec 2012 17:08:07 +0100 Subject: [PATCH 40/41] obsolete duplicate call of goblal config reading removed --- .../src/de/devboost/buildboost/GlobalBuildConfiguration.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java index 6b6c2c6..1d02d67 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/GlobalBuildConfiguration.java @@ -77,16 +77,11 @@ private static void readGlobalConfiguration() { } public String getConfigItem(final String key) { - - readGlobalConfiguration(); return userProperties.getProperty(key); - } public String getConfigItem(final String key, final String defaultValue) { - readGlobalConfiguration(); return userProperties.getProperty(key, defaultValue); - } public boolean isDebugEnabled() { From 6749906f69db8e7ed9cf4a6445b2e9f84c6ac318 Mon Sep 17 00:00:00 2001 From: Thomas Schubert Date: Sun, 23 Dec 2012 18:16:50 +0100 Subject: [PATCH 41/41] revert specific changes of forked version --- .../src/de/devboost/buildboost/IConstants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d5a93b7..0c9aef8 100644 --- a/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java +++ b/Core/de.devboost.buildboost/src/de/devboost/buildboost/IConstants.java @@ -21,9 +21,9 @@ */ public interface IConstants { - String BUILD_BOOST_REPOSITORY_URL = "https://github.com/FunThomas424242/BuildBoost.git"; + 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 = ".*\\.buildboost\\.genext\\..*"; + String BUILD_BOOST_GENEXT_PROJECT_ID_PATTERN = "de\\.devboost\\.buildboost\\.genext\\..*"; String BUILD_BOOST_BUILD_PROJECT_ID_PATTERN = ".*\\.build"; String REPOS_FOLDER = "repos";