Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 147 lines (121 sloc) 3.694 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'eclipse-wtp'

def leTime = System.currentTimeMillis()

repositories {
    maven {
      name "cobra"
      url "http://cobra.cs.uni-duesseldorf.de/artifactory/repo"
    }
}

configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

dependencies {
   compile(group: 'de.prob', name: 'de.prob.core.kernel', version: '2.0.0-milestone-9-SNAPSHOT')
 // compile group: 'de.prob', name: 'cli', version: '2.0.0-milestone-4-SNAPSHOT', changing: true
compile "javax.servlet:servlet-api:2.5"
compile 'com.google.inject.extensions:guice-servlet:3.0'
compile 'com.google.code.gson:gson:1.7.1'
compile 'de.prob:tla2b:1.0.3-SNAPSHOT'
compile 'com.microsoft:tla2tools:1.4.6'
}

sourceSets {
main {
compileClasspath += fileTree(dir: './libs', includes: ['**/tla.jar'])
runtimeClasspath += fileTree(dir: './libs', includes: ['**/tla.jar'])

}

}



def prettyName(String name) {
String r1 = name.replaceAll("_", " ");
StringBuffer sb = new StringBuffer();
boolean upperCaseAllowed = true;
for (int i = 0; i < r1.length(); i++) {
char c = r1.charAt(i);
if (!Character.isLowerCase(c)) {
if (!upperCaseAllowed) {
sb.append(" ");
}
upperCaseAllowed = true;
} else
upperCaseAllowed = false;
sb.append(c);
}
return sb.toString();
}

task examples << {
result = [:]
files { new File("examples").listFiles() }.each {
formalism ->
examples = new TreeMap()
formalism.listFiles().each {
examples[prettyName(it.name)] = it.text
}
result[formalism.getName()] = examples
}
   def output = new groovy.json.JsonBuilder(result).toString()
   def out = new File('src/main/resources/javascripts/examples.js')
   if (out.exists()) out.delete()
   out << "example_list = "+output;
}


processResources {
dependsOn examples
doLast{
def out = new File('src/main/java/de/prob/web/TimeStamp.java')
if (out.exists()) out.delete()
out << 'package de.prob.web;\npublic class TimeStamp { \n public static final String TIME="'+leTime+'"; \n}'
new File('src/main/webapp/js/').listFiles().each { if (it.getName().startsWith("javascripts")) it.deleteDir() }
new File('src/main/webapp/css/').listFiles().each { if (it.getName().startsWith("stylesheets")) it.deleteDir() }
copy {
from 'src/main/resources/javascripts'
into 'src/main/webapp/js/javascripts_'+leTime
}
copy {
from 'src/main/resources/stylesheets'
into 'src/main/webapp/css/stylesheets_'+leTime
}
}
}

def download(address,target) {
def file = new FileOutputStream(target)
def out = new BufferedOutputStream(file)
out << new URL(address).openStream()
out.close()
}

task downloadCli << {
dir = 'src/main/webapp/probcli/'
delete file(dir)
new File(dir).mkdirs()

['leopard64':'macos','linux':'linux','linux64':'linux64','win32':'windows'].each {
n = it.getKey()

targetdir = dir+it.getValue()
targetzip = dir+"probcli_${n}.zip"
url = "http://nightly.cobra.cs.uni-duesseldorf.de/cli/probcli_${n}.zip"
download(url,targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
delete file(targetzip)
}

targetdir = dir+"windows/"
targetzip = targetdir+"windowslib.zip"
download("http://nightly.cobra.cs.uni-duesseldorf.de/cli/windowslib.zip",targetzip)
FileTree zip = zipTree(targetzip)
copy {
from zip
into targetdir
}
delete file(targetzip)


}

war {
manifest {
attributes 'Class-Path': "./lib/tla.jar"
}
}


compileJava.dependsOn processResources
war.dependsOn downloadCli


httpPort = 8080
stopPort = 9451
stopKey = 'foo'
Something went wrong with that request. Please try again.