View | Details | Raw Unified | Return to bug 178717
Collapse All | Expand All

(-)src/org/eclipse/pde/internal/build/IPDEBuildConstants.java (+1 lines)
Lines 41-46 Link Here
41
	public final static String GENERIC_VERSION_NUMBER = "0.0.0"; //$NON-NLS-1$ 
41
	public final static String GENERIC_VERSION_NUMBER = "0.0.0"; //$NON-NLS-1$ 
42
	public final static String ANY_STRING = "ANY"; //$NON-NLS-1$
42
	public final static String ANY_STRING = "ANY"; //$NON-NLS-1$
43
	public final static String DEFAULT_ASSEMBLE_NAME = "assemble"; //$NON-NLS-1$
43
	public final static String DEFAULT_ASSEMBLE_NAME = "assemble"; //$NON-NLS-1$
44
  public final static String DEFAULT_PACKAGE_NAME = "package"; //$NON-NLS-1$
44
	public final static String DEFAULT_ASSEMBLE_ALL = "all.xml"; //$NON-NLS-1$
45
	public final static String DEFAULT_ASSEMBLE_ALL = "all.xml"; //$NON-NLS-1$
45
	public final static String DEFAULT_CUSTOM_TARGETS = "customTargets"; //$NON-NLS-1$
46
	public final static String DEFAULT_CUSTOM_TARGETS = "customTargets"; //$NON-NLS-1$
46
	public final static String DEFAULT_RETRIEVE_FILENAME_DESCRIPTOR = "retrieve.xml"; //$NON-NLS-1$
47
	public final static String DEFAULT_RETRIEVE_FILENAME_DESCRIPTOR = "retrieve.xml"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/build/AssembleScriptGenerator.java (-6 / +51 lines)
Lines 68-74 Link Here
68
				features.addAll(configInfo[2]);
68
				features.addAll(configInfo[2]);
69
				rootFiles.addAll(configInfo[3]);
69
				rootFiles.addAll(configInfo[3]);
70
			}
70
			}
71
			basicGenerateAssembleConfigFileTargetCall(new Config("group","group","group") , allPlugins, allFeatures, features, rootFiles);
71
			basicGenerateAssembleConfigFileTargetCall(new Config("group","group","group") , allPlugins, allFeatures, features, rootFiles); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
72
		} else {
72
		} else {
73
			for (Iterator allConfigs = getConfigInfos().iterator(); allConfigs.hasNext();) {
73
			for (Iterator allConfigs = getConfigInfos().iterator(); allConfigs.hasNext();) {
74
				Config current = (Config) allConfigs.next();
74
				Config current = (Config) allConfigs.next();
Lines 83-88 Link Here
83
		return new Collection[] { assemblageInformation.getCompiledPlugins(aConfig), assemblageInformation.getCompiledFeatures(aConfig), assemblageInformation.getFeatures(aConfig), assemblageInformation.getRootFileProviders(aConfig) };
83
		return new Collection[] { assemblageInformation.getCompiledPlugins(aConfig), assemblageInformation.getCompiledFeatures(aConfig), assemblageInformation.getFeatures(aConfig), assemblageInformation.getRootFileProviders(aConfig) };
84
	}
84
	}
85
85
86
	/**
87
   * TODO: Rename this to something more understandable. Suggest
88
   * generateAssembleConfigFileTargetCall.
89
   * 
90
   * @param aConfig
91
   *          Configurationd details.
92
   * @param binaryPlugins
93
   *          all binary plugins.
94
   * @param binaryFeatures
95
   *          all binary features.
96
   * @param allFeatures
97
   *          all features.
98
   * @param rootFiles
99
   *          all root files
100
   * @throws CoreException
101
   *           failures.
102
   */
86
	protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException {
103
	protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException {
87
		// generate the script for a configuration
104
		// generate the script for a configuration
88
		configScriptGenerator.initialize(directory, featureId, aConfig, binaryPlugins, binaryFeatures, allFeatures, rootFiles);
105
		configScriptGenerator.initialize(directory, featureId, aConfig, binaryPlugins, binaryFeatures, allFeatures, rootFiles);
Lines 91-101 Link Here
91
		configScriptGenerator.setGroupConfigs(groupConfigs);
108
		configScriptGenerator.setGroupConfigs(groupConfigs);
92
		configScriptGenerator.generate();
109
		configScriptGenerator.generate();
93
110
94
		Map params = new HashMap(1);
111
		Map params = new HashMap(2);
95
		params.put("assembleScriptName", configScriptGenerator.getTargetName() + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
112
    String targetName = getTargetScriptName(aConfig);
96
		script.printAntTask(Utils.getPropertyFormat(DEFAULT_CUSTOM_TARGETS), null, configScriptGenerator.getTargetName(), null, null, params);
113
    String assembleScriptName = getAssembleScriptName();
97
	}
114
    params.put("assembleScriptName", assembleScriptName + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
98
115
    script.printAntTask(Utils.getPropertyFormat(DEFAULT_CUSTOM_TARGETS), null, targetName, null, null, params);
116
	}
117
118
  /**
119
   * Returns the name of the Ant target to invoke.
120
   * 
121
   * This is a Template Method (325) from GOF for
122
   * {@link #basicGenerateAssembleConfigFileTargetCall(Config, Collection, Collection, Collection, Collection)}.
123
   * 
124
   * @param aConfig
125
   *          configuration available, if needed to genereate result.
126
   * @return the name of the Ant target to invoke
127
   */
128
  protected String getTargetScriptName(Config aConfig) {
129
    return configScriptGenerator.getTargetName();
130
  }
131
132
  /**
133
   * Return the value of the assembleScriptName parameter in the ant task.
134
   * 
135
   * This is a Template Method (325) from GOF for
136
   * {@link #basicGenerateAssembleConfigFileTargetCall(Config, Collection, Collection, Collection, Collection)}.
137
   * 
138
   * @return the value of the assembleScriptName parameter in the ant task
139
   */
140
  protected String getAssembleScriptName() {
141
    return configScriptGenerator.getTargetName();
142
  }
143
  
99
	public void setSignJars(boolean value) {
144
	public void setSignJars(boolean value) {
100
		configScriptGenerator.setSignJars(value);
145
		configScriptGenerator.setSignJars(value);
101
	}
146
	}
(-)src/org/eclipse/pde/internal/build/BuildScriptGenerator.java (-47 / +133 lines)
Lines 173-202 Link Here
173
				generator.generate();
173
				generator.generate();
174
			}
174
			}
175
175
176
			if (generator != null && generateAssembleScript == true) {
176
      if (generator != null && generateAssembleScript == true) {
177
				String[] featureInfo = null;
177
        String featureIdForAssemble = "all"; //$NON-NLS-1$
178
				if (features.size() == 1)
178
        String featureIdForPackage = ""; //$NON-NLS-1$
179
					featureInfo = getNameAndVersion((String) features.get(0));
179
        if (features.size() == 1) {
180
				else
180
          featureIdForAssemble = getNameAndVersion((String) features.get(0))[0];
181
					featureInfo = new String[] {"all"}; //$NON-NLS-1$
181
          featureIdForPackage = featureIdForAssemble;
182
182
        }
183
				generateAssembleScripts(assemblageInformation, featureInfo, generator.siteFactory);
183
184
184
        generateAssembleScripts(assemblageInformation, featureIdForAssemble, generator.siteFactory);
185
				if (features.size() == 1)
185
        generatePackageScripts(assemblageInformation, featureIdForPackage, generator.siteFactory);
186
					featureInfo = getNameAndVersion((String) features.get(0));
186
      }
187
				else
187
      if (generateVersionsList)
188
					featureInfo = new String[] {""}; //$NON-NLS-1$
188
        generateVersionsLists(assemblageInformation);
189
189
    } finally {
190
				generatePackageScripts(assemblageInformation, featureInfo, generator.siteFactory);
190
      if (generator != null)
191
			}
191
        generator.getSite(false).getRegistry().cleanupOriginalState();
192
			if (generateVersionsList)
192
    }
