From 1d7009e3559d8f1dd70a163fb70a5312da8e4896 Mon Sep 17 00:00:00 2001 From: birkhoff <mike.birkhoff@gmx.de> Date: Mon, 2 Apr 2012 19:16:29 +0200 Subject: [PATCH] get ArtifactIds from Manifest file --- build.gradle | 4 ++ de.bmotionstudio.gef.editor/build.gradle | 52 +++++++++++++++++++++++- de.bmotionstudio.rodin/build.gradle | 51 ++++++++++++++++++++++- de.prob.core/build.gradle | 18 +++++--- de.prob.parent/build.gradle | 3 -- de.prob.plugin/build.gradle | 50 ++++++++++++++++++++++- de.prob.repository/build.gradle | 2 +- de.prob.ui/build.gradle | 50 ++++++++++++++++++++++- de.prob2.feature/build.gradle | 21 +++++++--- 9 files changed, 229 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index 43dbf8eb..8ae05df9 100644 --- a/build.gradle +++ b/build.gradle @@ -132,6 +132,10 @@ subprojects { 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 diff --git a/de.bmotionstudio.gef.editor/build.gradle b/de.bmotionstudio.gef.editor/build.gradle index c5a89e9c..ba42248b 100644 --- a/de.bmotionstudio.gef.editor/build.gradle +++ b/de.bmotionstudio.gef.editor/build.gradle @@ -1,3 +1,51 @@ +apply plugin: 'base' + +deploy <<{ + + content = new File("${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.substring(21) + 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(artifactId+'/pom.xml') + f.delete() + f << start()+elder()+repos()+artifact(artifactId, versionNumber)+end() + /* + * old pom.xml files are deleted and replaced by new auto generated Tycho pom.xml files + */ + +} + + + + +/* -- In case of Error use old Build Script -- deploy <<{ @@ -10,7 +58,7 @@ deploy <<{ * 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 - */ + *//* } } @@ -26,4 +74,4 @@ deploy <<{ f.delete() f << start()+elder()+repos()+artifact(artifactId, versionNumber)+end() -} \ No newline at end of file +} */ \ No newline at end of file diff --git a/de.bmotionstudio.rodin/build.gradle b/de.bmotionstudio.rodin/build.gradle index e6f02c69..94332104 100644 --- a/de.bmotionstudio.rodin/build.gradle +++ b/de.bmotionstudio.rodin/build.gradle @@ -1,4 +1,49 @@ +apply plugin: 'base' +deploy <<{ + + content = new File("${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.substring(21) + 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(artifactId+'/pom.xml') + f.delete() + f << start()+elder()+repos()+artifact(artifactId, versionNumber)+end() + /* + * old pom.xml files are deleted and replaced by new auto generated Tycho pom.xml files + */ + +} + + +/* deploy <<{ content = new File("de.bmotionstudio.rodin/META-INF/MANIFEST.MF").getText("UTF-8") @@ -10,7 +55,7 @@ deploy <<{ * 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 - */ + *//* } } @@ -27,4 +72,6 @@ deploy <<{ f.delete() f << start()+elder()+repos()+artifact(artifactId, versionNumber)+end() -} \ No newline at end of file +} + +*/ \ No newline at end of file diff --git a/de.prob.core/build.gradle b/de.prob.core/build.gradle index 401209f8..c8f6efb1 100644 --- a/de.prob.core/build.gradle +++ b/de.prob.core/build.gradle @@ -1,11 +1,13 @@ apply plugin: 'base' deploy <<{ - - content = new File("de.prob.core/META-INF/MANIFEST.MF").getText("UTF-8") + content = new File("${project.name}/META-INF/MANIFEST.MF").getText("UTF-8") + + - printFileLine = { if( it ==~ /Bundle-Version.+qualifier/ ){ + 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 @@ -15,13 +17,19 @@ deploy <<{ */ } + + if( it ==~ /Bundle-SymbolicName:.+/ ){ + artifactId = it.substring(21) + artifactId = artifactId.replace(";singleton:=true",'') + } + /* Artifact ID is taken from Bundle-SymbolicName minus the + * 16 chars ';singleton:=true' + */ } content.eachLine( printFileLine ) - artifactId = 'de.prob.core' - println artifactId println "\t"+versionNumber diff --git a/de.prob.parent/build.gradle b/de.prob.parent/build.gradle index 6b332ad7..be028d57 100644 --- a/de.prob.parent/build.gradle +++ b/de.prob.parent/build.gradle @@ -66,9 +66,6 @@ deploy <<{ versionNumber = '1.0.0.qualifier' artifactId = parentId() - - println projects(2) + numberOfProjects() + projects(1) - def f = new File(artifactId+'/pom.xml') f.delete() diff --git a/de.prob.plugin/build.gradle b/de.prob.plugin/build.gradle index 86ac130a..a40edf01 100644 --- a/de.prob.plugin/build.gradle +++ b/de.prob.plugin/build.gradle @@ -1,4 +1,50 @@ +apply plugin: 'base' +deploy <<{ + + content = new File("${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.substring(21) + 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(artifactId+'/pom.xml') + f.delete() + f << start()+elder()+repos()+artifact(artifactId, versionNumber)+end() + /* + * old pom.xml files are deleted and replaced by new auto generated Tycho pom.xml files + */ + +} + + + +/* deploy <<{ @@ -11,7 +57,7 @@ deploy <<{ * 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 - */ + *//* } } @@ -27,4 +73,4 @@ deploy <<{ f.delete() f << start()+elder()+repos()+artifact(artifactId, versionNumber)+end() -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/de.prob.repository/build.gradle b/de.prob.repository/build.gradle index ab746c32..f6bcac70 100644 --- a/de.prob.repository/build.gradle +++ b/de.prob.repository/build.gradle @@ -21,7 +21,7 @@ def reposi(artifact) { """ deploy <<{ versionNumber = '1.0.0.qualifier' - artifactId = 'de.prob.repository' + artifactId = project.name println artifactId diff --git a/de.prob.ui/build.gradle b/de.prob.ui/build.gradle index 59fef50c..88cff69e 100644 --- a/de.prob.ui/build.gradle +++ b/de.prob.ui/build.gradle @@ -1,4 +1,49 @@ +apply plugin: 'base' +deploy <<{ + + content = new File("${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.substring(21) + 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(artifactId+'/pom.xml') + f.delete() + f << start()+elder()+repos()+artifact(artifactId, versionNumber)+end() + /* + * old pom.xml files are deleted and replaced by new auto generated Tycho pom.xml files + */ + +} + + +/* deploy <<{ content = new File("de.prob.ui/META-INF/MANIFEST.MF").getText("UTF-8") @@ -10,7 +55,7 @@ deploy <<{ * 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 - */ + *//* } } @@ -26,4 +71,5 @@ deploy <<{ f.delete() f << start()+elder()+repos()+artifact(artifactId, versionNumber)+end() -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/de.prob2.feature/build.gradle b/de.prob2.feature/build.gradle index 695a03f7..05a35fa8 100644 --- a/de.prob2.feature/build.gradle +++ b/de.prob2.feature/build.gradle @@ -18,9 +18,13 @@ def feature(artifactId, versionNumber) { """ deploy <<{ - content = new File("de.prob2.feature/feature.xml").getText("UTF-8") + boolean idfound = false - printFileLine = { if( it ==~ /.+version.+qualifier.+/ ){ + content = new File("${project.name}/feature.xml").getText("UTF-8") + + printFileLine = { + + if( it ==~ /.+version.+qualifier.+/ ){ versionNumber = it.substring(15,it.size()-1) // possibile error: cuts off first 15 chars and leaves out last '"' @@ -30,12 +34,19 @@ deploy <<{ */ } + + + if( it ==~ /.+id=".+/ && idfound == false ){ + artifactId = it.substring(10,it.length()-1) + idfound = true + } + /* Artifact ID is taken from Bundle-SymbolicName minus the + * 16 chars ';singleton:=true' + */ } content.eachLine( printFileLine ) - - - artifactId = 'de.prob2.feature' + println artifactId println "\t"+versionNumber -- GitLab