Skip to content
Snippets Groups Projects
Commit 01d0e63e authored by Jens Bendisposto's avatar Jens Bendisposto
Browse files

Refactored build process. Replaced ant by gradle

parent 49a7be93
No related branches found
No related tags found
No related merge requests found
Showing
with 78 additions and 148 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="parser"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/kodkod.jar"/>
<classpathentry kind="lib" path="lib/prolog.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
bin/
build/
.gradle/
.settings/
.classpath
.project
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>probkodkod</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
project.version = '1.0.1-SNAPSHOT';
project.group = 'de.stups'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
repositories {
maven {
name "cobra"
url "http://cobra.cs.uni-duesseldorf.de/artifactory/repo"
}
}
configurations {
sablecc
}
sourceSets {
main {
java {
srcDirs = ['build/temp','src/main/java']
}
}
}
sourceSets.test.runtimeClasspath += files(sourceSets.main.java.srcDirs)
dependencies {
sablecc(group: 'de.stups', name: 'sablecc', version: '3.2.7-SNAPSHOT', changing: true)
compile 'de.prob:prologlib:2.4.15'
compile 'kodkod:kodkod:1.0.0'
compile 'org.sat4j:org.sat4j.core:2.3.1'
testCompile 'junit:junit:4.8.2'
}
task genParser(type:JavaExec) {
doFirst{ file('build/temp').mkdirs() }
inputs.dir new File('src/main/resources')
outputs.dir new File('build/temp')
main = 'org.sablecc.sablecc.SableCC'
classpath = configurations.sablecc
maxHeapSize = '1024m'
args = ['-d','build/temp','src/main/resources/problem.grammar']
}
compileJava {
dependsOn = ['genParser']
}
test {
doFirst {
println "testing"
}
}
jar {
from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
manifest {
attributes 'Implementation-Title': 'ProB Kodkod',
'Implementation-Version': project.version,
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version')
}
}
<?xml version="1.0"?>
<project name="probkodkod" default="jar" basedir=".">
<property name="src" value="src"/>
<property name="test" value="test"/>
<property name="build" value="build"/>
<property name="parser" value="parser"/>
<property name="jar" value="${build}/jar"/>
<property name="testbin" value="${build}/testbin"/>
<property name="main.class" value="de.stups.probkodkod.KodkodInteraction"/>
<property name="lib" value="lib"/>
<property name="kodkod" value="${lib}/kodkod.jar"/>
<property name="sat4jjar" value="org.sat4j.core.jar"/>
<property name="sat4j" value="${lib}/${sat4jjar}"/>
<property name="prolog" value="${lib}/prolog.jar"/>
<property name="junit" value="${lib}/junit-4.8.2.jar"/>
<property name="uptodate" value="uptodate"/>
<property name="testresultdir" value="${build}/testresult"/>
<property name="target" value="1.5"/>
<taskdef name="sablecc" classname="org.sablecc.ant.taskdef.Sablecc"/>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${jar}"/>
</target>
<target name="is_uptodate">
<uptodate property="parser.uptodate">
<srcfiles dir="${src}" includes="*.grammar"/>
<mapper type="merge" to="../${parser}/${uptodate}"/>
</uptodate>
</target>
<target name="clear" depends="init">
<delete> <fileset dir="${build}" includes="**/*"/> </delete>
<delete includeemptydirs="yes"> <fileset dir="${parser}" includes="**/*"/> </delete>
</target>
<target name="parser" depends="is_uptodate,init" unless="parser.uptodate" description="Generate the parser classes">
<delete> <fileset dir="${parser}" includes="**/*"/> </delete>
<sablecc src="${src}" includes="*.grammar" outputdirectory="${parser}"/>
<touch file="${parser}/${uptodate}"/>
</target>
<target name="compile" depends="init,parser">
<!-- Compile the java code -->
<javac srcdir="${parser}" destdir="${jar}" debug="true" target="${target}"/>
<javac srcdir="${src}" destdir="${jar}" debug="true" target="${target}">
<classpath location="${kodkod}"/>
<classpath location="${prolog}"/>
</javac>
<copy todir="${jar}">
<fileset dir="${parser}">
<exclude name="**/*.java"/>
<exclude name="${uptodate}"/>
</fileset>
</copy>
</target>
<target name="compiletests" depends="compile">
<mkdir dir="${testbin}"/>
<javac srcdir="${test}" destdir="${testbin}" debug="true" target="${target}">
<classpath location="${kodkod}"/>
<classpath location="${prolog}"/>
<classpath location="${junit}"/>
<classpath location="${jar}"/>
</javac>
<copy todir="${testbin}">
<fileset dir="${test}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="test" depends="compiletests" description="Test">
<mkdir dir="${testresultdir}"/>
<junit haltonerror="true" fork="true">
<classpath location="${testbin}"/>
<classpath location="${kodkod}"/>
<classpath location="${prolog}"/>
<classpath location="${junit}"/>
<classpath location="${sat4j}"/>
<classpath location="${jar}"/>
<jvmarg value="-Djava.library.path=${lib}"/>
<formatter type="plain" usefile="true" />
<batchtest todir="${testresultdir}">
<fileset dir="${testbin}" includes="**/*Test.class"/>
</batchtest>
</junit>
</target>
<target name="manifest" depends="init">
<manifest file="${build}/MANIFEST.MF">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${sat4jjar}"/>
</manifest>
</target>
<target name="jar" depends="clear,test,manifest" description="Build the jar file">
<jar destfile="${build}/probkodkod.jar"
basedir="${jar}"
manifest="${build}/MANIFEST.MF">
<zipfileset src="${kodkod}"/>
<zipfileset src="${prolog}"/>
</jar>
</target>
<target name="tar" depends="jar" description="Build a tar file with all needed files">
<tar destfile="${build}/probkodkod.tar.gz"
compression="gzip">
<tarfileset dir="${build}"> <include name="probkodkod.jar"/> </tarfileset>
<tarfileset dir="${lib}">
<include name="kodkod.jar"/>
<include name="libminisat.so"/>
</tarfileset>
</tar>
</target>
</project>
\ No newline at end of file
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment