Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 275316 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/build/P2InfUtils.java (-7 / +13 lines)
Lines 24-52 Link Here
24
24
25
	private static final VersionRange BUNDLE_RANGE = new VersionRange("[1.0.0, 2.0.0)"); //$NON-NLS-1$
25
	private static final VersionRange BUNDLE_RANGE = new VersionRange("[1.0.0, 2.0.0)"); //$NON-NLS-1$
26
26
27
	public static void printBundleCU(StringBuffer buffer, int i, String name, Version version, String filter, String[] instructions) {
27
	public static void printBundleCU(StringBuffer buffer, int i, String name, Version hostVersion, String filter, String[] instructions) {
28
		VersionRange range = new VersionRange(version, true, version, true);
28
		printBundleCU(buffer, i, name, hostVersion.toString(), hostVersion, filter, instructions);
29
	}
29
30
31
	public static void printBundleCU(StringBuffer buffer, int i, String name, String cuVersion, Version hostVersion, String filter, String[] instructions) {
32
		VersionRange hostRange = new VersionRange(hostVersion, true, hostVersion, true);
33
		//cuVersion may not be a proper OSGi version at this point (ie 1.0.0.$qualifier$)
34
		String cuRange = "[" + cuVersion + "," + cuVersion + "]"; //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
30
		String prefix = "units." + i + '.'; //$NON-NLS-1$
35
		String prefix = "units." + i + '.'; //$NON-NLS-1$
31
36
32
		printRequires(buffer, null, i, NAMESPACE_IU, "@FLAVOR@" + name, range, filter, true); //$NON-NLS-1$
37
		//generate requirement to the new CU we are creating
38
		printRequires(buffer, null, i, NAMESPACE_IU, "@FLAVOR@" + name, cuRange, filter, true); //$NON-NLS-1$
33
39
34
		buffer.append(prefix + "id=@FLAVOR@" + name + '\n'); //$NON-NLS-1$ 
40
		buffer.append(prefix + "id=@FLAVOR@" + name + '\n'); //$NON-NLS-1$ 
35
		buffer.append(prefix + "version=" + version + '\n'); //$NON-NLS-1$
41
		buffer.append(prefix + "version=" + cuVersion + '\n'); //$NON-NLS-1$
36
		buffer.append(prefix + "properties.1.name=org.eclipse.pde.build.default\n"); //$NON-NLS-1$
42
		buffer.append(prefix + "properties.1.name=org.eclipse.pde.build.default\n"); //$NON-NLS-1$
37
		buffer.append(prefix + "properties.1.value=true\n"); //$NON-NLS-1$
43
		buffer.append(prefix + "properties.1.value=true\n"); //$NON-NLS-1$
38
		if (filter != null)
44
		if (filter != null)
39
			buffer.append(prefix + "filter=" + filter + '\n'); //$NON-NLS-1$ 
45
			buffer.append(prefix + "filter=" + filter + '\n'); //$NON-NLS-1$ 
40
46
41
		printProvides(buffer, prefix, 1, NAMESPACE_IU, "@FLAVOR@" + name, version.toString()); //$NON-NLS-1$
47
		printProvides(buffer, prefix, 1, NAMESPACE_IU, "@FLAVOR@" + name, cuVersion); //$NON-NLS-1$
42
		printProvides(buffer, prefix, 2, NAMESPACE_FLAVOR, "@FLAVOR@", "1.0.0"); //$NON-NLS-1$ //$NON-NLS-2$
48
		printProvides(buffer, prefix, 2, NAMESPACE_FLAVOR, "@FLAVOR@", "1.0.0"); //$NON-NLS-1$ //$NON-NLS-2$
43
49
44
		printInstructions(buffer, prefix, instructions);
50
		printInstructions(buffer, prefix, instructions);
45
51
46
		printHostRequires(buffer, prefix, 1, NAMESPACE_OSGI, name, range, false);
52
		printHostRequires(buffer, prefix, 1, NAMESPACE_OSGI, name, hostRange, false);
47
		printHostRequires(buffer, prefix, 2, NAMESPACE_TYPE, "bundle", BUNDLE_RANGE, false); //$NON-NLS-1$ 
53
		printHostRequires(buffer, prefix, 2, NAMESPACE_TYPE, "bundle", BUNDLE_RANGE, false); //$NON-NLS-1$ 
48
54
49
		printRequires(buffer, prefix, 1, NAMESPACE_OSGI, name, range, null, false);
55
		printRequires(buffer, prefix, 1, NAMESPACE_OSGI, name, hostRange, null, false);
50
		printRequires(buffer, prefix, 2, NAMESPACE_TYPE, "bundle", BUNDLE_RANGE, null, false); //$NON-NLS-1$
56
		printRequires(buffer, prefix, 2, NAMESPACE_TYPE, "bundle", BUNDLE_RANGE, null, false); //$NON-NLS-1$
51
	}
57
	}
