-
-
Notifications
You must be signed in to change notification settings - Fork 299
Expand file tree
/
Copy pathbuild.gradle
More file actions
102 lines (85 loc) · 3.45 KB
/
build.gradle
File metadata and controls
102 lines (85 loc) · 3.45 KB
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
import java.nio.file.Files
import org.zeroturnaround.zip.ZipUtil
import org.apache.commons.io.FileUtils
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
plugins {
id 'java'
}
// Extend compile to copy the jars from gradle-tooling and slf4j:
// https://stackoverflow.com/a/43602463
configurations {
implementationCopy
implementationExtract
}
dependencies {
// implementation group: "org.processing", name: "core", version: "${processingVersion}"
// implementation group: "org.processing", name: "pde", version: "${processingVersion}"
// implementation group: "org.processing", name: "java-mode", version: "${processingVersion}"
implementationExtract "org.eclipse.jdt:org.eclipse.jdt.debug:${jdtVersion}"
implementationCopy "org.gradle:gradle-tooling-api:${toolingVersion}"
implementationCopy "org.slf4j:slf4j-api:${slf4jVersion}"
implementationCopy "org.slf4j:slf4j-simple:${slf4jVersion}"
implementation fileTree(include: ["jdi.jar", "jdimodel.jar", "core.jar", "pde.jar", "JavaMode.jar"], dir: 'mode')
}
// This task copies the gradle tooling jar into the mode folder
tasks.register("copyToLib", Copy) {
from(configurations.implementationCopy)
into("mode")
}
tasks.named('build') {
dependsOn 'copyToLib'
}
tasks.named('compileJava') {
dependsOn 'copyToLib'
}
sourceSets.main.java.srcDir("src/")
tasks.register('getjdi', Copy) {
// This task extracts the jar files inside org.eclipse.jdt.debug, which are
// jdi.jar and jdimodel.jar and needed to build the debugger.
from(zipTree(configurations.implementationExtract.singleFile)) {
include '**/*.jar'
exclude 'META-INF'
}
into "mode"
}
tasks.register('permissions', Exec) {
// This task retrieves the latest list of Android permissions and adds them
// to the Permissions.java file. The python scripts requries BeautifulSoup
workingDir "scripts"
commandLine "python", "permissions.py"
}
tasks.register("wrapper", Wrapper) {
gradleVersion = "${gradlewVersion}" // version required for gradle wrapper
}
tasks.named("wrapper").configure {
doLast {
def wrapperFolder = file("mode/gradlew")
wrapperFolder.mkdirs()
file("gradle").renameTo(file("mode/gradlew/gradle"))
file("gradlew").renameTo(file("mode/gradlew/gradlew"))
file("gradlew.bat").renameTo(file("mode/gradlew/gradlew.bat"))
FileUtils.copyDirectory(file("gradle"), file("../debug/gradle"))
delete("gradle")
ZipUtil.pack(file("mode/gradlew"), new File("mode/mode/gradlew.zip"))
delete("mode/gradlew")
}
}
tasks.named('clean') {
doFirst {
delete fileTree("mode") {
include "**/*.jar"
exclude "jdi.jar", "jdimodel.jar", "istack-commons-runtime.jar", "javax.activation-api.jar",
"jaxb-api.jar", "jaxb-jxc.jar", "jaxb-runtime.jar", "jaxb-xjc.jar", "core.jar",
"pde.jar", "JavaMode.jar", "org.eclipse.core.contenttype.jar", "org.eclipse.core.jobs.jar",
"org.eclipse.core.resources.jar", "org.eclipse.core.runtime.jar", "org.eclipse.equinox.common.jar",
"org.eclipse.equinox.preferences.jar", "org.eclipse.jdt.core.jar", "org.eclipse.osgi.jar",
"org.eclipse.text.jar"
}
}
}
tasks.named('build') {
doLast {
Files.copy(file("$buildDir/libs/mode.jar").toPath(),
file("mode/AndroidMode.jar").toPath(), REPLACE_EXISTING)
}
}