193
				generateVersionsLists(assemblageInformation);
193
	}
194
		} finally {
194
195
			if (generator != null)
195
  /**
196
				generator.getSite(false).getRegistry().cleanupOriginalState();
196
   * Generate the Assembly Scripts for the specified feature.
197
		}
197
   * 
198
	}
198
   * @param assemblageInformation
199
199
   *          assemblageInformation .
200
   * @param featureInfo
201
   *          the feature to generate scripts for.
202
   * @param factory
203
   *          BuildTimeSiteFactory.
204
   * @throws CoreException
205
   *           failures.
206
   */
207
  private void generateAssembleScripts(AssemblyInformation assemblageInformation, String featureInfo, BuildTimeSiteFactory factory) throws CoreException {
208
    AssembleScriptGenerator assembler = createAssembleScriptGenerator(workingDirectory, assemblageInformation, featureInfo);
209
    initialiseAssembleScriptGenerator(assembler, factory);
210
    assembler.generate();
211
  }
212
213
  /**
214
   * Create an <code>AssembleScriptGenerator</code> for generating an Assemble
215
   * Script.
216
   * 
217
   * This is a Template Method (325) from GOF for
218
   * {@link #generateAssembleScripts(AssemblyInformation, String, BuildTimeSiteFactory)}.
219
   * 
220
   * @param directory
221
   *          see AssembleScriptGenerator
222
   * @param assemblageInformation
223
   *          see AssembleScriptGenerator
224
   * @param featureId
225
   *          see AssembleScriptGenerator
226
   * @return an AssembleScriptGenerator
227
   * @see AssembleScriptGenerator
228
   */
229
  protected AssembleScriptGenerator createAssembleScriptGenerator(String directory, AssemblyInformation assemblageInformation, String featureId) {
230
    return new AssembleScriptGenerator(directory, assemblageInformation, featureId);
231
  }
232
233
  /**
234
   * Initialise the <code>AssembleScriptGenerator</code> used for generating
235
   * an Assemble Script.
236
   * 
237
   * This is a Template Method (325) from GOF for
238
   * {@link #generateAssembleScripts(AssemblyInformation, String, BuildTimeSiteFactory)}.
239
   * 
240
   * @param generator
241
   *          AssembleScriptGenerator to be initialised.
242
   * @param factory
243
   *          BuildTimeSiteFactory used in generating scripts.
244
   */
245
  protected void initialiseAssembleScriptGenerator(AssembleScriptGenerator generator, BuildTimeSiteFactory factory) {
246
    generator.setSignJars(signJars);
247
    generator.setGenerateJnlp(generateJnlp);
248
    generator.setArchivesFormat(getArchivesFormat());
249
    generator.setProduct(product);
250
    generator.setGroupConfigs(groupConfigs);
251
    generator.setBuildSiteFactory(factory);
252
  }
253
  
254
  /**
255
   * Generate the Package Scripts for the specified feature.
256
   * 
257
   * @param assemblageInformation
258
   *          assemblageInformation.
259
   * @param featureInfothe
260
   *          feature to generate scripts for.
261
   * @param factory
262
   *          BuildTimeSiteFactory.
263
   * @throws CoreException
264
   *           failures.
265
   */
266
  private void generatePackageScripts(AssemblyInformation assemblageInformation, String featureInfo, BuildTimeSiteFactory factory) throws CoreException {
267
    PackageScriptGenerator assembler = createPackageScriptGenerator(workingDirectory, assemblageInformation, featureInfo);
268
    initialisePackageScriptGenerator(assembler, factory);
269
270
    assembler.generate();
271
  }
272
  
273
  /**
274
   * Create the <code>PackageScriptGenerator</code> for generating a Package
275
   * Script.
276
   * 
277
   * This is a Template Method (325) from GOF for
278
   * {@link #generatePackageScripts(AssemblyInformation, String, BuildTimeSiteFactory)}
279
   * 
280
   * @param directory
281
   *          see PackageScriptGenerator
282
   * @param assemblageInformation
283
   *          see PackageScriptGenerator
284
   * @param featureId
285
   *          see PackageScriptGenerator
286
   * @return a PackageScriptGenerator
287
   * @see PackageScriptGenerator
288
   */
289
  protected PackageScriptGenerator createPackageScriptGenerator(String directory, AssemblyInformation assemblageInformation, String featureId) {
290
    return new PackageScriptGenerator(directory, assemblageInformation, featureId);
291
  }
292
  
293
  /**
294
   * Initialise the <code>PackageScriptGenerator</code> used for generating a
295
   * Package Script.
296
   * 
297
   * This ia a Template Method (325) from GOF for
298
   * {@link #generatePackageScripts(AssemblyInformation, String, BuildTimeSiteFactory)}.
299
   * 
300
   * @param generator
301
   *          PackageScriptGenerator to be initialised.
302
   * @param factory
303
   *          BuildTimeSiteFactory used in generating scripts.
304
   */
305
  protected void initialisePackageScriptGenerator(PackageScriptGenerator generator, BuildTimeSiteFactory factory) {
306
    initialiseAssembleScriptGenerator(generator, factory);
307
  }  
308
    
200
	protected void generateVersionsLists(AssemblyInformation assemblageInformation) throws CoreException {
309
	protected void generateVersionsLists(AssemblyInformation assemblageInformation) throws CoreException {
201
		if (assemblageInformation == null)
310
		if (assemblageInformation == null)
202
			return;
311
			return;
Lines 306-334 Link Here
306
		}
415
		}
307
	}