52
58
(-)src/org/eclipse/pde/internal/build/ProductGenerator.java (-13 / +19 lines)
Lines 155-160 Link Here
155
155
156
	private void generateP2InfCUs(StringBuffer buffer, int startIndex, boolean cus, boolean launchers) {
156
	private void generateP2InfCUs(StringBuffer buffer, int startIndex, boolean cus, boolean launchers) {
157
		int index = startIndex;
157
		int index = startIndex;
158
159
		String productVersionString = productFile.getVersion();
160
		String productRangeString = null;
161
		if (productVersionString.endsWith(PROPERTY_QUALIFIER)) {
162
			Version productVersion = new Version(productVersionString);
163
			productVersionString = productVersion.getMajor() + "." + productVersion.getMinor() + "." + productVersion.getMicro() + ".$qualifier$"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
164
			productRangeString = "[" + productVersionString + "," + productVersionString + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
165
		} else {
166
			productRangeString = new VersionRange(new Version(productVersionString), true, new Version(productVersionString), true).toString();
167
		}
168
158
		if (cus) {
169
		if (cus) {
159
			BundleInfo[] infos = getDefaultStartInfo();
170
			BundleInfo[] infos = getDefaultStartInfo();
160
			for (int i = 0; i < infos.length && infos[i] != null; i++) {
171
			for (int i = 0; i < infos.length && infos[i] != null; i++) {
Lines 172-178 Link Here
172
					instructions[P2InfUtils.INSTRUCTION_CONFIGURE] += "setProgramProperty(propName:org.eclipse.update.reconcile, propValue:false);"; //$NON-NLS-1$
183
					instructions[P2InfUtils.INSTRUCTION_CONFIGURE] += "setProgramProperty(propName:org.eclipse.update.reconcile, propValue:false);"; //$NON-NLS-1$
173
					instructions[P2InfUtils.INSTRUCTION_UNCONFIGURE] += "setProgramProperty(propName:org.eclipse.update.reconcile, propValue:);"; //$NON-NLS-1$
184
					instructions[P2InfUtils.INSTRUCTION_UNCONFIGURE] += "setProgramProperty(propName:org.eclipse.update.reconcile, propValue:);"; //$NON-NLS-1$
174
				}
185
				}
175
				P2InfUtils.printBundleCU(buffer, index++, bundle.getSymbolicName(), bundle.getVersion(), bundle.getPlatformFilter(), instructions);
186
				if (!GENERIC_VERSION_NUMBER.equals(productVersionString))
187
					P2InfUtils.printBundleCU(buffer, index++, bundle.getSymbolicName(), productVersionString, bundle.getVersion(), bundle.getPlatformFilter(), instructions);
188
				else
189
					P2InfUtils.printBundleCU(buffer, index++, bundle.getSymbolicName(), bundle.getVersion(), bundle.getPlatformFilter(), instructions);
176
190
177
			}
191
			}
178
		}
192
		}
Lines 180-194 Link Here
180
		BundleDescription launcher = assembly.getPlugin(BUNDLE_EQUINOX_LAUNCHER, null);
194
		BundleDescription launcher = assembly.getPlugin(BUNDLE_EQUINOX_LAUNCHER, null);
