Sync bnd code

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1412393 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java b/bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java
index bb39983..e551c9c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java
@@ -116,37 +116,23 @@
 		}
 	}
 
-	protected Jar getBaselineJar(boolean fallback) throws Exception {
+	public Jar getBaselineJar(boolean fallback) throws Exception {
 
 		String baseline = getProperty(Constants.BASELINE);
-		if ((baseline == null || baseline.trim().length() == 0) && !fallback)
+		String baselineRepo = getProperty(Constants.BASELINEREPO);
+		if ((baseline == null || baseline.trim().length() == 0) 
+				&& (baselineRepo == null || baselineRepo.trim().length() == 0) && !fallback)
 			return null;
 
-		trace("baseline %s", baseline);
-
 		File baselineFile = null;
-		if ((baseline == null || baseline.trim().length() == 0) && fallback) {
-
-			String repoName = getProperty(Constants.BASELINEREPO);
-			if (repoName == null) {
-				repoName = getProperty(Constants.RELEASEREPO);
-				if (repoName == null) {
-					return null;
-				}
-			}
-
-			List<RepositoryPlugin> repos = getPlugins(RepositoryPlugin.class);
-			for (RepositoryPlugin repo : repos) {
-				if (repoName.equals(repo.getName())) {
-					SortedSet<Version> versions = repo.versions(getBsn());
-					if (!versions.isEmpty()) {
-						baselineFile = repo.get(getBsn(), versions.last(), null);
-					}
-					break;
-				}
-			}
+		if ((baseline == null || baseline.trim().length() == 0)) {
+			baselineFile = getBaselineFromRepo(fallback);
+			if (baselineFile != null)
+				trace("baseline %s", baselineFile.getName());
 		} else {
 
+			trace("baseline %s", baseline);
+
 			Collection<Container> bundles = project.getBundles(Strategy.LOWEST, baseline);
 			for (Container c : bundles) {
 
@@ -165,6 +151,32 @@
 		return new Jar(baselineFile);
 	}
 
+	private File getBaselineFromRepo(boolean fallback) throws Exception {
+		String repoName = getProperty(Constants.BASELINEREPO);
+		if (repoName == null && !fallback)
+			return null;
+
+		if (repoName == null) {
+			repoName = getProperty(Constants.RELEASEREPO);
+			if (repoName == null) {
+				return null;
+			}
+		}
+
+		List<RepositoryPlugin> repos = getPlugins(RepositoryPlugin.class);
+		for (RepositoryPlugin repo : repos) {
+			if (repoName.equals(repo.getName())) {
+				SortedSet<Version> versions = repo.versions(getBsn());
+				if (!versions.isEmpty()) {
+					return repo.get(getBsn(), versions.last(), null);
+				}
+				break;
+			}
+		}
+		return null;
+
+	}
+
 	/** 
 	 * Gets the baseline Jar. 
 	 *