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 264603 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/build/IXMLConstants.java (+3 lines)
Lines 65-70 Link Here
65
	public static final String TARGET_ROOT_TARGET = "rootTarget"; //$NON-NLS-1$
65
	public static final String TARGET_ROOT_TARGET = "rootTarget"; //$NON-NLS-1$
66
	public static final String TARGET_CUSTOM_ASSEMBLY = "customAssembly"; //$NON-NLS-1$
66
	public static final String TARGET_CUSTOM_ASSEMBLY = "customAssembly"; //$NON-NLS-1$
67
	public static final String TARGET_P2_METADATA = "generate.p2.metadata"; //$NON-NLS-1$
67
	public static final String TARGET_P2_METADATA = "generate.p2.metadata"; //$NON-NLS-1$
68
	public static final String TARGET_RUN_DIRECTOR = "runDirector"; //$NON-NLS-1$
69
68
	// properties
70
	// properties
69
	public static final String PROPERTY_ARCH = "arch"; //$NON-NLS-1$
71
	public static final String PROPERTY_ARCH = "arch"; //$NON-NLS-1$
70
	public static final String PROPERTY_BASE_ARCH = "basearch"; //$NON-NLS-1$
72
	public static final String PROPERTY_BASE_ARCH = "basearch"; //$NON-NLS-1$
Lines 153-158 Link Here
153
	public static final String PROPERTY_OMIT_ROOTFILES = "updateJar.omitRootfiles"; //$NON-NLS-1$
155
	public static final String PROPERTY_OMIT_ROOTFILES = "updateJar.omitRootfiles"; //$NON-NLS-1$
154
	public static final String PROPERTY_GENERATE_API_DESCRIPTION = "generateAPIDescription"; //$NON-NLS-1$
156
	public static final String PROPERTY_GENERATE_API_DESCRIPTION = "generateAPIDescription"; //$NON-NLS-1$
155
	public static final String PROPERTY_BINARY_FOLDERS = "binary.folders"; //$NON-NLS-1$
157
	public static final String PROPERTY_BINARY_FOLDERS = "binary.folders"; //$NON-NLS-1$
158
	public static final String PROPERTY_LAUNCHER_JAR = "equinoxLauncherJar"; //$NON-NLS-1$
156
159
157
	//Jar processor properties
160
	//Jar processor properties
158
	public static final String PROPERTY_SIGN_ALIAS = "sign.alias"; //$NON-NLS-1$
161
	public static final String PROPERTY_SIGN_ALIAS = "sign.alias"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/build/IBuildPropertiesConstants.java (-1 / +7 lines)
Lines 96-104 Link Here
96
	public static final String PROPERTY_P2_COMPRESS = "p2.compress"; //$NON-NLS-1$
96
	public static final String PROPERTY_P2_COMPRESS = "p2.compress"; //$NON-NLS-1$
97
	public static final String PROPERTY_P2_METADATA_REPO_NAME = "p2.metadata.repo.name"; //$NON-NLS-1$
97
	public static final String PROPERTY_P2_METADATA_REPO_NAME = "p2.metadata.repo.name"; //$NON-NLS-1$
98
	public static final String PROPERTY_P2_ARTIFACT_REPO_NAME = "p2.artifact.repo.name"; //$NON-NLS-1$
98
	public static final String PROPERTY_P2_ARTIFACT_REPO_NAME = "p2.artifact.repo.name"; //$NON-NLS-1$
99
	public static final String PROPERTY_P2_BUILD_REPO = "p2.build.repo"; //$NON-NLS-1$
99
100
	//Internal usage only
100
	//Internal usage only
101
	public static final String PROPERTY_P2_BUILD_REPO = "p2.build.repo"; //$NON-NLS-1$
101
	public static final String PROPERTY_P2_GENERATION_MODE = "p2.generation.mode"; //$NON-NLS-1$
102
	public static final String PROPERTY_P2_GENERATION_MODE = "p2.generation.mode"; //$NON-NLS-1$
103
	public static final String PROPERTY_P2_REPO = "p2.repo"; //$NON-NLS-1$
104
	public static final String PROPERTY_P2_DIRECTOR_IU = "p2.director.iu"; //$NON-NLS-1$
105
	public static final String PROPERTY_P2_DIRECTOR_VERSION = "p2.director.version"; //$NON-NLS-1$
106
	public static final String PROPERTY_P2_DIRECTOR_INSTALLPATH = "p2.director.installPath"; //$NON-NLS-1$
107
102
	public static final String SOURCE_PLUGIN = "sourcePlugin"; //$NON-NLS-1$
108
	public static final String SOURCE_PLUGIN = "sourcePlugin"; //$NON-NLS-1$
103
109
104
	public static final String PROPERTY_PACKAGER_MODE = "packagerMode"; //$NON-NLS-1$
110
	public static final String PROPERTY_PACKAGER_MODE = "packagerMode"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/build/P2ConfigScriptGenerator.java (-5 / +80 lines)