181
		if (launcher != null && launchers) {
195
		if (launcher != null && launchers) {
182
			VersionRange launcherRange = new VersionRange(launcher.getVersion(), true, launcher.getVersion(), true);
196
			VersionRange launcherRange = new VersionRange(launcher.getVersion(), true, launcher.getVersion(), true);
183
			String versionString = productFile.getVersion();
184
			String rangeString = null;
185
			if (versionString.endsWith(PROPERTY_QUALIFIER)) {
186
				Version productVersion = new Version(versionString);
187
				versionString = productVersion.getMajor() + "." + productVersion.getMinor() + "." + productVersion.getMicro() + ".$qualifier$"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
188
				rangeString = "[" + versionString + "," + versionString + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
189
			} else {
190
				rangeString = new VersionRange(new Version(versionString), true, new Version(versionString), true).toString();
191
			}
192
197
193
			// include the launcher jar
198
			// include the launcher jar
194
			P2InfUtils.printRequires(buffer, null, index++, P2InfUtils.NAMESPACE_IU, BUNDLE_EQUINOX_LAUNCHER, launcherRange, launcher.getPlatformFilter(), true);
199
			P2InfUtils.printRequires(buffer, null, index++, P2InfUtils.NAMESPACE_IU, BUNDLE_EQUINOX_LAUNCHER, launcherRange, launcher.getPlatformFilter(), true);
Lines 201-213 Link Here
201
			instructions[P2InfUtils.INSTRUCTION_UNCONFIGURE] = "removeProgramArg(programArg:-startup);removeProgramArg(programArg:@artifact);"; //$NON-NLS-1$
206
			instructions[P2InfUtils.INSTRUCTION_UNCONFIGURE] = "removeProgramArg(programArg:-startup);removeProgramArg(programArg:@artifact);"; //$NON-NLS-1$
202
			P2InfUtils.printBundleCU(buffer, index++, BUNDLE_EQUINOX_LAUNCHER, launcher.getVersion(), null, instructions);
207
			P2InfUtils.printBundleCU(buffer, index++, BUNDLE_EQUINOX_LAUNCHER, launcher.getVersion(), null, instructions);
203
208
204
			String brandedRange = rangeString;
209
			String brandedRange = productRangeString;
205
			BuildTimeFeature executableFeature = assembly.getRootProvider(FEATURE_EQUINOX_EXECUTABLE, null);
210
			BuildTimeFeature executableFeature = assembly.getRootProvider(FEATURE_EQUINOX_EXECUTABLE, null);
206
			if (executableFeature == null && havePDEUIState())
211
			if (executableFeature == null && havePDEUIState())
207
				executableFeature = assembly.getRootProvider("org.eclipse.pde.container.feature", null); //$NON-NLS-1$
212
				executableFeature = assembly.getRootProvider("org.eclipse.pde.container.feature", null); //$NON-NLS-1$
208
213
209
			//in case of no version on the product, the branding defaults to the version of the launcher provider
214
			//in case of no version on the product, the branding defaults to the version of the launcher provider
210
			if (executableFeature != null && versionString.equals(Version.emptyVersion.toString())) {
215
			if (executableFeature != null && productVersionString.equals(Version.emptyVersion.toString())) {
211
				String brandedVersion = executableFeature.getVersion();
216
				String brandedVersion = executableFeature.getVersion();
212
				brandedRange = new VersionRange(new Version(brandedVersion), true, new Version(brandedVersion), true).toString();
217
				brandedRange = new VersionRange(new Version(brandedVersion), true, new Version(brandedVersion), true).toString();
213
			}
218
			}
Lines 232-237 Link Here
232
					instructions[P2InfUtils.INSTRUCTION_UNINSTALL] = UNINSTALL_INSTRUCTION;
237
					instructions[P2InfUtils.INSTRUCTION_UNINSTALL] = UNINSTALL_INSTRUCTION;
233
					instructions[P2InfUtils.INSTRUCTION_CONFIGURE] = "addProgramArg(programArg:--launcher.library);addProgramArg(programArg:@artifact);"; //$NON-NLS-1$
238
					instructions[P2InfUtils.INSTRUCTION_CONFIGURE] = "addProgramArg(programArg:--launcher.library);addProgramArg(programArg:@artifact);"; //$NON-NLS-1$
234
					instructions[P2InfUtils.INSTRUCTION_UNCONFIGURE] = "removeProgramArg(programArg:--launcher.library);removeProgramArg(programArg:@artifact);"; //$NON-NLS-1$
239
					instructions[P2InfUtils.INSTRUCTION_UNCONFIGURE] = "removeProgramArg(programArg:--launcher.library);removeProgramArg(programArg:@artifact);"; //$NON-NLS-1$
240
					//launcher CU gets same version as launcher
235
					P2InfUtils.printBundleCU(buffer, index++, fragment.getSymbolicName(), fragment.getVersion(), fragment.getPlatformFilter(), instructions);
241
					P2InfUtils.printBundleCU(buffer, index++, fragment.getSymbolicName(), fragment.getVersion(), fragment.getPlatformFilter(), instructions);
236
242
237
					if (executableFeature != null) {
243
					if (executableFeature != null) {
Lines 244-250 Link Here
244
						String launcherName = getLauncherName(executableFeature);
250
						String launcherName = getLauncherName(executableFeature);
245
						instructions[P2InfUtils.INSTRUCTION_CONFIGURE] = "setLauncherName(name:" + launcherName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
251
						instructions[P2InfUtils.INSTRUCTION_CONFIGURE] = "setLauncherName(name:" + launcherName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
246
						instructions[P2InfUtils.INSTRUCTION_UNCONFIGURE] = "setLauncherName()"; //$NON-NLS-1$
252
						instructions[P2InfUtils.INSTRUCTION_UNCONFIGURE] = "setLauncherName()"; //$NON-NLS-1$
247
						P2InfUtils.printIU(buffer, index++, brandedIU, versionString, config.getPlatformFilter(), instructions);
253
						P2InfUtils.printIU(buffer, index++, brandedIU, productVersionString, config.getPlatformFilter(), instructions);
248
					}
254
					}
249
				}
255
				}
