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

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/build/BuildScriptGenerator.java (-3 / +3 lines)
Lines 89-95 Link Here
89
	// the default id is a generic feature name as uber source features have no inherent 
89
	// the default id is a generic feature name as uber source features have no inherent 
90
	// semantics or scope.
90
	// semantics or scope.
91
	private String sourceBundleTemplateFeature = "org.eclipse.pde.build.uber.feature"; //$NON-NLS-1$
91
	private String sourceBundleTemplateFeature = "org.eclipse.pde.build.uber.feature"; //$NON-NLS-1$
92
	private String sourceBundleFeatureId = null;  //default is sourceBundleTemplateFeature + ".source"
92
	private String sourceBundleFeatureId = null; //default is sourceBundleTemplateFeature + ".source"
93
93
94
	// the default version is simply time-based as uber source features have no inherent 
94
	// the default version is simply time-based as uber source features have no inherent 
95
	// semantics or scope.
95
	// semantics or scope.
Lines 164-170 Link Here
164
				String[] modelInfo = getNameAndVersion((String) iterator.next());
164
				String[] modelInfo = getNameAndVersion((String) iterator.next());
165
				generator.setBuildSiteFactory(siteFactory);
165
				generator.setBuildSiteFactory(siteFactory);
166
				generator.setModelId(modelInfo[0], modelInfo[1]);
166
				generator.setModelId(modelInfo[0], modelInfo[1]);
167
167
				generator.setFeatureGenerator(new BuildDirector());
168
				generator.setPluginPath(pluginPath);
168
				generator.setPluginPath(pluginPath);
169
				generator.setDevEntries(devEntries);
169
				generator.setDevEntries(devEntries);
170
				generator.setCompiledElements(generator.getCompiledElements());
170
				generator.setCompiledElements(generator.getCompiledElements());
Lines 181-187 Link Here
181
					//Filtering is not required here, since we are only generating the build for a plugin or a fragment
181
					//Filtering is not required here, since we are only generating the build for a plugin or a fragment
182
					generator.setBuildSiteFactory(siteFactory);
182
					generator.setBuildSiteFactory(siteFactory);
183
					generator.setModel(bundlesToBuild[i]);
183
					generator.setModel(bundlesToBuild[i]);
184
184
					generator.setFeatureGenerator(new BuildDirector());
185
					generator.setPluginPath(pluginPath);
185
					generator.setPluginPath(pluginPath);
186
					generator.setDevEntries(devEntries);
186
					generator.setDevEntries(devEntries);
187
					generator.setCompiledElements(generator.getCompiledElements());
187
					generator.setCompiledElements(generator.getCompiledElements());
(-)src/org/eclipse/pde/internal/build/IXMLConstants.java (+1 lines)
Lines 50-55 Link Here
50
	public static final String TARGET_ASSEMBLE_ARCHIVE_CONDITION = "assemble.archive.condition"; //$NON-NLS-1$
50
	public static final String TARGET_ASSEMBLE_ARCHIVE_CONDITION = "assemble.archive.condition"; //$NON-NLS-1$
51
	public static final String TARGET_CLEANUP_ASSEMBLY = "cleanup.assembly"; //$NON-NLS-1$
51
	public static final String TARGET_CLEANUP_ASSEMBLY = "cleanup.assembly"; //$NON-NLS-1$
52
	public static final String TARGET_COPY_SRC_INCLUDES = "copy.src.includes"; //$NON-NLS-1$
52
	public static final String TARGET_COPY_SRC_INCLUDES = "copy.src.includes"; //$NON-NLS-1$
53
	public static final String TARGET_NESTED_JARS = ".nestedJars"; //$NON-NLS-1$
53
	public static final String TARGET_INIT = "init"; //$NON-NLS-1$
54
	public static final String TARGET_INIT = "init"; //$NON-NLS-1$
54
	public static final String TARGET_MAIN = "main"; //$NON-NLS-1$
55
	public static final String TARGET_MAIN = "main"; //$NON-NLS-1$
55
	public static final String TARGET_GZIP_RESULTS = "gzipResults"; //$NON-NLS-1$
56
	public static final String TARGET_GZIP_RESULTS = "gzipResults"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/build/ant/AntScript.java (+22 lines)
Lines 378-383 Link Here
378
		}
378
		}
379
	}
379
	}
380
380
381
	public void printUnzipTask(String zipFile, String destDir, boolean overWrite, String includePatterns, String excludePatterns) {
382
		printTab();
383
		output.print("<unzip"); //$NON-NLS-1$
384
		printAttribute("src", zipFile, true); //$NON-NLS-1$
385
		printAttribute("dest", destDir, true); //$NON-NLS-1$
386
		printAttribute("overwrite", Boolean.toString(overWrite), true); //$NON-NLS-1$
387
		if (includePatterns == null && excludePatterns == null) {
388
			output.println("/>"); //$NON-NLS-1$
389
		} else {
390
			output.println(">"); //$NON-NLS-1$
391
			indent++;
392
			printTab();
393
			output.print("<patternset "); //$NON-NLS-1$
394
			printAttribute("includes", includePatterns, false); //$NON-NLS-1$
395
			printAttribute("excludes", excludePatterns, false); //$NON-NLS-1$
396
			output.println("/>"); //$NON-NLS-1$
397
			indent--;
398
			printTab();
399
			output.println("</unzip>"); //$NON-NLS-1$
400
		}
401
	}
402
381
	public void printTarTask(String zipfile, String basedir, boolean filesOnly, boolean update, FileSet[] fileSets) {
403
	public void printTarTask(String zipfile, String basedir, boolean filesOnly, boolean update, FileSet[] fileSets) {
382
		printTab();
404
		printTab();
383
		output.print("<tar"); //$NON-NLS-1$
405
		output.print("<tar"); //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/build/builder/BuildDirector.java (+26 lines)
Lines 10-20 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.build.builder;
11
package org.eclipse.pde.internal.build.builder;
12
12
13
import java.io.File;
13
import java.util.*;
14
import java.util.*;
14
import org.eclipse.core.runtime.*;
15
import org.eclipse.core.runtime.*;
15
import org.eclipse.osgi.service.resolver.BundleDescription;
16
import org.eclipse.osgi.service.resolver.BundleDescription;
16
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.osgi.util.NLS;
17
import org.eclipse.pde.internal.build.*;
18
import org.eclipse.pde.internal.build.*;
19
import org.eclipse.pde.internal.build.builder.ClasspathComputer3_0.ClasspathElement;
18
import org.eclipse.pde.internal.build.site.BuildTimeFeature;
20
import org.eclipse.pde.internal.build.site.BuildTimeFeature;
19
import org.eclipse.pde.internal.build.site.compatibility.Feature;
21
import org.eclipse.pde.internal.build.site.compatibility.Feature;
20
import org.eclipse.pde.internal.build.site.compatibility.FeatureEntry;
22
import org.eclipse.pde.internal.build.site.compatibility.FeatureEntry;
Lines 78-83 Link Here
78
		this.assemblyData = assemblageInformation;
80
		this.assemblyData = assemblageInformation;
79
	}
81
	}
80
82
83
	private final Map extractedLocations = new HashMap();
84
85
	public String getExtractedRoot(ClasspathElement element) {
86
		if (element.getSubPath() == null)
87
			return element.getPath();
88
89
		String absolute = element.getAbsolutePath();
90
		if (extractedLocations.containsKey(absolute)) {
91
			return (String) extractedLocations.get(absolute);
92
		}
93
94
		//Use the jar name, append a suffix if that name is already taken
95
		String name = new File(absolute).getName();
96
		if (name.endsWith(".jar")) //$NON-NLS-1$
97
			name = name.substring(0, name.length() - 4);
98
		String destination = name;
99
		while (extractedLocations.containsValue(destination)) {
100
			destination = name + '_' + Integer.toHexString(destination.hashCode());
101
		}
102
103
		extractedLocations.put(absolute, destination);
104
		return destination;
105
	}
