diff --git a/.travis.yml b/.travis.yml index 4c551c18215e56f3349f96ab9202e734fddad6d8..476d37985c49fc0ae8db388e6bf479c73c41e2dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,10 +15,13 @@ script: - cd org.rodinp.handbook.feature - ant -file customBuild.xml - cd .. - - cd org.rodinp.handbook.releng - - gradle importHelpPlugin - - cd .. + - cp -r org.rodinp.handbook.feature/build/eclipse/* org.rodinp.handbook/ - mvn -f org.rodinp.handbook.parent/pom.xml install + - mkdir -p current + - cp -r org.rodinp.handbook.feature/build/* current/ + - mkdir -p updatesite + - cp -r org.rodinp.handbook.repository/target/repository/* updatesite/ + - cp org.rodinp.handbook.releng/index.html updatesite/ after_success: - travis-custom-deploy sftp current env: diff --git a/org.rodinp.handbook.releng/build.gradle b/org.rodinp.handbook.releng/build.gradle deleted file mode 100755 index 6bad5b974ca30e6e6e9e19ea4552dd00840c6def..0000000000000000000000000000000000000000 --- a/org.rodinp.handbook.releng/build.gradle +++ /dev/null @@ -1,55 +0,0 @@ -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 from: 'tycho_build.gradle' - -// Local tasks -task importPlugin << { - sourcedir = '../org.rodinp.handbook.feature/build/eclipse' - targetdir = '../org.rodinp.handbook' - delete file(targetdir) - new File(targetdir).mkdirs() - copy { - from sourcedir - into targetdir - } -} - -task deleteOldHelpPlugin(type: Delete) { - String helpPlugin = workspacePath+'org.rodinp.handbook' - delete helpPlugin -} - -task importHelpPlugin(type:Copy) { - from workspacePath+'org.rodinp.handbook.feature/build/eclipse' - into workspacePath+'org.rodinp.handbook' -} - -task deleteOldArtifacts(type: Delete) { - String updateSite = workspacePath+'updatesite' - delete updateSite -} - -task collectArtifacts() << { - copy { - from workspacePath+groupID+'.feature/build/' - into workspacePath+'current' - } - copy { - from workspacePath+groupID+'.repository/target/repository/' - into workspacePath+'updatesite' - } - copy { - from "index.html" - into workspacePath+'updatesite' - } -} diff --git a/org.rodinp.handbook.releng/tycho_build.gradle b/org.rodinp.handbook.releng/tycho_build.gradle deleted file mode 100755 index 8961d78f868bc4cba62894824a3fe54f031f00a7..0000000000000000000000000000000000000000 --- a/org.rodinp.handbook.releng/tycho_build.gradle +++ /dev/null @@ -1,452 +0,0 @@ -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' - - - -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 -*/ - - -///////////////////////////////////////////////////////////////////////////////////////// -// -- !!! DEFINING SUB PROJECTS !!! -- // -///////////////////////////////////////////////////////////////////////////////////////// - -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. - * 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") - - 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() - 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") - - printFileLine = { - - if( it ==~ /.+version.+qualifier.+/ ){ - 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 - * 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=", '') - artifactId = artifactId.replace(" ", '') - artifactId = artifactId.replace('"', '') - idfound = true - } - - } - - content.eachLine( printFileLine ) - - - println artifactId - println "\t"+versionNumber - - - def f = new File(workspacePath+artifactId+'/pom.xml') - f.delete() - f << feature(artifactId, versionNumber) - - } - - } - } - - - -}// defining subprojects - - -clean { - dependsOn += subprojects.deleteArtifacts -} - -task createParent() << { - // --------- define Parent --------- // - - new File(workspacePath+"${parentID}").mkdir() - versionNumber = '1.0.0.qualifier' - 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++){ - f << module(projects(i)) - } - f << module(repositoryName) - f << endParent() - -} - -task createRepository() << { - - // ------------ define Repository --------- // - - - 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') - f.delete() - f << categoryHead() - for(int i = 0; i < features.size(); i++){ - - content = new File("${workspacePath}${features[i]}/feature.xml").getText("UTF-8") - boolean idfound = false - printFileLine = { - if( it ==~ /.+version.+qualifier.+/ ){ - featureVersionNumber = it - featureVersionNumber = featureVersionNumber.replace(" ", '') - featureVersionNumber = featureVersionNumber.replace("version=", '') - featureVersionNumber = featureVersionNumber.replace('"', '') - - - } - - - if( it ==~ /.+id=".+/ && idfound == false ){ - featureArtifactId = it - featureArtifactId = featureArtifactId.replace("id=", '') - featureArtifactId = featureArtifactId.replace(" ", '') - 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') - 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' -} - - -//--- Defining Tycho POM parts --// - - - def artifact(artifactId,versionNumber) { """ - <groupId>${groupId()}</groupId> - <artifactId>${artifactId}</artifactId> - <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> - <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>0.14.1</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>0.14.1</version> - <extensions>true</extensions> - </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> - </project> -"""} - - -// 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 - - -// Build Script can be executed via gradle install -// Pom Generation can be executed via gradle deploy