From cbe7eedb9e467fdae00c05ac81eac06882243ff6 Mon Sep 17 00:00:00 2001 From: Sebastian Krings <sebastian@krin.gs> Date: Fri, 29 Apr 2016 14:15:02 +0200 Subject: [PATCH] switch build to pure maven --- .travis.yml | 4 +- org.rodinp.handbook.feature/pom.xml | 15 ++ org.rodinp.handbook.parent/pom.xml | 42 +++++ org.rodinp.handbook.releng/build.gradle | 18 +- org.rodinp.handbook.releng/tycho_build.gradle | 173 ++++++++++-------- org.rodinp.handbook.repository/pom.xml | 17 ++ org.rodinp.handbook/META-INF/MANIFEST.MF | 7 + org.rodinp.handbook/build.properties | 9 + org.rodinp.handbook/plugin.xml | 6 + org.rodinp.handbook/pom.xml | 18 ++ 10 files changed, 216 insertions(+), 93 deletions(-) create mode 100644 org.rodinp.handbook.feature/pom.xml create mode 100644 org.rodinp.handbook.parent/pom.xml create mode 100644 org.rodinp.handbook.repository/pom.xml create mode 100644 org.rodinp.handbook/META-INF/MANIFEST.MF create mode 100644 org.rodinp.handbook/build.properties create mode 100644 org.rodinp.handbook/plugin.xml create mode 100644 org.rodinp.handbook/pom.xml diff --git a/.travis.yml b/.travis.yml index 76115c1..9603469 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,11 +14,9 @@ script: - ant -file customBuild.xml - cd .. - cd org.rodinp.handbook.releng - - gradle deleteOldHelpPlugin deleteOldArtifacts importHelpPlugin createPoms + - gradle importHelpPlugin - cd .. - mvn -f org.rodinp.handbook.parent/pom.xml install - - cd org.rodinp.handbook.releng - - gradle collectArtifacts after_success: - travis-custom-deploy sftp current env: diff --git a/org.rodinp.handbook.feature/pom.xml b/org.rodinp.handbook.feature/pom.xml new file mode 100644 index 0000000..76d7e62 --- /dev/null +++ b/org.rodinp.handbook.feature/pom.xml @@ -0,0 +1,15 @@ +<?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.rodinp.handbook</groupId> + <artifactId>org.rodinp.handbook.parent</artifactId> + <version>1.0.0.qualifier</version> + <relativePath>../org.rodinp.handbook.parent/pom.xml</relativePath> + </parent> + <groupId>org.rodinp.handbook</groupId> + <artifactId>org.rodinp.handbook.feature</artifactId> + <version>2.5.0.qualifier</version> + <packaging>eclipse-feature</packaging> + </project> diff --git a/org.rodinp.handbook.parent/pom.xml b/org.rodinp.handbook.parent/pom.xml new file mode 100644 index 0000000..239f1ea --- /dev/null +++ b/org.rodinp.handbook.parent/pom.xml @@ -0,0 +1,42 @@ +<?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>org.rodinp.handbook</groupId> + <artifactId>org.rodinp.handbook.parent</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>0.14.1</tycho-version> + </properties> + + <repositories> + <!-- configure p2 repository to resolve against --> + + + + </repositories> + + <build> + <plugins> + <plugin> + <!-- enable tycho build extension --> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-maven-plugin</artifactId> + <version>0.21.0</version> + <extensions>true</extensions> + </plugin> + </plugins> + </build> + + <!-- the modules that should be built together --> + <modules> + <module>../org.rodinp.handbook</module> + <module>../org.rodinp.handbook.feature</module> + <module>../org.rodinp.handbook.repository</module> + + </modules> +</project> diff --git a/org.rodinp.handbook.releng/build.gradle b/org.rodinp.handbook.releng/build.gradle index 182743b..6bad5b9 100755 --- a/org.rodinp.handbook.releng/build.gradle +++ b/org.rodinp.handbook.releng/build.gradle @@ -1,14 +1,14 @@ -groupID = "org.rodinp.handbook" -features = ["org.rodinp.handbook.feature"] // must be the same as the folder name Please remember to add '../' if necessary +def groupID = "org.rodinp.handbook" +def features = ["org.rodinp.handbook.feature"] // must be the same as the folder name Please remember to add '../' if necessary -descriptions = [["org.rodinp.handbook.feature": "Rodin Handbook"]] // label and descriptions of the features +def descriptions = [["org.rodinp.handbook.feature": "Rodin Handbook"]] // label and descriptions of the features -repositoryName = groupID+".repository" // will be the folder name -parentID = groupID+".parent" // will be the same as the folder name +def repositoryName = groupID+".repository" // will be the folder name +def parentID = groupID+".parent" // will be the same as the folder name -targetRepositories = [] // ps Repository with Target Definition File +def targetRepositories = [] // ps Repository with Target Definition File -workspacePath = "../" // Relative Path to workspace directory e.g. your build is located in the folder workspace/buildscript please set relativePath to ".../" +def workspacePath = "../" // Relative Path to workspace directory e.g. your build is located in the folder workspace/buildscript please set relativePath to ".../" apply from: 'tycho_build.gradle' @@ -17,7 +17,7 @@ task importPlugin << { sourcedir = '../org.rodinp.handbook.feature/build/eclipse' targetdir = '../org.rodinp.handbook' delete file(targetdir) - new File(targetdir).mkdirs() + new File(targetdir).mkdirs() copy { from sourcedir into targetdir @@ -44,7 +44,7 @@ task collectArtifacts() << { from workspacePath+groupID+'.feature/build/' into workspacePath+'current' } - copy { + copy { from workspacePath+groupID+'.repository/target/repository/' into workspacePath+'updatesite' } diff --git a/org.rodinp.handbook.releng/tycho_build.gradle b/org.rodinp.handbook.releng/tycho_build.gradle index 30b014f..8961d78 100755 --- a/org.rodinp.handbook.releng/tycho_build.gradle +++ b/org.rodinp.handbook.releng/tycho_build.gradle @@ -1,3 +1,16 @@ +def groupID = "org.rodinp.handbook" +def features = ["org.rodinp.handbook.feature"] // must be the same as the folder name Please remember to add '../' if necessary + +def descriptions = [["org.rodinp.handbook.feature": "Rodin Handbook"]] // label and descriptions of the features + +def repositoryName = groupID+".repository" // will be the folder name +def parentID = groupID+".parent" // will be the same as the folder name + +def targetRepositories = [] // ps Repository with Target Definition File + +def workspacePath = "../" // Relative Path to workspace directory e.g. your build is located in the folder workspace/buildscript please set relativePath to ".../" + + apply plugin: 'base' @@ -45,44 +58,44 @@ def groupId(){ ///////////////////////////////////////////////////////////////////////////////////////// subprojects { - + apply plugin: 'base' - + task deleteArtifacts(type: Delete) { delete 'target','pom.xml' } - + task deploy() <<{ description = "\tGenerating the Tycho Poms. Please remember to add a '.qualifier' to the version numbers!" versionNumber = 'Version Number Error:\tcheck Manifest for Bundle-Version Number and make sure to add a ".qualifier" to the version numbers!\n' - + 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. + * + * 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 - content = new File(workspacePath+"${project.name}/META-INF/MANIFEST.MF").getText("UTF-8") + content = new File(workspacePath+"${project.name}/META-INF/MANIFEST.MF").getText("UTF-8") - printFileLine = { + printFileLine = { if( it ==~ /Bundle-Version.+qualifier/ ){ - versionNumber = it.substring(16) // possibile error: cuts off first 16 chars - + 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:", ''); @@ -94,49 +107,49 @@ subprojects { * 16 chars ';singleton:=true' */ } - + content.eachLine( printFileLine ) - - + + println artifactId println "\t"+versionNumber - - def f = new File(workspacePath+artifactId+'/pom.xml') + + def f = new File(workspacePath+artifactId+'/pom.xml') f.delete() f << start()+elder()+artifact(artifactId, versionNumber)+end() - /* + /* * old pom.xml files are deleted and replaced by new auto generated Tycho pom.xml files */ }else{ // if subprojects aren't a feature - - + + // -- Features -- // - + if(features.any{ it == project.name } ){ - + boolean idfound = false - content = new File(workspacePath+"${project.name}/feature.xml").getText("UTF-8") + content = new File(workspacePath+"${project.name}/feature.xml").getText("UTF-8") printFileLine = { - + if( it ==~ /.+version.+qualifier.+/ ){ - versionNumber = it + versionNumber = it versionNumber = versionNumber.replace(" ", '') versionNumber = versionNumber.replace("version=", '') versionNumber = versionNumber.replace('"', '') versionNumber = versionNumber.replace('<', '') versionNumber = versionNumber.replace('>', '') - - /* Version Number is taken from Feature.xml + + /* Version Number is taken from Feature.xml * feature.xml is searched for version="version.qualifier" * first 15 chars and last '"' are cut off */ } - - + + if( it ==~ /.+id=".+/ && idfound == false ){ artifactId = it artifactId = artifactId.replace("id=", '') @@ -144,27 +157,27 @@ subprojects { artifactId = artifactId.replace('"', '') idfound = true } - + } - + content.eachLine( printFileLine ) - + println artifactId println "\t"+versionNumber - def f = new File(workspacePath+artifactId+'/pom.xml') + def f = new File(workspacePath+artifactId+'/pom.xml') f.delete() f << feature(artifactId, versionNumber) - + } - + } } - - + + }// defining subprojects @@ -174,12 +187,12 @@ clean { task createParent() << { // --------- define Parent --------- // - - new File(workspacePath+"${parentID}").mkdir() + + new File(workspacePath+"${parentID}").mkdir() versionNumber = '1.0.0.qualifier' artifactId = parentId() - def f = new File(workspacePath+artifactId+'/pom.xml') + def f = new File(workspacePath+artifactId+'/pom.xml') f.delete() f << parentPom(artifactId) for(int i = 0; i < targetRepositories.size(); i++){ @@ -198,31 +211,31 @@ task createParent() << { task createRepository() << { // ------------ define Repository --------- // - - - new File(workspacePath+"${repositoryName}").mkdir() - + + + new File(workspacePath+"${repositoryName}").mkdir() + versionNumber = '1.0.0.qualifier' artifactId = repositoryName featureVersionNumber = '1.0.0.qualifier' - def f = new File(workspacePath+artifactId+'/category.xml') + def f = new File(workspacePath+artifactId+'/category.xml') f.delete() f << categoryHead() for(int i = 0; i < features.size(); i++){ - content = new File("${workspacePath}${features[i]}/feature.xml").getText("UTF-8") + content = new File("${workspacePath}${features[i]}/feature.xml").getText("UTF-8") boolean idfound = false printFileLine = { if( it ==~ /.+version.+qualifier.+/ ){ - featureVersionNumber = it + featureVersionNumber = it featureVersionNumber = featureVersionNumber.replace(" ", '') featureVersionNumber = featureVersionNumber.replace("version=", '') featureVersionNumber = featureVersionNumber.replace('"', '') } - - + + if( it ==~ /.+id=".+/ && idfound == false ){ featureArtifactId = it featureArtifactId = featureArtifactId.replace("id=", '') @@ -230,32 +243,32 @@ task createRepository() << { featureArtifactId = featureArtifactId.replace('"', '') idfound = true } - + } - + content.eachLine( printFileLine ) f << categoryFeatures(featureArtifactId.replace(workspacePath,''), featureVersionNumber) }// for - + for(int i = 0; i < features.size(); i++){ - + f << categoryDescription(features[i], descriptions[features[i]][0] ,descriptions[features[i]][1]) // featureName, label, description }//for - + f << categoryEnd() - - def pom = new File(workspacePath+artifactId+'/pom.xml') + + 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" + description = "\tExecutes a 'mvn install' of the parent pom.xml and auto-generates Tycho Poms" commandLine 'mvn', 'install', '-f', workspacePath+parentID+'/pom.xml' } @@ -269,16 +282,16 @@ task install(dependsOn: [createPoms] , type:Exec) { <version>${versionNumber}</version> <packaging>eclipse-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> @@ -292,7 +305,7 @@ task install(dependsOn: [createPoms] , type:Exec) { def end() {""" </project> """} - + // -- defining Parent Pom -- // @@ -301,11 +314,11 @@ task install(dependsOn: [createPoms] , type:Exec) { 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 --> @@ -314,14 +327,14 @@ def parentPom(artifactId) { """<?xml version="1.0" encoding="UTF-8"?> </properties> <repositories> - <!-- configure p2 repository to resolve against --> - + <!-- configure p2 repository to resolve against --> + """} def repos(String targetRepo, int i) {""" - + <repository> <id>targetRepository${i}</id> <layout>p2</layout> @@ -333,7 +346,7 @@ def repos(String targetRepo, int i) {""" def endRepos() {""" - </repositories> + </repositories> <build> <plugins> @@ -358,13 +371,13 @@ def moduleStart(){""" def module(String project){""" <module>../${project}</module> """} - + def endParent() {""" </modules> </project> """} - + // end of defining parent pom.xml // repository Pom @@ -380,7 +393,7 @@ def reposi() { """ <relativePath>../${parentID}/pom.xml</relativePath> </parent> - + <groupId>${groupID}</groupId> <artifactId>${repositoryName}</artifactId> <version>1.0.0.qualifier</version> @@ -389,12 +402,12 @@ def reposi() { """ """} -// creates a category in +// 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"/> @@ -437,5 +450,3 @@ def feature(artifactId, versionNumber) { """ // Build Script can be executed via gradle install // Pom Generation can be executed via gradle deploy - - diff --git a/org.rodinp.handbook.repository/pom.xml b/org.rodinp.handbook.repository/pom.xml new file mode 100644 index 0000000..83b747a --- /dev/null +++ b/org.rodinp.handbook.repository/pom.xml @@ -0,0 +1,17 @@ +<?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.rodinp.handbook</groupId> + <artifactId>org.rodinp.handbook.parent</artifactId> + <version>1.0.0.qualifier</version> + <relativePath>../org.rodinp.handbook.parent/pom.xml</relativePath> + </parent> + + + <groupId>org.rodinp.handbook</groupId> + <artifactId>org.rodinp.handbook.repository</artifactId> + <version>1.0.0.qualifier</version> + <packaging>eclipse-repository</packaging> + </project> diff --git a/org.rodinp.handbook/META-INF/MANIFEST.MF b/org.rodinp.handbook/META-INF/MANIFEST.MF new file mode 100644 index 0000000..135e4a0 --- /dev/null +++ b/org.rodinp.handbook/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Rodin Handbook v.2.5 +Bundle-SymbolicName: org.rodinp.handbook;singleton:=true +Bundle-Version: 2.5.0.qualifier +Bundle-Vendor: Formal Mind GmbH (formalmind.com) +Created-By: Formalmind GmbH diff --git a/org.rodinp.handbook/build.properties b/org.rodinp.handbook/build.properties new file mode 100644 index 0000000..77d4db2 --- /dev/null +++ b/org.rodinp.handbook/build.properties @@ -0,0 +1,9 @@ +bin.includes = plugin.xml,\ + *.xml,\ + *.html,\ + *.pdf,\ + icons/,\ + META-INF/,\ + images/,\ + styles/,\ + files/ diff --git a/org.rodinp.handbook/plugin.xml b/org.rodinp.handbook/plugin.xml new file mode 100644 index 0000000..94ac333 --- /dev/null +++ b/org.rodinp.handbook/plugin.xml @@ -0,0 +1,6 @@ +<?xml version='1.0' encoding='ISO-8859-1' ?> +<plugin> + <extension point="org.eclipse.help.toc"> + <toc primary="true" file="eclipse-toc.xml" /> + </extension> +</plugin> diff --git a/org.rodinp.handbook/pom.xml b/org.rodinp.handbook/pom.xml new file mode 100644 index 0000000..4a39907 --- /dev/null +++ b/org.rodinp.handbook/pom.xml @@ -0,0 +1,18 @@ +<?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.rodinp.handbook</groupId> + <artifactId>org.rodinp.handbook.parent</artifactId> + <version>1.0.0.qualifier</version> + <relativePath>../org.rodinp.handbook.parent/pom.xml</relativePath> + </parent> + + <groupId>org.rodinp.handbook</groupId> + <artifactId>org.rodinp.handbook</artifactId> + <version>2.5.0.qualifier</version> + <packaging>eclipse-plugin</packaging> + + </project> -- GitLab