Lines 9-18 Link Here
9
9
10
package org.eclipse.pde.internal.build;
10
package org.eclipse.pde.internal.build;
11
11
12
import java.io.File;
12
import java.util.*;
13
import java.util.*;
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.*;
14
import org.eclipse.osgi.service.resolver.BundleDescription;
15
import org.eclipse.osgi.service.resolver.BundleDescription;
16
import org.eclipse.pde.internal.build.ant.AntScript;
17
import org.eclipse.pde.internal.build.ant.FileSet;
15
import org.eclipse.pde.internal.build.site.BuildTimeFeature;
18
import org.eclipse.pde.internal.build.site.BuildTimeFeature;
19
import org.eclipse.pde.internal.build.site.BuildTimeSite;
20
import org.eclipse.pde.internal.build.site.compatibility.FeatureEntry;
16
21
17
public class P2ConfigScriptGenerator extends AssembleConfigScriptGenerator {
22
public class P2ConfigScriptGenerator extends AssembleConfigScriptGenerator {
18
	private AssemblyInformation assemblyInformation = null;
23
	private AssemblyInformation assemblyInformation = null;
Lines 32-45 Link Here
32
		initializeCollections();
37
		initializeCollections();
33
38
34
		try {
39
		try {
35
			openScript(directory, "assemble." + featureId + ".p2.xml"); //$NON-NLS-1$ //$NON-NLS-2$
40
			String prefix = assembling ? "assemble." : "package."; //$NON-NLS-1$ //$NON-NLS-2$
41
			openScript(directory, prefix + featureId + ".p2.xml"); //$NON-NLS-1$
36
		} catch (CoreException e) {
42
		} catch (CoreException e) {
37
			return;
43
			return;
38
		}
44
		}
39
		generatePrologue();
45
		generatePrologue();
40
		generateMainBegin();
46
		generateMainBegin();
41
		generateGatherCalls();
47
		generateGatherCalls();
42
		generateBrandingCalls();
43
		generateMetadataCalls();
48
		generateMetadataCalls();
44
		generateMainEnd();
49
		generateMainEnd();
45
50
Lines 110-133 Link Here
110
			}
115
			}
111
		}
116
		}
112
		script.printDeleteTask(Utils.getPropertyFormat(PROPERTY_ASSEMBLY_TMP) + "/p2.branding", null, null); //$NON-NLS-1$
117
		script.printDeleteTask(Utils.getPropertyFormat(PROPERTY_ASSEMBLY_TMP) + "/p2.branding", null, null); //$NON-NLS-1$
118
		script.println();
113
	}
119
	}
114
120
115
	protected void generateMetadataTarget() {
121
	protected void generateMetadataTarget() {
116
		script.printTargetDeclaration(TARGET_P2_METADATA, null, null, null, null);
122
		script.printTargetDeclaration(TARGET_P2_METADATA, null, null, assembling ? PROPERTY_RUN_PACKAGER : null, null);
123
124
		generateBrandingCalls();
117
125
118
		ProductFile product = getProductFile();
126
		ProductFile product = getProductFile();
119
		if (product != null) {
127
		if (product != null) {
128
129
			String productPath = product.getLocation();
130
			String productDir = getWorkingDirectory() + '/' + DEFAULT_FEATURE_LOCATION + '/' + CONTAINER_FEATURE + "/product"; //$NON-NLS-1$
131
			File productFile = new File(productPath);
132
			String newProduct = new File(productDir, productFile.getName()).getAbsolutePath();
133
			script.printCopyFileTask(productPath, newProduct, true);
134
135
			File parent = new File(productPath).getParentFile();
136
			File p2Inf = new File(parent, "p2.inf"); //$NON-NLS-1$
137
			if (p2Inf.exists())
138
				script.printCopyTask(p2Inf.getAbsolutePath(), productDir, null, false, true);
139
			generateProductReplaceTask(product, newProduct);
140
			productPath = newProduct;
141
120
			script.printTab();
142
			script.printTab();
121
			script.print("<p2.publish.product "); //$NON-NLS-1$
143
			script.print("<p2.publish.product "); //$NON-NLS-1$
122
			script.printAttribute("flavor", Utils.getPropertyFormat(PROPERTY_P2_FLAVOR), true); //$NON-NLS-1$
144
			script.printAttribute("flavor", Utils.getPropertyFormat(PROPERTY_P2_FLAVOR), true); //$NON-NLS-1$
123
			script.printAttribute("repository", Utils.getPropertyFormat(PROPERTY_P2_BUILD_REPO), true); //$NON-NLS-1$ 
145
			script.printAttribute("repository", Utils.getPropertyFormat(PROPERTY_P2_BUILD_REPO), true); //$NON-NLS-1$ 
124
			script.printAttribute("productFile", product.getLocation(), true); //$NON-NLS-1$
146
			script.printAttribute("productFile", newProduct, true); //$NON-NLS-1$
125
			script.println("/>"); //$NON-NLS-1$
147
			script.println("/>"); //$NON-NLS-1$
126
		}
148
		}
127
		script.printTargetEnd();
149
		script.printTargetEnd();
128
	}
150
	}
129
151
152
	//TODO this is duplicated from AssembleScriptGenerator
