-
Notifications
You must be signed in to change notification settings - Fork 19
/
build.gradle
115 lines (95 loc) · 3.1 KB
/
build.gradle
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
apply plugin: 'java'
apply plugin: 'idea'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.6.1'
}
}
repositories {
mavenCentral()
maven {
url "https://swt-repo.googlecode.com/svn/repo/"
}
}
apply from: 'gradle/publish.gradle'
apply from: 'gradle/swt.gradle'
apply from: 'gradle/integTest.gradle'
apply from: 'gradle/example.gradle'
defaultTasks 'build'
public String getPlatform(String platform) {
switch (platform.replaceAll(' ', '').toLowerCase()) {
case ~/.*linux.*/: return 'linux'
case ~/.*darwin.*/: return 'darwin'
case ~/.*osx.*/: return 'darwin'
case ~/.*win.*/: return 'windows'
default: return null
}
}
ext {
swtVersion = '4.3'
swtArtifactName = "org.eclipse.swt.${swtWindowingLibrary}.${swtPlatform}.${swtArch}"
platform = getPlatform(System.properties['os.name'])
}
dependencies {
compile "org.eclipse.swt:${swtArtifactName}:${swtVersion}"
compile "org.projectlombok:lombok:1.16.12"
compile "com.google.guava:guava:20.0"
testCompile "junit:junit:4.11"
testCompile "org.mockito:mockito-all:1.9.5"
examplesCompile "org.reflections:reflections:0.9.9-RC1"
}
task ragel() {
inputs.dir 'src/main/resources/ragel'
ext.ragelOutputDir = file('build/generated-src/java/com/readytalk/swt/text/tokenizer')
outputs.dir ragelOutputDir
doFirst {
def ragelPath = "ragel"
def command = "which ragel"
if (platform == 'windows') {
command = "where ragel"
}
def proc = command.execute()
proc.waitFor()
def rpath = "${proc.in.text}"
if (rpath != null && rpath.length() > 0 && rpath.contains('ragel')) {
ragelPath = rpath.trim()
ragelOutputDir.mkdirs()
} else {
logger.warn('')
logger.warn('The Ragel finite-state machine compiler could not be found on the path.')
logger.warn('This must be installed for compilation to succeed.')
logger.warn('To install:')
logger.warn(' - Debian & Debian Variants: sudo apt-get install ragel')
logger.warn(' - OS X with Homebrew: brew install ragel')
logger.warn(' - Windows: download from http://www.jgoettgens.de/Meine_Bilder_und_Dateien/ragel-vs2012.7z')
logger.warn('For more installation information, please visit http://www.complang.org/ragel/')
logger.warn('')
throw new GradleException('Please install ragel to continue.')
}
// Run ragel on all input files
inputs.getFiles().each { File file ->
(ragelPath + ' -J -o ' + (ragelOutputDir.getPath() + '/' + file.name - '.rl' + ' ') + file).execute()
}
}
}
compileJava {
dependsOn ragel
source = ['src/main/java', 'build/generated-src/java']
options.fork = true
}
tasks.withType(JavaCompile) {
sourceCompatibility = 1.6
targetCompatibility = 1.6
options.bootClasspath = "${System.env.JAVA6_HOME}/jre/lib/rt.jar"
options.bootClasspath += "${File.pathSeparator}${System.env.JAVA6_HOME}/jre/lib/jsse.jar"
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
task getVersion << {
println version
}
apply from: 'gradle/idea.gradle'