diff options
| author | DJ Houghton | 2012-01-06 19:29:31 +0000 |
|---|---|---|
| committer | DJ Houghton | 2012-01-06 19:29:31 +0000 |
| commit | 67b2ea6074c2a2bc6701e678c843b3adf688fc24 (patch) | |
| tree | 88eeedc993a55f26f55d8855f752de4f77283b6b | |
| parent | 216dd0f8a4b1199240d05a844446045d6b7ba1be (diff) | |
| download | eclipse.pde.build-67b2ea6074c2a2bc6701e678c843b3adf688fc24.tar.gz eclipse.pde.build-67b2ea6074c2a2bc6701e678c843b3adf688fc24.tar.xz eclipse.pde.build-67b2ea6074c2a2bc6701e678c843b3adf688fc24.zip | |
Bug 367982 - Test failures in nightly buildv20120106-1929
4 files changed, 72 insertions, 9 deletions
diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2InfUtils.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2InfUtils.java index 37dfea98..f366ce4e 100644 --- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2InfUtils.java +++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/P2InfUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. All rights reserved. + * Copyright (c) 2009, 2012 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html @@ -92,7 +92,7 @@ public class P2InfUtils { } public static void printRequires(StringBuffer buffer, String prefix, int i, String namespace, String name, VersionRange range, String filter, boolean greedy) { - printRequires(buffer, prefix, i, namespace, name, range.toString(), filter, greedy); + printRequires(buffer, prefix, i, namespace, name, Utils.toString(range), filter, greedy); } public static void printRequires(StringBuffer buffer, String prefix, int i, String namespace, String name, String range, String filter, boolean greedy) { @@ -118,7 +118,7 @@ public class P2InfUtils { prefix = ""; //$NON-NLS-1$ buffer.append(prefix + "hostRequirements." + i + ".namespace=" + namespace + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ buffer.append(prefix + "hostRequirements." + i + ".name=" + name + '\n'); //$NON-NLS-1$ //$NON-NLS-2$ - buffer.append(prefix + "hostRequirements." + i + ".range=" + range.toString() + '\n'); //$NON-NLS-1$ //$NON-NLS-2$ + buffer.append(prefix + "hostRequirements." + i + ".range=" + Utils.toString(range) + '\n'); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append(prefix + "hostRequirements." + i + ".greedy=" + Boolean.toString(greedy) + '\n'); //$NON-NLS-1$ //$NON-NLS-2$ } diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ProductGenerator.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ProductGenerator.java index fc89d736..aed86da5 100644 --- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ProductGenerator.java +++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ProductGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -199,7 +199,7 @@ public class ProductGenerator extends AbstractScriptGenerator { productVersionString = productVersion.getMajor() + "." + productVersion.getMinor() + "." + productVersion.getMicro() + ".$qualifier$"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ productRangeString = "[" + productVersionString + "," + productVersionString + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else { - productRangeString = new VersionRange(new Version(productVersionString), true, new Version(productVersionString), true).toString(); + productRangeString = Utils.toString(new VersionRange(new Version(productVersionString), true, new Version(productVersionString), true)); } if (cus) { @@ -256,7 +256,7 @@ public class ProductGenerator extends AbstractScriptGenerator { //in case of no version on the product, the branding defaults to the version of the launcher provider if (executableFeature != null && productVersionString.equals(Version.emptyVersion.toString())) { String brandedVersion = executableFeature.getVersion(); - brandedRange = new VersionRange(new Version(brandedVersion), true, new Version(brandedVersion), true).toString(); + brandedRange = Utils.toString(new VersionRange(new Version(brandedVersion), true, new Version(brandedVersion), true)); } List configs = getConfigInfos(); diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/Utils.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/Utils.java index ed1bf91b..e3bf801e 100644 --- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/Utils.java +++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/Utils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1050,4 +1050,67 @@ public final class Utils implements IPDEBuildConstants, IBuildPropertiesConstant } return result.toString(); } + + static public String toString(VersionRange range) { + // never qualify for now since p2 does not support fully qualified versions with empty qualifiers + return toString(range, false); + } + + private static String toString(VersionRange range, boolean qualify) { + // Do not use the VersionRange.toString method because it will fully qualify the versions + Version left = range.getLeft(); + Version right = range.getRight(); + String leftVersion = left.toString(); + if (right == null) { + return toString(left, range.getLeftType(), qualify); + } + String rightVerion = right.toString(); + StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5); + result.append(range.getLeftType()); + result.append(toString(left, range.getLeftType(), qualify)); + result.append(','); + result.append(toString(right, range.getRightType(), qualify)); + result.append(range.getRightType()); + return result.toString(); + } + + private static String toString(Version version, char endPointType, boolean qualify) { + // need to avoid fully qualifying the versions if not needed. + if (version == null) + return ""; //$NON-NLS-1$ + int q = version.getQualifier().length(); + if (q > 0) { + return version.toString(); + } + StringBuffer buffer = new StringBuffer(version.toString().length() + 1); + buffer.append(version.getMajor()); + buffer.append('.'); + buffer.append(version.getMinor()); + buffer.append('.'); + buffer.append(version.getMicro()); + if (!qualify) // we never want to qualify in this case + return buffer.toString(); + char separator = version.isReleaseVersion() ? '.' : '-'; + switch (endPointType) { + case VersionRange.LEFT_CLOSED : + if (separator == '.') // left release version [x.y.z. must fully qualify + buffer.append(separator); + break; + case VersionRange.LEFT_OPEN : + if (separator == '-') // left pre-release version [x.y.z- must fully qualify + buffer.append(separator); + break; + case VersionRange.RIGHT_CLOSED : + if (separator == '-') // right release version x.y.z.) must fully qualify + buffer.append(separator); + break; + case VersionRange.RIGHT_OPEN : + if (separator == '.') // right pre-release version x.y.z-] must fully qualify + buffer.append(separator); + break; + default : + break; + } + return buffer.toString(); + } } diff --git a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/BuildTimeSite.java b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/BuildTimeSite.java index 7c0ffdc3..c5f6d20a 100644 --- a/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/BuildTimeSite.java +++ b/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/site/BuildTimeSite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -280,7 +280,7 @@ public class BuildTimeSite /*extends Site*/implements IPDEBuildConstants, IXMLCo VersionRange versionSpec = constraint.getVersionRange(); if (versionSpec == null) return constraint.getName(); - return constraint.getName() + '_' + versionSpec; + return constraint.getName() + '_' + Utils.toString(versionSpec); } public BuildTimeFeature findFeature(String featureId, String versionId, boolean throwsException) throws CoreException { |