416
	}
308
 
417
 
309
	protected void generatePackageScripts(AssemblyInformation assemblageInformation, String[] featureInfo, BuildTimeSiteFactory factory) throws CoreException {
310
		PackageScriptGenerator assembler = null;
311
		assembler = new PackageScriptGenerator(workingDirectory, assemblageInformation, featureInfo[0]);
312
		assembler.setSignJars(signJars);
313
		assembler.setGenerateJnlp(generateJnlp);
314
		assembler.setArchivesFormat(getArchivesFormat());
315
		assembler.setProduct(product);
316
		assembler.setBuildSiteFactory(factory);
317
		assembler.setGroupConfigs(groupConfigs);
318
		assembler.generate();
319
	}
320
321
	private void generateAssembleScripts(AssemblyInformation assemblageInformation, String[] featureInfo, BuildTimeSiteFactory factory) throws CoreException {
322
		AssembleScriptGenerator assembler = new AssembleScriptGenerator(workingDirectory, assemblageInformation, featureInfo[0]);
323
		assembler.setSignJars(signJars);
324
		assembler.setGenerateJnlp(generateJnlp);
325
		assembler.setArchivesFormat(getArchivesFormat());
326
		assembler.setProduct(product);
327
		assembler.setBuildSiteFactory(factory);
328
		assembler.setGroupConfigs(groupConfigs);
329
		assembler.generate();
330
	}
331
332
	public void setGenerateArchive(boolean generateArchive) {
418
	public void setGenerateArchive(boolean generateArchive) {
333
		this.generateArchive = generateArchive;
419
		this.generateArchive = generateArchive;
334
	}
420
	}
(-)src/org/eclipse/pde/internal/build/BundleHelper.java (+9 lines)
Lines 111-114 Link Here
111
			log = null;
111
			log = null;
112
		}
112
		}
113
	}
113
	}
114
  
115
  public void log(String msg, Throwable t) {
116
    Platform.getLog(bundle).log(new Status(IStatus.INFO, bundle.getSymbolicName(), IStatus.OK, msg, t));
117
  }
118
119
  public void log(String msg) {
120
    log(msg, null);
121
  }
122
  
114
}
123
}
(-)src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java (-93 / +104 lines)
Lines 37-42 Link Here
37
	protected Properties featuresPostProcessingSteps;
37
	protected Properties featuresPostProcessingSteps;
38
	protected ArrayList addedByPermissions = new ArrayList();	//contains the list of files and folders that have been added to an archive by permission management
