diff options
author | Andrew Niefer | 2010-03-23 22:14:31 +0000 |
---|---|---|
committer | Andrew Niefer | 2010-03-23 22:14:31 +0000 |
commit | ceb9d46228538a481f4d3c6fc03ecf523a68a855 (patch) | |
tree | 799e78f528d87af8f5ae9eee98214764ad294409 /bundles | |
parent | da12e4db54d637bd5f4c24bc1e3904424fc18ba0 (diff) | |
download | rt.equinox.p2-ceb9d46228538a481f4d3c6fc03ecf523a68a855.tar.gz rt.equinox.p2-ceb9d46228538a481f4d3c6fc03ecf523a68a855.tar.xz rt.equinox.p2-ceb9d46228538a481f4d3c6fc03ecf523a68a855.zip |
bug 291696 - Ensure we can get rid of the metadata generator
Diffstat (limited to 'bundles')
8 files changed, 83 insertions, 61 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/compatibility/GeneratorApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/compatibility/GeneratorApplication.java index 31bc98dd3..f7bed224f 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/compatibility/GeneratorApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/compatibility/GeneratorApplication.java @@ -80,8 +80,12 @@ public class GeneratorApplication implements IApplication { if (args.containsKey(IGeneratorConstants.PAR)) args.put(IGeneratorConstants.PUBLISH_ATIFACT_REPOSITORY, args.remove(IGeneratorConstants.PAR)); - if (args.containsKey(IGeneratorConstants.ROOT)) - args.put(IGeneratorConstants.IU, args.remove(IGeneratorConstants.ROOT)); + if (args.containsKey(IGeneratorConstants.ROOT)) { + String rootId = args.remove(IGeneratorConstants.ROOT); + args.put(IGeneratorConstants.IU, rootId); + args.put(IGeneratorConstants.ID, rootId); + } + if (args.containsKey(IGeneratorConstants.ROOT_VERSION)) args.put(IGeneratorConstants.VERSION, args.remove(IGeneratorConstants.ROOT_VERSION)); @@ -103,7 +107,11 @@ public class GeneratorApplication implements IApplication { args.put(IGeneratorConstants.METADATA_REPO, repoLocation); } - if (args.containsKey(IGeneratorConstants.SITE)) { + File base = new File(args.get(IGeneratorConstants.SOURCE)); + File configuration = new File(base, "configuration"); //$NON-NLS-1$ + if (configuration.exists()) { + applicationMap.put(APP_ID, INSTALL_APPLICATION); + } else if (args.containsKey(IGeneratorConstants.SITE)) { applicationMap.put(APP_ID, UPDATE_SITE_APPLICATION); } else if (args.containsKey(IGeneratorConstants.CONFIG)) { applicationMap.put(APP_ID, INSTALL_APPLICATION); diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/compatibility/IGeneratorConstants.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/compatibility/IGeneratorConstants.java index f53539744..30bd49cb9 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/compatibility/IGeneratorConstants.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/compatibility/IGeneratorConstants.java @@ -49,5 +49,6 @@ public interface IGeneratorConstants { public static final String P2_OS = "-p2.os"; //$NON-NLS-1$ public static final String SITE = "-site"; //$NON-NLS-1$ public static final String IU = "-iu"; //$NON-NLS-1$ + public static final String ID = "-id"; //$NON-NLS-1$ public static final String VERSION = "-version"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/DataLoader.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/DataLoader.java index 63b3b0981..b6244ce8b 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/DataLoader.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/internal/p2/publisher/eclipse/DataLoader.java @@ -54,6 +54,8 @@ public class DataLoader { LauncherData launcherData = manipulator.getLauncherData(); launcherData.setFwPersistentDataLocation(config, true); launcherData.setLauncher(executable); + if (executable == null) + launcherData.setHome(config.getParentFile()); try { manipulator.load(); } catch (IllegalStateException e2) { diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java index 8ed541287..184714a01 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java @@ -65,7 +65,7 @@ public class EclipseInstallAction extends AbstractPublisherAction { createAdvice(); ArrayList<IPublisherAction> actions = new ArrayList<IPublisherAction>(); // create an action that just publishes the raw bundles and features - IPublisherAction action = new MergeResultsAction(new IPublisherAction[] {createFeaturesAction(), createBundlesAction()}, IPublisherResult.MERGE_ALL_NON_ROOT); + IPublisherAction action = new MergeResultsAction(new IPublisherAction[] {createFeaturesAction(), createBundlesAction()}, IPublisherResult.MERGE_ALL_ROOT); actions.add(action); actions.add(createApplicationExecutableAction(info.getConfigurations())); actions.add(createRootFilesAction()); @@ -109,12 +109,13 @@ public class EclipseInstallAction extends AbstractPublisherAction { } protected Collection<IPublisherAction> createAccumulateConfigDataActions(String[] configs) { + File configuration = new File(source, "configuration/config.ini"); //$NON-NLS-1$ + if (!configuration.exists()) + configuration = null; + Collection<IPublisherAction> result = new ArrayList<IPublisherAction>(configs.length); for (int i = 0; i < configs.length; i++) { String configSpec = configs[i]; - File configuration = computeConfigurationLocation(configSpec); - if (!configuration.exists()) - configuration = null; String os = AbstractPublisherAction.parseConfigSpec(configSpec)[1]; File executable = ExecutablesDescriptor.findExecutable(os, computeExecutableLocation(configSpec), "eclipse"); //$NON-NLS-1$ if (!executable.exists()) @@ -122,6 +123,7 @@ public class EclipseInstallAction extends AbstractPublisherAction { IPublisherAction action = new AccumulateConfigDataAction(info, configSpec, configuration, executable); result.add(action); } + return result; } @@ -209,34 +211,9 @@ public class EclipseInstallAction extends AbstractPublisherAction { return new File(source); } - protected File computeConfigurationLocation(String configSpec) { - return new File(source, "configuration/config.ini"); //$NON-NLS-1$ - } - protected IPublisherAction createBundlesAction() { // TODO need to add in the simple configorator and reconciler bundle descriptions. // TODO bundles action needs to take bundleDescriptions directly rather than just files. return new BundlesAction(new File[] {new File(source, "plugins")}); //$NON-NLS-1$ } - - //TODO reconsitute these methods - // private GeneratorBundleInfo createSimpleConfiguratorBundleInfo() { - // GeneratorBundleInfo result = new GeneratorBundleInfo(); - // result.setSymbolicName(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR); - // result.setVersion("0.0.0"); //$NON-NLS-1$ - // result.setStartLevel(1); - // result.setMarkedAsStarted(true); - // return result; - // } - // - // private GeneratorBundleInfo createDropinsReconcilerBundleInfo() { - // GeneratorBundleInfo result = new GeneratorBundleInfo(); - // result.setSymbolicName(ORG_ECLIPSE_EQUINOX_P2_RECONCILER_DROPINS); - // result.setVersion("0.0.0"); //$NON-NLS-1$ - // result.setMarkedAsStarted(true); - // result.setSpecialConfigCommands("mkdir(path:${installFolder}/dropins)"); //$NON-NLS-1$ - // result.setSpecialUnconfigCommands("rmdir(path:${installFolder}/dropins)"); //$NON-NLS-1$ - // return result; - // } - } diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java index f9a97b7b5..5b0484c03 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java @@ -63,8 +63,8 @@ public class EquinoxExecutableAction extends AbstractPublisherAction { setPublisherInfo(publisherinfo); ExecutablesDescriptor brandedExecutables = brandExecutables(executables); try { - publishExecutableIU(brandedExecutables, result); - publishExecutableCU(brandedExecutables, result); + if (publishExecutableIU(brandedExecutables, result)) + publishExecutableCU(brandedExecutables, result); publishExecutableSetter(brandedExecutables, result); } finally { if (brandedExecutables.isTemporary()) @@ -97,7 +97,13 @@ public class EquinoxExecutableAction extends AbstractPublisherAction { * Publishes IUs and CUs for the files that make up the launcher for a given * ws/os/arch combination. */ - protected void publishExecutableIU(ExecutablesDescriptor execDescriptor, IPublisherResult result) { + protected boolean publishExecutableIU(ExecutablesDescriptor execDescriptor, IPublisherResult result) { + String[] config = parseConfigSpec(configSpec); + if (execDescriptor.getFiles().length == 0 && (config.length == 0 || CONFIG_ANY.equalsIgnoreCase(config[0]))) { + return false; //no cu required + } + boolean publishCU = true; + // Create the IU for the executable InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription(); String id = getExecutableId(); @@ -114,23 +120,28 @@ public class EquinoxExecutableAction extends AbstractPublisherAction { iu.setCapabilities(new IProvidedCapability[] {selfCapability, executableCapability}); //Create the artifact descriptor. we have several files so no path on disk - IArtifactKey key = PublisherHelper.createBinaryArtifactKey(id, version); - iu.setArtifacts(new IArtifactKey[] {key}); - IArtifactDescriptor descriptor = PublisherHelper.createArtifactDescriptor(info.getArtifactRepository(), key, null); - publishArtifact(descriptor, execDescriptor.getFiles(), null, info, createRootPrefixComputer(execDescriptor.getLocation())); - if (execDescriptor.isTemporary()) - FileUtils.deleteAll(execDescriptor.getLocation()); - + if (execDescriptor.getFiles().length == 0) { + publishCU = false; + } else { + IArtifactKey key = PublisherHelper.createBinaryArtifactKey(id, version); + iu.setArtifacts(new IArtifactKey[] {key}); + IArtifactDescriptor descriptor = PublisherHelper.createArtifactDescriptor(info.getArtifactRepository(), key, null); + publishArtifact(descriptor, execDescriptor.getFiles(), null, info, createRootPrefixComputer(execDescriptor.getLocation())); + if (execDescriptor.isTemporary()) + FileUtils.deleteAll(execDescriptor.getLocation()); + } // setup a requirement between the executable and the launcher fragment that has the shared library - String[] config = parseConfigSpec(configSpec); - String ws = config[0]; - String os = config[1]; - String arch = config[2]; - String launcherFragment = EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER + '.' + ws + '.' + os; - if (!(Constants.OS_MACOSX.equals(os) && !Constants.ARCH_X86_64.equals(arch))) - launcherFragment += '.' + arch; - iu.setRequiredCapabilities(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, launcherFragment, VersionRange.emptyRange, filter, false, false)}); + if (config.length > 0 && !CONFIG_ANY.equalsIgnoreCase(config[0])) { + String ws = config[0]; + String os = config[1]; + String arch = config[2]; + String launcherFragment = EquinoxLauncherCUAction.ORG_ECLIPSE_EQUINOX_LAUNCHER + '.' + ws + '.' + os; + if (!(Constants.OS_MACOSX.equals(os) && !Constants.ARCH_X86_64.equals(arch))) + launcherFragment += '.' + arch; + iu.setRequiredCapabilities(new IRequirement[] {MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, launcherFragment, VersionRange.emptyRange, filter, false, false)}); + } result.addIU(MetadataFactory.createInstallableUnit(iu), IPublisherResult.ROOT); + return publishCU; } private String getExecutableId() { diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java index e5bc16a15..abcafe7ef 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java @@ -58,13 +58,15 @@ public class EquinoxLauncherCUAction extends AbstractPublisherAction { for (int i = 0; i < configSpecs.length; i++) { String configSpec = configSpecs[i]; String[] specs = Utils.getTokens(configSpec, "."); //$NON-NLS-1$ - if (specs.length > 2 && Constants.OS_MACOSX.equals(specs[1]) && !Constants.ARCH_X86_64.equals(specs[2])) { - //launcher fragment for mac only has arch for x86_64 - id = ORG_ECLIPSE_EQUINOX_LAUNCHER + '.' + specs[0] + '.' + specs[1]; - } else { - id = ORG_ECLIPSE_EQUINOX_LAUNCHER + '.' + configSpec; + if (specs.length > 0 && !AbstractPublisherAction.CONFIG_ANY.equalsIgnoreCase(specs[0])) { + if (specs.length > 2 && Constants.OS_MACOSX.equals(specs[1]) && !Constants.ARCH_X86_64.equals(specs[2])) { + //launcher fragment for mac only has arch for x86_64 + id = ORG_ECLIPSE_EQUINOX_LAUNCHER + '.' + specs[0] + '.' + specs[1]; + } else { + id = ORG_ECLIPSE_EQUINOX_LAUNCHER + '.' + configSpec; + } + publishCU(id, configSpec, results); } - publishCU(id, configSpec, results); } } diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java index f838580dc..516cb99b8 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java @@ -12,7 +12,10 @@ package org.eclipse.equinox.p2.publisher.eclipse; import java.io.File; import java.net.URISyntaxException; import java.util.ArrayList; +import org.eclipse.equinox.p2.metadata.Version; import org.eclipse.equinox.p2.publisher.*; +import org.eclipse.equinox.p2.publisher.actions.RootIUAction; +import org.eclipse.equinox.p2.publisher.actions.RootIUResultFilterAdvice; /** * <p> @@ -29,6 +32,9 @@ public class FeaturesAndBundlesPublisherApplication extends AbstractPublisherApp protected File[] features = null; protected File[] bundles = null; + protected String rootIU = null; + protected String rootVersion = null; + public FeaturesAndBundlesPublisherApplication() { // nothing to do } @@ -41,6 +47,12 @@ public class FeaturesAndBundlesPublisherApplication extends AbstractPublisherApp if (arg.equalsIgnoreCase("-bundles")) //$NON-NLS-1$ bundles = createFiles(parameter); + + if (arg.equalsIgnoreCase("-iu")) //$NON-NLS-1$ + rootIU = parameter; + + if (arg.equalsIgnoreCase("-version")) //$NON-NLS-1$ + rootVersion = parameter; } private File[] createFiles(String parameter) { @@ -59,6 +71,12 @@ public class FeaturesAndBundlesPublisherApplication extends AbstractPublisherApp if (bundles == null) bundles = new File[] {new File(source, "plugins")}; //$NON-NLS-1$ result.add(new BundlesAction(bundles)); + + if (rootIU != null) { + result.add(new RootIUAction(rootIU, Version.parseVersion(rootVersion), rootIU)); + info.addAdvice(new RootIUResultFilterAdvice(null)); + } + return result.toArray(new IPublisherAction[result.size()]); } } diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java index a66101b6e..64c46b92d 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java @@ -10,13 +10,10 @@ ******************************************************************************/ package org.eclipse.equinox.p2.publisher.eclipse; - - import java.net.URISyntaxException; import java.util.ArrayList; -import org.eclipse.equinox.p2.metadata.VersionedId; -import org.eclipse.equinox.p2.metadata.IVersionedId; -import org.eclipse.equinox.p2.metadata.Version; +import org.eclipse.equinox.p2.core.ProvisionException; +import org.eclipse.equinox.p2.metadata.*; import org.eclipse.equinox.p2.publisher.*; public class InstallPublisherApplication extends AbstractPublisherApplication { @@ -41,6 +38,12 @@ public class InstallPublisherApplication extends AbstractPublisherApplication { start = true; } + protected void initialize(PublisherInfo publisherInfo) throws ProvisionException { + super.initialize(publisherInfo); + + publisherInfo.setConfigurations(new String[] {""}); //$NON-NLS-1$ + } + protected void processParameter(String arg, String parameter, PublisherInfo publisherInfo) throws URISyntaxException { super.processParameter(arg, parameter, publisherInfo); |