Skip to content
Snippets Groups Projects
Commit fcd6272c authored by birkhoff's avatar birkhoff
Browse files

Auto Generation of modules in parent.pom

parent bf914255
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
def parentPom() { """
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>de.prob.parent</artifactId>
<artifactId>${artifactId}</artifactId>
<version>1.0.0.qualifier</version>
<packaging>pom</packaging>
......@@ -46,29 +46,108 @@
<!-- the modules that should be built together -->
<modules>
<module>../de.prob.core</module>
"""}
<module>../de.bmotionstudio.gef.editor</module>
<module>../de.bmotionstudio.rodin</module>
<module>../de.prob.ui</module>
<module>../de.prob.plugin</module>
<!-- <module>../de.prob.feature</module> -->
<module>../de.prob2.feature</module>
<module>../de.prob.repository</module>
//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()
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">
<modelVersion>4.0.0</modelVersion>
<groupId>de.prob</groupId>
<artifactId>de.prob.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 -->
<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>
<module>../de.prob.core</module>
<module>../de.bmotionstudio.gef.editor</module>
<module>../de.bmotionstudio.rodin</module>
<module>../de.prob.ui</module>
<module>../de.prob.plugin</module>
<!-- <module>../de.prob.feature</module> -->
<module>../de.prob2.feature</module>
<module>../de.prob.repository</module>
</modules>
</project>
"""}
*/
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment