Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 34508 Details for
Bug 107272
Allow product configurations to be built by Ant scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
revised patch
107272.txt (text/plain), 39.85 KB, created by
Andrew Niefer
on 2006-02-10 14:16:44 EST
(
hide
)
Description:
revised patch
Filename:
MIME Type:
Creator:
Andrew Niefer
Created:
2006-02-10 14:16:44 EST
Size:
39.85 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.build >Index: src/org/eclipse/pde/internal/build/IPDEBuildConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/IPDEBuildConstants.java,v >retrieving revision 1.32 >diff -u -r1.32 IPDEBuildConstants.java >--- src/org/eclipse/pde/internal/build/IPDEBuildConstants.java 8 Feb 2006 14:20:19 -0000 1.32 >+++ src/org/eclipse/pde/internal/build/IPDEBuildConstants.java 10 Feb 2006 19:16:39 -0000 >@@ -101,6 +101,7 @@ > public final static int WARNING_MISSING_SOURCE = 20; > public final static int WARNING_ELEMENT_NOT_FETCHED = 21; > public final static int EXCEPTION_CONFIG_FORMAT = 22; >+ public final static int EXCEPTION_PRODUCT_FORMAT = 23; > > //User object keys. BundleDescription.getUserObject() > public final static String IS_COMPILED = "isCompiler"; //$NON-NLS-1$ >Index: src/org/eclipse/pde/internal/build/ProductGenerator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ProductGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 ProductGenerator.java >--- src/org/eclipse/pde/internal/build/ProductGenerator.java 1 Feb 2006 18:34:14 -0000 1.1 >+++ src/org/eclipse/pde/internal/build/ProductGenerator.java 10 Feb 2006 19:16:39 -0000 >@@ -77,7 +77,7 @@ > refactoredRuntime = state.getResolvedBundle(BUNDLE_EQUINOX_COMMON) != null; > } > >- private void loadProduct() { >+ private void loadProduct() throws CoreException { > if (product == null || product.startsWith("${")) { //$NON-NLS-1$ > productFile = null; > return; >@@ -171,6 +171,10 @@ > for (Iterator iter = pluginList.iterator(); iter.hasNext();) { > String id = (String) iter.next(); > BundleDescription bundle = state.getResolvedBundle(id); >+ if (bundle == null) { >+ //TODO error? >+ continue; >+ } > String filter = bundle.getPlatformFilter(); > if (filter == null || helper.createFilter(filter).match(environment)) { > if (BUNDLE_OSGI.equals(id)) >Index: src/org/eclipse/pde/internal/build/AbstractScriptGenerator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AbstractScriptGenerator.java,v >retrieving revision 1.49 >diff -u -r1.49 AbstractScriptGenerator.java >--- src/org/eclipse/pde/internal/build/AbstractScriptGenerator.java 7 Feb 2006 03:06:43 -0000 1.49 >+++ src/org/eclipse/pde/internal/build/AbstractScriptGenerator.java 10 Feb 2006 19:16:39 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2006 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -35,6 +35,7 @@ > private static PDEUIStateWrapper pdeUIState; > > /** Location of the plug-ins and fragments. */ >+ protected String[] sitePaths; > protected String[] pluginPath; > protected BuildTimeSiteFactory siteFactory; > >@@ -235,14 +236,21 @@ > } > > /** >- * Method getPaths. >+ * Method getPaths. These are the paths used for the BuildTimeSite > * @return URL[] > */ > private String[] getPaths() { >- if (pluginPath != null) >- return pluginPath; >+ if (sitePaths == null) { >+ if (pluginPath != null) { >+ sitePaths = new String[pluginPath.length + 1]; >+ System.arraycopy(pluginPath, 0, sitePaths, 0, pluginPath.length); >+ sitePaths[sitePaths.length - 1] = workingDirectory; >+ } else { >+ sitePaths = new String[] {workingDirectory}; >+ } >+ } > >- return new String[] {workingDirectory}; >+ return sitePaths; > } > > public void setBuildSiteFactory(BuildTimeSiteFactory siteFactory) { >@@ -290,6 +298,12 @@ > pdeUIState = new PDEUIStateWrapper(); > } > >+ protected boolean havePDEUIState() { >+ return pdeUIState != null; >+ } >+ >+ //Find a file in a bundle or a feature. >+ //location is assumed to be structured like : /<featureId | pluginId>/path.to.the.file > protected String findFile(String location, boolean makeRelative) { > if (location == null) > return null; >Index: src/org/eclipse/pde/internal/build/ProductFile.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/ProductFile.java,v >retrieving revision 1.5 >diff -u -r1.5 ProductFile.java >--- src/org/eclipse/pde/internal/build/ProductFile.java 1 Feb 2006 18:34:14 -0000 1.5 >+++ src/org/eclipse/pde/internal/build/ProductFile.java 10 Feb 2006 19:16:39 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 IBM Corporation and others. >+ * Copyright (c) 2005, 2006 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -14,6 +14,7 @@ > import java.io.*; > import java.util.*; > import javax.xml.parsers.*; >+import org.eclipse.core.runtime.*; > import org.xml.sax.*; > import org.xml.sax.helpers.DefaultHandler; > >@@ -21,7 +22,7 @@ > * > * @since 3.1 > */ >-public class ProductFile extends DefaultHandler { >+public class ProductFile extends DefaultHandler implements IPDEBuildConstants { > private final static SAXParserFactory parserFactory = SAXParserFactory.newInstance(); > > private static final String SOLARIS_LARGE = "solarisLarge"; //$NON-NLS-1$ >@@ -50,13 +51,14 @@ > private String id = null; > private boolean useFeatures = false; > private List plugins = null; >+ private List features = null; > private String splashLocation = null; > private String productName; > > /** > * Constructs a feature parser. > */ >- public ProductFile(String location, String os) { >+ public ProductFile(String location, String os) throws CoreException { > super(); > this.location = new File(location); > this.currentOS = os; >@@ -64,11 +66,9 @@ > parserFactory.setNamespaceAware(true); > parser = parserFactory.newSAXParser(); > } catch (ParserConfigurationException e) { >- if (BundleHelper.getDefault().isDebugging()) >- System.out.println(e); >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e)); > } catch (SAXException e) { >- if (BundleHelper.getDefault().isDebugging()) >- System.out.println(e); >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e)); > } > } > >@@ -85,6 +85,12 @@ > return plugins; > } > >+ public List getFeatures() { >+ if(!parsed) >+ parse(); >+ return features; >+ } >+ > public boolean containsPlugin(String plugin) { > if(!parsed) > parse(); >@@ -183,6 +189,8 @@ > processPlugin(attributes); > } else if ("splash".equals(localName)) { //$NON-NLS-1$ > splashLocation = attributes.getValue("location"); //$NON-NLS-1$ >+ } else if ("feature".equals(localName)) { //$NON-NLS-1$ >+ processFeature(attributes); > } > } > >@@ -191,14 +199,19 @@ > plugins = new ArrayList(); > plugins.add(attributes.getValue("id")); //$NON-NLS-1$ > } >+ >+ private void processFeature(Attributes attributes) { >+ if (features == null) >+ features = new ArrayList(); >+ features.add(attributes.getValue("id")); //$NON-NLS-1$ >+ } > > private void processProduct(Attributes attributes) { > id = attributes.getValue("id"); //$NON-NLS-1$ > productName = attributes.getValue("name"); //$NON-NLS-1$ > String use = attributes.getValue("useFeatures"); //$NON-NLS-1$ > if (use != null) >- useFeatures = IBuildPropertiesConstants.TRUE.equals(use.toUpperCase()); >- >+ useFeatures = IBuildPropertiesConstants.TRUE.equalsIgnoreCase(use); > } > > private void processConfigIni(Attributes attributes) { >Index: src/org/eclipse/pde/internal/build/BuildScriptGenerator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/BuildScriptGenerator.java,v >retrieving revision 1.57 >diff -u -r1.57 BuildScriptGenerator.java >--- src/org/eclipse/pde/internal/build/BuildScriptGenerator.java 1 Feb 2006 18:34:14 -0000 1.57 >+++ src/org/eclipse/pde/internal/build/BuildScriptGenerator.java 10 Feb 2006 19:16:39 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2006 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -18,8 +18,7 @@ > import org.eclipse.pde.internal.build.builder.*; > import org.eclipse.pde.internal.build.packager.PackageScriptGenerator; > import org.eclipse.pde.internal.build.site.BuildTimeSiteFactory; >-import org.eclipse.update.core.IFeature; >-import org.eclipse.update.core.VersionedIdentifier; >+import org.eclipse.update.core.*; > import org.osgi.framework.Version; > > public class BuildScriptGenerator extends AbstractScriptGenerator { >@@ -326,10 +325,6 @@ > this.elements = elements; > } > >- public void setPluginPath(String[] pluginPath) { >- this.pluginPath = pluginPath; >- } >- > /** > * Sets the recursiveGeneration. > * >Index: src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java,v >retrieving revision 1.64 >diff -u -r1.64 AssembleConfigScriptGenerator.java >--- src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java 9 Feb 2006 15:20:48 -0000 1.64 >+++ src/org/eclipse/pde/internal/build/AssembleConfigScriptGenerator.java 10 Feb 2006 19:16:39 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.build; > >+import java.io.File; > import java.util.*; > import org.eclipse.core.runtime.*; > import org.eclipse.osgi.service.resolver.BundleDescription; >@@ -86,7 +87,16 @@ > String productPath = findFile(product, false); > if (productPath == null) > productPath = product; >- productFile = new ProductFile(productPath, configInfo.getOs()); >+ File f = new File(productPath); >+ if (f.exists() && f.isFile()) { >+ try { >+ productFile = new ProductFile(productPath, configInfo.getOs()); >+ } catch (CoreException e) { >+ // TODO log >+ } >+ } else { >+ //TODO log >+ } > } > > private String computeIconsList() { >Index: templates/headless-build/build.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/templates/headless-build/build.properties,v >retrieving revision 1.1 >diff -u -r1.1 build.properties >--- templates/headless-build/build.properties 23 Jan 2006 15:55:23 -0000 1.1 >+++ templates/headless-build/build.properties 10 Feb 2006 19:16:40 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2003, 2005 IBM Corporation and others. >+# Copyright (c) 2003, 2006 IBM Corporation and others. > # All rights reserved. This program and the accompanying materials > # are made available under the terms of the Eclipse Public License v1.0 > # which accompanies this distribution, and is available at >@@ -22,6 +22,9 @@ > product=/plugin or feature id/path/to/.product > runPackager=true > >+#Set the name of the archive that will result from the product build. >+#archiveNamePrefix= >+ > # The prefix that will be used in the generated archive. > archivePrefix=<output archive root> > >Index: templates/headless-build/customTargets.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/templates/headless-build/customTargets.xml,v >retrieving revision 1.1 >diff -u -r1.1 customTargets.xml >--- templates/headless-build/customTargets.xml 23 Jan 2006 15:55:23 -0000 1.1 >+++ templates/headless-build/customTargets.xml 10 Feb 2006 19:16:40 -0000 >@@ -4,24 +4,12 @@ > <!-- Run a given ${target} on all elements being built --> > <!-- Add on <ant> task for each top level element being built. --> > <!-- ===================================================================== --> >+ <property name="allElementsFile" value="${builder}/allElements.xml"/> >+ <import file="${allElementsFile}" /> > <target name="allElements"> >- <ant antfile="${genericTargets}" target="${target}"> >- <property name="type" value="<feature | plugin | fragment>" /> >- <property name="id" value="<element.id>" /> >- </ant> >+ <antcall target="allElementsDelegator" /> > </target> >- >- <!-- ===================================================================== --> >- <!-- Targets to assemble the built elements for particular configurations --> >- <!-- These generally call the generated assemble scripts (named in --> >- <!-- ${assembleScriptName}) but may also add pre and post processing --> >- <!-- Add one target for each root element and each configuration --> >- <!-- ===================================================================== --> >- >- <target name="assemble.<element.id>[.config.spec]"> >- <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >- </target> >- >+ > <!-- ===================================================================== --> > <!-- ===================================================================== --> > <target name="getBaseComponents" depends="checkLocalBase" unless="skipBase"> >Index: scripts/build.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/scripts/build.xml,v >retrieving revision 1.14 >diff -u -r1.14 build.xml >--- scripts/build.xml 27 Apr 2005 12:54:42 -0000 1.14 >+++ scripts/build.xml 10 Feb 2006 19:16:39 -0000 >@@ -8,8 +8,9 @@ > <property name="builderDirectory" location="${builder}"/> > <property name="buildProperties" location="${builder}/build.properties"/> > <property file="${buildProperties}"/> >-<property name="customTargets" location="${builderDirectory}/customTargets.xml"/> >-<property name="genericTargets" location="genericTargets.xml"/> >+<available property="customTargets" file="${builder}/customTargets.xml" value="${builder}/customTargets.xml"/> >+<property name="customTargets" location="${eclipse.pdebuild.templates}/headless-build/customTargets.xml"/> >+<property name="genericTargets" location="${eclipse.pdebuild.scripts}/genericTargets.xml"/> > > <!-- ===================================================================== --> > <!-- main entry point to setup, fetch, generate, build etc. Use --> >Index: src_ant/org/eclipse/pde/internal/build/tasks/BuildScriptGeneratorTask.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src_ant/org/eclipse/pde/internal/build/tasks/BuildScriptGeneratorTask.java,v >retrieving revision 1.33 >diff -u -r1.33 BuildScriptGeneratorTask.java >--- src_ant/org/eclipse/pde/internal/build/tasks/BuildScriptGeneratorTask.java 18 Jan 2006 22:16:16 -0000 1.33 >+++ src_ant/org/eclipse/pde/internal/build/tasks/BuildScriptGeneratorTask.java 10 Feb 2006 19:16:40 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.build.tasks; > >+import java.io.File; > import org.apache.tools.ant.BuildException; > import org.apache.tools.ant.Task; > import org.eclipse.core.runtime.CoreException; >@@ -51,10 +52,10 @@ > /** > * Set the plug-in path to be the given value. > * >- * @param pluginPath the plug-in path >+ * @param pluginPath a File.pathSeparator separated list of paths > */ > public void setPluginPath(String pluginPath) { >- generator.setPluginPath(Utils.getArrayFromString(pluginPath)); >+ generator.setPluginPath(Utils.getArrayFromString(pluginPath, File.pathSeparator)); > } > > /** >Index: src/org/eclipse/pde/internal/build/builder/FeatureBuildScriptGenerator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/builder/FeatureBuildScriptGenerator.java,v >retrieving revision 1.75 >diff -u -r1.75 FeatureBuildScriptGenerator.java >--- src/org/eclipse/pde/internal/build/builder/FeatureBuildScriptGenerator.java 2 Feb 2006 22:12:54 -0000 1.75 >+++ src/org/eclipse/pde/internal/build/builder/FeatureBuildScriptGenerator.java 10 Feb 2006 19:16:40 -0000 >@@ -532,7 +532,7 @@ > * > */ > private void generateRootFilesAndPermissions() throws CoreException { >- if (product != null) { >+ if (product != null && !havePDEUIState()) { > ProductGenerator generator = new ProductGenerator(); > generator.setProduct(product); > generator.setBuildSiteFactory(siteFactory); >@@ -1149,7 +1149,7 @@ > while (tokenizer.hasMoreTokens()){ > String token = tokenizer.nextToken(); > if (token.startsWith("unpack")){ //$NON-NLS-1$ >- unpack = (token.toUpperCase().indexOf(TRUE) > -1); >+ unpack = (token.toLowerCase().indexOf(TRUE) > -1); > break; > } > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/plugin.xml,v >retrieving revision 1.54 >diff -u -r1.54 plugin.xml >--- plugin.xml 17 Jun 2005 15:13:11 -0000 1.54 >+++ plugin.xml 10 Feb 2006 19:16:39 -0000 >@@ -21,6 +21,11 @@ > </antTask> > <antTask > library="lib/pdebuild-ant.jar" >+ name="eclipse.generateFeature" >+ class="org.eclipse.pde.internal.build.tasks.FeatureGeneratorTask"> >+ </antTask> >+ <antTask >+ library="lib/pdebuild-ant.jar" > name="eclipse.buildManifest" > class="org.eclipse.pde.internal.build.tasks.BuildManifestTask"> > </antTask> >@@ -84,5 +89,23 @@ > <run class="org.eclipse.pde.internal.build.BuildApplication"/> > </application> > </extension> >+ <extension >+ point="org.eclipse.ant.core.antProperties"> >+ <antProperty >+ class="org.eclipse.pde.internal.build.properties.PDEProperties" >+ eclipseRuntime="false" >+ headless="true" >+ name="eclipse.pdebuild.home"/> >+ <antProperty >+ class="org.eclipse.pde.internal.build.properties.PDEProperties" >+ eclipseRuntime="false" >+ headless="true" >+ name="eclipse.pdebuild.scripts"/> >+ <antProperty >+ class="org.eclipse.pde.internal.build.properties.PDEProperties" >+ eclipseRuntime="false" >+ headless="true" >+ name="eclipse.pdebuild.templates"/> >+ </extension> > > </plugin> >Index: src/org/eclipse/pde/internal/build/properties/PDEProperties.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/properties/PDEProperties.java >diff -N src/org/eclipse/pde/internal/build/properties/PDEProperties.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/properties/PDEProperties.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,46 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *****************************************/ >+ >+package org.eclipse.pde.internal.build.properties; >+ >+import java.io.IOException; >+import org.eclipse.ant.core.IAntPropertyValueProvider; >+import org.eclipse.core.runtime.Platform; >+ >+public class PDEProperties implements IAntPropertyValueProvider { >+ static private final String PREFIX = "eclipse.pdebuild"; //$NON-NLS-1$ >+ static private final String HOME = PREFIX + ".home"; //$NON-NLS-1$ >+ static private final String SCRIPTS = PREFIX + ".scripts"; //$NON-NLS-1$ >+ static private final String TEMPLATES = PREFIX + ".templates"; //$NON-NLS-1$ >+ >+ public String getAntPropertyValue(String antPropertyName) { >+ String searchedEntry = null; >+ if (HOME.equals(antPropertyName)) >+ searchedEntry = "."; //$NON-NLS-1$ >+ >+ if (SCRIPTS.equals(antPropertyName)) >+ searchedEntry = "scripts"; //$NON-NLS-1$ >+ >+ if (TEMPLATES.equals(antPropertyName)) >+ searchedEntry = "templates"; //$NON-NLS-1$ >+ >+ if (searchedEntry == null) >+ return null; //TODO Throw an expcetion or log an error >+ >+ try { >+ return Platform.asLocalURL(Platform.getBundle("org.eclipse.pde.build").getEntry(searchedEntry)).getPath(); //$NON-NLS-1$ >+ } catch (IOException e) { >+ return null; >+ } >+ >+ } >+ >+} >Index: scripts/productBuild/allElements.xml >=================================================================== >RCS file: scripts/productBuild/allElements.xml >diff -N scripts/productBuild/allElements.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ scripts/productBuild/allElements.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,87 @@ >+<project name="Product Build allElements Delegator"> >+ <property name="archiveNamePrefix" value="${buildId}"/> >+ >+ <!-- ===================================================================== --> >+ <!-- Run a given ${target} on all elements being built --> >+ <!-- Add on <ant> task for each top level element being built. --> >+ <!-- ===================================================================== --> >+ <target name="allElementsDelegator"> >+ <ant antfile="${genericTargets}" target="${target}"> >+ <property name="type" value="feature" /> >+ <property name="id" value="org.eclipse.pde.build.container.feature" /> >+ </ant> >+ </target> >+ >+ <!-- ===================================================================== --> >+ <!-- Targets to assemble the built elements for particular configurations --> >+ <!-- These generally call the generated assemble scripts (named in --> >+ <!-- ${assembleScriptName}) but may also add pre and post processing --> >+ <!-- Add one target for each root element and each configuration --> >+ <!-- ===================================================================== --> >+ <target name="assemble.org.eclipse.pde.build.container.feature"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.win32.win32.x86"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-win32.win32.x86.zip"/> >+ </ant> >+ >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.linux.gtk.ppc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-linux.gtk.ppc.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.linux.gtk.x86"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-linux.gtk.x86.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.linux.gtk.x86_64"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-linux.gtk.x86_64.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.linux.motif.x86"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-linux.motif.x86.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.solaris.motif.sparc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-solaris.motif.sparc.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.solaris.gtk.sparc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-solaris.gtk.sparc.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.aix.motif.ppc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-aix.motif.ppc.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.hpux.motif.PA_RISC"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-hpux.motif.PA_RISC.zip"/> >+ </ant> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.macosx.carbon.ppc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"> >+ <property name="archiveName" value="${archiveNamePrefix}-macosx.carbon.ppc.tar.gz"/> >+ </ant> >+ </target> >+</project> >Index: templates/headless-build/allElements.xml >=================================================================== >RCS file: templates/headless-build/allElements.xml >diff -N templates/headless-build/allElements.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ templates/headless-build/allElements.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,25 @@ >+<project name="allElements Delegator"> >+ >+ <!-- ===================================================================== --> >+ <!-- Run a given ${target} on all elements being built --> >+ <!-- Replace element.id with the id of the top level element being built --> >+ <!-- Add on <ant> task for each top level element being built. --> >+ <!-- ===================================================================== --> >+ <target name="allElementsDelegator"> >+ <ant antfile="${genericTargets}" target="${target}"> >+ <property name="type" value="feature | plugin | fragment" /> >+ <property name="id" value="element.id" /> >+ </ant> >+ </target> >+ >+ <!-- ===================================================================== --> >+ <!-- Targets to assemble the built elements for particular configurations --> >+ <!-- These generally call the generated assemble scripts (named in --> >+ <!-- ${assembleScriptName}) but may also add pre and post processing --> >+ <!-- Add one target for each root element and each configuration --> >+ <!-- Replace element.id with the id of the top level element being built --> >+ <!-- ===================================================================== --> >+ <target name="assemble.element.id[.config.spec]"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+</project> >Index: scripts/productBuild/productBuild.xml >=================================================================== >RCS file: scripts/productBuild/productBuild.xml >diff -N scripts/productBuild/productBuild.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ scripts/productBuild/productBuild.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+<project name="Build a Product" default="main"> >+ >+<!-- ===================================================================== --> >+<!-- Global properties. See the build.properties for information on --> >+<!-- the properties which callers can control. --> >+<!-- ===================================================================== --> >+<property name="allElementsFile" value="${eclipse.pdebuild.scripts}/productBuild/allElements.xml"/> >+ >+<import file="${eclipse.pdebuild.scripts}/build.xml"/> >+ >+<!-- ===================================================================== --> >+<!-- main entry point to setup, fetch, generate, build etc. Use --> >+<!-- the customTargets.xml to modify the build behaviour. --> >+<!-- ===================================================================== --> >+<target name="main" description="the main build target"> >+ <antcall target="preBuild" /> >+ <antcall target="generateFeature"/> <!-- Generate the feature to drive the fetch --> >+ <antcall target="fetch" /> >+ <antcall target="generateFeature"> <!-- We are calling generate feature a second time so that we can get the pack / unpack clause fixed --> >+ <param name="verify" value="true"/> >+ </antcall> >+ <antcall target="generate" /> >+ <antcall target="process" /> >+ <antcall target="assemble" /> >+ <antcall target="package" /> >+ <antcall target="postBuild" /> >+</target> >+ >+<!-- ===================================================================== --> >+<!-- Generate a container feature based on the product file --> >+<!-- The plugin or feature containing the .product file will need to exist --> >+<!-- already, use preSetup or postSetup to fetch it if necessary --> >+<!-- ===================================================================== --> >+<target name="generateFeature"> >+ <eclipse.generateFeature >+ featureId="org.eclipse.pde.build.container.feature" >+ buildDirectory="${buildDirectory}" >+ baseLocation="${baseLocation}" >+ productFile="${product}" >+ verify="${verify}" >+ /> >+</target> >+ >+ >+</project> >Index: src_ant/org/eclipse/pde/internal/build/tasks/FeatureGeneratorTask.java >=================================================================== >RCS file: src_ant/org/eclipse/pde/internal/build/tasks/FeatureGeneratorTask.java >diff -N src_ant/org/eclipse/pde/internal/build/tasks/FeatureGeneratorTask.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src_ant/org/eclipse/pde/internal/build/tasks/FeatureGeneratorTask.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,107 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.build.tasks; >+ >+import java.io.File; >+import org.apache.tools.ant.BuildException; >+import org.apache.tools.ant.Task; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.pde.internal.build.FeatureGenerator; >+import org.eclipse.pde.internal.build.Utils; >+import org.eclipse.pde.internal.build.site.BuildTimeSiteFactory; >+ >+/** >+ * Generate a container feature based on a .product file and/or provided feature, plugin lists >+ * @since 3.2 >+ */ >+public class FeatureGeneratorTask extends Task { >+ private FeatureGenerator generator = new FeatureGenerator(); >+ >+ public void execute() throws BuildException { >+ try { >+ run(); >+ } catch (CoreException e) { >+ throw new BuildException(e); >+ } >+ } >+ >+ public void run() throws CoreException { >+ generator.generate(); >+ } >+ >+ /** >+ * Set the folder in which the build will occur. >+ * @param buildDirectory the location where the build will occur. >+ */ >+ public void setBuildDirectory(String buildDirectory) { >+ generator.setWorkingDirectory(buildDirectory); >+ } >+ >+ /** >+ * Set the product file to base the feature on >+ * @param productFile >+ */ >+ public void setProductFile(String productFile) { >+ generator.setProductFile(productFile); >+ } >+ >+ /** >+ * Set a location that contains plugins and features required by plugins and features >+ * for which the feature is being generated >+ * @param baseLocation >+ */ >+ public void setBaseLocation(String baseLocation) { >+ BuildTimeSiteFactory.setInstalledBaseSite(baseLocation); >+ } >+ >+ /** >+ * Set a list of plugin ids to be included in the generated feature >+ * @param pluginList a comma separated list of plugin ids >+ */ >+ public void setPluginList(String pluginList) { >+ if (pluginList != null && !pluginList.startsWith("${")) //$NON-NLS-1$ >+ generator.setPluginList(Utils.getArrayFromString(pluginList)); >+ } >+ >+ /** >+ * Set a list of feature ids to be include in the generated feature >+ * @param featureList a comma separated list of feature ids >+ */ >+ public void setFeatureList(String featureList) { >+ if (featureList != null && !featureList.startsWith("${")) //$NON-NLS-1$ >+ generator.setFeatureList(Utils.getArrayFromString(featureList)); >+ } >+ >+ /** >+ * The id to give to the generated feature >+ * @param featureId >+ */ >+ public void setFeatureId(String featureId) { >+ generator.setFeatureId(featureId); >+ } >+ >+ /** >+ * Set the list of additional paths in which to look for required plugins >+ * >+ * @param pluginPath a {@link File.pathSeparator} separated list of paths >+ */ >+ public void setPluginPath(String pluginPath) { >+ generator.setPluginPath(Utils.getArrayFromString(pluginPath, File.pathSeparator)); >+ } >+ >+ /** >+ * Set to true if you want to verify that the plugins and features are available. >+ * @param verify >+ */ >+ public void setVerify(boolean verify) { >+ generator.setVerify(verify); >+ } >+} >Index: src/org/eclipse/pde/internal/build/FeatureGenerator.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/build/FeatureGenerator.java >diff -N src/org/eclipse/pde/internal/build/FeatureGenerator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/build/FeatureGenerator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,171 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.pde.internal.build; >+ >+import java.io.*; >+import java.util.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.osgi.service.resolver.BundleDescription; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.internal.build.site.PDEState; >+ >+public class FeatureGenerator extends AbstractScriptGenerator { >+ private String featureId = null; >+ private String productFile = null; >+ private String[] pluginList = null; >+ private String[] featureList = null; >+ >+ private ProductFile product = null; >+ >+ private boolean verify = false; >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.internal.build.AbstractScriptGenerator#generate() >+ */ >+ public void generate() throws CoreException { >+ initialize(); >+ >+ List plugins = pluginList != null ? Arrays.asList(pluginList) : new ArrayList(); >+ List features = featureList != null ? Arrays.asList(featureList) : new ArrayList(); >+ if (product != null) { >+ List productElements = product.useFeatures() ? product.getFeatures() : product.getPlugins(); >+ if (productElements != null && productElements.size() > 0) { >+ if (product.useFeatures()) >+ features.addAll(productElements); >+ else >+ plugins.addAll(productElements); >+ } >+ } >+ >+ try { >+ createFeature(featureId, plugins, features); >+ } catch (FileNotFoundException e) { >+ //error >+ } >+ } >+ >+ public void setProductFile(String productFile) { >+ this.productFile = productFile; >+ } >+ >+ public void setPluginList(String[] pluginList) { >+ this.pluginList = pluginList; >+ } >+ >+ public void setFeatureList(String[] featureList) { >+ this.featureList = featureList; >+ } >+ >+ public void setFeatureId(String featureId) { >+ this.featureId = featureId; >+ } >+ >+ private void initialize(){ >+ if (productFile != null && !productFile.startsWith("${")) { //$NON-NLS-1$ >+ String productPath = findFile(productFile, false); >+ if (productPath == null) >+ productPath = productFile; >+ File f = new File(productPath); >+ if (f.exists() && f.isFile()) { >+ try { >+ product = new ProductFile(productPath, null); >+ } catch (CoreException e) { >+ // log >+ } >+ } >+ } >+ } >+ >+ protected void createFeature(String feature, List plugins, List features) throws CoreException, FileNotFoundException { >+ String location = IPDEBuildConstants.DEFAULT_FEATURE_LOCATION + '/' + feature; >+ File directory = new File(getWorkingDirectory(), location); >+ if (!directory.exists()) >+ directory.mkdirs(); >+ >+ PDEState state = verify ? getSite(false).getRegistry() : null; >+ >+ //Create feature.xml >+ File file = new File(directory, IPDEBuildConstants.DEFAULT_FEATURE_FILENAME_DESCRIPTOR); >+ OutputStream output = new FileOutputStream(file); >+ XMLWriter writer = null; >+ try { >+ writer = new XMLWriter(output); >+ } catch (UnsupportedEncodingException e) { >+ //should not happen >+ return; >+ } >+ Map parameters = new HashMap(); >+ >+ parameters.put("id", feature); //$NON-NLS-1$ >+ parameters.put("version", "1.0.0"); //$NON-NLS-1$ //$NON-NLS-2$ >+ writer.startTag("feature", parameters, true); //$NON-NLS-1$ >+ >+ for (Iterator iter = plugins.iterator(); iter.hasNext();) { >+ String name = (String) iter.next(); >+ boolean unpack = true; >+ if (verify) { >+ BundleDescription bundle = state.getResolvedBundle(name); >+ if (bundle != null){ >+ String [] bundleClasspath = (String[]) state.getExtraData().get(new Long(bundle.getBundleId())); >+ unpack = !(bundleClasspath == null || bundleClasspath.length == 0 || bundleClasspath[0].equals(".")); //$NON-NLS-1$ >+ } else { >+ //throw error >+ String message = NLS.bind(Messages.exception_missingPlugin, name); >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PLUGIN_MISSING, message, null)); >+ } >+ } >+ parameters.clear(); >+ parameters.put("id", name); //$NON-NLS-1$ >+ parameters.put("version", "0.0.0"); //$NON-NLS-1$//$NON-NLS-2$ >+ parameters.put("unpack", unpack ? "true" : "false"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ >+ writer.printTag("plugin", parameters, true, true, true); //$NON-NLS-1$ >+ } >+ >+ for (Iterator iter = features.iterator(); iter.hasNext();) { >+ String name = (String) iter.next(); >+ if (verify) { >+ //this will throw an exception if the feature is not found. >+ getSite(false).findFeature(name, null, true); >+ } >+ parameters.clear(); >+ parameters.put("id", name); //$NON-NLS-1$ >+ parameters.put("version", "0.0.0"); //$NON-NLS-1$//$NON-NLS-2$ >+ writer.printTag("includes", parameters, true, true, true); //$NON-NLS-1$ >+ >+ } >+ writer.endTag("feature"); //$NON-NLS-1$ >+ writer.close(); >+ >+ //create build.properties >+ file = new File(directory, IPDEBuildConstants.PROPERTIES_FILE); >+ Properties prop = new Properties(); >+ prop.put("pde", "marker"); //$NON-NLS-1$ //$NON-NLS-2$ >+ FileOutputStream stream = null; >+ try{ >+ stream = new FileOutputStream(file); >+ prop.store(stream, "Marker File so that the file gets written"); //$NON-NLS-1$ >+ stream.flush(); >+ } catch (IOException e) { >+ if( stream != null) { >+ try { >+ stream.close(); >+ } catch (IOException e1) { >+ // nothing >+ } >+ } >+ } >+ >+ } >+ >+ public void setVerify(boolean verify) { >+ this.verify = verify; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 107272
:
34267
| 34508