106
81
	/**
107
	/**
82
	 * Returns a list of BundleDescription objects representing the elements delivered by the feature. 
108
	 * Returns a list of BundleDescription objects representing the elements delivered by the feature. 
83
	 *  
109
	 *  
(-)src/org/eclipse/pde/internal/build/builder/ClasspathComputer3_0.java (-38 / +58 lines)
Lines 25-32 Link Here
25
import org.osgi.framework.Filter;
25
import org.osgi.framework.Filter;
26
26
27
public class ClasspathComputer3_0 implements IClasspathComputer, IPDEBuildConstants, IXMLConstants, IBuildPropertiesConstants {
27
public class ClasspathComputer3_0 implements IClasspathComputer, IPDEBuildConstants, IXMLConstants, IBuildPropertiesConstants {
28
	public static class ClasspathElement {
28
	public class ClasspathElement {
29
		private final String path;
29
		private final String path;
30
		private final String subPath;
30
		private String accessRules;
31
		private String accessRules;
31
32
32
		/**
33
		/**
Lines 35-42 Link Here
35
		 * @param accessRules
36
		 * @param accessRules
36
		 * @throws NullPointerException if path is null
37
		 * @throws NullPointerException if path is null
37
		 */
38
		 */
38
		public ClasspathElement(String path, String accessRules) {
39
		protected ClasspathElement(String path, String subPath, String accessRules) {
40
			if (path == null)
41
				throw new NullPointerException();
39
			this.path = path;
42
			this.path = path;
43
			this.subPath = subPath;
40
			this.accessRules = accessRules;
44
			this.accessRules = accessRules;
41
		}
45
		}
42
46
Lines 48-57 Link Here
48
			return path;
52
			return path;
49
		}
53
		}
50
54
55
		public String getSubPath() {
56
			return subPath;
57
		}
58
51
		public String getAccessRules() {
59
		public String getAccessRules() {
52
			return accessRules;
60
			return accessRules;
53
		}
61
		}
54
62
63
		public String getAbsolutePath() {
64
			if (new File(path).isAbsolute())
65
				return path;
66
67
			return modelLocation + '/' + path;
68
		}
69
55
		public void addRules(String newRule) {
70
		public void addRules(String newRule) {
56
			if (accessRules.equals("") || accessRules.equals(newRule)) //$NON-NLS-1$
71
			if (accessRules.equals("") || accessRules.equals(newRule)) //$NON-NLS-1$
57
				return;
72
				return;
Lines 70-88 Link Here
70
		public boolean equals(Object obj) {
85
		public boolean equals(Object obj) {
71
			if (obj instanceof ClasspathElement) {
86
			if (obj instanceof ClasspathElement) {
72
				ClasspathElement element = (ClasspathElement) obj;
87
				ClasspathElement element = (ClasspathElement) obj;
73
				return (path != null && path.equals(element.getPath()));
88
				if (!path.equals(element.getPath()))
89
					return false;
90
				if (subPath != null && subPath.equals(element.getSubPath()))
91
					return false;
92
				return true;
74
			}
93
			}
75
			return false;
94
			return false;
76
		}
95
		}
77
96
78
		public int hashCode() {
97
		public int hashCode() {
79
			return path.hashCode();
98
			int result = path.hashCode();
99
			return 13 * result + ((subPath == null) ? 0 : subPath.hashCode());
80
		}
100
		}
81
101
82
		public static String normalize(String path) {
83
			//always use '/' as a path separator to help with comparing paths in equals
84
			return path.replaceAll("\\\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
85
		}
86
	}
102
	}
87
103
88
	private static final String EXCLUDE_ALL_RULE = "?**/*"; //$NON-NLS-1$
104
	private static final String EXCLUDE_ALL_RULE = "?**/*"; //$NON-NLS-1$
Lines 92-97 Link Here
92
	private Map pathElements = null;
108
	private Map pathElements = null;
93
	private boolean allowBinaryCycles = false;
109
	private boolean allowBinaryCycles = false;
94
	private Set requiredIds = null;
110
	private Set requiredIds = null;
111
	protected String modelLocation = null;
95
112
96
	public ClasspathComputer3_0(ModelBuildScriptGenerator modelGenerator) {
113
	public ClasspathComputer3_0(ModelBuildScriptGenerator modelGenerator) {
97
		this.generator = modelGenerator;
114
		this.generator = modelGenerator;
Lines 109-115 Link Here
109
	public List getClasspath(BundleDescription model, ModelBuildScriptGenerator.CompiledEntry jar) throws CoreException {
126
	public List getClasspath(BundleDescription model, ModelBuildScriptGenerator.CompiledEntry jar) throws CoreException {
110
		List classpath = new ArrayList(20);
127
		List classpath = new ArrayList(20);
111
		List pluginChain = new ArrayList(10); //The list of plugins added to detect cycle
128
		List pluginChain = new ArrayList(10); //The list of plugins added to detect cycle
112
		String location = generator.getLocation(model);
129
		modelLocation = generator.getLocation(model);
113
		Set addedPlugins = new HashSet(10); //The set of all the plugins already added to the classpath (this allows for optimization)
130
		Set addedPlugins = new HashSet(10); //The set of all the plugins already added to the classpath (this allows for optimization)
114
		pathElements = new HashMap();
131
		pathElements = new HashMap();
115
		visiblePackages = getVisiblePackages(model);
132
		visiblePackages = getVisiblePackages(model);
Lines 117-126 Link Here
117
		allowBinaryCycles = AbstractScriptGenerator.getPropertyAsBoolean(IBuildPropertiesConstants.PROPERTY_ALLOW_BINARY_CYCLES);
134
		allowBinaryCycles = AbstractScriptGenerator.getPropertyAsBoolean(IBuildPropertiesConstants.PROPERTY_ALLOW_BINARY_CYCLES);
118
135
119
		//PREREQUISITE
136
		//PREREQUISITE
120
		addPrerequisites(model, classpath, location, pluginChain, addedPlugins);
137
		addPrerequisites(model, classpath, modelLocation, pluginChain, addedPlugins);
121
138
122
		//SELF
139
		//SELF
123
		addSelf(model, jar, classpath, location, pluginChain, addedPlugins);
140
		addSelf(model, jar, classpath, modelLocation, pluginChain, addedPlugins);
124
141
125
		recordRequiredIds(model);
142
		recordRequiredIds(model);
126
143
Lines 327-340 Link Here
327
		}
344
		}
328
345
329
		String path = null;
346
		String path = null;
330
		if ("jar".equalsIgnoreCase(basePath.getFileExtension())) { //$NON-NLS-1$
347
		String subPath = null;
348
		Path libraryPath = new Path(libraryName);
349
		if (libraryPath.isAbsolute()) {
350
			path = libraryPath.toOSString();
351
		} else if ("jar".equalsIgnoreCase(basePath.getFileExtension())) { //$NON-NLS-1$
352
			if ("jar".equalsIgnoreCase(libraryPath.getFileExtension())) //$NON-NLS-1$
353
				subPath = libraryPath.toOSString();
331
			path = basePath.toOSString();
354
			path = basePath.toOSString();
332
		} else {
355
		} else {
333
			Path libraryPath = new Path(libraryName);
356
			path = basePath.append(libraryPath).toOSString();
334
			if (libraryPath.isAbsolute())
335
				path = libraryPath.toOSString();
336
			else
337
				path = basePath.append(libraryPath).toOSString();
338
		}
357
		}
339
		path = ModelBuildScriptGenerator.replaceVariables(path, pluginKey == null ? false : generator.getCompiledElements().contains(pluginKey));
358
		path = ModelBuildScriptGenerator.replaceVariables(path, pluginKey == null ? false : generator.getCompiledElements().contains(pluginKey));
340
		String secondaryPath = null;
359
		String secondaryPath = null;
Lines 345-365 Link Here
345
364
346
		}
365
		}
347
366
348
		addClasspathElementWithRule(classpath, path, rules);
367
		addClasspathElementWithRule(classpath, path, subPath, rules);
349
		if (secondaryPath != null) {
368
		if (secondaryPath != null) {
350
			addClasspathElementWithRule(classpath, secondaryPath, rules);
369
			addClasspathElementWithRule(classpath, secondaryPath, null, rules);
351
		}
370
		}
352
	}
371
	}
353
372
354
	private void addClasspathElementWithRule(List classpath, String path, String rules) {
373
	private void addClasspathElementWithRule(List classpath, String path, String subPath, String rules) {
355
		String normalizedPath = ClasspathElement.normalize(path);
374
		String elementsKey = subPath != null ? path + '/' + subPath : path;
356
		ClasspathElement existing = (ClasspathElement) pathElements.get(normalizedPath);
375
		ClasspathElement existing = (ClasspathElement) pathElements.get(elementsKey);
357
		if (existing != null) {
376
		if (existing != null) {
358
			existing.addRules(rules);
377
			existing.addRules(rules);
359
		} else {
378
		} else {
360
			ClasspathElement element = new ClasspathElement(normalizedPath, rules);
379
			ClasspathElement element = new ClasspathElement(path, subPath, rules);
361
			classpath.add(element);
380
			classpath.add(element);
362
			pathElements.put(normalizedPath, element);
381
			pathElements.put(elementsKey, element);
363
		}
382
		}
364
	}
383
	}
365
384
Lines 424-432 Link Here
424
			for (int i = 0; i < extra.length; i++) {
443
			for (int i = 0; i < extra.length; i++) {
425
				//Potential pb: if the path refers to something that is being compiled (which is supposetly not the case, but who knows...)
444
				//Potential pb: if the path refers to something that is being compiled (which is supposetly not the case, but who knows...)
426
				//the user will get $basexx instead of $ws 
445
				//the user will get $basexx instead of $ws 
427
				String toAdd = computeExtraPath(extra[i], classpath, location);
446
				String[] toAdd = computeExtraPath(extra[i], classpath, location);
428
				if (toAdd != null)
447
				if (toAdd != null && toAdd.length == 2)
429
					addPathAndCheck(null, new Path(toAdd), "", modelProperties, classpath); //$NON-NLS-1$
448
					addPathAndCheck(null, new Path(toAdd[0]), toAdd[1], modelProperties, classpath);
430
			}
449
			}
431
		}
450
		}
432
451
Lines 435-443 Link Here
435
		for (int i = 0; i < jarSpecificExtraClasspath.length; i++) {
454
		for (int i = 0; i < jarSpecificExtraClasspath.length; i++) {
436
			//Potential pb: if the path refers to something that is being compiled (which is supposetly not the case, but who knows...)
455
			//Potential pb: if the path refers to something that is being compiled (which is supposetly not the case, but who knows...)
437
			//the user will get $basexx instead of $ws 
456
			//the user will get $basexx instead of $ws 
438
			String toAdd = computeExtraPath(jarSpecificExtraClasspath[i], classpath, location);
457
			String[] toAdd = computeExtraPath(jarSpecificExtraClasspath[i], classpath, location);
439
			if (toAdd != null)
458
			if (toAdd != null && toAdd.length == 2)
440
				addPathAndCheck(null, new Path(toAdd), "", modelProperties, classpath); //$NON-NLS-1$
459
				addPathAndCheck(null, new Path(toAdd[0]), toAdd[1], modelProperties, classpath);
441
		}
460
		}
442
	}
461
	}
443
462
Lines 448-461 Link Here
448
	 * @return String the relative path 
467
	 * @return String the relative path 
449
	 * @throws CoreException
468
	 * @throws CoreException
450
	 */
469
	 */
451
	private String computeExtraPath(String url, List classpath, String location) throws CoreException {
470
	private String[] computeExtraPath(String url, List classpath, String location) throws CoreException {
452
		String relativePath = null;
471
		String relativePath = null;
453
472
454
		String[] urlfragments = Utils.getArrayFromString(url, "/"); //$NON-NLS-1$
473
		String[] urlfragments = Utils.getArrayFromString(url, "/"); //$NON-NLS-1$
455
474
456
		// A valid platform url for a plugin has a leat 3 segments.
475
		// A valid platform url for a plugin has a leat 3 segments.
457
		if (urlfragments.length > 2 && urlfragments[0].equals(PlatformURLHandler.PROTOCOL + PlatformURLHandler.PROTOCOL_SEPARATOR)) {
476
		if (urlfragments.length > 2 && urlfragments[0].equals(PlatformURLHandler.PROTOCOL + PlatformURLHandler.PROTOCOL_SEPARATOR)) {
458
			String modelLocation = null;
477
			String bundleLocation = null;
459
			BundleDescription bundle = null;
478
			BundleDescription bundle = null;
460
			if (urlfragments[1].equalsIgnoreCase(PLUGIN) || urlfragments[1].equalsIgnoreCase(FRAGMENT)) {
479
			if (urlfragments[1].equalsIgnoreCase(PLUGIN) || urlfragments[1].equalsIgnoreCase(FRAGMENT)) {
461
				bundle = generator.getSite(false).getRegistry().getResolvedBundle(urlfragments[2]);
480
				bundle = generator.getSite(false).getRegistry().getResolvedBundle(urlfragments[2]);
Lines 472-483 Link Here
472
					return null;
491
					return null;
473
				}
492
				}
474
493
475
				modelLocation = generator.getLocation(bundle);
494
				bundleLocation = generator.getLocation(bundle);
476
				if (modelLocation != null) {
495
				if (bundleLocation != null) {
477
					for (int i = 3; i < urlfragments.length; i++) {
496
					String entry = urlfragments[3];
478
						modelLocation += '/' + urlfragments[i];
497
					for (int i = 4; i < urlfragments.length; i++) {
498
						entry += '/' + urlfragments[i];
479
					}
499
					}
480
					return Utils.makeRelative(new Path(modelLocation), new Path(location)).toOSString();
500
					return new String[] {Utils.makeRelative(new Path(bundleLocation), new Path(location)).toOSString(), entry};
481
				}
501
				}
482
			} else if (urlfragments[1].equalsIgnoreCase("resource")) { //$NON-NLS-1$
502
			} else if (urlfragments[1].equalsIgnoreCase("resource")) { //$NON-NLS-1$
483
				String message = NLS.bind(Messages.exception_url, generator.getModel().getSymbolicName() + '/' + generator.getPropertiesFileName() + ": " + url); //$NON-NLS-1$
503
				String message = NLS.bind(Messages.exception_url, generator.getModel().getSymbolicName() + '/' + generator.getPropertiesFileName() + ": " + url); //$NON-NLS-1$
Lines 500-506 Link Here
500
			//		String message = Policy.bind("exception.url", PROPERTIES_FILE + "::"+url); //$NON-NLS-1$  //$NON-NLS-2$
520
			//		String message = Policy.bind("exception.url", PROPERTIES_FILE + "::"+url); //$NON-NLS-1$  //$NON-NLS-2$
501
			//		throw new CoreException(new Status(IStatus.ERROR,PI_PDEBUILD, IPDEBuildConstants.EXCEPTION_MALFORMED_URL, message,e));
521
			//		throw new CoreException(new Status(IStatus.ERROR,PI_PDEBUILD, IPDEBuildConstants.EXCEPTION_MALFORMED_URL, message,e));
502
		}
522
		}
503
		return relativePath;
523
		return new String[] {relativePath, ""}; //$NON-NLS-1$
504
	}
524
	}
505
525
506
	//Add the prerequisite of a given plugin (target)
526
	//Add the prerequisite of a given plugin (target)