38
	protected ArrayList addedByPermissions = new ArrayList();	//contains the list of files and folders that have been added to an archive by permission management
39
	
39
	
40
  private static final int MAX_ZIP_EXEC_COMMAND_PARAMETERS = 15;
41
  
40
	private static final String PROPERTY_SOURCE = "source"; //$NON-NLS-1$
42
	private static final String PROPERTY_SOURCE = "source"; //$NON-NLS-1$
41
	private static final String PROPERTY_ELEMENT_NAME = "elementName"; //$NON-NLS-1$
43
	private static final String PROPERTY_ELEMENT_NAME = "elementName"; //$NON-NLS-1$
42
44
Lines 131-138 Link Here
131
		if (embeddedSource)
133
		if (embeddedSource)
132
			generateGatherSourceCalls();
134
			generateGatherSourceCalls();
133
		generatePostProcessingSteps();
135
		generatePostProcessingSteps();
134
		generateBrandingCalls();
136
		generateBrandingCalls(); // BAE: TODO: PACKAGE ONLY???
135
		generateArchivingSteps();
137
		generateArchivingSteps(); // BAE: TODO: PACKAGE ONLY???
136
		generateEpilogue();
138
		generateEpilogue();
137
	}
139
	}
138
140
Lines 466-521 Link Here
466
	}
468
	}
467
469
468
	private void generateZipTarget() {
470
	private void generateZipTarget() {
469
		final int parameterSize = 15;
471
    List parameters = new ArrayList(plugins.length + features.length + 1);
470
		List parameters = new ArrayList(parameterSize + 1);
472
    for (int i = 0; i < plugins.length; i++) {
471
		for (int i = 0; i < plugins.length; i++) {
473
      parameters.add(Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) getFinalShape(plugins[i])[0]);
472
			parameters.add(Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) getFinalShape(plugins[i])[0]);
474
    }
473
			if (i % parameterSize == 0) {
475
    for (int i = 0; i < features.length; i++) {
474
				createZipExecCommand(parameters);
476
      parameters.add(Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) getFinalShape(features[i])[0]);
475
				parameters.clear();
477
    }
476
			}
478
    createZipExecCommand(Utils.getPropertyFormat(PROPERTY_ASSEMBLY_TMP), parameters);
477
		}
479
478
		if (!parameters.isEmpty()) {
480
    if (!rootFileProviders.isEmpty()) {
479
			createZipExecCommand(parameters);
481
      parameters.clear();
480
			parameters.clear();
482
      parameters.add("."); //$NON-NLS-1$
481
		}
483
      createZipExecCommand(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + configInfo.toStringReplacingAny(".", ANY_STRING), parameters); //$NON-NLS-1$
482
484
    }
483
		if (!parameters.isEmpty()) {
485
	}
484
			createZipExecCommand(parameters);
486
485
			parameters.clear();
487
  /**
486
		}
488
   * Create a zip command for the specified parameters. This will chunk the zip
487
489
   * command into a command of no more that MAX_ZIP_EXEC_COMMAND_PARAMETERS.
488
		for (int i = 0; i < features.length; i++) {
490
   * 
489
			parameters.add(Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) getFinalShape(features[i])[0]);
491
   * @param dir
490
			if (i % parameterSize == 0) {
492
   *          the root directory to zip from.
491
				createZipExecCommand(parameters);
493
   * @param lineArgs
492
				parameters.clear();
494
   *          the list of parameters to the zip command.
493
			}
495
   */
494
		}
496
  private void createZipExecCommand(String dir, List lineArgs) {
495
		if (!parameters.isEmpty()) {
497
    String zipArguments = "-r -q " + Utils.getPropertyFormat(PROPERTY_ZIP_ARGS) + " '" + Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH) + '\''; //$NON-NLS-1$ //$NON-NLS-2$
496
			createZipExecCommand(parameters);
498
    List zipLineArgs = new ArrayList(MAX_ZIP_EXEC_COMMAND_PARAMETERS + 1);
497
			parameters.clear();
499
    for (Iterator iter = lineArgs.iterator(); iter.hasNext();) {
498
		}
500
      zipLineArgs.add(iter.next());
499
501
      if (zipLineArgs.size() == MAX_ZIP_EXEC_COMMAND_PARAMETERS) {
500
		createZipRootFileCommand();
502
        zipLineArgs.add(0, zipArguments);
501
	}
503
        script.printExecTask("zip", dir, zipLineArgs, null); //$NON-NLS-1$
502
504
        zipLineArgs.clear();
503
	/**
505
      }
504
	 *  Zip the root files
506
    }
505
	 */
507
    if (!zipLineArgs.isEmpty()) {
506
	private void createZipRootFileCommand() {
508
      zipLineArgs.add(0, zipArguments);
507
		if (rootFileProviders.size() == 0)
509
      script.printExecTask("zip", dir, zipLineArgs, null); //$NON-NLS-1$
508
			return;
510
    }
509
511
  }
510
		List parameters = new ArrayList(1);
511
		parameters.add("-r -q ${zipargs} '" + Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH) + "' . "); //$NON-NLS-1$ //$NON-NLS-2$
512
		script.printExecTask("zip", Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + configInfo.toStringReplacingAny(".", ANY_STRING), parameters, null); //$NON-NLS-1$ //$NON-NLS-2$ 
513
	}