153
	protected void generateProductReplaceTask(ProductFile product, String productDirectory) {
154
		if (product == null)
155
			return;
156
157
		BuildTimeSite site = null;
158
		try {
159
			site = getSite(false);
160
		} catch (CoreException e1) {
161
			return;
162
		}
163
164
		List productEntries = product.getProductEntries();
165
		String mappings = Utils.getEntryVersionMappings((FeatureEntry[]) productEntries.toArray(new FeatureEntry[productEntries.size()]), site);
166
		script.println("<eclipse.idReplacer productFilePath=\"" + AntScript.getEscaped(productDirectory) + "\""); //$NON-NLS-1$ //$NON-NLS-2$
167
		script.println("                    selfVersion=\"" + product.getVersion() + "\" "); //$NON-NLS-1$ //$NON-NLS-2$
168
		if (product.useFeatures())
169
			script.println("                    featureIds=\"" + mappings + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
170
		else
171
			script.println("                    pluginIds=\"" + mappings + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ 
172
173
		return;
174
	}
175
130
	protected void generateEpilogue() {
176
	protected void generateEpilogue() {
131
		script.printProjectEnd();
177
		script.printProjectEnd();
132
	}
178
	}
179
180
	protected void generateGatherBinPartsTarget() {
181
		if (assembling) {
182
			super.generateGatherBinPartsTarget();
183
			return;
184
		}
185
186
		script.printTargetDeclaration(TARGET_GATHER_BIN_PARTS, null, null, null, null);
187
188
		ArrayList p2Features = new ArrayList();
189
		ArrayList p2Bundles = new ArrayList();
190
		for (int i = 0; i < plugins.length; i++) {
191
			Path pluginLocation = new Path(plugins[i].getLocation());
192
			p2Bundles.add(new FileSet(pluginLocation.removeLastSegments(1).toOSString(), null, pluginLocation.lastSegment(), null, null, null, null));
193
194
		}
195
196
		for (int i = 0; i < features.length; i++) {
197
			IPath featureLocation = new Path(features[i].getURL().getPath());
198
			featureLocation = featureLocation.removeLastSegments(1);
199
			p2Features.add(new FileSet(featureLocation.removeLastSegments(1).toOSString(), null, featureLocation.lastSegment(), null, null, null, null));
200
		}
201
202
		String repo = Utils.getPropertyFormat(PROPERTY_P2_BUILD_REPO);
203
		script.printP2PublishFeaturesAndBundles(repo, repo, (FileSet[]) p2Bundles.toArray(new FileSet[p2Bundles.size()]), (FileSet[]) p2Features.toArray(new FileSet[p2Features.size()]), Utils.getPropertyFormat(PROPERTY_P2_CATEGORY_SITE));
204
205
		script.printTargetEnd();
206
		script.println();
207
	}
133
}
208
}
(-)src/org/eclipse/pde/internal/build/IPDEBuildConstants.java (+1 lines)
Lines 39-44 Link Here
39
	public final static String MANIFEST = "MANIFEST.MF"; //$NON-NLS-1$
39
	public final static String MANIFEST = "MANIFEST.MF"; //$NON-NLS-1$
40
40
41
	// default values
41
	// default values
42
	public final static String PROPERTY_GENERIC_TARGETS = "genericTargets"; //$NON-NLS-1$
42
	public final static String DEFAULT_BUILD_SCRIPT_FILENAME = "build.xml"; //$NON-NLS-1$
43
	public final static String DEFAULT_BUILD_SCRIPT_FILENAME = "build.xml"; //$NON-NLS-1$
43
	public final static String DEFAULT_FEATURE_LOCATION = "features"; //$NON-NLS-1$
44
	public final static String DEFAULT_FEATURE_LOCATION = "features"; //$NON-NLS-1$
44
	public final static String DEFAULT_FETCH_SCRIPT_FILENAME = "fetch.xml"; //$NON-NLS-1$
45
	public final static String DEFAULT_FETCH_SCRIPT_FILENAME = "fetch.xml"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/build/AssembleScriptGenerator.java (-1 / +5 lines)
Lines 110-116 Link Here
110
				basicGenerateAssembleConfigFileTargetCall(current, configInfo[0], configInfo[1], configInfo[2], configInfo[3]);
110
				basicGenerateAssembleConfigFileTargetCall(current, configInfo[0], configInfo[1], configInfo[2], configInfo[3]);
111
			}
111
			}
112
		}
112
		}
113
		if (configScriptGenerator.haveP2Bundles())
113
		if (configScriptGenerator.haveP2Bundles() && !BuildDirector.p2Gathering)
114
			script.printAntCallTask(TARGET_P2_METADATA, true, null);
114
			script.printAntCallTask(TARGET_P2_METADATA, true, null);
115
		script.printTargetEnd();
115
		script.printTargetEnd();
116
	}
116
	}
Lines 125-130 Link Here
125
		p2ConfigGenerator.initialize(directory, featureId);
125
		p2ConfigGenerator.initialize(directory, featureId);
126
		p2ConfigGenerator.generate();
126
		p2ConfigGenerator.generate();
127
127
128
		script.printTab();
128
		script.print("<assemble "); //$NON-NLS-1$
129
		script.print("<assemble "); //$NON-NLS-1$
129
		script.printAttribute("config", "p2", true); //$NON-NLS-1$ //$NON-NLS-2$
130
		script.printAttribute("config", "p2", true); //$NON-NLS-1$ //$NON-NLS-2$
130
		script.printAttribute("element", p2ConfigGenerator.getTargetElement(), true); //$NON-NLS-1$
131
		script.printAttribute("element", p2ConfigGenerator.getTargetElement(), true); //$NON-NLS-1$
Lines 141-146 Link Here
141
		configScriptGenerator.setGroupConfigs(groupConfigs);
142
		configScriptGenerator.setGroupConfigs(groupConfigs);
142
		configScriptGenerator.generate();
143
		configScriptGenerator.generate();
143
144
145
		script.printTab();
144
		script.print("<assemble "); //$NON-NLS-1$
146
		script.print("<assemble "); //$NON-NLS-1$
145
		String config = configScriptGenerator.getTargetConfig();
147
		String config = configScriptGenerator.getTargetConfig();
146
		script.printAttribute("config", config, true); //$NON-NLS-1$
148
		script.printAttribute("config", config, true); //$NON-NLS-1$
Lines 151-156 Link Here
151
	}
153
	}
152
154
153
	protected void generateMetadataTarget() {
155
	protected void generateMetadataTarget() {
156
		if (BuildDirector.p2Gathering)
157
			return;
154
		if (configScriptGenerator.haveP2Bundles()) {
158
		if (configScriptGenerator.haveP2Bundles()) {
155
			script.printTargetDeclaration(TARGET_P2_METADATA, null, TARGET_P2_METADATA, PROPERTY_RUN_PACKAGER, null);
159
			script.printTargetDeclaration(TARGET_P2_METADATA, null, TARGET_P2_METADATA, PROPERTY_RUN_PACKAGER, null);
156
160
(-)src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java (-40 / +79 lines)
Lines 11-16 Link Here
11
package org.eclipse.pde.internal.build;
11
package org.eclipse.pde.internal.build;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.io.IOException;
14
import java.util.*;
15
import java.util.*;
15
import java.util.jar.JarFile;
16
import java.util.jar.JarFile;
16
import org.eclipse.core.runtime.*;
17
import org.eclipse.core.runtime.*;
Lines 20-25 Link Here
20
import org.eclipse.pde.internal.build.builder.BuildDirector;
21
import org.eclipse.pde.internal.build.builder.BuildDirector;
21
import org.eclipse.pde.internal.build.builder.ModelBuildScriptGenerator;
22
import org.eclipse.pde.internal.build.builder.ModelBuildScriptGenerator;
22
import org.eclipse.pde.internal.build.site.BuildTimeFeature;
23
import org.eclipse.pde.internal.build.site.BuildTimeFeature;
24
import org.osgi.framework.Bundle;
23
25
24
/**
26
/**
25
 * Generate an assemble script for a given feature and a given config. It
27
 * Generate an assemble script for a given feature and a given config. It
Lines 119-128 Link Here
119
121
120
		generateMainBegin();
122
		generateMainBegin();
121
		generateInitializationSteps();
123
		generateInitializationSteps();
122
		generateGatherCalls();
124
		if (BuildDirector.p2Gathering) {
123
		generateProcessingCalls();
125
			generateDirectorCall();
124
		generateBrandingCalls();
126
		} else {
125
		generateP2Steps();
127
			generateGatherCalls();
128
			generateProcessingCalls();
129
			generateBrandingCalls();
130
			generateP2Steps();
131
		}
126
		generateArchivingCalls();
132
		generateArchivingCalls();
127
		generateMainEnd();
133
		generateMainEnd();
128
134
Lines 139-151 Link Here
139
		script.println();
145
		script.println();
140
	}
146
	}
141
147
148
	protected void generateDirectorCall() {
149
		if (productFile != null)
150
			script.printAntCallTask(TARGET_RUN_DIRECTOR, true, null);
151
	}
152
153
	protected void generateDirectorTarget(boolean assembling) {
154
		script.printTargetDeclaration(TARGET_RUN_DIRECTOR, null, null, assembling ? PROPERTY_RUN_PACKAGER : null, null);
155
		Map parameters = new HashMap();
156
		parameters.put(PROPERTY_OS, Utils.getPropertyFormat(PROPERTY_OS));
157
		parameters.put(PROPERTY_WS, Utils.getPropertyFormat(PROPERTY_WS));
158
		parameters.put(PROPERTY_ARCH, Utils.getPropertyFormat(PROPERTY_ARCH));
159
		parameters.put(PROPERTY_P2_REPO, Utils.getPropertyFormat(PROPERTY_P2_BUILD_REPO));
160
		parameters.put(PROPERTY_P2_DIRECTOR_IU, productFile != null ? productFile.getId() : Utils.getPropertyFormat(PROPERTY_P2_ROOT_NAME));
161
		parameters.put(PROPERTY_P2_DIRECTOR_VERSION, productFile != null ? productFile.getVersion() : Utils.getPropertyFormat(PROPERTY_P2_ROOT_VERSION));
162
		parameters.put(PROPERTY_P2_DIRECTOR_INSTALLPATH, Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE));
163
		script.printAntTask(Utils.getPropertyFormat(PROPERTY_GENERIC_TARGETS), null, TARGET_RUN_DIRECTOR, null, TRUE, parameters);
164
		script.println();
165
		script.printTargetEnd();
166
	}
167
142
	private void generateProcessingCalls() {
168
	private void generateProcessingCalls() {
143
		script.printAntCallTask(TARGET_JAR_PROCESSING, true, null);
169
		script.printAntCallTask(TARGET_JAR_PROCESSING, true, null);
144
		script.println();
170
		script.println();
145
	}
171
	}
146
172
147
	private void generateArchivingCalls() {
173
	private void generateArchivingCalls() {
148
		if (!BuildDirector.p2Gathering)
174
		if (!BuildDirector.p2Gathering || productFile != null)
149
			script.printAntCallTask(TARGET_ASSEMBLE_ARCHIVE, true, null);
175
			script.printAntCallTask(TARGET_ASSEMBLE_ARCHIVE, true, null);
150
	}
176
	}
151
177
Lines 175-182 Link Here
175
		script.println();
201
		script.println();
176
	}
202
	}
177
203
178
	private void generateArchivingTarget() {
204
	protected void generateArchivingTarget(boolean assembling) {
179
		script.printTargetDeclaration(TARGET_ASSEMBLE_ARCHIVE, null, null, null, null);
205
		script.printTargetDeclaration(TARGET_ASSEMBLE_ARCHIVE, null, null, assembling && BuildDirector.p2Gathering ? PROPERTY_RUN_PACKAGER : null, null);
180
		Map properties = new HashMap();
206
		Map properties = new HashMap();
181
		properties.put(PROPERTY_ROOT_FOLDER, rootFolder);
207
		properties.put(PROPERTY_ROOT_FOLDER, rootFolder);
182
		printCustomAssemblyAntCall(PROPERTY_PRE + "archive", properties); //$NON-NLS-1$
208
		printCustomAssemblyAntCall(PROPERTY_PRE + "archive", properties); //$NON-NLS-1$
Lines 334-339 Link Here
334
		script.printProperty(PROPERTY_ECLIPSE_PLUGINS, Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_PLUGIN_LOCATION);
360
		script.printProperty(PROPERTY_ECLIPSE_PLUGINS, Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_PLUGIN_LOCATION);
335
		script.printProperty(PROPERTY_ECLIPSE_FEATURES, Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_FEATURE_LOCATION);
361
		script.printProperty(PROPERTY_ECLIPSE_FEATURES, Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_FEATURE_LOCATION);
336
		script.printProperty(PROPERTY_ARCHIVE_FULLPATH, Utils.getPropertyFormat(PROPERTY_BASEDIR) + '/' + Utils.getPropertyFormat(PROPERTY_BUILD_LABEL) + '/' + Utils.getPropertyFormat(PROPERTY_ARCHIVE_NAME));
362
		script.printProperty(PROPERTY_ARCHIVE_FULLPATH, Utils.getPropertyFormat(PROPERTY_BASEDIR) + '/' + Utils.getPropertyFormat(PROPERTY_BUILD_LABEL) + '/' + Utils.getPropertyFormat(PROPERTY_ARCHIVE_NAME));
363
		printLauncherJarProperty();
364
		script.printProperty(PROPERTY_P2_BUILD_REPO, "file:" + Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + "/buildRepo"); //$NON-NLS-1$ //$NON-NLS-2$
337
		script.printAvailableTask(PROPERTY_CUSTOM_ASSEMBLY, "${builder}/customAssembly.xml", "${builder}/customAssembly.xml"); //$NON-NLS-1$ //$NON-NLS-2$
365
		script.printAvailableTask(PROPERTY_CUSTOM_ASSEMBLY, "${builder}/customAssembly.xml", "${builder}/customAssembly.xml"); //$NON-NLS-1$ //$NON-NLS-2$
338
366
339
		if (productFile != null && productFile.getLauncherName() != null)
367
		if (productFile != null && productFile.getLauncherName() != null)
Lines 345-350 Link Here
345
		generatePackagingTargets();
373
		generatePackagingTargets();
346
	}
374
	}
347
375
376
	protected void printLauncherJarProperty() {
377
		Bundle launcherBundle = Platform.getBundle(BUNDLE_EQUINOX_LAUNCHER);
378
		try {
379
			File bundleFile = FileLocator.getBundleFile(launcherBundle);
380
			script.printProperty(PROPERTY_LAUNCHER_JAR, bundleFile.getAbsolutePath());
381
		} catch (IOException e) {
382
			// what can we do with this?
383
		}
384
	}
385
348
	protected void generateCustomGatherMacro() {
386
	protected void generateCustomGatherMacro() {
349
		List attributes = new ArrayList(5);
387
		List attributes = new ArrayList(5);
350
		attributes.add("dir"); //$NON-NLS-1$
388
		attributes.add("dir"); //$NON-NLS-1$
Lines 367-373 Link Here
367
		script.println();
405
		script.println();
368
	}
406
	}
369
407
370
	private void printCustomGatherCall(String fullName, String dir, String propertyName, String propertyValue, String subFolder) {
408
	protected void printCustomGatherCall(String fullName, String dir, String propertyName, String propertyValue, String subFolder) {
371
		script.println("<" + PROPERTY_CUSTOM_GATHER + " dir=\"" + dir + "\" projectName=\"" + fullName + "\" propertyName=\"" + propertyName + "\" propertyValue=\"" + propertyValue + "\" subFolder=\"" + (subFolder != null ? subFolder : "") + "\" />"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
409
		script.println("<" + PROPERTY_CUSTOM_GATHER + " dir=\"" + dir + "\" projectName=\"" + fullName + "\" propertyName=\"" + propertyName + "\" propertyValue=\"" + propertyValue + "\" subFolder=\"" + (subFolder != null ? subFolder : "") + "\" />"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
372
	}
410
	}
373
411
Lines 492-504 Link Here
492
		if (embeddedSource)
530
		if (embeddedSource)
493
			generateGatherSourceTarget();
531
			generateGatherSourceTarget();
494
		generatePostProcessingTarget();
532
		generatePostProcessingTarget();
495
		generateArchivingTarget();
533
		generateArchivingTarget(true);
496
534
497
		if (FORMAT_TAR.equalsIgnoreCase(archiveFormat))
535
		if (FORMAT_TAR.equalsIgnoreCase(archiveFormat))
498
			generateGZipTarget(true);
536
			generateGZipTarget(true);
499
537
500
		generateCustomAssemblyTarget();
538
		generateCustomAssemblyTarget();
501
		generateMetadataTarget();
539
		generateMetadataTarget();
540
		generateDirectorTarget(true);
502
541
503
		script.printProjectEnd();
542
		script.printProjectEnd();
504
		script.close();
543
		script.close();
Lines 589-594 Link Here
589
			}
628
			}
590
629
591
			script.printTargetEnd();
630
			script.printTargetEnd();
631
			script.println();
592
		}
632
		}
593
	}
633
	}
594
634
Lines 700-740 Link Here
700
740
701
	//TODO this code and the generateAntTarTarget() should be refactored using a factory or something like that.
741
	//TODO this code and the generateAntTarTarget() should be refactored using a factory or something like that.
702
	protected void generateAntZipTarget() {
742
	protected void generateAntZipTarget() {
703
		FileSet[] filesPlugins = new FileSet[plugins.length];
743
		List fileSets = new ArrayList();
704
		for (int i = 0; i < plugins.length; i++) {
705
			Object[] shape = shapeAdvisor.getFinalShape(plugins[i]);
706
			filesPlugins[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_PLUGIN_LOCATION + '/' + (String) shape[0], shape[1] == ShapeAdvisor.FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null);
707
		}
708
		if (plugins.length != 0)
709
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, filesPlugins);
710
744
711
		FileSet[] filesFeatures = new FileSet[features.length];
745
		if (BuildDirector.p2Gathering) {
712
		for (int i = 0; i < features.length; i++) {
746
			//TODO permissions
713
			Object[] shape = shapeAdvisor.getFinalShape(features[i]);
747
			fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE), false, null, "**/**", null, null, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null)); //$NON-NLS-1$
714
			filesFeatures[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_FEATURE_LOCATION + '/' + (String) shape[0], shape[1] == ShapeAdvisor.FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null);
748
		} else {
715
		}
749
			for (int i = 0; i < plugins.length; i++) {
716
		if (features.length != 0)
750
				Object[] shape = shapeAdvisor.getFinalShape(plugins[i]);
717
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, filesFeatures);
751
				fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_PLUGIN_LOCATION + '/' + (String) shape[0], shape[1] == ShapeAdvisor.FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null));
752
			}
