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 35507 Details for
Bug 127576
product export does not create the eclipse.ini
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]
updated
127576.txt (text/plain), 32.87 KB, created by
Andrew Niefer
on 2006-02-28 17:16:01 EST
(
hide
)
Description:
updated
Filename:
MIME Type:
Creator:
Andrew Niefer
Created:
2006-02-28 17:16:01 EST
Size:
32.87 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.build >Index: src/org/eclipse/pde/internal/build/FeatureGenerator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/FeatureGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 FeatureGenerator.java >--- src/org/eclipse/pde/internal/build/FeatureGenerator.java 13 Feb 2006 22:10:04 -0000 1.1 >+++ src/org/eclipse/pde/internal/build/FeatureGenerator.java 28 Feb 2006 22:11:09 -0000 >@@ -19,6 +19,8 @@ > import org.eclipse.pde.internal.build.site.PDEState; > > public class FeatureGenerator extends AbstractScriptGenerator { >+ private static final String LAUNCHER_FEATURE_NAME = "org.eclipse.platform.launchers"; //$NON-NLS-1$ >+ > private String featureId = null; > private String productFile = null; > private String[] pluginList = null; >@@ -129,8 +131,12 @@ > writer.printTag("plugin", parameters, true, true, true); //$NON-NLS-1$ > } > >+ boolean hasLaunchers = false; > for (Iterator iter = features.iterator(); iter.hasNext();) { > String name = (String) iter.next(); >+ if (name.equals(LAUNCHER_FEATURE_NAME)) { >+ hasLaunchers = true; >+ } > if (verify) { > //this will throw an exception if the feature is not found. > getSite(false).findFeature(name, null, true); >@@ -139,7 +145,13 @@ > 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$ >- >+ } >+ if (!hasLaunchers) { >+ parameters.clear(); >+ parameters.put("id", LAUNCHER_FEATURE_NAME); //$NON-NLS-1$ >+ parameters.put("version", "0.0.0"); //$NON-NLS-1$//$NON-NLS-2$ >+ parameters.put("optional", "true"); //$NON-NLS-1$//$NON-NLS-2$ >+ writer.printTag("includes", parameters, true, true, true); //$NON-NLS-1$ > } > writer.endTag("feature"); //$NON-NLS-1$ > writer.close(); >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.2 >diff -u -r1.2 ProductGenerator.java >--- src/org/eclipse/pde/internal/build/ProductGenerator.java 13 Feb 2006 22:10:04 -0000 1.2 >+++ src/org/eclipse/pde/internal/build/ProductGenerator.java 28 Feb 2006 22:11:09 -0000 >@@ -13,12 +13,14 @@ > import java.io.*; > import java.util.*; > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.Platform; > import org.eclipse.osgi.service.resolver.BundleDescription; > import org.eclipse.pde.internal.build.site.PDEState; > > public class ProductGenerator extends AbstractScriptGenerator { > private static final String BUNDLE_EQUINOX_COMMON = "org.eclipse.equinox.common"; //$NON-NLS-1$ > private static final String BUNDLE_EQUINOX_REGISTRY = "org.eclipse.equinox.registry"; //$NON-NLS-1$ >+ private static final String BUNDLE_RUNTIME_COMPATIBILITY_REGISTRY = "org.eclipse.core.runtime.compatibility.registry"; //$NON-NLS-1$ > private static final String BUNDLE_EQUINOX_PREFERENCES = "org.eclipse.equinox.preferences"; //$NON-NLS-1$ > private static final String BUNDLE_OSGI = "org.eclipse.osgi"; //$NON-NLS-1$ > private static final String BUNDLE_CORE_JOBS = "org.eclipse.core.jobs"; //$NON-NLS-1$ >@@ -27,8 +29,7 @@ > private static final String BUNDLE_UPDATE_CONFIGURATOR = "org.eclipse.update.configurator"; //$NON-NLS-1$ > private static final String START_LEVEL_2 = "@2:start"; //$NON-NLS-1$ > private static final String START_LEVEL_3 = "@3:start"; //$NON-NLS-1$ >- private static final String START_LEVEL_4 = "@4:start"; //$NON-NLS-1$ >- >+ > private String product = null; > private ProductFile productFile = null; > private String root = null; >@@ -40,43 +41,60 @@ > */ > public void generate() throws CoreException { > initialize(); >- >+ > if (productFile == null) > return; > >+ //we need at least a product id >+ if (productFile.getId() == null) { >+ return; >+ } >+ > String custom = findFile(productFile.getConfigIniPath(), false); > String location = null, fileList = null; > for (Iterator iter = getConfigInfos().iterator(); iter.hasNext();) { > Config config = (Config) iter.next(); > location = DEFAULT_PRODUCT_ROOT_FILES_DIR + '/' + config.toStringReplacingAny(".", ANY_STRING); //$NON-NLS-1$ >- >+ >+ String rootLocation = root + location; >+ File rootDir = new File(rootLocation); >+ if ((!rootDir.exists() && !rootDir.mkdirs()) || rootDir.isFile()) >+ continue; //we will fail trying to create the files, TODO log warning/error >+ > //add generated root files to build.properties > if (buildProperties != null) { > fileList = buildProperties.getProperty(ROOT_PREFIX + config.toString("."), ""); //$NON-NLS-1$ //$NON-NLS-2$ > fileList += (fileList.length() > 0) ? ',' + location : location; > buildProperties.put(ROOT_PREFIX + config.toString("."), fileList); //$NON-NLS-1$ > } >- >+ > //configuration/config.ini > if (custom != null) { >- copyFile(custom, root + location + "/configuration/config.ini"); //$NON-NLS-1$ >+ copyFile(custom, rootLocation + "/configuration/config.ini"); //$NON-NLS-1$ > } else { >- createConfigIni(config, root + location); >+ createConfigIni(config, rootLocation); > } >- >+ >+ //only the config.ini makes sense in the any config >+ if (config.getOs().equals(Config.ANY)) >+ continue; >+ > //.eclipseproduct >- createEclipseProductFile(root + location); >+ createEclipseProductFile(rootLocation); >+ >+ //eclipse.ini >+ createLauncherIniFile(rootLocation, config.getOs()); > } >- >+ > } >- >+ > private void initialize() throws CoreException { > loadProduct(); >- >+ > PDEState state = getSite(false).getRegistry(); > refactoredRuntime = state.getResolvedBundle(BUNDLE_EQUINOX_COMMON) != null; > } >- >+ > private void loadProduct() throws CoreException { > if (product == null || product.startsWith("${")) { //$NON-NLS-1$ > productFile = null; >@@ -85,33 +103,33 @@ > String productPath = findFile(product, false); > if (productPath == null) > productPath = product; >- >+ > //the ProductFile uses the OS to determine which icons to return, we don't care so can use null > //this is better since this generator may be used for multiple OS's > productFile = new ProductFile(productPath, null); > } >- >+ > private void copyFile(String src, String dest) { > File source = new File(src); > if (!source.exists()) > return; > File destination = new File(dest); > File destDir = destination.getParentFile(); >- if (!destDir.exists()) >- destDir.mkdirs(); >- >+ if ((!destDir.exists() && !destDir.mkdirs()) || destDir.isFile()) >+ return; //we will fail trying to create the file, TODO log warning/error >+ > InputStream in = null; > OutputStream out = null; > try { > in = new FileInputStream(source); > out = new FileOutputStream(destination); >- >+ > //Transfer bytes from in to out >- byte[] buf = new byte[1024]; >- int len; >- while ((len = in.read(buf)) > 0) { >- out.write(buf, 0, len); >- } >+ byte[] buf = new byte[1024]; >+ int len; >+ while ((len = in.read(buf)) > 0) { >+ out.write(buf, 0, len); >+ } > } catch (IOException e) { > //nothing > } finally { >@@ -132,31 +150,63 @@ > } > } > >- > private void createConfigIni(Config config, String location) throws CoreException { >+ File configDir = new File(location + "/configuration"); //$NON-NLS-1$ >+ if ((!configDir.exists() && !configDir.mkdirs()) || configDir.isFile()) >+ return; //we will fail trying to create the file, TODO log warning/error >+ > PDEState state = getSite(false).getRegistry(); >- >+ > StringBuffer buffer = new StringBuffer(); > buffer.append("#Product Runtime Configuration File\n"); //$NON-NLS-1$ >- >+ > String splash = getSplashLocation(config); > if (splash != null) > buffer.append("osgi.splashPath=" + splash + '\n'); //$NON-NLS-1$ > >+ String application = productFile.getApplication(); >+ if (application != null) >+ buffer.append("eclipse.application=" + application + '\n'); //$NON-NLS-1$ > buffer.append("eclipse.product=" + productFile.getId() + '\n'); //$NON-NLS-1$ > buffer.append("osgi.bundles="); //$NON-NLS-1$ > if (productFile.useFeatures() || productFile.containsPlugin(BUNDLE_UPDATE_CONFIGURATOR)) { > if (refactoredRuntime) { >- buffer.append(BUNDLE_EQUINOX_COMMON); buffer.append(START_LEVEL_2); buffer.append(','); >- buffer.append(BUNDLE_CORE_JOBS); buffer.append(START_LEVEL_2); buffer.append(','); >- buffer.append(BUNDLE_EQUINOX_REGISTRY); buffer.append(START_LEVEL_2); buffer.append(','); >- buffer.append(BUNDLE_EQUINOX_PREFERENCES); buffer.append(','); >- buffer.append(BUNDLE_CORE_CONTENTTYPE); buffer.append(','); >- buffer.append(BUNDLE_CORE_RUNTIME); buffer.append(START_LEVEL_3); buffer.append(','); >- buffer.append(BUNDLE_UPDATE_CONFIGURATOR); buffer.append(START_LEVEL_4); buffer.append('\n'); >+ //org.eclipse.equinox.common@2:start, >+ buffer.append(BUNDLE_EQUINOX_COMMON); >+ buffer.append(START_LEVEL_2); >+ buffer.append(','); >+ //org.eclipse.core.jobs@2:start, >+ buffer.append(BUNDLE_CORE_JOBS); >+ buffer.append(START_LEVEL_2); >+ buffer.append(','); >+ //org.eclipse.core.runtime.compatibility.registry, >+ buffer.append(BUNDLE_RUNTIME_COMPATIBILITY_REGISTRY); >+ buffer.append(','); >+ //org.eclipse.equinox.registry@2:start, >+ buffer.append(BUNDLE_EQUINOX_REGISTRY); >+ buffer.append(START_LEVEL_2); >+ buffer.append(','); >+ //org.eclipse.equinox.preferences, >+ buffer.append(BUNDLE_EQUINOX_PREFERENCES); >+ buffer.append(','); >+ //org.eclipse.core.contenttype, >+ buffer.append(BUNDLE_CORE_CONTENTTYPE); >+ buffer.append(','); >+ //org.eclipse.core.runtime@2:start, >+ buffer.append(BUNDLE_CORE_RUNTIME); >+ buffer.append(START_LEVEL_2); >+ buffer.append(','); >+ //org.eclipse.update.configurator@3:start >+ buffer.append(BUNDLE_UPDATE_CONFIGURATOR); >+ buffer.append(START_LEVEL_3); >+ buffer.append('\n'); > } else { >- buffer.append(BUNDLE_CORE_RUNTIME); buffer.append(START_LEVEL_2); buffer.append(','); >- buffer.append(BUNDLE_UPDATE_CONFIGURATOR); buffer.append(START_LEVEL_3); buffer.append('\n'); >+ buffer.append(BUNDLE_CORE_RUNTIME); >+ buffer.append(START_LEVEL_2); >+ buffer.append(','); >+ buffer.append(BUNDLE_UPDATE_CONFIGURATOR); >+ buffer.append(START_LEVEL_3); >+ buffer.append('\n'); > } > } else { > Dictionary environment = new Hashtable(4); >@@ -204,9 +254,6 @@ > > FileWriter writer = null; > try { >- File configDir = new File(location + "/configuration"); //$NON-NLS-1$ >- if (!configDir.exists()) >- configDir.mkdirs(); > writer = new FileWriter(new File(configDir, "config.ini")); //$NON-NLS-1$ > writer.write(buffer.toString()); > } catch (IOException e) { >@@ -222,24 +269,26 @@ > > } > >- private void createEclipseProductFile(String directory) throws CoreException { >+ private void createEclipseProductFile(String directory) throws CoreException { > File dir = new File(directory); >- if (!dir.exists() || !dir.isDirectory()) >- dir.mkdirs(); >- >+ if ((!dir.exists() && !dir.mkdirs()) || dir.isFile()) >+ return; //we will fail trying to create the file, TODO log warning/error >+ > Properties properties = new Properties(); >- properties.put("name", productFile.getProductName()); //$NON-NLS-1$ >- properties.put("id", productFile.getId()); //$NON-NLS-1$ >+ if (productFile.getProductName() != null) >+ properties.put("name", productFile.getProductName()); //$NON-NLS-1$ >+ if (productFile.getId() != null) >+ properties.put("id", productFile.getId()); //$NON-NLS-1$ > > BundleDescription bundle = getSite(false).getRegistry().getResolvedBundle(getBrandingPlugin()); > if (bundle != null) > properties.put("version", bundle.getVersion().toString()); //$NON-NLS-1$ >- >+ > FileOutputStream stream = null; > try { > File file = new File(dir, ".eclipseproduct"); //$NON-NLS-1$ > stream = new FileOutputStream(file); >- properties.store(stream, "Eclipse Product File"); //$NON-NLS-1$ >+ properties.store(stream, "Eclipse Product File"); //$NON-NLS-1$ > stream.flush(); > } catch (IOException e) { > //nothing >@@ -256,6 +305,8 @@ > > private String getBrandingPlugin() { > String id = productFile.getId(); >+ if (id == null) >+ return null; > int dot = id.lastIndexOf('.'); > return (dot != -1) ? id.substring(0, dot) : null; > } >@@ -293,10 +344,67 @@ > } > } > } >- } >+ } > return buffer.toString(); > } >- >+ >+ private void createLauncherIniFile(String directory, String os) { >+ String launcher = getLauncherName(); >+ >+ if (os.equals(Platform.OS_MACOSX)) { >+ directory += "/" + launcher + ".app/Contents/MacOS"; //$NON-NLS-1$//$NON-NLS-2$ >+ } >+ File dir = new File(directory); >+ if ((!dir.exists() && !dir.mkdirs()) || dir.isFile()) >+ return; //we will fail trying to create the file TODO log warning/error >+ >+ String programArgs = productFile.getProgramArguments(os); >+ String vmArgs = productFile.getVMArguments(os); >+ >+ if ((programArgs == null || programArgs.length() == 0) && (vmArgs == null || vmArgs.length() == 0)) >+ return; >+ >+ String lineDelimiter = Platform.OS_WIN32.equals(os) ? "\r\n" : "\n"; //$NON-NLS-1$ //$NON-NLS-2$ >+ PrintWriter writer = null; >+ try { >+ writer = new PrintWriter(new FileWriter(new File(dir, launcher + ".ini"))); //$NON-NLS-1$ >+ if (programArgs != null && programArgs.length() > 0) { >+ StringTokenizer tokenizer = new StringTokenizer(programArgs); >+ while (tokenizer.hasMoreTokens()) { >+ writer.print(tokenizer.nextToken()); >+ writer.print(lineDelimiter); >+ } >+ } >+ if (vmArgs != null && vmArgs.length() > 0) { >+ writer.print("-vmargs"); //$NON-NLS-1$ >+ writer.print(lineDelimiter); >+ StringTokenizer tokenizer = new StringTokenizer(vmArgs); >+ while (tokenizer.hasMoreTokens()) { >+ writer.print(tokenizer.nextToken()); >+ writer.print(lineDelimiter); >+ } >+ } >+ } catch (IOException e) { >+ //nothing >+ } finally { >+ if (writer != null) { >+ writer.close(); >+ } >+ } >+ } >+ >+ private String getLauncherName() { >+ String name = productFile.getLauncherName(); >+ >+ if (name != null && name.length() > 0) { >+ name = name.trim(); >+ if (name.endsWith(".exe")) //$NON-NLS-1$ >+ name = name.substring(0, name.length() - 4); >+ return name; >+ } >+ return "eclipse"; //$NON-NLS-1$ >+ } >+ > public void setProduct(String product) { > this.product = product; > } >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.6 >diff -u -r1.6 ProductFile.java >--- src/org/eclipse/pde/internal/build/ProductFile.java 13 Feb 2006 22:10:04 -0000 1.6 >+++ src/org/eclipse/pde/internal/build/ProductFile.java 28 Feb 2006 22:11:09 -0000 >@@ -25,75 +25,121 @@ > public class ProductFile extends DefaultHandler implements IPDEBuildConstants { > private final static SAXParserFactory parserFactory = SAXParserFactory.newInstance(); > >+ private static final String PROGRAM_ARGS = "programArgs"; //$NON-NLS-1$ >+ private static final String PROGRAM_ARGS_LINUX = "programArgsLin"; //$NON-NLS-1$ >+ private static final String PROGRAM_ARGS_MAC = "programArgsMac"; //$NON-NLS-1$ >+ private static final String PROGRAM_ARGS_SOLARIS = "programArgsSol"; //$NON-NLS-1$ >+ private static final String PROGRAM_ARGS_WIN = "programArgsWin"; //$NON-NLS-1$ >+ private static final String VM_ARGS = "vmArgs"; //$NON-NLS-1$ >+ private static final String VM_ARGS_LINUX = "vmArgsLin"; //$NON-NLS-1$ >+ private static final String VM_ARGS_MAC = "vmArgsMac"; //$NON-NLS-1$ >+ private static final String VM_ARGS_SOLARIS = "vmArgsSol"; //$NON-NLS-1$ >+ private static final String VM_ARGS_WIN = "vmArgsWin"; //$NON-NLS-1$ >+ > private static final String SOLARIS_LARGE = "solarisLarge"; //$NON-NLS-1$ > private static final String SOLARIS_MEDIUM = "solarisMedium"; //$NON-NLS-1$ > private static final String SOLARIS_SMALL = "solarisSmall"; //$NON-NLS-1$ > private static final String SOLARIS_TINY = "solarisTiny"; //$NON-NLS-1$ >- > private static final String WIN32_16_LOW = "winSmallLow"; //$NON-NLS-1$ > private static final String WIN32_16_HIGH = "winSmallHigh"; //$NON-NLS-1$ > private static final String WIN32_32_LOW = "winMediumLow"; //$NON-NLS-1$ > private static final String WIN32_32_HIGH = "winMediumHigh"; //$NON-NLS-1$ > private static final String WIN32_48_LOW = "winLargeLow"; //$NON-NLS-1$ > private static final String WIN32_48_HIGH = "winLargeHigh"; //$NON-NLS-1$ >- >+ >+ private static final String PRODUCT = "product"; //$NON-NLS-1$ >+ private static final String CONFIG_INI = "configIni"; //$NON-NLS-1$ >+ private static final String LAUNCHER = "launcher"; //$NON-NLS-1$ >+ private static final String LAUNCHER_ARGS = "launcherArgs"; //$NON-NLS-1$ >+ private static final String PLUGINS = "plugins"; //$NON-NLS-1$ >+ private static final String FEATURES = "features"; //$NON-NLS-1$ >+ private static final String SPLASH = "splash"; //$NON-NLS-1$ > private static final String P_USE_ICO = "useIco"; //$NON-NLS-1$ >+ >+ //These constants form a small state machine to parse the .product file >+ private static final int STATE_START = 0; >+ private static final int STATE_PRODUCT = 1; >+ private static final int STATE_LAUNCHER = 2; >+ private static final int STATE_LAUNCHER_ARGS = 3; >+ private static final int STATE_PLUGINS = 4; >+ private static final int STATE_FEATURES = 5; >+ private static final int STATE_PROGRAM_ARGS = 6; >+ private static final int STATE_PROGRAM_ARGS_LINUX = 7; >+ private static final int STATE_PROGRAM_ARGS_MAC = 8; >+ private static final int STATE_PROGRAM_ARGS_SOLARIS = 9; >+ private static final int STATE_PROGRAM_ARGS_WIN = 10; >+ private static final int STATE_VM_ARGS = 11; >+ private static final int STATE_VM_ARGS_LINUX = 12; >+ private static final int STATE_VM_ARGS_MAC = 13; >+ private static final int STATE_VM_ARGS_SOLARIS = 14; >+ private static final int STATE_VM_ARGS_WIN = 15; >+ >+ private int state = STATE_START; > > private SAXParser parser; >- private File location; > private String currentOS = null; > private boolean useIco = false; > private ArrayList result = new ArrayList(6); > private String launcherName = null; > private String icons[] = null; >- private boolean parsed = false; > private String configPath = null; > private String id = null; > private boolean useFeatures = false; > private List plugins = null; > private List features = null; > private String splashLocation = null; >- private String productName; >+ private String productName = null; >+ private String application = null; >+ >+ private Properties launcherArgs = new Properties(); >+ >+ private static String normalize(String text) { >+ if (text == null || text.trim().length() == 0) >+ return ""; //$NON-NLS-1$ > >+ text = text.replaceAll("\\r|\\n|\\f|\\t", " "); //$NON-NLS-1$ //$NON-NLS-2$ >+ return text.replaceAll("\\s+", " "); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ > /** > * Constructs a feature parser. > */ > public ProductFile(String location, String os) throws CoreException { > super(); >- this.location = new File(location); > this.currentOS = os; > try { > parserFactory.setNamespaceAware(true); > parser = parserFactory.newSAXParser(); >+ InputStream in = new FileInputStream(location); >+ parser.parse(new InputSource(in), this); > } catch (ParserConfigurationException e) { > throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e)); > } catch (SAXException e) { > throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e)); >+ } catch (FileNotFoundException e) { >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e)); >+ } catch (IOException e) { >+ throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_PRODUCT_FORMAT, e.getLocalizedMessage(), e)); > } > } > > public String getLauncherName() { >- if (parsed) >- return launcherName; >- parse(); > return launcherName; > } > > public List getPlugins() { >- if(!parsed) >- parse(); >+ if (plugins == null) >+ return Collections.EMPTY_LIST; > return plugins; > } > > public List getFeatures() { >- if(!parsed) >- parse(); >+ if(features == null) >+ return Collections.EMPTY_LIST; > return features; > } > > public boolean containsPlugin(String plugin) { >- if(!parsed) >- parse(); > return plugins != null && plugins.contains(plugin); > } > >@@ -103,8 +149,6 @@ > public String[] getIcons() { > if (icons != null) > return icons; >- if (!parsed) >- parse(); > String[] temp = new String[result.size()]; > int i = 0; > for (Iterator iter = result.iterator(); iter.hasNext();) { >@@ -118,82 +162,235 @@ > } > > public String getConfigIniPath() { >- if (!parsed) >- parse(); > return configPath; > } > > public String getId() { >- if (!parsed) >- parse(); > return id; > } > > public String getSplashLocation() { >- if (!parsed) >- parse(); > return splashLocation; > } > > public String getProductName() { >- if (!parsed) >- parse(); > return productName; > } > >+ public String getApplication() { >+ return application; >+ } >+ > public boolean useFeatures() { >- if (!parsed) >- parse(); > return useFeatures; > } > >- private void parse() { >- // mark us as parsed. If we fail this time it is likely we will fail next time >- // so don't even bother. >- parsed = true; >- InputStream in = null; >- try { >- in = new FileInputStream(location); >- try { >- parser.parse(new InputSource(in), this); >- } catch (SAXException e) { >- //Ignore >- } finally { >- in.close(); >- } >- } catch (IOException e) { >- //Ignore >+ public String getVMArguments(String os) { >+ String key = null; >+ if( os.equals(Platform.OS_WIN32)){ >+ key = VM_ARGS_WIN; >+ } else if( os.equals(Platform.OS_LINUX)) { >+ key = VM_ARGS_LINUX; >+ } else if( os.equals(Platform.OS_MACOSX)) { >+ key = VM_ARGS_MAC; >+ } else if(os.equals(Platform.OS_SOLARIS)) { >+ key = VM_ARGS_SOLARIS; > } >+ >+ String prefix = launcherArgs.getProperty(VM_ARGS); >+ String platform = null, args = null; >+ if (key != null) >+ platform = launcherArgs.getProperty(key); >+ if (prefix != null) >+ args = platform != null ? prefix + " " + platform : prefix; //$NON-NLS-1$ >+ else >+ args = platform != null ? platform : ""; //$NON-NLS-1$ >+ return normalize(args); > } >- >+ >+ public String getProgramArguments(String os) { >+ String key = null; >+ if( os.equals(Platform.OS_WIN32)){ >+ key = PROGRAM_ARGS_WIN; >+ } else if( os.equals(Platform.OS_LINUX)) { >+ key = PROGRAM_ARGS_LINUX; >+ } else if( os.equals(Platform.OS_MACOSX)) { >+ key = PROGRAM_ARGS_MAC; >+ } else if(os.equals(Platform.OS_SOLARIS)) { >+ key = PROGRAM_ARGS_SOLARIS; >+ } >+ >+ String prefix = launcherArgs.getProperty(PROGRAM_ARGS); >+ String platform = null, args = null; >+ if (key != null) >+ platform = launcherArgs.getProperty(key); >+ if (prefix != null) >+ args = platform != null ? prefix + " " + platform : prefix; //$NON-NLS-1$ >+ else >+ args = platform != null ? platform : ""; //$NON-NLS-1$ >+ return normalize(args); >+ } >+ > public void startElement(String uri, String localName, String qName, Attributes attributes) { >- if ("launcher".equals(localName)) { //$NON-NLS-1$ >- processLauncher(attributes); >- } else if ("solaris".equals(localName)) { //$NON-NLS-1$ >- processSolaris(attributes); >- } else if ("win".equals(localName)) { //$NON-NLS-1$ >- processWin(attributes); >- } else if ("linux".equals(localName)) { //$NON-NLS-1$ >- processLinux(attributes); >- } else if ("macosx".equals(localName)) { //$NON-NLS-1$ >- processMac(attributes); >- } else if ("ico".equals(localName)) { //$NON-NLS-1$ >- processIco(attributes); >- } else if ("bmp".equals(localName)) { //$NON-NLS-1$ >- processBmp(attributes); >- } else if ("configIni".equals(localName)) { //$NON-NLS-1$ >- processConfigIni(attributes); >- } else if ("product".equals(localName)) { //$NON-NLS-1$ >- processProduct(attributes); >- } else if ("plugin".equals(localName)) { //$NON-NLS-1$ >- 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); >+ switch (state) { >+ case STATE_START : >+ if (PRODUCT.equals(localName)) { >+ processProduct(attributes); >+ state = STATE_PRODUCT; >+ } >+ break; >+ >+ case STATE_PRODUCT : >+ if (CONFIG_INI.equals(localName)) { >+ processConfigIni(attributes); >+ } else if (LAUNCHER.equals(localName)) { >+ processLauncher(attributes); >+ state = STATE_LAUNCHER; >+ } else if (PLUGINS.equals(localName)) { >+ state = STATE_PLUGINS; >+ } else if (FEATURES.equals(localName)) { >+ state = STATE_FEATURES; >+ } else if (LAUNCHER_ARGS.equals(localName)) { >+ state = STATE_LAUNCHER_ARGS; >+ } else if (SPLASH.equals(localName)) { >+ splashLocation = attributes.getValue("location"); //$NON-NLS-1$ >+ } >+ break; >+ >+ case STATE_LAUNCHER : >+ if (Platform.OS_SOLARIS.equals(localName)) { >+ processSolaris(attributes); >+ } else if ("win".equals(localName)) { //$NON-NLS-1$ >+ processWin(attributes); >+ } else if (Platform.OS_LINUX.equals(localName)) { >+ processLinux(attributes); >+ } else if (Platform.OS_MACOSX.equals(localName)) { >+ processMac(attributes); >+ } >+ if ("ico".equals(localName)) { //$NON-NLS-1$ >+ processIco(attributes); >+ } else if ("bmp".equals(localName)) { //$NON-NLS-1$ >+ processBmp(attributes); >+ } >+ break; >+ >+ case STATE_LAUNCHER_ARGS : >+ if (PROGRAM_ARGS.equals(localName)) { >+ state = STATE_PROGRAM_ARGS; >+ } else if (PROGRAM_ARGS_LINUX.equals(localName)) { >+ state = STATE_PROGRAM_ARGS_LINUX; >+ } else if (PROGRAM_ARGS_MAC.equals(localName)) { >+ state = STATE_PROGRAM_ARGS_MAC; >+ } else if (PROGRAM_ARGS_SOLARIS.equals(localName)) { >+ state = STATE_PROGRAM_ARGS_SOLARIS; >+ } else if (PROGRAM_ARGS_WIN.equals(localName)) { >+ state = STATE_PROGRAM_ARGS_WIN; >+ } else if (VM_ARGS.equals(localName)) { >+ state = STATE_VM_ARGS; >+ } else if (VM_ARGS_LINUX.equals(localName)) { >+ state = STATE_VM_ARGS_LINUX; >+ } else if (VM_ARGS_MAC.equals(localName)) { >+ state = STATE_VM_ARGS_MAC; >+ } else if (VM_ARGS_SOLARIS.equals(localName)) { >+ state = STATE_VM_ARGS_SOLARIS; >+ } else if (VM_ARGS_WIN.equals(localName)) { >+ state = STATE_VM_ARGS_WIN; >+ } >+ break; >+ >+ case STATE_PLUGINS : >+ if ("plugin".equals(localName)) { //$NON-NLS-1$ >+ processPlugin(attributes); >+ } >+ break; >+ >+ case STATE_FEATURES : >+ if ("feature".equals(localName)) { //$NON-NLS-1$ >+ processFeature(attributes); >+ } >+ break; > } > } > >+ public void endElement(String uri, String localName, String qName) { >+ switch (state) { >+ case STATE_PLUGINS : >+ if (PLUGINS.equals(localName)) >+ state = STATE_PRODUCT; >+ break; >+ case STATE_FEATURES : >+ if (FEATURES.equals(localName)) >+ state = STATE_PRODUCT; >+ break; >+ case STATE_LAUNCHER_ARGS : >+ if (LAUNCHER_ARGS.equals(localName)) >+ state = STATE_PRODUCT; >+ break; >+ case STATE_LAUNCHER : >+ if (LAUNCHER.equals(localName)) >+ state = STATE_PRODUCT; >+ break; >+ >+ case STATE_PROGRAM_ARGS : >+ case STATE_PROGRAM_ARGS_LINUX : >+ case STATE_PROGRAM_ARGS_MAC : >+ case STATE_PROGRAM_ARGS_SOLARIS : >+ case STATE_PROGRAM_ARGS_WIN : >+ case STATE_VM_ARGS : >+ case STATE_VM_ARGS_LINUX : >+ case STATE_VM_ARGS_MAC : >+ case STATE_VM_ARGS_SOLARIS : >+ case STATE_VM_ARGS_WIN : >+ state = STATE_LAUNCHER_ARGS; >+ break; >+ } >+ } >+ >+ public void characters(char[] ch, int start, int length) { >+ switch (state) { >+ case STATE_PROGRAM_ARGS : >+ addLaunchArgumentToMap(PROGRAM_ARGS, String.valueOf(ch, start, length)); >+ break; >+ case STATE_PROGRAM_ARGS_LINUX : >+ addLaunchArgumentToMap(PROGRAM_ARGS_LINUX, String.valueOf(ch, start, length)); >+ break; >+ case STATE_PROGRAM_ARGS_MAC : >+ addLaunchArgumentToMap(PROGRAM_ARGS_MAC, String.valueOf(ch, start, length)); >+ break; >+ case STATE_PROGRAM_ARGS_SOLARIS : >+ addLaunchArgumentToMap(PROGRAM_ARGS_SOLARIS, String.valueOf(ch, start, length)); >+ break; >+ case STATE_PROGRAM_ARGS_WIN : >+ addLaunchArgumentToMap(PROGRAM_ARGS_WIN, String.valueOf(ch, start, length)); >+ break; >+ case STATE_VM_ARGS : >+ addLaunchArgumentToMap(VM_ARGS, String.valueOf(ch, start, length)); >+ break; >+ case STATE_VM_ARGS_LINUX : >+ addLaunchArgumentToMap(VM_ARGS_LINUX, String.valueOf(ch, start, length)); >+ break; >+ case STATE_VM_ARGS_MAC : >+ addLaunchArgumentToMap(VM_ARGS_MAC, String.valueOf(ch, start, length)); >+ break; >+ case STATE_VM_ARGS_SOLARIS : >+ addLaunchArgumentToMap(VM_ARGS_SOLARIS, String.valueOf(ch, start, length)); >+ break; >+ case STATE_VM_ARGS_WIN : >+ addLaunchArgumentToMap(VM_ARGS_WIN, String.valueOf(ch, start, length)); >+ break; >+ } >+ } >+ >+ private void addLaunchArgumentToMap(String key, String value) { >+ if (launcherArgs == null) >+ launcherArgs = new Properties(); >+ >+ String oldValue = launcherArgs.getProperty(key); >+ if (oldValue != null) >+ launcherArgs.setProperty(key, oldValue + value); >+ else >+ launcherArgs.setProperty(key, value); >+ } > private void processPlugin(Attributes attributes) { > if (plugins == null) > plugins = new ArrayList(); >@@ -209,6 +406,7 @@ > private void processProduct(Attributes attributes) { > id = attributes.getValue("id"); //$NON-NLS-1$ > productName = attributes.getValue("name"); //$NON-NLS-1$ >+ application = attributes.getValue("application"); //$NON-NLS-1$ > String use = attributes.getValue("useFeatures"); //$NON-NLS-1$ > if (use != null) > useFeatures = IBuildPropertiesConstants.TRUE.equalsIgnoreCase(use); >@@ -233,7 +431,7 @@ > } > > private void processSolaris(Attributes attributes) { >- if (!osMatch("solaris")) //$NON-NLS-1$ >+ if (!osMatch(Platform.OS_SOLARIS)) > return; > result.add(attributes.getValue(SOLARIS_LARGE)); > result.add(attributes.getValue(SOLARIS_MEDIUM)); >@@ -242,19 +440,19 @@ > } > > private void processWin(Attributes attributes) { >- if (!osMatch("win32")) //$NON-NLS-1$ >+ if (!osMatch(Platform.OS_WIN32)) > return; >- useIco = "true".equals(attributes.getValue(P_USE_ICO)); //$NON-NLS-1$ >+ useIco = IBuildPropertiesConstants.TRUE.equalsIgnoreCase(attributes.getValue(P_USE_ICO)); > } > > private void processIco(Attributes attributes) { >- if (!osMatch("win32") || !useIco) //$NON-NLS-1$ >+ if (!osMatch(Platform.OS_WIN32) || !useIco) > return; > result.add(attributes.getValue("path")); //$NON-NLS-1$ > } > > private void processBmp(Attributes attributes) { >- if (!osMatch("win32") || useIco) //$NON-NLS-1$ >+ if (!osMatch(Platform.OS_WIN32) || useIco) > return; > result.add(attributes.getValue(WIN32_16_HIGH)); > result.add(attributes.getValue(WIN32_16_LOW)); >@@ -265,13 +463,13 @@ > } > > private void processLinux(Attributes attributes) { >- if (!osMatch("linux")) //$NON-NLS-1$ >+ if (!osMatch(Platform.OS_LINUX)) > return; > result.add(attributes.getValue("icon")); //$NON-NLS-1$ > } > > private void processMac(Attributes attributes) { >- if (!osMatch("macosx")) //$NON-NLS-1$ >+ if (!osMatch(Platform.OS_MACOSX)) > return; > result.add(attributes.getValue("icon")); //$NON-NLS-1$ > } >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.81 >diff -u -r1.81 FeatureBuildScriptGenerator.java >--- src/org/eclipse/pde/internal/build/builder/FeatureBuildScriptGenerator.java 28 Feb 2006 14:05:11 -0000 1.81 >+++ src/org/eclipse/pde/internal/build/builder/FeatureBuildScriptGenerator.java 28 Feb 2006 22:11:09 -0000 >@@ -541,7 +541,12 @@ > generator.setBuildProperties(getBuildProperties()); > generator.setRoot(featureRootLocation); > generator.setWorkingDirectory(getWorkingDirectory()); >- generator.generate(); >+ try { >+ generator.generate(); >+ } catch (CoreException e ) { >+ //problem with the .product file >+ //TODO Log warning/error >+ } > } > for (Iterator iter = getConfigInfos().iterator(); iter.hasNext();) { > Config aConfig = (Config) iter.next();
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 127576
:
35176
|
35310
|
35410
| 35507