514
515
	private void createZipExecCommand(List parameters) {
516
		parameters.add(0, "-r -q " + Utils.getPropertyFormat(PROPERTY_ZIP_ARGS) + " '" + Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH) + '\''); //$NON-NLS-1$ //$NON-NLS-2$
517
		script.printExecTask("zip", Utils.getPropertyFormat(PROPERTY_ASSEMBLY_TMP), parameters, null); //$NON-NLS-1$ 
518
	}
519
512
520
	protected String computeArchiveName() {
513
	protected String computeArchiveName() {
521
		String extension = (FORMAT_TAR.equalsIgnoreCase(archiveFormat) || FORMAT_ANTTAR.equalsIgnoreCase(archiveFormat)) ? ".tar.gz" : ".zip"; //$NON-NLS-1$ //$NON-NLS-2$
514
		String extension = (FORMAT_TAR.equalsIgnoreCase(archiveFormat) || FORMAT_ANTTAR.equalsIgnoreCase(archiveFormat)) ? ".tar.gz" : ".zip"; //$NON-NLS-1$ //$NON-NLS-2$
Lines 547-592 Link Here
547
		script.printExecTask("rm", null, args, null); //$NON-NLS-1$
540
		script.printExecTask("rm", null, args, null); //$NON-NLS-1$
548
	}
541
	}
549
542
550
	//TODO this code andn the generateAntTarTarget() should be refactored using a factory or something like that.
543
	// TODO this code andn the generateAntTarTarget() should be refactored using a
551
	protected void generateAntZipTarget() {
544
  // factory or something like that.
552
		FileSet[] filesPlugins = new FileSet[plugins.length];
545
  protected void generateAntZipTarget() {
553
		for (int i = 0; i < plugins.length; i++) {
546
    List fileSets = new ArrayList();
554
			Object[] shape = getFinalShape(plugins[i]);
547
    FileSet[] pluginsFileSets = getPluginsFileSets();
555
			filesPlugins[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_PLUGIN_LOCATION + '/' + (String) shape[0], shape[1] == FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null);
548
    if (pluginsFileSets.length != 0) {
556
		}
549
      fileSets.addAll(Arrays.asList(pluginsFileSets));
557
		if (plugins.length != 0)
550
    }
558
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, filesPlugins);
551
    FileSet[] featuresFileSets = getFeaturesFileSets();
559
552
    if (featuresFileSets.length != 0) {
560
		FileSet[] filesFeatures = new FileSet[features.length];
553
      fileSets.addAll(Arrays.asList(featuresFileSets));
561
		for (int i = 0; i < features.length; i++) {
554
    }
562
			Object[] shape = getFinalShape(features[i]);
555
    if (!rootFileProviders.isEmpty()) {
563
			filesFeatures[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_FEATURE_LOCATION + '/' + (String) shape[0], shape[1] == FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null);
556
      if (groupConfigs) {
564
		}
557
        List allConfigs = getConfigInfos();
565
		if (features.length != 0)
558
        for (Iterator iter = allConfigs.iterator(); iter.hasNext();) {
566
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, filesFeatures);
559
          Config elt = (Config) iter.next();
567
560
          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$
568
		if (rootFileProviders.size() == 0)
561
        }
569
			return;
562
      } else {
570
563
        FileSet[] permissionSets = generatePermissions(true);
571
		if (groupConfigs) {
564
        String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$
572
			List allConfigs = getConfigInfos();
565
        fileSets.add(new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + configInfo.toStringReplacingAny(".", ANY_STRING) + '/' + Utils.getPropertyFormat(PROPERTY_COLLECTING_FOLDER), false, null, "**/**", null, toExcludeFromArchive, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null)); //$NON-NLS-1$//$NON-NLS-2$
573
			FileSet[] rootFiles = new FileSet[allConfigs.size()];
566
        if (permissionSets.length != 0) {
574
			int i = 0;
567
          fileSets.addAll(Arrays.asList(permissionSets));
575
			for (Iterator iter = allConfigs.iterator(); iter.hasNext();) {
568
        }
576
				Config elt = (Config) iter.next();
569
      }
577
				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$
570
    }
578
			}
571
    if (!fileSets.isEmpty()) {
579
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, rootFiles);
572
      FileSet[] filesSetsToAdd = (FileSet[]) fileSets.toArray(new FileSet[fileSets.size()]);
580
		} else {
573
      script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, filesSetsToAdd);
581
			FileSet[] permissionSets = generatePermissions(true);
574
    }
582
			FileSet[] rootFiles = new FileSet[permissionSets.length + 1];
575
  }
583
			String toExcludeFromArchive = Utils.getStringFromCollection(this.addedByPermissions, ","); //$NON-NLS-1$
576
584
			System.arraycopy(permissionSets, 0, rootFiles, 1, permissionSets.length);
577
  /**
585
			rootFiles[0] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + configInfo.toStringReplacingAny(".", ANY_STRING) + '/' + Utils.getPropertyFormat(PROPERTY_COLLECTING_FOLDER), false, null, "**/**", null, toExcludeFromArchive, null, Utils.getPropertyFormat(PROPERTY_ARCHIVE_PREFIX), null, null); //$NON-NLS-1$//$NON-NLS-2$
578
   * @return the file sets for all defined features.
586
			script.printZipTask(Utils.getPropertyFormat(PROPERTY_ARCHIVE_FULLPATH), null, false, true, rootFiles);
579
   */
587
		}
580
  private FileSet[] getFeaturesFileSets() {
588
	}
581
    FileSet[] filesFeatures = new FileSet[features.length];
589
582
    for (int i = 0; i < features.length; i++) {
583
      Object[] shape = getFinalShape(features[i]);
584
      filesFeatures[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_FEATURE_LOCATION + '/' + (String) shape[0], shape[1] == FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_FEATURE_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null);
585
    }
586
    return filesFeatures;
587
  }
588
589
  /**
590
   * @return the file sets for all defined plugins.
591
   */
592
  private FileSet[] getPluginsFileSets() {
593
    FileSet[] filesPlugins = new FileSet[plugins.length];
594
    for (int i = 0; i < plugins.length; i++) {
595
      Object[] shape = getFinalShape(plugins[i]);
596
      filesPlugins[i] = new ZipFileSet(Utils.getPropertyFormat(PROPERTY_ECLIPSE_BASE) + '/' + DEFAULT_PLUGIN_LOCATION + '/' + (String) shape[0], shape[1] == FILE, null, null, null, null, null, Utils.getPropertyFormat(PROPERTY_PLUGIN_ARCHIVE_PREFIX) + '/' + (String) shape[0], null, null);
597
    }
598
    return filesPlugins;
599
  }
600
  
590
	protected FileSet[] generatePermissions(boolean zip) {
601
	protected FileSet[] generatePermissions(boolean zip) {
591
		String configInfix = configInfo.toString("."); //$NON-NLS-1$
602
		String configInfix = configInfo.toString("."); //$NON-NLS-1$
592
		String prefixPermissions = ROOT_PREFIX + configInfix + '.' + PERMISSIONS + '.';
603
		String prefixPermissions = ROOT_PREFIX + configInfix + '.' + PERMISSIONS + '.';
Lines 631-637 Link Here
631
		return (FileSet[]) fileSets.toArray(new FileSet[fileSets.size()]);
642
		return (FileSet[]) fileSets.toArray(new FileSet[fileSets.size()]);
632
	}
643
	}
633
644
634
	//TODO this code andn the generateAntZipTarget() should be refactored using a factory or something like that.
645
	//TODO this code and the generateAntZipTarget() should be refactored using a factory or something like that.
