forked from processing/processing-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
129 lines (108 loc) · 4.95 KB
/
build.gradle
File metadata and controls
129 lines (108 loc) · 4.95 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import java.nio.file.Files
import org.zeroturnaround.zip.ZipUtil
import org.apache.commons.io.FileUtils
import java.util.regex.Pattern
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
apply plugin: 'java'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath group: 'commons-io', name: 'commons-io', version: '2.5'
classpath group: 'org.zeroturnaround', name: 'zt-zip', version: '1.9'
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'java-library'
// Versions of all dependencies
ext.targetSdkVersion = '26'
ext.supportLibsVersion = '26.0.2'
ext.wearVersion = '2.1.0'
ext.gvrVersion = '1.150.0'
ext.processingVersion = '3.3.7'
ext.toolingVersion = '4.3'
ext.slf4jVersion = '1.7.10'
ext.gradlewVersion = '4.4.1'
ext.toolsLibVersion = '26.0.0-dev'
ext.jdtVersion = '3.11.100'
Properties modeProperties = new Properties()
modeProperties.load(project.rootProject.file("mode/mode.properties").newDataInputStream())
ext.modeVersion = modeProperties.getProperty("prettyVersion")
Properties vrProperties = new Properties()
vrProperties.load(project.rootProject.file("mode/libraries/vr/library.properties").newDataInputStream())
ext.vrLibVersion = vrProperties.getProperty("prettyVersion")
def fn = project.rootProject.file("local.properties")
if (!fn.exists()) {
if (System.env["ANDROID_SDK"] != null) {
def syspath = System.env["ANDROID_SDK"]
def parts = syspath.split(Pattern.quote(File.separator))
def path = String.join("/", parts)
fn.withWriterAppend { w ->
w << "sdk.dir=${path}\n"
}
} else {
throw new GradleException(
"The file local.properties does not exist, and there is no ANDROID_SDK environmental variable defined in the system.\n" +
"Define ANDROID_SDK so it points to the location of the Android SDK, or create the local.properties file manually\n" +
"and add the following line to it:\n" +
"sdk.dir=<path to Android SDK>")
}
}
Properties localProperties = new Properties()
localProperties.load(project.rootProject.file("local.properties").newDataInputStream())
def sdkDir = localProperties.getProperty("sdk.dir")
ext.androidPlatformPath = "${sdkDir}/platforms/android-${targetSdkVersion}"
ext.androidToolsLibPath = "${sdkDir}/tools/lib"
ext.coreZipPath = "${rootDir}/mode/processing-core.zip"
repositories {
google()
jcenter()
flatDir dirs: androidPlatformPath
flatDir dirs: androidToolsLibPath
flatDir dirs: "${rootDir}/core/dist"
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
clean.doFirst {
delete "dist"
}
task dist {
dependsOn subprojects.build
doLast {
def root = "${buildDir}/zip/AndroidMode"
// Copy assets to build dir
FileUtils.copyDirectory(file("mode/templates"), file("${root}/templates"))
FileUtils.copyDirectory(file("mode/examples"), file("${root}/examples"))
FileUtils.copyDirectory(file("mode/icons"), file("${root}/icons"))
FileUtils.copyDirectory(file("mode/theme"), file("${root}/theme"))
FileUtils.copyDirectory(file("mode/mode"), file("${root}/mode"))
delete "${root}/mode/jdi.jar"
delete "${root}/mode/jdimodel.jar"
Files.copy(file("mode/processing-core.zip").toPath(),
file("${root}/processing-core.zip").toPath(), REPLACE_EXISTING);
Files.copy(file("mode/mode.properties").toPath(),
file("${root}/mode.properties").toPath(), REPLACE_EXISTING);
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/tool"),
file("${root}/tools/SDKUpdater/tool"))
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/src"),
file("${root}/tools/SDKUpdater/src"))
FileUtils.copyDirectory(file("mode/libraries/vr/examples"),
file("${root}/libraries/vr/examples"))
FileUtils.copyDirectory(file("mode/libraries/vr/library"),
file("${root}/libraries/vr/library"))
FileUtils.copyDirectory(file("mode/libraries/vr/src"),
file("${root}/libraries/vr/src"))
Files.copy(file("mode/libraries/vr/library.properties").toPath(),
file("${root}/libraries/vr/library.properties").toPath(), REPLACE_EXISTING);
File distFolder = file("dist");
distFolder.mkdirs();
ZipUtil.pack(file("${buildDir}/zip"), new File("dist/AndroidMode.zip"));
Files.copy(file("mode/mode.properties").toPath(),
file("dist/AndroidMode.txt").toPath(), REPLACE_EXISTING);
}
}