250
			}
256
			}
(-)src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java (-1 / +6 lines)
Lines 322-328 Link Here
322
				continue;
322
				continue;
323
			}
323
			}
324
324
325
			IInstallableUnit cu = BundlesAction.createBundleConfigurationUnit(bundle.getSymbolicName(), Version.parseVersion(bundle.getVersion()), false, bundle, flavor + cuIdPrefix, filter);
325
			IInstallableUnit cu = null;
326
			if (this.version != null && !this.version.equals(Version.emptyVersion))
327
				cu = BundlesAction.createBundleConfigurationUnit(bundle.getSymbolicName(), this.version, false, bundle, flavor + cuIdPrefix, filter);
328
			else
329
				cu = BundlesAction.createBundleConfigurationUnit(bundle.getSymbolicName(), Version.parseVersion(bundle.getVersion()), false, bundle, flavor + cuIdPrefix, filter);
330
326
			if (cu != null) {
331
			if (cu != null) {
327
				// Product Query will run against the repo, make sure these CUs are in before then
332
				// Product Query will run against the repo, make sure these CUs are in before then
328
				// TODO review the aggressive addition to the metadata repo.  perhaps the query can query the result as well.
333
				// TODO review the aggressive addition to the metadata repo.  perhaps the query can query the result as well.
(-)src/org/eclipse/pde/build/internal/tests/p2/PublishingTests.java (-2 / +5 lines)
Lines 743-751 Link Here
743
		assertTrue(productIu.getVersion().getQualifier().startsWith(QualifierReplacer.getDateQualifier().substring(0, 8)));
743
		assertTrue(productIu.getVersion().getQualifier().startsWith(QualifierReplacer.getDateQualifier().substring(0, 8)));
744
		assertTouchpoint(productIu, "configure", "addRepository(type:0,location:file${#58}//foo/bar);");
744
		assertTouchpoint(productIu, "configure", "addRepository(type:0,location:file${#58}//foo/bar);");
745
745
746
		getIU(finalRepo, "toolingorg.eclipse.equinox.common");
746
		IInstallableUnit iu = getIU(finalRepo, "toolingorg.eclipse.equinox.common");
747
		assertEquals(iu.getVersion(), productIu.getVersion());
747
748
748
		IInstallableUnit iu = getIU(finalRepo, "toolingheadless.product_root." + Platform.getWS() + '.' + Platform.getOS() + '.' + Platform.getOSArch());
749
		iu = getIU(finalRepo, "toolingheadless.product_root." + Platform.getWS() + '.' + Platform.getOS() + '.' + Platform.getOSArch());
749
		assertTouchpoint(iu, "configure", "setLauncherName(name:headless");
750
		assertTouchpoint(iu, "configure", "setLauncherName(name:headless");
750
		assertEquals(iu.getVersion(), productIu.getVersion());
751
		assertEquals(iu.getVersion(), productIu.getVersion());
751
	}
752
	}
Lines 968-975 Link Here
968
		iu = getIU(metadata, "toolinguid.product.config.win32.win32.x86");
969
		iu = getIU(metadata, "toolinguid.product.config.win32.win32.x86");
969
		assertTouchpoint(iu, "configure", "setProgramProperty(propName:eclipse.application, propValue:my.app);");
970
		assertTouchpoint(iu, "configure", "setProgramProperty(propName:eclipse.application, propValue:my.app);");
970
		assertTouchpoint(iu, "configure", "setProgramProperty(propName:eclipse.product, propValue:rcp.product);");
971
		assertTouchpoint(iu, "configure", "setProgramProperty(propName:eclipse.product, propValue:rcp.product);");
972
		assertEquals(iu.getVersion().toString(), "1.0.0.I10232");
971
973
972
		iu = getIU(metadata, "toolingorg.eclipse.equinox.simpleconfigurator");
974
		iu = getIU(metadata, "toolingorg.eclipse.equinox.simpleconfigurator");
975
		assertEquals(iu.getVersion().toString(), "1.0.0.I10232");
973
		assertTouchpoint(iu, "configure", "setStartLevel(startLevel:1);markStarted(started:true);");
976
		assertTouchpoint(iu, "configure", "setStartLevel(startLevel:1);markStarted(started:true);");
974
		assertFalse(buildFolder.getFile("tmp/eclipse/eclipse.exe").exists());
977
		assertFalse(buildFolder.getFile("tmp/eclipse/eclipse.exe").exists());
975
	}
978
	}

Return to bug 275316