(-)src/org/eclipse/pde/internal/build/builder/ModelBuildScriptGenerator.java (-4 / +47 lines)
Lines 1433-1440 Link Here
1433
					if (classpath.size() > 0 && classpath.get(0) instanceof ClasspathElement) {
1433
					if (classpath.size() > 0 && classpath.get(0) instanceof ClasspathElement) {
1434
						for (Iterator iterator = classpath.iterator(); iterator.hasNext();) {
1434
						for (Iterator iterator = classpath.iterator(); iterator.hasNext();) {
1435
							ClasspathElement element = (ClasspathElement) iterator.next();
1435
							ClasspathElement element = (ClasspathElement) iterator.next();
1436
							if (element.getPath() != null && element.getPath().length() > 0 && element.getAccessRules().length() > 0) {
1436
							if (element.getPath() != null && element.getAccessRules().length() > 0) {
1437
								String path = element.getPath();
1437
								String path = null;
1438
								if (element.getSubPath() == null)
1439
									path = element.getPath();
1440
								else
1441
									path = featureGenerator.getExtractedRoot(element) + '/' + element.getSubPath();
1442
1438
								if (path.startsWith(Utils.getPropertyFormat(PROPERTY_BUILD_RESULT_FOLDER))) {
1443
								if (path.startsWith(Utils.getPropertyFormat(PROPERTY_BUILD_RESULT_FOLDER))) {
1439
									//remove leading ${build.result.folder}/
1444
									//remove leading ${build.result.folder}/
1440
									path = path.substring(Utils.getPropertyFormat(PROPERTY_BUILD_RESULT_FOLDER).length() + 1);
1445
									path = path.substring(Utils.getPropertyFormat(PROPERTY_BUILD_RESULT_FOLDER).length() + 1);
Lines 1460-1465 Link Here
1460
	}
1465
	}
1461
1466
1462
	/**
1467
	/**
1468
	 * Add a target to extract any nested jars we need to compile against
1469
	 * @param classpath
1470
	 * @param entry
1471
	 * @return a new classpath list containing the extracted locations
1472
	 */
1473
	private List generateExtractNestedJars(List classpath, CompiledEntry entry) {
1474
		script.printTargetDeclaration(entry.getName(false) + TARGET_NESTED_JARS, null, null, null, null);
1475
1476
		if (classpath == null || classpath.size() == 0 || !(classpath.get(0) instanceof ClasspathElement)) {
1477
			script.printTargetEnd();
1478
			return classpath;
1479
		}
1480
1481
		List extracted = new ArrayList(classpath.size());
1482
		for (Iterator iterator = classpath.iterator(); iterator.hasNext();) {
1483
			ClasspathElement element = (ClasspathElement) iterator.next();
1484
1485
			if (element.getSubPath() == null)
1486
				extracted.add(element);
1487
			else {
1488
				String destPath = featureGenerator.getExtractedRoot(element);
1489
				String destDir = Utils.getPropertyFormat(PROPERTY_BUILD_DIRECTORY) + '/' + "nestedJars" + '/' + destPath.toString(); //$NON-NLS-1$
1490
				script.printMkdirTask(destDir);
1491
				script.printUnzipTask(element.getPath(), destDir, false, element.getSubPath(), null);
1492
				extracted.add(destDir + '/' + element.getSubPath());
1493
			}
1494
		}
1495
		script.printTargetEnd();
1496
1497
		return extracted;
1498
	}
1499
1500
	/**
1463
	 * Add the "jar" target to the given Ant script using the given classpath and
1501
	 * Add the "jar" target to the given Ant script using the given classpath and
1464
	 * jar as parameters.
1502
	 * jar as parameters.
1465
	 * 
1503
	 * 
Lines 1469-1479 Link Here
1469
	private void generateCompilationTarget(List classpath, CompiledEntry entry) {
1507
	private void generateCompilationTarget(List classpath, CompiledEntry entry) {
1470
		script.println();
1508
		script.println();
1471
		String name = entry.getName(false);
1509
		String name = entry.getName(false);
1472
		script.printTargetDeclaration(name, TARGET_INIT, null, entry.getName(true), NLS.bind(Messages.build_plugin_jar, model.getSymbolicName() + ' ' + name));
1510
1511
		//extract nested jars and update the classpath with the new locations
1512
		List extractedPath = generateExtractNestedJars(classpath, entry);
1513
1514
		String depends = TARGET_INIT + "," + name + TARGET_NESTED_JARS; //$NON-NLS-1$
1515
		script.printTargetDeclaration(name, depends, null, entry.getName(true), NLS.bind(Messages.build_plugin_jar, model.getSymbolicName() + ' ' + name));
1473
		String destdir = (entry.getType() == CompiledEntry.FOLDER) ? getJARLocation(entry.getName(true)) : getTempJARFolderLocation(entry.getName(true));
1516
		String destdir = (entry.getType() == CompiledEntry.FOLDER) ? getJARLocation(entry.getName(true)) : getTempJARFolderLocation(entry.getName(true));
1474
		script.printDeleteTask(destdir, null, null);
1517
		script.printDeleteTask(destdir, null, null);
1475
		script.printMkdirTask(destdir);
1518
		script.printMkdirTask(destdir);
1476
		script.printPathStructure("path", name + PROPERTY_CLASSPATH, classpath); //$NON-NLS-1$
1519
		script.printPathStructure("path", name + PROPERTY_CLASSPATH, extractedPath); //$NON-NLS-1$
1477
1520
1478
		String[] sources = entry.getSource();
1521
		String[] sources = entry.getSource();
1479
		Map params = null, references = null;
1522
		Map params = null, references = null;

Return to bug 157375