718
753
719
		if (rootFileProviders.size() == 0)
754
			for (int i = 0; i < features.length; i++) {
720
			return;
755
				Object[] shape = shapeAdvisor.getFinalShape(features[i]);
756
				fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_FEATURE_LOCATION + '/' + (String) shape[0], shape[1] == ShapeAdvisor.FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null));
757
			}
721
758
722
		if (groupConfigs) {
759
			if (rootFileProviders.size() > 0) {
723
			List allConfigs = getConfigInfos();
760
				if (groupConfigs) {
724
			FileSet[] rootFiles = new FileSet[allConfigs.size()];
761
					List allConfigs = getConfigInfos();
725
			int i = 0;
762
					for (Iterator iter = allConfigs.iterator(); iter.hasNext();) {
726
			for (Iterator iter = allConfigs.iterator(); iter.hasNext();) {
763
						Config elt = (Config) iter.next();
727
				Config elt = (Config) iter.next();
764
						fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + elt.toStringReplacingAny(".", ANY_STRING), false, null, "**/**", null, null, null, elt.toStringReplacingAny(".", ANY_STRING), null, null)); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
728
				rootFiles[i++] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + elt.toStringReplacingAny(".", ANY_STRING), false, null, "**/**", null, null, null, elt.toStringReplacingAny(".", ANY_STRING), null, null); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
765
					}
766
				} else {
767
					FileSet[] permissions = generatePermissions(true);
768
					String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$
769
					fileSets.add(new ZipFileSet(rootFolder, false, null, "**/**", null, toExcludeFromArchive, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null)); //$NON-NLS-1$
770
					fileSets.addAll(Arrays.asList(permissions));
771
				}
