Skip to content

Commit cfc5bf0

Browse files
committed
the gradle build
1 parent 7331aa5 commit cfc5bf0

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

build.gradle

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
repositories {
2+
mavenLocal()
3+
mavenCentral()
4+
maven {
5+
url 'http://maven-eclipse.github.io/maven'
6+
}
7+
}
8+
9+
// these java plugin settings don't really need to be specified since ant does the actual build, but it makes things nicer in an IDE that understands gradle projects
10+
apply plugin: 'java'
11+
12+
sourceCompatibility = '1.8'
13+
targetCompatibility = '1.8'
14+
15+
sourceSets {
16+
main {
17+
java {
18+
srcDirs 'annotations', 'arrays', 'assertions', 'com', 'compression', 'concurrency', 'containers', 'containersindepth', 'control', 'debugging', 'enums', 'exceptions', 'files', 'functional', 'generics', 'hiding', 'housekeeping', 'innerclasses', 'interfaces', 'iostreams', 'logging', 'network', 'newio', 'objects', 'onjava', 'operators', 'patterns', 'polymorphism', 'preferences', 'references', 'remote', 'reuse', 'serialization', 'standardio', 'staticchecking', 'streams', 'strings', 'swt', 'typeinfo', 'ui', 'unittesting'
19+
}
20+
}
21+
}
22+
23+
// fix for a xom / xalan transitive dependency issue: http://stackoverflow.com/a/23870656/77409
24+
configurations.all {
25+
resolutionStrategy {
26+
force 'xml-apis:xml-apis:1.0.b2'
27+
}
28+
}
29+
30+
31+
dependencies {
32+
compile 'org.eclipse.swt:org.eclipse.swt.win32.win32.x86:4.4.2'
33+
compile 'org.eclipse.swt:org.eclipse.swt.win32.win32.x86_64:4.4.2'
34+
compile 'org.eclipse.swt:org.eclipse.swt.gtk.linux.x86:4.4.2'
35+
compile 'org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:4.4.2'
36+
compile 'org.eclipse.swt:org.eclipse.swt.cocoa.macosx.x86_64:4.4.2'
37+
compile 'junit:junit:4.12'
38+
compile 'com.io7m.xom:xom:1.2.10'
39+
}
40+
41+
// this sets the classpath that ant uses to include the dependency jars
42+
ant.properties['java.class.path'] = sourceSets.main.compileClasspath.getAsPath()
43+
44+
// import the ant build and override a few task names
45+
ant.importBuild('build.xml') { antTaskName ->
46+
if (antTaskName == 'build') 'ant-build' // rename ant's build task to ant-build so it doesn't override the gradle task with that name
47+
else if (antTaskName == 'clean') 'ant-clean' // rename ant's clean task to ant-clean so it doesn't override the gradle task with that name
48+
else antTaskName
49+
}
50+
51+
// this task is already defined by gradle so we need to tell it to call the ant clean task
52+
clean << {
53+
tasks['ant-clean'].execute()
54+
}
55+
56+
// this task is already defined by gradle so we need to tell it to call the ant build task
57+
build << {
58+
tasks['ant-build'].execute()
59+
}
60+
61+
defaultTasks 'run'

0 commit comments

Comments
 (0)