-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
61 lines (50 loc) · 1.89 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
// Note: brjsPath is set in gradle.properties
//
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'java'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
version = org.bladerunnerjs.BuildVersionCalculator.calculateVersion(project)
group = 'org.bladerunnerjs.contrib'
logger.info "Build version calculated as: ${version}"
repositories {
mavenCentral()
}
if (!project.hasProperty("brjsPath")) {
throw new GradleException("The property 'brjsPath' must be set in gradle.properties")
}
dependencies {
compile fileTree(dir:brjsPath, include:"sdk/libs/java/system/*.jar")
testCompile 'org.mockito:mockito-core:1.9.0'
testCompile 'org.objenesis:objenesis:1.0'
}
test {
jvmArgs "-XX:MaxPermSize=512m"
}
task copyToConf, type: Copy, dependsOn: jar, {
def brjsConfJavaDir = new File("${brjsPath}/conf/java")
from jar.outputs.files.singleFile
into brjsConfJavaDir
doLast {
println "${project.name} jar copied to ${brjsConfJavaDir.getAbsolutePath()}"
}
}
task copyToBrjs, dependsOn: [copyToConf], {
}
// automatically add brjs-core sources jar for Eclipse classpath
tasks.eclipse.doLast {
try {
def classPathFile = file(".classpath")
String brjsCoreJar = fileTree(dir:"${brjsPath}/sdk/libs/java/system", include:"brjs-core-*.jar").singleFile
String brjsSrcJar = fileTree(dir:"${brjsPath}/sdk/docs/src", include:"brjs-core-*-sources.jar").singleFile
def findString = "path=\"${brjsCoreJar}\""
def replaceString = findString + " sourcepath=\"${brjsSrcJar}\""
if (classPathFile.exists()) {
classPathFile.write( classPathFile.text.replace(findString, replaceString) )
}
} catch (IllegalStateException ex) { // do nothing with the exception, it was probably thrown because the src jar doesnt exist
logger.warn("Warning: Exception was thrown when attempting to add the brjs-core src jar to the classpath. Sources will not be added to the Eclipse classpath.")
logger.debug(ex.toString())
}
}