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 34267 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]
proposed patch
107272.txt (text/plain), 21.62 KB, created by
Andrew Niefer
on 2006-02-07 11:00:41 EST
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Andrew Niefer
Created:
2006-02-07 11:00:41 EST
Size:
21.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.build >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 7 Feb 2006 15:46:14 -0000 >@@ -8,7 +8,8 @@ > <property name="builderDirectory" location="${builder}"/> > <property name="buildProperties" location="${builder}/build.properties"/> > <property file="${buildProperties}"/> >-<property name="customTargets" location="${builderDirectory}/customTargets.xml"/> >+<available property="customTargets" file="${builder}/customTargets.xml" value="${builder}/customTargets.xml"/> >+<property name="customTargets" location="${basedir}/../templates/headless-build/customTargets.xml"/> > <property name="genericTargets" location="genericTargets.xml"/> > > <!-- ===================================================================== --> >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 7 Feb 2006 15:46:14 -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: src/org/eclipse/pde/internal/build/FetchScriptGenerator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FetchScriptGenerator.java,v >retrieving revision 1.46 >diff -u -r1.46 FetchScriptGenerator.java >--- src/org/eclipse/pde/internal/build/FetchScriptGenerator.java 18 Jan 2006 22:16:16 -0000 1.46 >+++ src/org/eclipse/pde/internal/build/FetchScriptGenerator.java 7 Feb 2006 15:46:14 -0000 >@@ -253,7 +253,8 @@ > if (featureProperties.containsKey(GENERATION_SOURCE_FEATURE_PREFIX + featureId)) { > String[] extraElementsToFetch = Utils.getArrayFromString(featureProperties.getProperty(GENERATION_SOURCE_FEATURE_PREFIX + featureId), ","); //$NON-NLS-1$ > for (int j = 1; j < extraElementsToFetch.length; j++) { >- generateFetchEntry(extraElementsToFetch[j], false); >+ String [] elements = Utils.getArrayFromString(extraElementsToFetch[j], ";"); //$NON-NLS-1$ >+ generateFetchEntry(elements[0], false); > } > continue; > } >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 7 Feb 2006 15:46:14 -0000 >@@ -50,6 +50,7 @@ > private String id = null; > private boolean useFeatures = false; > private List plugins = null; >+ private List features = null; > private String splashLocation = null; > private String productName; > >@@ -85,6 +86,12 @@ > return plugins; > } > >+ public List getFeatures() { >+ if(!parsed) >+ parse(); >+ return features; >+ } >+ > public boolean containsPlugin(String plugin) { > if(!parsed) > parse(); >@@ -183,6 +190,8 @@ > processPlugin(attributes); > } else if ("splash".equals(localName)) { //$NON-NLS-1$ > splashLocation = attributes.getValue("location"); //$NON-NLS-1$ >+ } else if ("feature".equals(localName)) { >+ processFeature(attributes); > } > } > >@@ -191,13 +200,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.equals(use.toLowerCase()); > > } > >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 7 Feb 2006 15:46:14 -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> >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,63 @@ >+<project name="Product Build allElements Delegator"> >+ >+ <!-- ===================================================================== --> >+ <!-- 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}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.win32.win32.x86"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.linux.gtk.ppc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.linux.gtk.x86"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.linux.gtk.x86_64"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.linux.motif.x86"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.solaris.motif.sparc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.solaris.gtk.sparc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.aix.motif.ppc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.hpux.motif.PA_RISC"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </target> >+ >+ <target name="assemble.org.eclipse.pde.build.container.feature.macosx.carbon.ppc"> >+ <ant antfile="${assembleScriptName}" dir="${buildDirectory}"/> >+ </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,39 @@ >+<project name="Build All Elements" default="main"> >+ >+<!-- ===================================================================== --> >+<!-- Global properties. See the build.properties for information on --> >+<!-- the properties which callers can control. --> >+<!-- ===================================================================== --> >+<property name="builder" location="${user.dir}"/> >+<property name="builderDirectory" location="${builder}"/> >+<property name="buildProperties" location="${builder}/build.properties"/> >+<property file="${buildProperties}"/> >+ >+<property name="allElementsFile" value="${basedir}/allElements.xml"/> >+ >+<!-- ===================================================================== --> >+<!-- main entry point to setup, fetch, generate, build etc. Use --> >+<!-- the customTargets.xml to modify the build behaviour. --> >+<!-- ===================================================================== --> >+ >+<!-- ******* add in the descriptions for each of the top level targets to teh target decl --> >+<target name="main" description="the main build target"> >+ <antcall target="generateFeature" /> >+ <ant antfile="${basedir}/../build.xml" target="main" dir=".." /> >+</target> >+ >+<!-- ===================================================================== --> >+<!-- Steps to do before starting the build. Typical setup includes --> >+<!-- fetching the map files and building the directory. --> >+<!-- ===================================================================== --> >+<target name="generateFeature"> >+ <eclipse.generateFeature >+ featureId="org.eclipse.pde.build.container.feature" >+ buildDirectory="${buildDirectory}" >+ baseLocation="${baseLocation}" >+ productFile="${product}" >+ /> >+</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,64 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 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 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; >+ >+/** >+ * @author aniefer >+ * >+ */ >+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(); >+ } >+ >+ public void setBuildDirectory(String buildDirectory) { >+ generator.setWorkingDirectory(buildDirectory); >+ } >+ >+ public void setProductFile(String productFile) { >+ generator.setProductFile(productFile); >+ } >+ >+ public void setBaseLocation(String baseLocation) { >+ BuildTimeSiteFactory.setInstalledBaseSite(baseLocation); >+ } >+ >+ public void setPluginList(String pluginList) { >+ if (pluginList != null && !pluginList.startsWith("${")) //$NON-NLS-1$ >+ generator.setPluginList(Utils.getArrayFromString(pluginList)); >+ } >+ >+ public void setFeatureList(String featureList) { >+ if (featureList != null && !featureList.startsWith("${")) //$NON-NLS-1$ >+ generator.setFeatureList(Utils.getArrayFromString(featureList)); >+ } >+ >+ public void setFeatureId(String featureId) { >+ generator.setFeatureId(featureId); >+ } >+} >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,151 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 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.CoreException; >+import org.eclipse.osgi.service.resolver.BundleDescription; >+import org.eclipse.pde.internal.build.site.PDEState; >+ >+/** >+ * @author aniefer >+ * >+ */ >+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; >+ >+ >+ /* (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(); >+ List productElements = product.useFeatures() ? product.getFeatures() : product.getPlugins(); >+ if (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; >+ product = new ProductFile(productPath, null); >+ } >+ } >+ >+ 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 = getSite(false).getRegistry(); >+ >+ //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; >+ 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$ >+ } >+ >+ 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(); >+ 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"); //$NON-NLS-1$ >+ stream.flush(); >+ } catch (IOException e) { >+ if( stream != null) { >+ try { >+ stream.close(); >+ } catch (IOException e1) { >+ // nothing >+ } >+ } >+ } >+ >+ } >+}
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