diff options
author | Andrew Niefer | 2008-07-23 17:31:51 +0000 |
---|---|---|
committer | Andrew Niefer | 2008-07-23 17:31:51 +0000 |
commit | 083965dca6d17911c1a459183c8d7eb71d104142 (patch) | |
tree | c691522b74c0a653452271dce4272b98369af37b /bundles/org.eclipse.equinox.p2.metadata.generator | |
parent | a97094c9f3fd285e938d6a3470a072c1f799a507 (diff) | |
download | rt.equinox.p2-083965dca6d17911c1a459183c8d7eb71d104142.tar.gz rt.equinox.p2-083965dca6d17911c1a459183c8d7eb71d104142.tar.xz rt.equinox.p2-083965dca6d17911c1a459183c8d7eb71d104142.zip |
bug 237096 - NPE with p2 & feature rootfiles
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.metadata.generator')
2 files changed, 25 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java index cb4662a5a..2ddfac39a 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/Generator.java @@ -103,6 +103,7 @@ public class Generator { private static final String PRODUCT_CONFIG_SUFFIX = ".config"; //$NON-NLS-1$ private static final String PRODUCT_INI_SUFFIX = ".ini"; //$NON-NLS-1$ private static final String PRODUCT_LAUCHER_SUFFIX = ".launcher"; //$NON-NLS-1$ + private static final String CONFIG_ANY = "ANY"; //$NON-NLS-1$ static final String DEFAULT_BUNDLE_LOCALIZATION = "plugin"; //$NON-NLS-1$ @@ -140,6 +141,10 @@ public class Generator { public static String[] parseConfigSpec(String config) { String[] parsed = getArrayFromString(config, "_"); //$NON-NLS-1$ + for (int i = 0; i < parsed.length; i++) { + if (parsed[i].equals("*")) //$NON-NLS-1$ + parsed[i] = "ANY"; //$NON-NLS-1$ + } if (parsed.length > 3) { String[] adjusted = new String[] {parsed[0], parsed[1], parsed[2] + '_' + parsed[3]}; return adjusted; @@ -722,6 +727,9 @@ public class Generator { * ws/os/arch combination. */ private void generateExecutableIUs(String ws, String os, final String arch, String version, File root, GeneratorResult result, IArtifactRepository destination) { + if (root == null) + return; + //Create the IU InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription(); iu.setSingleton(true); @@ -732,8 +740,11 @@ public class Generator { Version launcherVersion = new Version(version); iu.setVersion(launcherVersion); iu.setSingleton(true); - String filter = "(& (osgi.ws=" + ws + ") (osgi.os=" + os + ") (osgi.arch=" + arch + "))"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - iu.setFilter(filter); + String filter = null; + if (!ws.equals(CONFIG_ANY) && !os.equals(CONFIG_ANY) && !arch.equals(CONFIG_ANY)) { + filter = "(& (osgi.ws=" + ws + ") (osgi.os=" + os + ") (osgi.arch=" + arch + "))"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + iu.setFilter(filter); + } IArtifactKey key = MetadataGeneratorHelper.createLauncherArtifactKey(launcherId, launcherVersion); iu.setArtifacts(new IArtifactKey[] {key}); @@ -752,7 +763,8 @@ public class Generator { String configUnitId = info.getFlavor() + launcherId; cu.setId(configUnitId); cu.setVersion(launcherVersion); - cu.setFilter(filter); + if (filter != null) + cu.setFilter(filter); cu.setHost(new RequiredCapability[] {MetadataFactory.createRequiredCapability(IInstallableUnit.NAMESPACE_IU_ID, launcherId, new VersionRange(launcherVersion, true, launcherVersion, true), null, false, false)}); cu.setProperty(IInstallableUnit.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); //TODO bug 218890, would like the fragment to provide the launcher capability as well, but can't right now. @@ -986,7 +998,12 @@ public class Generator { if (info.getLauncherConfig() != null) { String[] config = parseConfigSpec(info.getLauncherConfig()); String version = getProductVersion(); - generateExecutableIUs(config[1], config[0], config[2], version, executableLocation.getParentFile(), result, destination); + File root = null; + if (executableLocation != null) + root = executableLocation.getParentFile(); + else if (info instanceof EclipseInstallGeneratorInfoProvider) + root = ((EclipseInstallGeneratorInfoProvider) info).getBaseLocation(); + generateExecutableIUs(config[1], config[0], config[2], version, root, result, destination); generateProductIniCU(config[1], config[0], config[2], version, result); return; } diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src_ant/org/eclipse/equinox/internal/p2/metadata/generator/ant/GeneratorTask.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src_ant/org/eclipse/equinox/internal/p2/metadata/generator/ant/GeneratorTask.java index 94736d8d5..571c1a594 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.generator/src_ant/org/eclipse/equinox/internal/p2/metadata/generator/ant/GeneratorTask.java +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src_ant/org/eclipse/equinox/internal/p2/metadata/generator/ant/GeneratorTask.java @@ -173,12 +173,16 @@ public class GeneratorTask extends Task { } public void setRoot(String root) { + if (root == null || root.startsWith("${")) //$NON-NLS-1$ + return; if (provider == null) provider = new EclipseInstallGeneratorInfoProvider(); provider.setRootId(root); } public void setRootVersion(String rootVersion) { + if (rootVersion == null || rootVersion.startsWith("${")) //$NON-NLS-1$ + return; if (provider == null) provider = new EclipseInstallGeneratorInfoProvider(); provider.setRootVersion(rootVersion); |