729
			}
772
			}
730
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, rootFiles);
773
		}
731
		} else {
774
		if (fileSets.size() > 0) {
732
			FileSet[] permissionSets = generatePermissions(true);
775
			FileSet[] sets = (FileSet[]) fileSets.toArray(new FileSet[fileSets.size()]);
733
			FileSet[] rootFiles = new FileSet[permissionSets.length + 1];
776
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, sets);
734
			String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$
735
			System.arraycopy(permissionSets, 0, rootFiles, 1, permissionSets.length);
736
			rootFiles[0] = new ZipFileSet(rootFolder, false, null, "**/**", null, toExcludeFromArchive, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null); //$NON-NLS-1$
737
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, rootFiles);
738
		}
777
		}
739
	}
778
	}
740
779
(-)src/org/eclipse/pde/internal/build/ant/AntScript.java (+1 lines)
Lines 102-107 Link Here
102
			bundles[i].printAs("bundles", this); //$NON-NLS-1$
102
			bundles[i].printAs("bundles", this); //$NON-NLS-1$
103
		}
103
		}
104
		indent--;
104
		indent--;
105
		printTab();
105
		output.println("</eclipse.publish.featuresAndBundles>"); //$NON-NLS-1$
106
		output.println("</eclipse.publish.featuresAndBundles>"); //$NON-NLS-1$