635
	private void generateAntTarTarget() {
646
	private void generateAntTarTarget() {
636
		FileSet[] filesPlugins = new FileSet[plugins.length];
647
		FileSet[] filesPlugins = new FileSet[plugins.length];
637
		for (int i = 0; i < plugins.length; i++) {
648
		for (int i = 0; i < plugins.length; i++) {
(-)src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java (-1 / +1 lines)
Lines 609-615 Link Here
609
	private void generateRefreshTarget() {
609
	private void generateRefreshTarget() {
610
		script.println();
610
		script.println();
611
		script.printTargetDeclaration(TARGET_REFRESH, TARGET_INIT, PROPERTY_ECLIPSE_RUNNING, null, Messages.build_plugin_refresh);
611
		script.printTargetDeclaration(TARGET_REFRESH, TARGET_INIT, PROPERTY_ECLIPSE_RUNNING, null, Messages.build_plugin_refresh);
612
		script.printConvertPathTask(new Path(getLocation(model)).removeLastSegments(0).toOSString().replace('\\', '/'), PROPERTY_RESOURCE_PATH, false);
612
    script.printConvertPathTask(Utils.getPropertyFormat(PROPERTY_BASEDIR), PROPERTY_RESOURCE_PATH, false);    
613
		script.printRefreshLocalTask(Utils.getPropertyFormat(PROPERTY_RESOURCE_PATH), "infinite"); //$NON-NLS-1$
613
		script.printRefreshLocalTask(Utils.getPropertyFormat(PROPERTY_RESOURCE_PATH), "infinite"); //$NON-NLS-1$
614
		script.printTargetEnd();
614
		script.printTargetEnd();
615
	}
615
	}
(-)src/org/eclipse/pde/internal/build/builder/FeatureBuildScriptGenerator.java (-1 / +1 lines)
Lines 1067-1073 Link Here
1067
	private void generateRefreshTarget() {
1067
	private void generateRefreshTarget() {
1068
		script.println();
1068
		script.println();
1069
		script.printTargetDeclaration(TARGET_REFRESH, TARGET_INIT, PROPERTY_ECLIPSE_RUNNING, null, NLS.bind(Messages.build_feature_refresh, featureIdentifier));
1069
		script.printTargetDeclaration(TARGET_REFRESH, TARGET_INIT, PROPERTY_ECLIPSE_RUNNING, null, NLS.bind(Messages.build_feature_refresh, featureIdentifier));
1070
		script.printConvertPathTask(new Path(featureRootLocation).removeLastSegments(0).toOSString().replace('\\', '/'), PROPERTY_RESOURCE_PATH, false);
1070
    script.printConvertPathTask(Utils.getPropertyFormat(PROPERTY_BASEDIR), PROPERTY_RESOURCE_PATH, false);    
1071
		script.printRefreshLocalTask(Utils.getPropertyFormat(PROPERTY_RESOURCE_PATH), "infinite"); //$NON-NLS-1$
1071
		script.printRefreshLocalTask(Utils.getPropertyFormat(PROPERTY_RESOURCE_PATH), "infinite"); //$NON-NLS-1$
1072
		Map params = new HashMap(2);
1072
		Map params = new HashMap(2);
1073
		params.put(PROPERTY_TARGET, TARGET_REFRESH);
1073
		params.put(PROPERTY_TARGET, TARGET_REFRESH);
(-)src/org/eclipse/pde/internal/build/packager/PackageScriptGenerator.java (-14 / +17 lines)
Lines 32-39 Link Here
32
	
32
	
33
	protected String getScriptName() {
33
	protected String getScriptName() {
34
		if (backwardCompatibleName)
34
		if (backwardCompatibleName)
35
			return "package" + '.' + DEFAULT_ASSEMBLE_ALL;
35
			return DEFAULT_PACKAGE_NAME + '.' + DEFAULT_ASSEMBLE_ALL;
36
		return "package" + '.' + (featureId.equals("") ? "" : featureId + '.') + DEFAULT_ASSEMBLE_ALL;
36
		return DEFAULT_PACKAGE_NAME + '.' + (featureId.equals("") ? "" : featureId + '.') + DEFAULT_ASSEMBLE_ALL; //$NON-NLS-1$ //$NON-NLS-2$
37
	}
37
	}
38
	
38
	
39
	public void setPropertyFile(String propertyFile) {
39
	public void setPropertyFile(String propertyFile) {
Lines 44-63 Link Here
44
		return new Collection[] {assemblageInformation.getBinaryPlugins(aConfig), assemblageInformation.getBinaryFeatures(aConfig), assemblageInformation.getFeatures(aConfig), new HashSet(0) };
44
		return new Collection[] {assemblageInformation.getBinaryPlugins(aConfig), assemblageInformation.getBinaryFeatures(aConfig), assemblageInformation.getFeatures(aConfig), new HashSet(0) };
45
	}
45
	}
46
	
46
	
47
	protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException {
47
  /**
48
		configScriptGenerator.initialize(directory, featureId, aConfig, binaryPlugins, binaryFeatures, allFeatures, rootFiles); 
48
   * {@inheritDoc}
49
		((PackageConfigScriptGenerator) configScriptGenerator).setPackagingPropertiesLocation(packagingPropertiesLocation);
49
   */
50
		configScriptGenerator.setArchiveFormat((String) archivesFormat.get(aConfig));
50
  protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException {
51
		configScriptGenerator.setGroupConfigs(groupConfigs);
51
    ((PackageConfigScriptGenerator) configScriptGenerator).setPackagingPropertiesLocation(packagingPropertiesLocation);
52
		setForceUpdateJar(forceUpdateJarFormat);
52
    setForceUpdateJar(forceUpdateJarFormat);
53
		configScriptGenerator.setBuildSiteFactory(siteFactory);
54
		configScriptGenerator.generate();
55
53
56
		Map params = new HashMap(1);
54
    super.basicGenerateAssembleConfigFileTargetCall(aConfig, binaryPlugins, binaryFeatures, allFeatures, rootFiles);
57
		params.put("assembleScriptName", configScriptGenerator.getTargetName() + ".xml");
55
  }
58
		script.printAntTask(Utils.getPropertyFormat(DEFAULT_CUSTOM_TARGETS), null, computeBackwardCompatibleName(aConfig), null, null, params);
59
	}
60
	
56
	
57
  /**
58
   * {@inheritDoc}
59
   */
60
  protected String getTargetScriptName(Config aConfig) {
61
    return computeBackwardCompatibleName(aConfig);
62
  }
63
  
61
	public void setBackwardCompatibleName(boolean value) {
64
	public void setBackwardCompatibleName(boolean value) {
62
		backwardCompatibleName = value;
65
		backwardCompatibleName = value;
63
	}
66
	}
(-)src/org/eclipse/pde/internal/build/packager/PackagerGenerator.java (-17 / +23 lines)
Lines 11-18 Link Here
11
package org.eclipse.pde.internal.build.packager;
11
package org.eclipse.pde.internal.build.packager;
12
12
13
import java.util.List;
13
import java.util.List;
14
import org.eclipse.core.runtime.CoreException;
14
15
import org.eclipse.pde.internal.build.*;
15
import org.eclipse.pde.internal.build.AssemblyInformation;
16
import org.eclipse.pde.internal.build.BuildScriptGenerator;
16
import org.eclipse.pde.internal.build.BuildScriptGenerator;
17
import org.eclipse.pde.internal.build.Utils;
17
import org.eclipse.pde.internal.build.Utils;
18
import org.eclipse.pde.internal.build.site.BuildTimeSiteFactory;
18
import org.eclipse.pde.internal.build.site.BuildTimeSiteFactory;
Lines 39-59 Link Here
39
			}
39
			}
40
	}
40
	}
41
	
41
	
42
	protected void generatePackageScripts(AssemblyInformation assemblageInformation, String[] featureInfo, BuildTimeSiteFactory factory) throws CoreException {
42
  /**
43
		PackageScriptGenerator assembler = null;
43
   * {@inheritDoc}
44
		if (groupConfigs)
44
   */
45
			assembler = new DeltaPackScriptGenerator(workingDirectory, assemblageInformation, featureInfo[0]);
45
  protected PackageScriptGenerator createPackageScriptGenerator(String directory, AssemblyInformation assemblageInformation, String featureId) {
46
		else 
46
    if (groupConfigs) {
47
			assembler = new PackageScriptGenerator(workingDirectory, assemblageInformation, featureInfo[0]);
47
      return new DeltaPackScriptGenerator(workingDirectory, assemblageInformation, featureId);
48
		
48
    }
49
		assembler.setSignJars(signJars);
49
    return new PackageScriptGenerator(workingDirectory, assemblageInformation, featureId);
50
		assembler.setGenerateJnlp(generateJnlp);
50
  }
51
		assembler.setArchivesFormat(getArchivesFormat());
51
52
		assembler.setPropertyFile(propertyFile);
52
  /**
53
		assembler.setBackwardCompatibleName(true);
53
   * {@inheritDoc}
54
		assembler.setBuildSiteFactory(factory);
54
   */
55
		assembler.generate();
55
  protected void initialisePackageScriptGenerator(PackageScriptGenerator generator, BuildTimeSiteFactory factory) {
56
	}
56
    generator.setSignJars(signJars);
57
    generator.setGenerateJnlp(generateJnlp);
58
    generator.setArchivesFormat(getArchivesFormat());
59
    generator.setPropertyFile(propertyFile);
60
    generator.setBackwardCompatibleName(true);
61
    generator.setBuildSiteFactory(factory);
62
  }
57
	
63
	
58
	public void setPropertyFile(String propertyFile) {
64
	public void setPropertyFile(String propertyFile) {
59
		this.propertyFile = propertyFile;
65
		this.propertyFile = propertyFile;
(-)src/org/eclipse/pde/internal/build/packager/DeltaPackScriptGenerator.java (-2 / +2 lines)
Lines 18-29 Link Here
18
import org.eclipse.pde.internal.build.Config;
18
import org.eclipse.pde.internal.build.Config;
19
19
20
public class DeltaPackScriptGenerator extends PackageScriptGenerator {
20
public class DeltaPackScriptGenerator extends PackageScriptGenerator {
21
	public DeltaPackScriptGenerator(String directory, AssemblyInformation assemblageInformation, String featureId) throws CoreException {
21
	public DeltaPackScriptGenerator(String directory, AssemblyInformation assemblageInformation, String featureId) {
22
		super(directory, assemblageInformation, featureId);
22
		super(directory, assemblageInformation, featureId);
23
		groupConfigs = true;
23
		groupConfigs = true;
24
	}
24
	}
25
25
26
	protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException {
26
	protected void basicGenerateAssembleConfigFileTargetCall(Config aConfig, Collection binaryPlugins, Collection binaryFeatures, Collection allFeatures, Collection rootFiles) throws CoreException {
27
		super.basicGenerateAssembleConfigFileTargetCall(new Config("delta", "delta", "delta"), binaryPlugins, binaryFeatures, allFeatures, rootFiles);
27
		super.basicGenerateAssembleConfigFileTargetCall(new Config("delta", "delta", "delta"), binaryPlugins, binaryFeatures, allFeatures, rootFiles); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
28
	}
28
	}
29
}
29
}
(-)META-INF/MANIFEST.MF (-7 / +7 lines)
Lines 13-25 Link Here
13
 org.eclipse.core.runtime.compatibility;bundle-version="[3.1.100,4.0.0)";resolution:=optional
13
 org.eclipse.core.runtime.compatibility;bundle-version="[3.1.100,4.0.0)";resolution:=optional
14
Export-Package: 
14
Export-Package: 
15
 org.eclipse.pde.build,
15
 org.eclipse.pde.build,
16
 org.eclipse.pde.internal.build;x-friends:="org.eclipse.pde.core,org.eclipse.pde.ui",
16
 org.eclipse.pde.internal.build;x-friends:="org.eclipse.pde.core,org.eclipse.pde.ui,org.eclipse.pde.build.test",
17
 org.eclipse.pde.internal.build.ant;x-internal:=true,
17
 org.eclipse.pde.internal.build.ant;x-friends:="org.eclipse.pde.build.test",
18
 org.eclipse.pde.internal.build.builder;x-internal:=true,
18
 org.eclipse.pde.internal.build.builder;x-friends:="org.eclipse.pde.build.test",
19
 org.eclipse.pde.internal.build.fetch;x-internal:=true,
19
 org.eclipse.pde.internal.build.fetch;x-friends:="org.eclipse.pde.build.test",
20
 org.eclipse.pde.internal.build.packager;x-internal:=true,
20
 org.eclipse.pde.internal.build.packager;x-friends:="org.eclipse.pde.build.test",
21
 org.eclipse.pde.internal.build.properties;x-internal:=true,
21
 org.eclipse.pde.internal.build.properties;x-friends:="org.eclipse.pde.build.test",
22
 org.eclipse.pde.internal.build.site;x-internal:=true
22
 org.eclipse.pde.internal.build.site;x-friends:="org.eclipse.pde.build.test"
23
Import-Package: com.ibm.icu.util
23
Import-Package: com.ibm.icu.util
24
Bundle-Localization: plugin
24
Bundle-Localization: plugin
25
Eclipse-LazyStart: true
25
Eclipse-LazyStart: true
(-)scripts/productBuild/productBuild.xml (+2 lines)
Lines 42-47 Link Here
42
		verify="${verify}"
42
		verify="${verify}"
43
		pluginPath="${pluginPath}"
43
		pluginPath="${pluginPath}"
44
		configInfo="${configs}"
44
		configInfo="${configs}"
45
    pluginList="${pluginList}"
46
    featureList="${featureList}"		
45
	/>
47
	/>
46
</target>
48
</target>
47
49

Return to bug 178717