diff --git a/build.gradle b/build.gradle deleted file mode 100644 index eec203498a03b822da40f8e4b27ebe42251c02ef..0000000000000000000000000000000000000000 --- a/build.gradle +++ /dev/null @@ -1,36 +0,0 @@ -project.ext { - targetRepositories = ["http://www.stups.uni-duesseldorf.de/ProB/buildlibs/rodin/", - "http://download.eclipse.org/releases/juno/", - "http://rodin-b-sharp.sourceforge.net/updates"] - groupID = "org.eventb.texteditor" - categoryDescriptions = [["org.eventb.texteditor.feature": "Camille Text Editor"]] -} - -apply from: 'tycho_build.gradle' - -project(':org.eventb.texttools') { - repositories { - maven { - name "cobra" - url "http://cobra.cs.uni-duesseldorf.de/artifactory/repo" - } - } - - - def parser_version = '2.4.22-SNAPSHOT' - - dependencies { - compile group: "de.prob", name: "bparser", version: parser_version , changing: true - } -} - -// Local tasks -task deleteOldArtifacts(type: Delete) { - String updateSite = workspacePath+'updatesite' - delete updateSite -} - -task collectArtifacts(type:Copy) { - from groupID+'.repository/target/repository/' - into 'updatesite' -} diff --git a/org.eventb.texteditor.feature/feature.xml b/org.eventb.texteditor.feature/feature.xml index 1f55a9afadf62fd9705bbc017d966b93598d067a..4fecf01006952c813745e0f24d08b1cbad0ea3a6 100644 --- a/org.eventb.texteditor.feature/feature.xml +++ b/org.eventb.texteditor.feature/feature.xml @@ -178,7 +178,7 @@ Inc. in the United States, other countries, or both. <import plugin="org.eclipse.emf.compare.match" version="1.2.2" match="compatible"/> <import plugin="org.eclipse.core.resources" version="3.8.1" match="compatible"/> <import plugin="org.eventb.emf.core" version="3.0.0" match="greaterOrEqual"/> - </requires> + </requires> <plugin id="org.eventb.texteditor.ui" @@ -194,4 +194,11 @@ Inc. in the United States, other countries, or both. version="3.0.1.qualifier" unpack="false"/> + <plugin + id="org.eventb.texteditor.parsers" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> diff --git a/org.eventb.texteditor.parent/pom.xml b/org.eventb.texteditor.parent/pom.xml index 17bfb0081a6828a074c06afbf91be987fea4f3f2..bc2db178d3182ec8bacee9d73a01b518cd3e8dec 100644 --- a/org.eventb.texteditor.parent/pom.xml +++ b/org.eventb.texteditor.parent/pom.xml @@ -10,7 +10,7 @@ <!-- this is the parent POM from which all modules inherit common settings --> <properties> - <tycho-version>0.17.0</tycho-version> + <tycho-version>0.21.0</tycho-version> </properties> <repositories> @@ -25,7 +25,10 @@ <url>http://www.stups.uni-duesseldorf.de/ProB/buildlibs/rodin/</url> </repository> - + <repository> + <id>cobra</id> + <url>http://cobra.cs.uni-duesseldorf.de/artifactory/repo/</url> + </repository> <repository> <id>targetRepository1</id> @@ -50,14 +53,14 @@ <!-- enable tycho build extension --> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-maven-plugin</artifactId> - <version>0.17.0</version> + <version>0.21.0</version> <extensions>true</extensions> </plugin> <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>target-platform-configuration</artifactId> - <version>0.17.0</version> + <version>0.21.0</version> <configuration> <dependency-resolution> <optionalDependencies>ignore</optionalDependencies> @@ -70,11 +73,11 @@ <!-- the modules that should be built together --> <modules> - <module>../org.eventb.texteditor.feature</module> + <module>../org.eventb.texteditor.feature</module> <module>../org.eventb.texteditor.ui</module> <module>../org.eventb.texttools</module> <module>../org.eventb.texteditor.repository</module> - + <module>../org.eventb.texteditor.parsers</module> </modules> </project> - \ No newline at end of file + diff --git a/org.eventb.texteditor.parsers/.classpath b/org.eventb.texteditor.parsers/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..8af1909c821581f8b73a40cfeb430db153d9c13c --- /dev/null +++ b/org.eventb.texteditor.parsers/.classpath @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry exported="true" kind="lib" path="lib/guava-14.0.1.jar"/> + <classpathentry exported="true" kind="lib" path="lib/bparser-2.4.28-SNAPSHOT.jar"/> + <classpathentry exported="true" kind="lib" path="lib/eventbstruct-2.4.28-SNAPSHOT.jar"/> + <classpathentry exported="true" kind="lib" path="lib/jsr305-1.3.9.jar"/> + <classpathentry exported="true" kind="lib" path="lib/parserbase-2.4.28-SNAPSHOT.jar"/> + <classpathentry exported="true" kind="lib" path="lib/prologlib-2.4.28-SNAPSHOT.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.eventb.texteditor.parsers/.project b/org.eventb.texteditor.parsers/.project new file mode 100644 index 0000000000000000000000000000000000000000..f273c4361b39bed7fb642a348e103814ce1fabd1 --- /dev/null +++ b/org.eventb.texteditor.parsers/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eventb.texteditor.parsers</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/org.eventb.texteditor.parsers/.settings/org.eclipse.jdt.core.prefs b/org.eventb.texteditor.parsers/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f42de363afaae68bbd968318f1d331877f5514fc --- /dev/null +++ b/org.eventb.texteditor.parsers/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/org.eventb.texteditor.parsers/META-INF/MANIFEST.MF b/org.eventb.texteditor.parsers/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..687e00c645abd4ab2001ec990e5255a3a31b34f8 --- /dev/null +++ b/org.eventb.texteditor.parsers/META-INF/MANIFEST.MF @@ -0,0 +1,60 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Parsers +Bundle-SymbolicName: org.eventb.texteditor.parsers +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eventb.texteditor.parsers.Activator +Require-Bundle: org.eclipse.core.runtime +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-ClassPath: lib/bparser-2.4.28-SNAPSHOT.jar, + lib/eventbstruct-2.4.28-SNAPSHOT.jar, + lib/jsr305-1.3.9.jar, + lib/parserbase-2.4.28-SNAPSHOT.jar, + lib/prologlib-2.4.28-SNAPSHOT.jar, + lib/guava-14.0.1.jar +Export-Package: com.google.common.annotations, + com.google.common.base, + com.google.common.base.internal, + com.google.common.cache, + com.google.common.collect, + com.google.common.eventbus, + com.google.common.hash, + com.google.common.io, + com.google.common.math, + com.google.common.net, + com.google.common.primitives, + com.google.common.reflect, + com.google.common.util.concurrent, + de.be4.classicalb.core.parser, + de.be4.classicalb.core.parser.analysis, + de.be4.classicalb.core.parser.analysis.checking, + de.be4.classicalb.core.parser.analysis.pragma, + de.be4.classicalb.core.parser.analysis.pragma.internal, + de.be4.classicalb.core.parser.analysis.prolog, + de.be4.classicalb.core.parser.analysis.transforming, + de.be4.classicalb.core.parser.exceptions, + de.be4.classicalb.core.parser.lexer, + de.be4.classicalb.core.parser.node, + de.be4.classicalb.core.parser.parser, + de.be4.classicalb.core.pragma.analysis, + de.be4.classicalb.core.pragma.lexer, + de.be4.classicalb.core.pragma.node, + de.be4.classicalb.core.preparser.analysis, + de.be4.classicalb.core.preparser.lexer, + de.be4.classicalb.core.preparser.node, + de.be4.classicalb.core.preparser.parser, + de.be4.eventb.core.parser, + de.be4.eventb.core.parser.analysis, + de.be4.eventb.core.parser.lexer, + de.be4.eventb.core.parser.node, + de.be4.eventb.core.parser.parser, + de.hhu.stups.sablecc.patch, + de.prob.parserbase, + de.prob.prolog.match, + de.prob.prolog.output, + de.prob.prolog.term, + javax.annotation, + javax.annotation.concurrent, + javax.annotation.meta, + org.eventb.texteditor.parsers diff --git a/org.eventb.texteditor.parsers/build.gradle b/org.eventb.texteditor.parsers/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..5965e6c12b5ec8da2f489415161d043e1ffab2ac --- /dev/null +++ b/org.eventb.texteditor.parsers/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'java' + +repositories { + mavenCentral() + maven { + name "cobra" + url "http://cobra.cs.uni-duesseldorf.de/artifactory/repo" + } +} + +def parser_version = '2.4.28-SNAPSHOT' + +dependencies { + compile group: "de.prob", name: "bparser", version: parser_version, changing: true + compile group: "de.prob", name: "eventbstruct", version: parser_version, changing: true + compile 'com.google.guava:guava:14.0.1'// Apache Licence 2.0 +} + + + +task collectDependencies(type: Copy) { + from configurations.compile + from configurations.runtime + into "./lib/" +} \ No newline at end of file diff --git a/org.eventb.texteditor.parsers/build.properties b/org.eventb.texteditor.parsers/build.properties new file mode 100644 index 0000000000000000000000000000000000000000..75e0f3c5d478b325f103610e595aeb30ff23ecfd --- /dev/null +++ b/org.eventb.texteditor.parsers/build.properties @@ -0,0 +1,4 @@ +output.. = bin/ +bin.includes = META-INF/,\ + lib/,\ + lib/guava-14.0.1.jar diff --git a/org.eventb.texteditor.parsers/pom.xml b/org.eventb.texteditor.parsers/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..968bf2a9ae2ab688481f97677372d1ab986b18b3 --- /dev/null +++ b/org.eventb.texteditor.parsers/pom.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + + <parent> + <relativePath>../org.eventb.texteditor.parent/pom.xml</relativePath> + <groupId>org.eventb.texteditor</groupId> + <artifactId>org.eventb.texteditor.parent</artifactId> + <version>1.0.0.qualifier</version> + </parent> + + <artifactId>org.eventb.texteditor.parsers</artifactId> + <packaging>eclipse-plugin</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.fortasoft</groupId> + <artifactId>gradle-maven-plugin</artifactId> + <version>1.0.5</version> + <configuration> + <tasks> + <!-- this would effectively call "gradle doSomething" --> + <task>collectDependencies</task> + </tasks> + </configuration> + <executions> + <execution> + <!-- You can bind this to any phase you like --> + <phase>validate</phase> + <goals> + <!-- goal must be "invoke" --> + <goal>invoke</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> +</build> + +</project> \ No newline at end of file diff --git a/org.eventb.texteditor.parsers/src/org/eventb/texteditor/parsers/Activator.java b/org.eventb.texteditor.parsers/src/org/eventb/texteditor/parsers/Activator.java new file mode 100644 index 0000000000000000000000000000000000000000..44b9ea81d0730d07a266e44854f31435c272b736 --- /dev/null +++ b/org.eventb.texteditor.parsers/src/org/eventb/texteditor/parsers/Activator.java @@ -0,0 +1,30 @@ +package org.eventb.texteditor.parsers; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +} diff --git a/org.eventb.texteditor.ui/META-INF/MANIFEST.MF b/org.eventb.texteditor.ui/META-INF/MANIFEST.MF index 647006800899ef87d41ae9c0059f702061100e9d..6e4dfca7d95bbeb3ca20110cd8129cdedf66562f 100644 --- a/org.eventb.texteditor.ui/META-INF/MANIFEST.MF +++ b/org.eventb.texteditor.ui/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Require-Bundle: org.eventb.texttools;bundle-version="[2.0.0,3.1.0)";visibility:= org.eclipse.ui.editors;bundle-version="[3.8.0,4.0.0)", org.eclipse.ui.ide;bundle-version="[3.8.2,4.0.0)", org.rodinp.keyboard.ui;bundle-version="[2.0.0,3.0.0)", - org.eclipse.ui.workbench.texteditor + org.eclipse.ui.workbench.texteditor, + org.eventb.texteditor.parsers;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ClassPath: lib/commons-lang-2.4.jar, diff --git a/org.eventb.texteditor.ui/build.properties b/org.eventb.texteditor.ui/build.properties index d1798280b65baacfdc25d34776ca38a8b9dd79b8..0f86237aa97f628d7e8727d99465f7d3116f2cd3 100644 --- a/org.eventb.texteditor.ui/build.properties +++ b/org.eventb.texteditor.ui/build.properties @@ -3,10 +3,8 @@ output.. = bin/ bin.includes = META-INF/,\ .,\ plugin.xml,\ - lib/commons-lang-2.4.jar,\ plugin.properties,\ templates.xml,\ icons/ src.includes = templates.xml,\ - lib/,\ icons/ diff --git a/org.eventb.texteditor.ui/src/org/eventb/texteditor/ui/outline/LabelHelper.java b/org.eventb.texteditor.ui/src/org/eventb/texteditor/ui/outline/LabelHelper.java index 68e735ec33909bc0c41d0145ab43473fe8641d31..356732252c952ab3c05d315c82b9c34655eb74dd 100644 --- a/org.eventb.texteditor.ui/src/org/eventb/texteditor/ui/outline/LabelHelper.java +++ b/org.eventb.texteditor.ui/src/org/eventb/texteditor/ui/outline/LabelHelper.java @@ -9,11 +9,11 @@ package org.eventb.texteditor.ui.outline; import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang.StringUtils; import org.eclipse.emf.common.util.EList; import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.StyledString.Styler; import org.eventb.emf.core.EventBNamed; +import com.google.common.base.Joiner; public class LabelHelper { @@ -29,7 +29,7 @@ public class LabelHelper { } public static <T> String joinEList(final EList<T> parameters) { - return StringUtils.join(getAsStringList(parameters), ", "); + return Joiner.on(", ").join(getAsStringList(parameters)); } public static void appendAttrDelim(final StyledString result) { diff --git a/org.eventb.texttools/META-INF/MANIFEST.MF b/org.eventb.texttools/META-INF/MANIFEST.MF index b2a617e04d01642e4bb72f878b500e7b876ba487..7576876cf1cc49f6a33146b9162a2b7b0d941a80 100644 --- a/org.eventb.texttools/META-INF/MANIFEST.MF +++ b/org.eventb.texttools/META-INF/MANIFEST.MF @@ -12,7 +12,8 @@ Require-Bundle: org.eclipse.jface.text;bundle-version="[3.6.0,4.0.0)", org.eclipse.emf.compare.diff;bundle-version="[1.2.2,2.0.0)", org.eclipse.emf.compare.match;bundle-version="[1.2.2,2.0.0)", org.eclipse.core.resources;bundle-version="[3.8.1,4.0.0)";visibility:=reexport, - org.eclipse.emf.ecore + org.eclipse.emf.ecore, + org.eventb.texteditor.parsers;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: de.be4.eventb.core.parser.node, diff --git a/org.eventb.texttools/build.gradle b/org.eventb.texttools/build.gradle deleted file mode 100644 index 30d2f447a46f209ec9dde7209393ebf23aad716b..0000000000000000000000000000000000000000 --- a/org.eventb.texttools/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -apply plugin: 'java' - -def parser_version = '2.4.22-SNAPSHOT' - -dependencies { - compile group: "de.prob", name: "bparser", version: parser_version , changing: true -} \ No newline at end of file diff --git a/org.eventb.texttools/build.properties b/org.eventb.texttools/build.properties index 47c27d05b203a9f88618c8eca3da7814f7e0a67d..b476c1fb379a6d62bc7a0ff842d7efa4503570ea 100644 --- a/org.eventb.texttools/build.properties +++ b/org.eventb.texttools/build.properties @@ -1,8 +1,5 @@ -source.. = src/,\ - src_generated/ +source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - plugin.xml,\ - lib/EventBParser.jar -src.includes = lib/EventBParser.jar + plugin.xml \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index bd28fa79f1b386d97c3275b678a01a752dbd53c4..0000000000000000000000000000000000000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'org.eventb.texteditor.feature','org.eventb.texteditor.ui','org.eventb.texttools' \ No newline at end of file diff --git a/tycho_build.gradle b/tycho_build.gradle deleted file mode 100644 index 1b9e8c25a96f5f02278b9738159ed18c705b6875..0000000000000000000000000000000000000000 --- a/tycho_build.gradle +++ /dev/null @@ -1,923 +0,0 @@ -/* - Build Script can be executed via 'gradle install' - Build Script Dependencies can be downloaded via 'gradle collectDepenencies' - Executing the Build Script and download Dependencies can be executed via 'gradle completeInstall' - For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath' - Pom Generation can be executed via gradle deploy - - If you have a product definition please add a buildProduct = true to your main build.gradle script - -*/ - - -apply plugin: 'base' - -import groovy.io.FileType -project.ext.tychoVersion = "0.17.0" - -// defines a List with projects which will not be included in the tycho build -try{ - excludeFromTychoBuild = excludeFromTychoBuild -}catch(MissingPropertyException e){ - project.ext.excludeFromTychoBuild = [] -} - -// defines a List with projects which Manifest files will not be affected by alterations of setClassPath and deleteCLassPath tasks -try{ - excludeManifestClassPathDelete = excludeManifestClassPathDelete -}catch(MissingPropertyException e){ - project.ext.excludeManifestClassPathDelete = [] -} - -// defines a List with projects which .classpath file will not be altered -try{ - excludeFromClassPath = excludeFromClassPath -}catch(MissingPropertyException e){ - project.ext.excludeFromClassPath = [] -} - - -try{ - workspacePath = workspacePath -}catch(MissingPropertyException e){ - project.ext.workspacePath = "" -} - -// Folder in each subproject where dependency jars are located -try{ - dependencyFolder = dependencyFolder -}catch(MissingPropertyException e){ - project.ext.dependencyFolder = "lib/dependencies/" -} - -try{ - groupID = groupID -}catch(MissingPropertyException e){ - - // workspace nach releng durchsuchen - def folderNames = [] - def folders = [] - println "folders:" - new File(workspacePath+".").listFiles().each{ dir -> - if( dir.isDirectory() ) folders << dir.getName() - } - - folders.each(){ it -> - it = (String)it.replaceFirst(/\.\//, "") - if( !( ( it ==~ /\..+/ ) || (it ==~ /.*.repository/) || (it ==~ /.*.parent/) ) ) folderNames << it // subProjects eventuell unnötig settings.gradle datei stattdessen benutzen - } - - - project.ext.groupID = "group" - for( int i = 0; i < folderNames.size(); i++ ){ - - if( folderNames[i] ==~ /.*\.[rR]eleng/ ){ - groupID = folderNames[i] - groupID = groupID.replace( ".releng", "") - groupID = groupID.replace( ".Releng", "") - } - } - -} - -// List which defines the features. By default it searches for projects with '.feature' at the end -try{ - features = features -}catch(MissingPropertyException e){ - - project.ext.features = [] - for( int i = 0; i < subprojects.name.size(); i++ ){ - if( subprojects.name[i] ==~ /.*\.[fF]eature/ ){ - features.add( subprojects.name[i] ) - } - } - -} - - -try{ - repositoryName = repositoryName -}catch(MissingPropertyException e){ - project.ext.repositoryName = groupID+".repository" -} - -try{ - parentID = parentID -}catch(MissingPropertyException e){ - project.ext.parentID = groupID+".parent" -} - -Boolean noDescriptions = false // in case of using own CategoryDescription Map - -try{ - categoryDescriptions = categoryDescriptions -}catch(MissingPropertyException e){ - project.ext.categoryDescriptions = [ [:],[:] ] // label and descriptions of the features - noDescriptions = true -} // categoryDescriptions = [["feature": "labelName","feature2": "label"],["feature": "featureDescription","feature2": "feature2Description"]] // label and descriptions of the features - -try{ - targetRepositories = targetRepositories -}catch(MissingPropertyException e){ - project.ext.targetRepositories = ["http://download.eclipse.org/releases/indigo/"] -} - -try{ - buildProduct = buildProduct - -}catch(MissingPropertyException e){ - project.ext.buildProduct = false -} - - - -def projects(int i){ - return subprojects.name[i] -} -// returns the name of a subproject listed in the settings.gradle file - - -def numberOfProjects(){ - return subprojects.name.size() -} -// returns the number of projects listed in the settings.gradle file -// - - - - -/* -- Return ParentId -- */ - -def parentId(){ - return parentID -} -/* -* This is the project of the parent Pom -* The Tycho Maven Build is triggered from -* this project's pom -*/ - - - -/* -- Return Group Id -- */ -def groupId(){ - return groupID -} - -/* -* This Group ID will be used in every sub project -*/ - -def addLibToCP(def project, def libPar){ - - def filePar = new File(workspacePath+project+"/.classpath") - boolean notYetAdded = true - filePar.eachLine{ line -> - def pattern = ".*${dependencyFolder}${libPar}.*" - if(line ==~ /${pattern}/){ - notYetAdded = false - } - - } - if(notYetAdded){ - File newCP = new File(workspacePath+project+'/.cp') - filePar.eachLine{ line -> - - if(line ==~ /.*<\/classpath>.*/){ - - String entry = '\t<classpathentry exported="true" kind="lib" path="'+dependencyFolder+libPar+'"/>'+'\n</classpath>\n' - line = line.replaceAll(/<\/classpath>/, entry) - println project + " : "+ libPar +" added to classpath" - newCP << line - }else{ - newCP << line+"\n" - } - } - filePar.delete() - newCP.renameTo(workspacePath+project+'/.classpath') - }else{ - println project + " : "+ libPar +" classpath entry already present" - } - -} -// Add certain Jar to Library - - -def deleteLibFromCP(def project){ - - def filePar = new File(workspacePath+project+"/.classpath") - boolean deleteCP = false - def newCP = new File(workspacePath+project+'/cp') - def pattern = ".*${dependencyFolder}[^<].*/>" - - filePar.eachLine{ line -> - - if(line ==~ /\n(\ |\t)*/) line = line.replaceAll(/\n(\ |\t)*/, '') // delete empty lines - if(line ==~ /${pattern}/){ - deleteCP = true - def pattern2 = '(\\ |\\t)*<classpathentry exported="true" kind="lib" path="'+dependencyFolder+"[^<].*"+'"/>(\\ |\\t)*' - line = line.replaceAll(/${pattern2}/, '') - newCP << line - }else{ - newCP << line+"\n" - } - } - if(!deleteCP){ - println project + " : no dependencies from "+ dependencyFolder+" found in classpath file! " - newCP.delete() - }else{ - filePar.delete() - newCP.renameTo(workspacePath+project+'/.classpath') - println workspacePath+project+'/.classpath' +"!" - } -} -// deletes whole DependenciesLibrary Folder - - -def addRunTimeLib( String libPar, String projectPar){ - - def mf = new File(projectPar+"/META-INF/MANIFEST.MF") - def newMf = new File(projectPar+"/MF") - newMf.delete() - mf.eachLine{ line -> - if(line ==~ /.*Bundle-ClassPath:.*\.jar.*/){ - - libsInLine = line.replaceAll(/[\ \t]*Bundle-ClassPath:[\ \t]*/, '') - line = line.replaceFirst(/[^\ \t]*\.jar[\ \,]*/, dependencyFolder+libPar+",\n "+libsInLine) // /[^\ \t]*.\.jar[\ \,]*/ - }else{ - if(line ==~ /.*Bundle-ClassPath: \.[\ \t]*/){ - line = line+",\n "+dependencyFolder+libPar - }else{ - if( line ==~ /.*Bundle-ClassPath: \.\,[\ \t]*/ ){ - line = line+"\n "+dependencyFolder+libPar+"," - } - } - } - - newMf << line+"\n" - } - mf.delete() - newMf.renameTo(projectPar+"/META-INF/MANIFEST.MF") - - -} // Adds a Library to the current Bundle-ClassPath of the Manifest file - - -def createRunTimeLib(String projectPar){ - def mf = new File(projectPar+"/META-INF/MANIFEST.MF") - mf << "Bundle-ClassPath: ." -} // Creates a Bundle-ClassPath Section in the Manifest file - -def boolean checkForRunTimeLibs(String projectPar){ - boolean returnBool = false - def mf = new File(projectPar+"/META-INF/MANIFEST.MF") - mf.eachLine{ line -> - if(line ==~ /.*Bundle-ClassPath:.*/){ - returnBool = true - } - } - return returnBool -} // checks for a Bundle-ClassPath section in the Manifest file - - -def boolean checkRunTimeLib(String libPar, String projectPar){ // checks if lib is in RunTimeLibrary present and - def mf = new File(projectPar+"/META-INF/MANIFEST.MF") // changes reference if necessary - def newMf = new File(projectPar+"/MF") - newMf.delete() - boolean returnBool = false - boolean changed = false - mf.eachLine{ line -> - if(line ==~ /.*${libPar}.*/){ - if( !( line ==~ /.*(\ |\t)*${dependencyFolder}${libPar}(\ |\t)*.*/ ) ){ // if lib is already referenced through another folder than lib/dependencies - line = line.replaceFirst( /[^\ \t]*${libPar}/, dependencyFolder+libPar ) // it's entry in the MF file will be overwritten to reference the lib from dependencyFolder - changed = true - println line - } - returnBool = true - } - - newMf << line+"\n" - } - if(changed){ - mf.delete() - newMf.renameTo(projectPar+"/META-INF/MANIFEST.MF") - }else{ - newMf.delete() - } - return returnBool - -}// checks if lib is already present in Manifest file -// if lib is present but is referenced from another folder than dependencyFolder the library from dependencyFolder will be referenced - - -def deleteManifestClassPath(String projectPar){ - - def mf = new File(projectPar+"/META-INF/MANIFEST.MF") - def newMf = new File(projectPar+"/MF") - boolean startDelete = false - newMf.delete() - mf.eachLine{ line -> - - if(line ==~ /[A-Z].*/) startDelete = false - if(line ==~ /.*Bundle-ClassPath:.*/) startDelete = true - - if(!startDelete && !( line ==~ /(\ |\t)*/) ) newMf << line+"\n" - } - - mf.delete() - newMf.renameTo(projectPar+"/META-INF/MANIFEST.MF") - -} - -///////////////////////////////////////////////////////////////////////////////////////// -// -- !!! DEFINING SUB PROJECTS !!! -- // -///////////////////////////////////////////////////////////////////////////////////////// - -subprojects { - - apply plugin: 'base' - apply plugin: 'java' -// apply plugin: 'eclipse' - - task deleteArtifacts(type: Delete) { - delete 'target','pom.xml' - } - - ///// Copy Dependencies into subprojects DependencyFolder ///// - task collectDependencies(type: Copy) { - - from configurations.compile - from configurations.runtime - - into "${dependencyFolder}" - - } - - task setClassPath(dependsOn: 'collectDependencies')<<{ - description = "\tAdds all your Dependencies from your local lib folder in each project to it's classpath" - Boolean exclude = false // if no lib/dependency folder is found this task will do nothing - if( excludeFromClassPath.every{ it != project.name }){ - def dependencyList = [] - try{ - def dir = new File(workspacePath+project.name+"/"+dependencyFolder).eachFile() { file-> - if( !(file.getName() ==~/.*\.txt/) ){ - dependencyList << file.getName() - } - } - }catch(Exception e){ - exclude = true - println project.name+" has no dependencies in '${dependencyFolder}' defined: Classpath will not be changed" - - } - - if( features.every{ it != project.name } && !exclude ){ - - if( excludeManifestClassPathDelete.every{ it != project.name }) deleteManifestClassPath( project.name ) - - if( ! checkForRunTimeLibs(project.name) ){ // Adds Lib to Manifest File - createRunTimeLib( project.name) - } - for(int icp = 0; icp < dependencyList.size; icp++){ - addLibToCP(project.name, dependencyList[icp]) //Adds Lib to .classPath file - - if(!checkRunTimeLib(dependencyList[icp], project.name)){ // if library not present add it to RunTimeLibrary - addRunTimeLib( dependencyList[icp], project.name) - } - } - - def warningReadMe = new File(workspacePath+project.name+"/"+dependencyFolder+"_README.txt") - warningReadMe.delete() - warningReadMe << "Do Not Remove any Jars/Libraries in this Folder!\nThis folder contains all of your dependencies defined in your gradle script.\n" - warningReadMe << "Removing or renaming any of these files will result in an Error in your .classpath file\n" - warningReadMe << "If any error concerning missing dependencies should occur please run 'gradle deleteFromClassPath setClassPath' in your workspace folder from your shell." - - } - }// if exclude - }// setClassPath - - - task deleteFromClassPath()<<{ - - description = "\tDeletes all your Dependencies located in your local lib folder from each project's classpath" - - boolean depsDelete = false - def depsFolder = new File(workspacePath+project.name+'/'+dependencyFolder) - if(depsFolder.exists()) depsDelete = true - depsFolder.deleteDir() - - try{ - - if(features.every{ it != project.name } && depsDelete){ - deleteLibFromCP(project.name) - } - - }catch(Exception e){ - println project.name+": No Classpath File found: ClassPath will not be changed" - } - - } - - /////---- For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath' ----/////// - - //////////////////////////////////////////////////////////////////////////////////////////// - - task deploy() <<{ - description = "\tGenerating the Tycho Poms. Please remember to add a '.qualifier' to the version numbers!" - - String versionNumber = 'Version Number Error:\tcheck Manifest for Bundle-Version Number and make sure to add a ".qualifier" to the version numbers!\n' - String artifactId = 'Could not find Bundle-SymbolicName in Manifest.file' - - - /* -- In case of changed Manifest File in Eclipse: - * - * Version Numbers of the projects are collected via - * regular expressions in the Manifest.MF File. - * versionnumber of the projects are equal to their - * Bundle-Version Number - */ - - - if(features.every{ it != project.name }){ // Generating Poms for sub projects except features - def content = new File(workspacePath+"${project.name}/META-INF/MANIFEST.MF").getText("UTF-8") - - def printFileLine = { - if( it ==~ /Bundle-Version.+qualifier/ ){ - versionNumber = it.substring(16) // possibile error: cuts off first 16 chars - - /* Version Number is taken from Bundle-Version in Manifest.MF - * If there is no Bundle-Version or the versionnumber needs to - * be taken from a different key word, please change the - * regular expression and the substring above - */ - } - - if( it ==~ /Bundle-SymbolicName:.+/ ){ - artifactId = it - artifactId = artifactId.replace("Bundle-SymbolicName:", ''); - artifactId = artifactId.replace(";",'') - artifactId = artifactId.replace(" ",'') - artifactId = artifactId.replace("singleton:=true",'') - } - /* Artifact ID is taken from Bundle-SymbolicName minus the - * 16 chars ';singleton:=true' - */ - } - - content.eachLine( printFileLine ) - - println artifactId - println "\t"+versionNumber - - def f = new File(workspacePath+artifactId+'/pom.xml') - f.delete() - - // ---- Test Cases ------ // - - if( project.name ==~ /.*\.[tT]ests*/){ - - f << start()+elder()+testArtifact(artifactId, versionNumber)+end() - }else{ - - // ---- Normal Plugin ----- // - f << start()+elder()+artifact(artifactId, versionNumber)+end() - /* - * old pom.xml files are deleted and replaced by new auto generated Tycho pom.xml files - */ - } - }else{ // end of { if subprojects aren't a feature } Block - -// -- Features -- // - - if(features.any{ it == project.name } ){ - - def parsedXml = new XmlParser().parse(workspacePath+"${project.name}/feature.xml") - - artifactId = parsedXml.attribute("id") - versionNumber = parsedXml.attribute("version") - - println artifactId - println "\t"+versionNumber - - def f = new File(workspacePath+artifactId+'/pom.xml') - f.delete() - f << feature(artifactId, versionNumber) - } - } - }//deploy - - -}// defining subprojects - - -clean { - dependsOn += subprojects.deleteArtifacts -} - -task createParent() << { - // --------- define Parent --------- // - - new File(workspacePath+"${parentID}").mkdir() - String versionNumber = '1.0.0.qualifier' - String artifactId = parentId() - - def f = new File(workspacePath+artifactId+'/pom.xml') - f.delete() - f << parentPom(artifactId) - for(int i = 0; i < targetRepositories.size(); i++){ - f << repos(targetRepositories[i], i) - } - f << endRepos() - f << moduleStart() - for(int i = 0; i < numberOfProjects(); i++){ - - if( excludeFromTychoBuild.every{ it != projects(i) } ){ - - f << module(projects(i)) - } - } - f << module(repositoryName) - f << endParent() - -} - -task createRepository() << { - - // ------------ define Repository --------- // - - new File(workspacePath+"${repositoryName}").mkdir() - - String versionNumber = '1.0.0.qualifier' - String artifactId = repositoryName - String featureVersionNumber = '1.0.0.qualifier' - String featureArtifactId - def f = new File(workspacePath+artifactId+'/category.xml') - f.delete() - f << categoryHead() - for(int i = 0; i < features.size(); i++){ - - def parsedXml = new XmlParser().parse("${workspacePath}${features[i]}/feature.xml") - - featureVersionNumber = parsedXml.attribute("version") - featureArtifactId = parsedXml.attribute("id") - - if(noDescriptions){ - categoryDescriptions[0].put( features[i], parsedXml.attribute("label") ) - categoryDescriptions[1].put( features[i], parsedXml.description.text() ) - } - f << categoryFeatures(featureArtifactId.replace(workspacePath,''), featureVersionNumber) - }// for - - for( int i = 0; i < features.size(); i++ ){ - - if(noDescriptions){ - f << categoryDescription(features[i], categoryDescriptions[0][features[i]] ,categoryDescriptions[1][features[i]] ) - // featureName, label, description - }else{ - f << categoryDescription(features[i], categoryDescriptions[features[i]][0] ,categoryDescriptions[features[i]][1]) - } - }//for - - f << categoryEnd() - - def pom = new File(workspacePath+artifactId+'/pom.xml') - pom.delete() - pom << reposi() -}// end of repository definition - - -task createPoms(dependsOn: [createParent, createRepository, subprojects.deploy]) - - -task install(dependsOn: [createPoms] , type:Exec) { - description = "\tExecutes a 'mvn install' of the parent pom.xml and auto-generates Tycho Poms" - commandLine 'mvn', 'install', '-f', workspacePath+parentID+'/pom.xml' -} - -task completeInstall(dependsOn: [subprojects.collectDependencies, createPoms], type:Exec ){ - - description = "\tCopies dependencies into dependencyFolder of each subproject and executes a 'mvn install' of the parent pom.xml and auto-generates Tycho Poms" - commandLine 'mvn', 'install', '-f', workspacePath+parentID+'/pom.xml' -} - -task tycho(dependsOn: [createPoms] , type:Exec) { - description = "\tExecutes a 'mvn install' of the parent pom.xml and auto-generates Tycho Poms" - commandLine 'mvn', 'install', '-f', workspacePath+parentID+'/pom.xml' -} - - -//--- Defining Tycho POM parts --// - - - def artifact(artifactId,versionNumber) { """ - <groupId>${groupId()}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${versionNumber}</version> - <packaging>eclipse-plugin</packaging> - """ } - - def testArtifact(artifactId,versionNumber) { """ - <groupId>${groupId()}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${versionNumber}</version> - <packaging>eclipse-test-plugin</packaging> - """ } - - - def start() { """<?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> - """} - - - def elder() {""" - <parent> - <groupId>${groupId()}</groupId> - <artifactId>${parentId()}</artifactId> - <version>1.0.0.qualifier</version> - <relativePath>../${parentId()}/pom.xml</relativePath> - </parent> - """} - - - def end() {""" - </project> - """} - -// -- defining Parent Pom -- // - - - - -def parentPom(artifactId) { """<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <groupId>${groupId()}</groupId> - <artifactId>${artifactId}</artifactId> - <version>1.0.0.qualifier</version> - - <packaging>pom</packaging> - - <!-- this is the parent POM from which all modules inherit common settings --> - <properties> - <tycho-version>${tychoVersion}</tycho-version> - </properties> - - <repositories> - <!-- configure p2 repository to resolve against --> - - -"""} - - -def repos(String targetRepo, int i) {""" - - <repository> - <id>targetRepository${i}</id> - <layout>p2</layout> - <url>${targetRepo}</url> - </repository> - -"""} - - - -def endRepos() {""" - </repositories> - - <build> - <plugins> - <plugin> - <!-- enable tycho build extension --> - <groupId>org.eclipse.tycho</groupId> - <artifactId>tycho-maven-plugin</artifactId> - <version>${tychoVersion}</version> - <extensions>true</extensions> - </plugin> - - <plugin> - <groupId>org.eclipse.tycho</groupId> - <artifactId>target-platform-configuration</artifactId> - <version>${tychoVersion}</version> - <configuration> - <dependency-resolution> - <optionalDependencies>ignore</optionalDependencies> - </dependency-resolution> - </configuration> - </plugin> - - </plugins> - </build> -"""} - -def moduleStart(){""" - <!-- the modules that should be built together --> - <modules> - """} - -//for(int i = 0; i < numberOfProjects(); i++) - -def module(String project){""" <module>../${project}</module> -"""} - - - -def endParent() {""" - </modules> -</project> - """} - -// end of defining parent pom.xml - -// repository Pom -def reposi() { """ -<?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>${groupID}</groupId> - <artifactId>${parentID}</artifactId> - <version>1.0.0.qualifier</version> - <relativePath>../${parentID}/pom.xml</relativePath> - </parent> - - - <groupId>${groupID}</groupId> - <artifactId>${repositoryName}</artifactId> - <version>1.0.0.qualifier</version> - <packaging>eclipse-repository</packaging> - - ${reposiBuildStep()} -</project> -"""} - -def String reposiBuildStep(){ - - if( buildProduct != false ){ - return """ - <build> - <plugins> - <plugin> - <groupId>org.eclipse.tycho</groupId> - <artifactId>tycho-p2-director-plugin</artifactId> - <version>\${tycho-version}</version> - <executions> - <execution> - <!-- (optional) install the product for all configured os/ws/arch environments using p2 director --> - <id>materialize-products</id> - <goals> - <goal>materialize-products</goal> - </goals> - </execution> - - <execution> - <!-- (optional) create product zips (one per os/ws/arch) --> - <id>archive-products</id> - <goals> - <goal>archive-products</goal> - </goals> - </execution> - - </executions> - </plugin> - </plugins> - </build> - """ - }else{ - return "\n" - } -} - - -// creates a category in -def categoryHead() { """<?xml version="1.0" encoding="UTF-8"?> -<site> - -"""} - -def categoryFeatures(artifactId, versionNumber){""" - <feature url="features/${artifactId}_${versionNumber}.jar" id="${artifactId}" version="${versionNumber}"> - <category name="${artifactId}.category"/> - </feature> -"""} - -def categoryDescription(artifactId, categoryName, categorydescription){""" -<category-def name="${artifactId}.category" label="${categoryName}"> - <description> -${categorydescription} - </description> - </category-def> -"""} - -def categoryEnd(){""" -</site> -"""} -// end of category definition - -// feature pom -def feature(artifactId, versionNumber) { """ -<?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>${groupId()}</groupId> - <artifactId>${parentId()}</artifactId> - <version>1.0.0.qualifier</version> - <relativePath>../${parentId()}/pom.xml</relativePath> - </parent> - <groupId>${groupId()}</groupId> - <artifactId>${artifactId}</artifactId> - <version>${versionNumber}</version> - <packaging>eclipse-feature</packaging> - </project> -"""} -// end of feature pom - - -// -------- In case you want to generate the product definition ------ // -/* - -def productXML(){ -""" -<?xml version="1.0" encoding="UTF-8"?> -<?pde version="3.5"?> - -<product name="${groupID}.product" uid="${groupID}" id="${groupID}.product" application="${product}" version="1.0.0.qualifier" useFeatures="true" includeLaunchers="true"> - - <configIni use="default"> - </configIni> - - <launcherArgs> - <programArgs>-consoleLog</programArgs> - <vmArgs>-Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgs> - <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> - </launcherArgs> - - <plugins> - - </plugins> - <features> -"""+listProductFeature()+""" - <feature id="org.eclipse.rcp" version="3.7.2.v20120120-1424-9DB5FmnFq5JCf1UA38R-kz0S0272"/> - </features> - <configurations> - <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" /> - <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" /> - <plugin id="org.eclipse.osgi" autoStart="true" startLevel="-1" /> - </configurations> - -</product> - - -""" - -/* -""" -<?xml version="1.0" encoding="UTF-8"?> -<?pde version="3.5"?> - -<product name="de.prob.product" uid="de.prob" id="de.prob.standalone.product" application="de.prob.standalone.application" version="1.0.0.qualifier" useFeatures="true" includeLaunchers="true"> - - <configIni use="default"> - </configIni> - - <launcherArgs> - <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> - </launcherArgs> - - <plugins> - </plugins> - - -</product> - - -"""*/ - -/* - - <feature id="birkhoff.feature" version="1.0.0.qualifier"/> - - -*/ -/* -} - -def String listProductFeatures(){ - String returnString = "" - for(int i = 0; i < features.size(); i++){ - - returnString += '\n\t\t<feature id="${features[i]}" version="1.0.0.qualifier"/>' - - } - return returnString - -} -*/ - -// Build Script can be executed via gradle install -// For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath' -// Pom Generation can be executed via gradle deploy \ No newline at end of file