106
	}
107
	}
107
108
(-)src/org/eclipse/pde/internal/build/packager/PackageScriptGenerator.java (-1 / +13 lines)
Lines 47-53 Link Here
47
	}
47
	}
48
48
49
	protected void generateP2ConfigFileTargetCall() {
49
	protected void generateP2ConfigFileTargetCall() {
50
		//empty
50
		P2ConfigScriptGenerator p2ConfigGenerator = new P2ConfigScriptGenerator(assemblageInformation, false);
51
		p2ConfigGenerator.setProduct(productLocation);
52
		p2ConfigGenerator.initialize(directory, featureId);
53
		p2ConfigGenerator.generate();
54
55
		script.printTab();
56
		script.print("<assemble "); //$NON-NLS-1$
57
		script.printAttribute("config", "p2", true); //$NON-NLS-1$ //$NON-NLS-2$
58
		script.printAttribute("element", p2ConfigGenerator.getTargetElement(), true); //$NON-NLS-1$
59
		script.printAttribute("dot", ".", true); //$NON-NLS-1$ //$NON-NLS-2$
60
		script.printAttribute("scriptPrefix", "package", true); //$NON-NLS-1$ //$NON-NLS-2$
61
		script.println("/>"); //$NON-NLS-1$
51
	}
62
	}
52
63
53
	protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException {
64
	protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException {
Lines 59-64 Link Here
59
		configScriptGenerator.setBuildSiteFactory(siteFactory);
70
		configScriptGenerator.setBuildSiteFactory(siteFactory);
60
		configScriptGenerator.generate();
71
		configScriptGenerator.generate();
61
72
73
		script.printTab();
62
		script.print("<assemble "); //$NON-NLS-1$
74
		script.print("<assemble "); //$NON-NLS-1$
63
		String config = configScriptGenerator.getTargetConfig();
75
		String config = configScriptGenerator.getTargetConfig();
64
		script.printAttribute("config", config, true); //$NON-NLS-1$
76
		script.printAttribute("config", config, true); //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/build/packager/PackageConfigScriptGenerator.java (+8 lines)
Lines 183-188 Link Here
183
		super.generateTarGZTasks(false);
183
		super.generateTarGZTasks(false);
184
	}
184
	}
185
185
186
	protected void generateDirectorTarget(boolean assembling) {
187
		super.generateDirectorTarget(false);
188
	}
189
190
	protected void generateArchivingTarget(boolean assembling) {
191
		super.generateArchivingTarget(false);
192
	}
