Skip to content

Instantly share code, notes, and snippets.

@Dierk
Created September 15, 2013 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dierk/6566983 to your computer and use it in GitHub Desktop.
Save Dierk/6566983 to your computer and use it in GitHub Desktop.
compile against a special frege version, download and install if not yet there
/**
Making the Frege language available. Compiler and Runtime is all in one jar.
To be completed.
@author Dierk Koenig
*/
apply plugin:'java'
def frege_version = '3.21.190'
def qualifier = 'g714a7cc'
def frege_jar = file(System.properties.'user.home'+"/.frege/home/frege-${frege_version}.jar")
def frege_src_dir = 'src/main/frege'
def frege_build_dir = 'build/frege'
task installFrege(type: Download) {
sourceUrl = "https://github.com/Frege/frege/releases/download/$frege_version/frege$frege_version-${qualifier}.jar"
target = frege_jar
}
task compileFrege(depends:installFrege, type:JavaExec) {
jvmArgs = ["-Xss1m"]
args = ["-d", frege_build_dir, "-sp", frege_src_dir]
new File(frege_src_dir).eachFileRecurse {
if (it.file && it.path.endsWith('.fr')) args += it.path
}
println args
classpath = files(frege_jar)
main = "frege.compiler.Main"
}
class Download extends DefaultTask {
@Input
String sourceUrl
@OutputFile
File target
@TaskAction
void download() {
ant.get(src: sourceUrl, dest: target)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment