Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2017-03-01 23:56:30 -0500
committerGerrit Code Review @ Eclipse.org2017-03-17 00:31:07 -0400
commit36f66d36b29d45c86e09c78e3e0a5f2dce2ee185 (patch)
tree0adc6e5993de14e69d09d7f0706366e92c5cb649
parent4fe701bcf7f2bd897c21bb5e86e649c2670030ff (diff)
downloadorg.eclipse.cdt-36f66d36b29d45c86e09c78e3e0a5f2dce2ee185.tar.gz
org.eclipse.cdt-36f66d36b29d45c86e09c78e3e0a5f2dce2ee185.tar.xz
org.eclipse.cdt-36f66d36b29d45c86e09c78e3e0a5f2dce2ee185.zip
Generate config.ini for stand-alone debugger based on debug.product
Before this change, we had to remember to edit the config.ini every time a dependency was modified in debug.product. This change introduces a script during the build that generates the config.ini with the same list of plugins specified in debug.product. The cdtdebug.sh start-up script was simplified in the process because the config.ini includes all platform-specific plugins now and they just won't get loaded if they are not a match for the environment. Change-Id: I658b0dd8688088e203966a154e6154f1b2c851f4 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r--debug/org.eclipse.cdt.debug.application/.classpath1
-rw-r--r--debug/org.eclipse.cdt.debug.application/.gitignore170
-rw-r--r--debug/org.eclipse.cdt.debug.application/build.properties3
-rw-r--r--debug/org.eclipse.cdt.debug.application/configGenerator.xml15
-rw-r--r--debug/org.eclipse.cdt.debug.application/pom.xml41
-rw-r--r--debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh11
-rw-r--r--debug/org.eclipse.cdt.debug.application/scripts/config.ini7
-rw-r--r--debug/org.eclipse.cdt.debug.application/src-config-generator/org/eclipse/cdt/debug/application/ConfigGenerator.java117
8 files changed, 179 insertions, 186 deletions
diff --git a/debug/org.eclipse.cdt.debug.application/.classpath b/debug/org.eclipse.cdt.debug.application/.classpath
index f96aed716d..8de1f1073f 100644
--- a/debug/org.eclipse.cdt.debug.application/.classpath
+++ b/debug/org.eclipse.cdt.debug.application/.classpath
@@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src-config-generator"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/debug/org.eclipse.cdt.debug.application/.gitignore b/debug/org.eclipse.cdt.debug.application/.gitignore
index 1e8a55af15..661cce99bb 100644
--- a/debug/org.eclipse.cdt.debug.application/.gitignore
+++ b/debug/org.eclipse.cdt.debug.application/.gitignore
@@ -1,170 +1,2 @@
/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
-/bin
+scripts/config.ini
diff --git a/debug/org.eclipse.cdt.debug.application/build.properties b/debug/org.eclipse.cdt.debug.application/build.properties
index 1641833f33..e7020d3496 100644
--- a/debug/org.eclipse.cdt.debug.application/build.properties
+++ b/debug/org.eclipse.cdt.debug.application/build.properties
@@ -1,4 +1,5 @@
-source.. = src/
+source.. = src/,\
+ src-config-generator/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
diff --git a/debug/org.eclipse.cdt.debug.application/configGenerator.xml b/debug/org.eclipse.cdt.debug.application/configGenerator.xml
new file mode 100644
index 0000000000..6f5e41896b
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.application/configGenerator.xml
@@ -0,0 +1,15 @@
+<!-- This generates the config.ini file, based on the debug.product -->
+<project name="Build specific targets and properties" default="generate.configuration">
+ <target name="generate.configuration" description="Generates config.ini file">
+ <java classname="org.eclipse.cdt.debug.application.ConfigGenerator" failonerror="true">
+ <arg value="-product"/>
+ <arg value="${product_path}"/>
+ <arg value="-out"/>
+ <arg value="${config_path}"/>
+ <classpath>
+ <pathelement path="bin"/>
+ <pathelement path="target/classes"/>
+ </classpath>
+ </java>
+ </target>
+</project>
diff --git a/debug/org.eclipse.cdt.debug.application/pom.xml b/debug/org.eclipse.cdt.debug.application/pom.xml
new file mode 100644
index 0000000000..3133b72d58
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.application/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.cdt</groupId>
+ <artifactId>org.eclipse.cdt.debug-parent</artifactId>
+ <version>9.3.0-SNAPSHOT</version>
+ </parent>
+
+ <version>1.1.0-SNAPSHOT</version>
+ <artifactId>org.eclipse.cdt.debug.application</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-configuration</id>
+ <phase>prepare-package</phase>
+ <configuration>
+ <target>
+ <property name="product_path" value="${project.basedir}/../org.eclipse.cdt.debug.application.product/debug.product"/>
+ <property name="config_path" value="${project.basedir}/scripts/config.ini"/>
+ <ant antfile="configGenerator.xml" target="generate.configuration"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh
index 4875453390..1583013e8d 100644
--- a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh
+++ b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh
@@ -82,24 +82,17 @@ fi
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd) # install.sh will modify this line. DO NOT REMOVE THE FOLLOWING MARKER: @#@#
ECLIPSE_EXEC="$ECLIPSE_HOME/eclipse"
-# On Mac OS X, the application layout is a bit different (Eclipse.app)
+# On macOS, the application layout is a bit different (Eclipse.app)
case $ECLIPSE_HOME in
*MacOS) ECLIPSE_HOME="$ECLIPSE_HOME/../Eclipse" ;;
esac
PLUGIN_DIR="$ECLIPSE_HOME/plugins"
OSGI_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.osgi_*.jar' -not -name '*source*' -exec basename {} \; | tail -1`
-SWT_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.swt.*.jar' -not -name '*source*' -exec basename {} \; | tail -1`
-SWT_PLUGIN=`echo $SWT_JAR | sed -e "s/_[0-9]*\..*.jar//"`
-FS_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.core.filesystem.*.jar' -not -name '*source*' -exec basename {} \; | grep -v java7 | tail -1`
-FS_PLUGIN=`echo $FS_JAR | sed -e "s/_[0-9]*\..*.jar//"`
-LINUX_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.cdt.core.linux.*.jar' -not -name '*source*' -exec basename {} \; | tail -1`
-LINUX_PLUGIN=`echo $LINUX_JAR | sed -e "s/_[0-9]*\..*.jar//"`
# Run eclipse with the Stand-alone Debugger product specified
"$ECLIPSE_EXEC" -clean -product org.eclipse.cdt.debug.application.product \
-data "$HOME/workspace-cdtdebug" -configuration file\:"$HOME/cdtdebugger" \
-dev file\:"$HOME/cdtdebugger/dev.properties" $options \
- -vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \
- -Dlinux.plugin=$LINUX_PLUGIN -Declipse.home="$ECLIPSE_HOME"
+ -vmargs -Dosgi.jar=$OSGI_JAR -Declipse.home="$ECLIPSE_HOME"
diff --git a/debug/org.eclipse.cdt.debug.application/scripts/config.ini b/debug/org.eclipse.cdt.debug.application/scripts/config.ini
deleted file mode 100644
index 7c55466fb2..0000000000
--- a/debug/org.eclipse.cdt.debug.application/scripts/config.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-#Configuration File
-#Fri Dec 20 17:38:27 EST 2013
-osgi.install.area=file\:$eclipse.home$
-osgi.framework=file\:$eclipse.home$/plugins/$osgi.jar$
-osgi.bundles=org.eclipse.cdt.core.linux,org.eclipse.linuxtools.cdt.libhover.library.docs,org.eclipse.cdt.core.native,org.eclipse.core.net,org.eclipse.e4.core.di.extensions,org.eclipse.cdt.debug.ui.memory.floatingpoint,org.eclipse.ui.editors,org.eclipse.equinox.ds@1\:start,org.eclipse.search,org.eclipse.text,org.eclipse.jface.databinding,org.eclipse.cdt.debug.ui.memory.search,org.eclipse.debug.core,org.apache.batik.util,org.eclipse.cdt.debug.ui.memory.memorybrowser,org.eclipse.e4.ui.widgets,org.eclipse.cdt.debug.core,org.eclipse.ui,org.eclipse.cdt.make.core,javax.annotation,org.eclipse.equinox.registry,org.eclipse.cdt.dsf.ui,org.eclipse.cdt.debug.ui.memory.traditional,org.eclipse.cdt.ui,org.eclipse.ui.ide,org.w3c.dom.svg,org.eclipse.jface,org.eclipse.ltk.ui.refactoring,org.w3c.dom.smil,org.eclipse.e4.ui.model.workbench,org.eclipse.equinox.bidi,org.eclipse.e4.ui.workbench,org.eclipse.e4.ui.di,org.eclipse.debug.ui,org.eclipse.e4.ui.bindings,org.eclipse.core.contenttype,org.eclipse.e4.ui.workbench.swt,org.eclipse.ui.views,org.eclipse.emf.ecore.change,org.eclipse.equinox.app,org.eclipse.e4.ui.services,org.eclipse.ant.core,org.eclipse.equinox.p2.core,org.eclipse.cdt.core,org.eclipse.cdt.debug.application,org.eclipse.cdt.debug.application.doc,org.eclipse.core.resources,org.eclipse.team.ui,org.eclipse.equinox.common@2\:start,org.eclipse.equinox.p2.engine,org.eclipse.cdt.debug.ui,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.views.log,org.eclipse.help,org.eclipse.help.ui,org.eclipse.help.base,org.eclipse.help.webapp,org.eclipse.equinox.jsp.jasper,org.eclipse.equinox.jsp.jasper.registry,org.apache.jasper.glassfish,org.apache.lucene.core,org.apache.lucene.analysis,org.eclipse.equinox.http.jetty,org.eclipse.equinox.http.registry,org.eclipse.jetty.http,org.eclipse.equinox.http.servlet,org.eclipse.jetty.io,org.eclipse.jetty.server,org.eclipse.jetty.servlet,org.eclipse.jetty.util,org.eclipse.jetty.continuation,org.eclipse.jetty.security,javax.servlet.jsp,javax.el,org.eclipse.core.filesystem,org.eclipse.equinox.event,org.eclipse.cdt.dsf.gdb.ui,org.eclipse.ltk.core.refactoring,com.ibm.icu,org.eclipse.swt,org.eclipse.core.filebuffers,org.eclipse.e4.ui.workbench.addons.swt,javax.inject,$swt.plugin$,org.eclipse.core.databinding.observable,org.eclipse.core.jobs,org.eclipse.ui.forms,org.eclipse.e4.core.contexts,javax.xml,org.eclipse.core.variables,org.eclipse.ui.navigator,org.eclipse.e4.core.commands,org.eclipse.core.databinding,org.eclipse.core.commands,org.eclipse.ui.workbench,org.eclipse.equinox.util,org.eclipse.cdt.launch,org.w3c.css.sac,org.eclipse.e4.ui.workbench.renderers.swt,org.eclipse.cdt.managedbuilder.core,org.eclipse.jface.text,org.eclipse.cdt.managedbuilder.gnu.ui,org.eclipse.equinox.p2.metadata,org.eclipse.emf.ecore.xmi,org.eclipse.emf.common,org.eclipse.cdt.gdb,org.eclipse.compare.core,$linux.plugin$,org.eclipse.ui.console,org.eclipse.cdt.dsf.gdb,javax.servlet,org.eclipse.equinox.p2.repository,org.eclipse.linuxtools.cdt.libhover.glibc,org.eclipse.equinox.security,org.eclipse.compare,org.eclipse.core.runtime@start,org.eclipse.cdt.dsf,org.eclipse.osgi.services,org.eclipse.e4.ui.workbench3,org.eclipse.equinox.preferences,org.w3c.dom.events,org.eclipse.linuxtools.cdt.libhover,org.eclipse.ui.navigator.resources,org.eclipse.e4.ui.css.core,org.eclipse.ui.workbench.texteditor,org.eclipse.core.expressions,org.eclipse.e4.ui.css.swt.theme,org.eclipse.core.databinding.property,org.eclipse.emf.ecore,org.eclipse.e4.core.services,org.eclipse.cdt.gdb.ui,org.apache.batik.util.gui,org.eclipse.e4.core.di,$fs.plugin$,org.eclipse.team.core,org.eclipse.cdt.debug.ui.memory.transport,org.eclipse.equinox.p2.metadata.repository,org.eclipse.e4.ui.css.swt,org.apache.batik.css,org.eclipse.e4.emf.xpath,org.apache.commons.jxpath,org.tukaani.xz,org.eclipse.e4.core.di.annotations,com.google.gson,org.eclipse.launchbar.core,org.eclipse.launchbar.ui,org.eclipse.tools.templates.core,org.eclipse.tools.templates.ui,org.eclipse.tm.terminal.control
-osgi.configuration.cascaded=false
-osgi.bundles.defaultStartLevel=4
diff --git a/debug/org.eclipse.cdt.debug.application/src-config-generator/org/eclipse/cdt/debug/application/ConfigGenerator.java b/debug/org.eclipse.cdt.debug.application/src-config-generator/org/eclipse/cdt/debug/application/ConfigGenerator.java
new file mode 100644
index 0000000000..e2b6ab47b6
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.application/src-config-generator/org/eclipse/cdt/debug/application/ConfigGenerator.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson.
+ * 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
+ *******************************************************************************/
+
+package org.eclipse.cdt.debug.application;
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+
+/**
+ * A "script" that generates the config.ini used by the stand-alone debugger
+ * script. This is done by parsing the debug.product file to find the plug-ins.
+ */
+public class ConfigGenerator {
+ private static final Pattern PLUGIN_LINE_PATTERN = Pattern.compile("\\s*<plugin id=\"(\\S*)\".*"); //$NON-NLS-1$
+
+ /** Plug-ins requiring a start level for things to work correctly */
+ private static final Map<String, String> PLUGINS_WITH_START_LEVEL = new HashMap<>();
+ /** Plug-ins that we don't want to load when using the script VS using the product */
+ private static final Set<String> PLUGINS_NOT_IN_SCRIPT_VERSION = new HashSet<>();
+
+ static {
+ PLUGINS_WITH_START_LEVEL.put("org.eclipse.equinox.ds", "@1\\:start"); //$NON-NLS-1$ //$NON-NLS-2$
+ PLUGINS_WITH_START_LEVEL.put("org.eclipse.equinox.common", "@2\\:start"); //$NON-NLS-1$ //$NON-NLS-2$
+ PLUGINS_WITH_START_LEVEL.put("org.eclipse.core.runtime", "@start"); //$NON-NLS-1$ //$NON-NLS-2$
+ // We don't want the user to do "Check for updates", etc.
+ PLUGINS_NOT_IN_SCRIPT_VERSION.add("org.eclipse.update.configurator"); //$NON-NLS-1$
+ PLUGINS_NOT_IN_SCRIPT_VERSION.add("org.eclipse.equinox.p2.ui"); //$NON-NLS-1$
+ PLUGINS_NOT_IN_SCRIPT_VERSION.add("org.eclipse.equinox.p2.ui.sdk"); //$NON-NLS-1$
+ }
+
+ public static void main(String[] args) {
+ if (args.length < 4) {
+ printUsage();
+ System.exit(1);
+ }
+
+ String productFilePath = args[1];
+ List<String> pluginList = parsePluginList(productFilePath);
+ if (pluginList.isEmpty()) {
+ System.err.println("No plugins. Something must have gone wrong."); //$NON-NLS-1$
+ System.exit(1);
+ }
+
+ Path configOutputPath = Paths.get(args[3]);
+ generateConfigIni(pluginList, configOutputPath);
+ System.exit(0);
+ }
+
+ private static void generateConfigIni(List<String> pluginList, Path configOutputPath) {
+ try (FileWriter r = new FileWriter(configOutputPath.toFile())) {
+ r.write("osgi.install.area=file\\:$eclipse.home$\n"); //$NON-NLS-1$
+ r.write("osgi.framework=file\\:$eclipse.home$/plugins/$osgi.jar$\n"); //$NON-NLS-1$
+ r.write("osgi.bundles="); //$NON-NLS-1$
+
+ // Write all plug-in names
+ for (int i =0; i < pluginList.size(); i++) {
+ String pluginName = pluginList.get(i);
+ if (PLUGINS_NOT_IN_SCRIPT_VERSION.contains(pluginName)) {
+ continue;
+ }
+
+ r.write(pluginName);
+
+ // Add start level if necessary
+ if (PLUGINS_WITH_START_LEVEL.containsKey(pluginName)) {
+ r.write(PLUGINS_WITH_START_LEVEL.get(pluginName));
+ }
+
+ r.write(',');
+ }
+ r.write('\n');
+ r.write("osgi.configuration.cascaded=false\n"); //$NON-NLS-1$
+ r.write("osgi.bundles.defaultStartLevel=4\n"); //$NON-NLS-1$
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private static List<String> parsePluginList(String productPath) {
+ List<String> pluginList = new ArrayList<>();
+ try (Stream<String> stream = Files.lines(Paths.get(productPath))) {
+ stream.forEach((line) -> {
+ Matcher m = PLUGIN_LINE_PATTERN.matcher(line);
+ if (m.matches()) {
+ pluginList.add(m.group(1));
+ }
+ });
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ return pluginList;
+ }
+
+ private static void printUsage() {
+ System.err.println("Usage:"); //$NON-NLS-1$
+ System.err.println(" ConfigGenerator -product /path/to/foo.product -out /path/to/config.ini"); //$NON-NLS-1$
+ }
+}

Back to the top