193
186
	protected Object[] getFinalShape(BundleDescription bundle) {
194
	protected Object[] getFinalShape(BundleDescription bundle) {
187
		if (AbstractScriptGenerator.getPropertyAsBoolean(IBuildPropertiesConstants.PROPERTY_PACKAGER_MODE) == true) {
195
		if (AbstractScriptGenerator.getPropertyAsBoolean(IBuildPropertiesConstants.PROPERTY_PACKAGER_MODE) == true) {
188
			String shape = isFolder(new Path(bundle.getLocation())) ? ShapeAdvisor.FOLDER : ShapeAdvisor.FILE;
196
			String shape = isFolder(new Path(bundle.getLocation())) ? ShapeAdvisor.FOLDER : ShapeAdvisor.FILE;
(-)src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java (-2 / +3 lines)
Lines 607-614 Link Here
607
		generateAPIToolsCall(getCompiledLocations(), Utils.isStringIn(splitIncludes, EXPANDED_DOT + '/') != -1, Utils.getPropertyFormat(PROPERTY_BUILD_RESULT_FOLDER));
607
		generateAPIToolsCall(getCompiledLocations(), Utils.isStringIn(splitIncludes, EXPANDED_DOT + '/') != -1, Utils.getPropertyFormat(PROPERTY_BUILD_RESULT_FOLDER));
608
608
609
		script.println("<eclipse.gatherBundle "); //$NON-NLS-1$
609
		script.println("<eclipse.gatherBundle "); //$NON-NLS-1$
610
		script.println("   metadataRepository=\"file:${buildDirectory}/buildRepo\""); //$NON-NLS-1$
610
		script.println("   metadataRepository=\"" + Utils.getPropertyFormat(PROPERTY_P2_BUILD_REPO) + "\""); //$NON-NLS-1$ //$NON-NLS-2$
611
		script.println("   artifactRepository=\"file:${buildDirectory}/buildRepo\""); //$NON-NLS-1$
611
		script.println("   artifactRepository=\"" + Utils.getPropertyFormat(PROPERTY_P2_BUILD_REPO) + "\""); //$NON-NLS-1$ //$NON-NLS-2$
612
		script.println("   buildResultFolder=\"" + Utils.getPropertyFormat(PROPERTY_BUILD_RESULT_FOLDER) + "\""); //$NON-NLS-1$ //$NON-NLS-2$
612
		script.println("   buildResultFolder=\"" + Utils.getPropertyFormat(PROPERTY_BUILD_RESULT_FOLDER) + "\""); //$NON-NLS-1$ //$NON-NLS-2$
613
		script.println("   baseDirectory=\"${basedir}\""); //$NON-NLS-1$
613
		script.println("   baseDirectory=\"${basedir}\""); //$NON-NLS-1$
614
		if (associatedEntry != null && associatedEntry.unpackSet())
614
		if (associatedEntry != null && associatedEntry.unpackSet())
Lines 856-861 Link Here
856
		script.printProjectDeclaration(model.getSymbolicName(), TARGET_BUILD_JARS, DOT);
856
		script.printProjectDeclaration(model.getSymbolicName(), TARGET_BUILD_JARS, DOT);
857
		script.println();
857
		script.println();
858
858
859
		script.printProperty(PROPERTY_P2_BUILD_REPO, "file:" + Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + "/buildRepo"); //$NON-NLS-1$ //$NON-NLS-2$
859
		script.printProperty(PROPERTY_BASE_WS, Utils.getPropertyFormat(PROPERTY_WS));
860
		script.printProperty(PROPERTY_BASE_WS, Utils.getPropertyFormat(PROPERTY_WS));
860
		script.printProperty(PROPERTY_BASE_OS, Utils.getPropertyFormat(PROPERTY_OS));
861
		script.printProperty(PROPERTY_BASE_OS, Utils.getPropertyFormat(PROPERTY_OS));
861
		script.printProperty(PROPERTY_BASE_ARCH, Utils.getPropertyFormat(PROPERTY_ARCH));
862
		script.printProperty(PROPERTY_BASE_ARCH, Utils.getPropertyFormat(PROPERTY_ARCH));
(-)scripts/genericTargets.xml (+36 lines)
Lines 200-203 Link Here
200
	</p2.repo2runnable>
200
	</p2.repo2runnable>
201
</target>
201
</target>
202
202
203
<!-- Invoke the p2 director to perform an install  -->
204
<target name="runDirector" >
205
	<property name="p2.director.bundlepool" value="${p2.director.installPath}"/>
206
	<property name="p2.director.dataArea" value="${p2.director.installPath}/p2"/>
207
	<property name="p2.director.extraArgs" value="-profileProperties org.eclipse.update.install.features=true" />
208
	<property name="p2.director.extraVMArgs" value="-Declipse.p2.MD5Check=false" />
209
	<property name="p2.director.profile" value="profile" />
210
	<property name="p2.director.version" value="" />
211
	
212
	<java jar="${equinoxLauncherJar}" fork="true"  failonerror="true">
213
		<arg line="-application org.eclipse.equinox.p2.director.app.application" />
214
		<arg line="-nosplash" />
215
		<arg line="--launcher.suppressErrors" />
216
		<arg line="-consoleLog" />
217
		<arg line="-flavor ${p2.flavor}" />
218
		<arg line="-installIU ${p2.director.iu}" />
219
		<arg line="-version ${p2.director.version}" />
220
		<arg line="-p2.os ${os}" />
221
		<arg line="-p2.ws ${ws}" />
222
		<arg line="-p2.arch ${arch}" />
223
		<arg line="-roaming" />
224
		<arg line="-profile ${p2.director.profile}" />
225
		<arg line="${p2.director.extraArgs}" />
226
		<arg line="-metadataRepository"/>
227
		<arg value="${p2.repo}" />
228
		<arg line="-artifactRepository"/>
229
		<arg value="${p2.repo}" />
230
		<arg line="-destination"/>
231
		<arg value="${p2.director.installPath}" />
232
		<arg line="-bundlepool"/>
233
		<arg value="${p2.director.bundlepool}" />
234
235
		<jvmarg value="-Declipse.p2.data.area=${p2.director.dataArea}" />
236
		<jvmarg line="${p2.director.extraVMArgs}" />
237
	</java>
238
</target>
203
</project>
239
</project>
(-)src/org/eclipse/pde/build/internal/tests/p2/PublishingTests.java (+2 lines)
Lines 349-353 Link Here
349
		assertEquals(iu.getVersion().toString(), "1.0.0");
349
		assertEquals(iu.getVersion().toString(), "1.0.0");
350
		assertRequires(iu, "org.eclipse.equinox.p2.iu", "org.eclipse.osgi");
350
		assertRequires(iu, "org.eclipse.equinox.p2.iu", "org.eclipse.osgi");
351
351
352
		assertResourceFile(buildFolder, "I.TestBuild/eclipse-macosx.carbon.ppc.zip");
353
		assertResourceFile(buildFolder, "I.TestBuild/eclipse-win32.win32.x86.zip");
352
	}
354
	}
353
}
355
}

Return to bug 264603