Commit 77e913c1 authored by dgelessus's avatar dgelessus
Browse files

Fix dubious indents and formatting in Gradle scripts

parent 012a9ec3
Pipeline #66413 passed with stages
in 4 minutes and 46 seconds
// to trigger a full tycho build please use 'gradle deleteFromClassPath completeInstall'
import org.apache.tools.ant.taskdefs.condition.Os
project.ext{
targetRepositories = ["http://download.eclipse.org/releases/luna/",
"http://rodin-b-sharp.sourceforge.net/updates",
"https://www3.hhu.de/stups/buildlibs/org.rodinp.dev/"]
project.ext {
targetRepositories = [
"http://download.eclipse.org/releases/luna/",
"http://rodin-b-sharp.sourceforge.net/updates",
"https://www3.hhu.de/stups/buildlibs/org.rodinp.dev/",
]
groupID = "de.prob"
}
......@@ -16,7 +17,6 @@ apply from: 'tycho_build.gradle'
/*task bMotionStudioHelpCustumBuild(type: Exec){
commandLine 'ant', '-f','de.bmotionstudio.help/customBuild.xml'
}
......@@ -25,26 +25,23 @@ install.dependsOn bMotionStudioHelpCustumBuild
completeInstall.dependsOn bMotionStudioHelpCustumBuild*/
project(':de.prob.core') {
repositories {
mavenCentral()
mavenCentral()
}
def parser_version = '2.5.1'
def parser_version = '2.5.1'
dependencies {
compile group: "de.hhu.stups", name: "answerparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "bparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "cliparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "ltlparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "parserbase", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "prologlib", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "unicode", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "theorymapping", version: parser_version , changing: true
compile 'commons-lang:commons-lang:2.6'
compile group: "de.hhu.stups", name: "answerparser", version: parser_version, changing: true
compile group: "de.hhu.stups", name: "bparser", version: parser_version, changing: true
compile group: "de.hhu.stups", name: "cliparser", version: parser_version, changing: true
compile group: "de.hhu.stups", name: "ltlparser", version: parser_version, changing: true
compile group: "de.hhu.stups", name: "parserbase", version: parser_version, changing: true
compile group: "de.hhu.stups", name: "prologlib", version: parser_version, changing: true
compile group: "de.hhu.stups", name: "unicode", version: parser_version, changing: true
compile group: "de.hhu.stups", name: "theorymapping", version: parser_version, changing: true
compile 'commons-lang:commons-lang:2.6'
}
}
project(':de.prob.ui') {
......@@ -52,98 +49,95 @@ project(':de.prob.ui') {
mavenCentral()
}
dependencies {
compile 'commons-codec:commons-codec:1.8'
compile 'commons-codec:commons-codec:1.8'
}
}
def download(address,target) {
def file = new FileOutputStream(target)
def out = new BufferedOutputStream(file)
out << new URL(address).openStream()
out.close()
def file = new FileOutputStream(target)
def out = new BufferedOutputStream(file)
out << new URL(address).openStream()
out.close()
}
task downloadCli {
task downloadCli {
doLast{
def dir = workspacePath+'de.prob.core/prob/'
def dir = workspacePath + 'de.prob.core/prob/'
delete file(dir)
new File(dir).mkdirs()
new File(dir).mkdirs()
['leopard64':'macos','linux32':'linux','linux64':'linux64','win64':'windows'].each {
def n = it.getKey()
def targetdir = dir+it.getValue()
def targetzip = dir+"probcli_${n}.zip"
def url = "https://www3.hhu.de/stups/downloads/prob/cli/nightly/probcli_${n}.zip"
download(url,targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
def n = it.getKey()
def targetdir = dir + it.getValue()
def targetzip = dir + "probcli_${n}.zip"
def url = "https://www3.hhu.de/stups/downloads/prob/cli/nightly/probcli_${n}.zip"
download(url, targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
delete file(targetzip)
}
def targetdir = dir + "windows/"
def targetzip = targetdir + "windowslib64.zip"
download("https://www3.hhu.de/stups/downloads/prob/cli/nightly/windowslib64.zip",targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
delete file(targetzip)
}
def targetdir = dir+"windows/"
def targetzip = targetdir+"windowslib64.zip"
download("https://www3.hhu.de/stups/downloads/prob/cli/nightly/windowslib64.zip",targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
delete file(targetzip)
}
}
task downloadCli2 (type: Exec) {
def dir = workspacePath + 'de.prob.core/prob/'
delete file(dir)
new File(dir).mkdirs()
task downloadCli2 ( type: Exec ) {
def dir = workspacePath+'de.prob.core/prob/'
delete file(dir)
new File(dir).mkdirs()
['leopard64':'macos','linux32':'linux','linux64':'linux64','win64':'windows'].each {
['leopard64':'macos','linux32':'linux','linux64':'linux64','win64':'windows'].each {
def n = it.getKey()
def targetdir = dir+it.getValue()
def targetzip = dir+"probcli_${n}.zip"
def targetdir = dir + it.getValue()
def targetzip = dir + "probcli_${n}.zip"
def url = "https://www3.hhu.de/stups/downloads/prob/cli/nightly//probcli_${n}.zip"
download(url,targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
download(url, targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
delete file(targetzip)
}
def targetdir = dir+"windows/"
def targetzip = targetdir+"windowslib64.zip"
download("https://www3.hhu.de/stups/downloads/prob/cli/nightly/windowslib64.zip",targetzip)
def targetdir = dir + "windows/"
def targetzip = targetdir + "windowslib64.zip"
download("https://www3.hhu.de/stups/downloads/prob/cli/nightly/windowslib64.zip", targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
copy {
from zip
into targetdir
}
delete file(targetzip)
}
completeInstall.dependsOn downloadCli
completeInstall.dependsOn subprojects.setClassPath
task deleteOldArtifacts(type: Delete) {
String updateSite = workspacePath+'updatesite'
String updateSite = workspacePath + 'updatesite'
delete updateSite
}
task collectArtifacts(type:Copy) {
from workspacePath + groupID+'.repository/target/repository/'
into workspacePath + 'updatesite'
from workspacePath + "index.html"
into workspacePath + 'updatesite'
task collectArtifacts(type: Copy) {
from workspacePath + groupID + '.repository/target/repository/'
into workspacePath + 'updatesite'
from workspacePath + "index.html"
into workspacePath + 'updatesite'
}
......@@ -3,17 +3,17 @@ apply plugin: 'java'
def parser_version = '2.5.1'
dependencies {
compile group: "de.hhu.stups", name: "answerparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "bparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "cliparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "ltlparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "parserbase", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "prologlib", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "unicode", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "theorymapping", version: parser_version , changing: true
compile 'commons-lang:commons-lang:2.6'
compile 'commons-codec:commons-codec:1.8'
compile 'com.thoughtworks.xstream:xstream:1.4.7'
compile group: 'net.java.dev.jna', name: 'jna', version: '3.4.0'
compile group: 'de.hhu.stups', name: 'ptolemy-jfmi', version: '1.1.0'
compile group: "de.hhu.stups", name: "answerparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "bparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "cliparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "ltlparser", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "parserbase", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "prologlib", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "unicode", version: parser_version , changing: true
compile group: "de.hhu.stups", name: "theorymapping", version: parser_version , changing: true
compile 'commons-lang:commons-lang:2.6'
compile 'commons-codec:commons-codec:1.8'
compile 'com.thoughtworks.xstream:xstream:1.4.7'
compile group: 'net.java.dev.jna', name: 'jna', version: '3.4.0'
compile group: 'de.hhu.stups', name: 'ptolemy-jfmi', version: '1.1.0'
}
......@@ -3,11 +3,10 @@ import org.apache.tools.ant.taskdefs.condition.Os
Build Script can be executed via 'gradle install'
Build Script Dependencies can be downloaded via 'gradle collectDepenencies'
Executing the Build Script and download Dependencies can be executed via 'gradle completeInstall'
For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath'
For a complete classPath Refresh please execute 'gradle deleteFromClassPath setClassPath'
Pom Generation can be executed via gradle deploy
If you have a product definition please add a buildProduct = true to your main build.gradle script
*/
......@@ -16,663 +15,604 @@ apply plugin: 'base'
import groovy.io.FileType
project.ext.tychoVersion = "1.0.0"
try{
try {
excludeFromTychoBuild = excludeFromTychoBuild
}catch(MissingPropertyException e){
} catch (MissingPropertyException e) {
project.ext.excludeFromTychoBuild = []
}
try{
try {
excludeFromClassPath = excludeFromClassPath
}catch(MissingPropertyException e){
} catch (MissingPropertyException e) {
project.ext.excludeFromClassPath = []
}
try{
try {
workspacePath = workspacePath
}catch(MissingPropertyException e){
} catch (MissingPropertyException e) {
project.ext.workspacePath = ""
}
try{
try {
dependencyFolder = dependencyFolder
}catch(MissingPropertyException e){
project.ext.dependencyFolder = "lib/dependencies/" // Folder in each subproject where
} catch (MissingPropertyException e) {
project.ext.dependencyFolder = "lib/dependencies/" // Folder in each subproject where
}
try{
try {
groupID = groupID
}catch(MissingPropertyException e){
} catch (MissingPropertyException e) {
// workspace nach releng durchsuchen
def folderNames = []
def folders = []
println "folders:"
new File(workspacePath+".").listFiles().each{ dir ->
if( dir.isDirectory() ) folders << dir.getName()
new File(workspacePath+".").listFiles().each{dir ->
if (dir.isDirectory()) {
folders << dir.getName()
}
}
folders.each(){ it ->
folders.each { it ->
it = (String)it.replaceFirst(/\.\//, "")
if( !( ( it ==~ /\..+/ ) || (it ==~ /.*.repository/) || (it ==~ /.*.parent/) ) ) folderNames << it // subProjects eventuell unnötig settings.gradle datei stattdessen benutzen
// subProjects eventuell unnötig settings.gradle datei stattdessen benutzen
if (!(it ==~ /\..+/ || it ==~ /.*.repository/ || it ==~ /.*.parent/)) {
folderNames << it
}
}
project.ext.groupID = "group"
for( int i = 0; i < folderNames.size(); i++ ){
if( folderNames[i] ==~ /.*\.[rR]eleng/ ){
for (int i = 0; i < folderNames.size(); i++) {
if (folderNames[i] ==~ /.*\.[rR]eleng/) {
groupID = folderNames[i]
groupID = groupID.replace( ".releng", "")
groupID = groupID.replace( ".Releng", "")
groupID = groupID.replace(".releng", "")
groupID = groupID.replace(".Releng", "")
}
}
}
try{
try {
features = features
}catch(MissingPropertyException e){
} catch (MissingPropertyException e) {
project.ext.features = []
for( int i = 0; i < subprojects.name.size(); i++ ){
if( subprojects.name[i] ==~ /.*\.[fF]eature/ ){
features.add( subprojects.name[i] )
for (int i = 0; i < subprojects.name.size(); i++){
if (subprojects.name[i] ==~ /.*\.[fF]eature/) {
features.add(subprojects.name[i])
}
}
}
try{
try {
repositoryName = repositoryName
}catch(MissingPropertyException e){
project.ext.repositoryName = groupID+".repository"
} catch (MissingPropertyException e) {
project.ext.repositoryName = groupID + ".repository"
}
try{
try {
parentID = parentID
}catch(MissingPropertyException e){
project.ext.parentID = groupID+".parent"
} catch (MissingPropertyException e) {
project.ext.parentID = groupID + ".parent"
}
Boolean noDescriptions = false // in case of using own CategoryDescription Map
Boolean noDescriptions = false // in case of using own CategoryDescription Map
try{
try {
categoryDescriptions = categoryDescriptions
}catch(MissingPropertyException e){
project.ext.categoryDescriptions = [ [:],[:] ] // label and descriptions of the features
} catch (MissingPropertyException e) {
project.ext.categoryDescriptions = [[:], [:]] // label and descriptions of the features
noDescriptions = true
} // categoryDescriptions = [["feature": "labelName","feature2": "label"],["feature": "featureDescription","feature2": "feature2Description"]] // label and descriptions of the features
// categoryDescriptions = [["feature": "labelName", "feature2": "label"], ["feature": "featureDescription", "feature2": "feature2Description"]] // label and descriptions of the features
}
try{
try {
targetRepositories = targetRepositories
}catch(MissingPropertyException e){
} catch (MissingPropertyException e) {
project.ext.targetRepositories = ["http://download.eclipse.org/releases/luna/"]
}
try{
try {
buildProduct = buildProduct
}catch(MissingPropertyException e){
} catch (MissingPropertyException e) {
project.ext.buildProduct = false
}
def projects(int i){
return subprojects.name[i]
// returns the name of a subproject listed in the settings.gradle file
def projects(int i) {
return subprojects.name[i]
}
// returns the name of a subproject listed in the settings.gradle file
def numberOfProjects(){
// returns the number of projects 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(){
// This is the project of the parent Pom
// The Tycho Maven Build is triggered from this project's pom
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(){
// This Group ID will be used in every sub project
def groupId() {
return groupID
}
/*
* This Group ID will be used in every sub project
*/
def addLibToCP(def project, def libPar){
def filePar = new File(workspacePath+project+"/.classpath")
// Add certain Jar to Library
def addLibToCP(def project, def libPar) {
def filePar = new File(workspacePath + project + "/.classpath")
boolean notYetAdded = true
filePar.eachLine{ line ->
filePar.eachLine {line ->
def pattern = ".*${dependencyFolder}${libPar}.*"
if(line ==~ /${pattern}/){
if (line ==~ /${pattern}/) {
notYetAdded = false
}
}
if(notYetAdded){
File newCP = new File(workspacePath+project+'/.cp')
filePar.eachLine{ line ->
if(line ==~ /.*<\/classpath>.*/){
String entry = '\t<classpathentry exported="true" kind="lib" path="'+dependencyFolder+libPar+'"/>'+'\n</classpath>\n'
if (notYetAdded) {
File newCP = new File(workspacePath + project + '/.cp')
filePar.eachLine {line ->
if (line ==~ /.*<\/classpath>.*/) {
String entry = '\t<classpathentry exported="true" kind="lib" path="' + dependencyFolder + libPar + '"/>' + '\n</classpath>\n'
line = line.replaceAll(/<\/classpath>/, entry)
println project + " : "+ libPar +" added to classpath"
println project + " : " + libPar + " added to classpath"
newCP << line
}else{
newCP << line+"\n"
} else {
newCP << line + "\n"
}
}
filePar.delete()
newCP.renameTo(workspacePath+project+'/.classpath')
}else{
println project + " : "+ libPar +" classpath entry already present"
newCP.renameTo(workspacePath + project + '/.classpath')
} else {
println project + " : " + libPar + " classpath entry already present"
}
}
// Add certain Jar to Library
def deleteLibFromCP(def project){
def filePar = new File(workspacePath+project+"/.classpath")
// deletes whole DependenciesLibrary Folder
def deleteLibFromCP(def project) {
def filePar = new File(workspacePath + project + "/.classpath")
boolean deleteCP = false
def newCP = new File(workspacePath+project+'/cp')
def newCP = new File(workspacePath + project + '/cp')
def pattern = ".*${dependencyFolder}[^<].*/>"
filePar.eachLine{ line ->
if(line ==~ /\n(\ |\t)*/) line = line.replaceAll(/\n(\ |\t)*/, '') // delete empty lines
if(line ==~ /${pattern}/){
filePar.eachLine {line ->
if (line ==~ /\n(\ |\t)*/) {
// delete empty lines
line = line.replaceAll(/\n(\ |\t)*/, '')
}
if (line ==~ /${pattern}/) {
deleteCP = true
def pattern2 = '(\\ |\\t)*<classpathentry exported="true" kind="lib" path="'+dependencyFolder+"[^<].*"+'"/>(\\ |\\t)*'
def pattern2 = '(\\ |\\t)*<classpathentry exported="true" kind="lib" path="' + dependencyFolder + "[^<].*"+'"/>(\\ |\\t)*'
line = line.replaceAll(/${pattern2}/, '')
newCP << line
}else{
} else {
newCP << line+"\n"
}
}
if(!deleteCP){
println project + " : no dependencies from "+ dependencyFolder+" found in classpath file! "
if (!deleteCP) {
println project + " : no dependencies from " + dependencyFolder + " found in classpath file! "
newCP.delete()
}else{
} else {
filePar.delete()
newCP.renameTo(workspacePath+project+'/.classpath')
println workspacePath+project+'/.classpath' +"!"
newCP.renameTo(workspacePath + project + '/.classpath')
println workspacePath + project + '/.classpath' + "!"
}
}
// deletes whole DependenciesLibrary Folder
def addRunTimeLib( String libPar, String projectPar){
def mf = new File(projectPar+"/META-INF/MANIFEST.MF")
def newMf = new File(projectPar+"/MF")
// Adds a Library to the current Bundle-ClassPath of the Manifest file
def addRunTimeLib(String libPar, String projectPar) {
def mf = new File(projectPar + "/META-INF/MANIFEST.MF")
def newMf = new File(projectPar + "/MF")
newMf.delete()
mf.eachLine{ line ->
if(line ==~ /.*Bundle-ClassPath:.*\.jar.*/){
mf.eachLine {line ->
if (line ==~ /.*Bundle-ClassPath:.*\.jar.*/) {
libsInLine = line.replaceAll(/[\ \t]*Bundle-ClassPath:[\ \t]*/, '')
line = line.replaceFirst(/[^\ \t]*\.jar[\ \,]*/, dependencyFolder+libPar+",\n "+libsInLine) // /[^\ \t]*.\.jar[\ \,]*/
}else{
if(line ==~ /.*Bundle-ClassPath: \.[\ \t]*/){
line = line+",\n "+dependencyFolder+libPar
}else{
if( line ==~ /.*Bundle-ClassPath: \.\,[\ \t]*/ ){
line = line+"\n "+dependencyFolder+libPar+","
}
line = line.replaceFirst(/[^\ \t]*\.jar[\ \,]*/, dependencyFolder + libPar + ",\n " + libsInLine) // /[^\ \t]*.\.jar[\ \,]*/
} else {
if (line ==~ /.*Bundle-ClassPath: \.[\ \t]*/) {
line = line + ",\n " + dependencyFolder + libPar
} else if (line ==~ /.*Bundle-ClassPath: \.\,[\ \t]*/) {
line = line + "\n " + dependencyFolder + libPar + ","
}
}
newMf << line+"\n"
newMf << line + "\n"
}
mf.delete()
newMf.renameTo(projectPar+"/META-INF/MANIFEST.MF")
} // Adds a Library to the current Bundle-ClassPath of the Manifest file
newMf.renameTo(projectPar + "/META-INF/MANIFEST.MF")
}
def createRunTimeLib(String libPar, String projectPar){
def mf = new File(projectPar+"/META-INF/MANIFEST.MF")
mf << "Bundle-ClassPath: lib/dependencies/"+libPar
} // Creates a Bundle-ClassPath Section in the Manifest file
// Creates a Bundle-ClassPath Section in the Manifest file
def createRunTimeLib(String libPar, String projectPar) {
def mf = new File(projectPar + "/META-INF/MANIFEST.MF")
mf << "Bundle-ClassPath: lib/dependencies/" + libPar
}
def boolean checkForRunTimeLibs(String projectPar){