diff --git a/build.gradle b/build.gradle index 8d42db5c12775203b8ed0dce56009c8e8b348588..8618cc881345810b157da09f30dcb30927ce9d9f 100644 --- a/build.gradle +++ b/build.gradle @@ -60,6 +60,13 @@ def download(address,target) { out.close() } +def projects(int i){ + return subprojects.name[i] +} + +def numberOfProjects(){ + return subprojects.name.size() +} task downloadCli << { dir = 'de.prob.core/prob/' @@ -83,14 +90,17 @@ task downloadCli << { } +def parentId(){ + return "de.prob.parent" +} subprojects { apply plugin: 'base' - + task deploy(){ - description = "\tGenerating the Tycho Poms" + description = "\tGenerating the Tycho Poms. Please remember to add a '.qualifier' to the version numbers!" - versionNumber = 'Version Number Error: check Manifest for Bundle-Version Number' + versionNumber = 'Version Number Error:\tcheck Manifest for Bundle-Version Number and make sure to add a ".qualifier" to the version numbers!\n' /* -- In case of changed Manifest File in Eclipse: * * Version Numbers of the projects are collected via @@ -119,6 +129,16 @@ clean { } +task install(dependsOn: [createPoms, downloadCli] , type:Exec) { + description = "\tExecutes a 'mvn install' of the parent pom.xml and auto-generates Tycho Poms" + + + commandLine 'mvn', 'install', '-f', 'de.prob.parent/pom.xml' + +} + + + // Build Script can be executed via gradle install // Pom Generation can be executed via gradle deploy diff --git a/de.prob.parent/build.gradle b/de.prob.parent/build.gradle index 4c64fdf9d6704bd03b208dbfb34910038982db30..20ea06862197d3582747df7f7bb41c58ae3b74eb 100644 --- a/de.prob.parent/build.gradle +++ b/de.prob.parent/build.gradle @@ -1,3 +1,92 @@ + 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>de.prob</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 --> + <repository> + <id>prob_target</id> + <layout>p2</layout> + <url>http://cobra.cs.uni-duesseldorf.de/prob_dev_target/</url> + </repository> + + + <repository> + <id>indigo</id> + <layout>p2</layout> + <url>http://download.eclipse.org/releases/indigo/</url> + </repository> + + </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> + + <!-- the modules that should be built together --> + <modules> + """} + +//for(int i = 0; i < numberOfProjects(); i++) + +def module(int i){ + if(projects(i)!=parentId()){""" <module>../${projects(i)}</module> +"""}else{""""""} +} + + +def endParent() {""" + </modules> +</project> + """} + + +deploy <<{ + + versionNumber = '1.0.0.qualifier' + artifactId = 'de.prob.parent' + + println projects(2) + numberOfProjects() + projects(1) + + + def f = new File(artifactId+'/pom.xml') + f.delete() + f << parentPom(artifactId) + for(int i = 0; i < numberOfProjects(); i++){ + f << module(i) + } + f << endParent() + +} + + + + +/* + +!!!!! In case of problems the old parernt Pom Defenintion: !!!! + def parentPom() { """ <?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"> @@ -59,16 +148,6 @@ </modules> </project> """} +*/ -deploy <<{ - - versionNumber = '1.0.0.qualifier' - artifactId = 'de.prob.parent' - - - - def f = new File(artifactId+'/pom.xml') - f.delete() - f << parentPom() - -} \ No newline at end of file + \ No newline at end of file