-
-
Notifications
You must be signed in to change notification settings - Fork 299
Expand file tree
/
Copy pathbuild.gradle
More file actions
99 lines (85 loc) · 3.22 KB
/
build.gradle
File metadata and controls
99 lines (85 loc) · 3.22 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
import org.apache.tools.ant.Project
import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
plugins {
id 'aar'
}
dependencies {
implementation name: "android"
implementationAar "androidx.legacy:legacy-support-v4:${v4legacyVersion}"
implementationAar "com.google.android.support:wearable:${wearVersion}"
}
sourceSets {
main {
java {
srcDirs = ["../../libs/processing-core/src/main/java/"]
}
resources {
srcDirs = ["../../libs/processing-core/src/main/"]
exclude "AndroidManifest.xml"
exclude '**/java/**'
}
}
}
task sourceJar(type: Jar, dependsOn: classes) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
classifier = "sources"
from sourceSets.main.allSource
}
// Does not work because of Processing-specific tags in source code, such as @webref
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}
artifacts {
// archives javadocJar
archives sourceJar
}
jar.doLast { task ->
ant.checksum file: task.archivePath
}
clean.doFirst {
delete "dist"
delete "${coreZipPath}"
}
compileJava.doFirst {
String[] deps = ["wearable.jar"]
for (String fn : deps) {
Files.copy(file("${rootDir}/build/libs/" + fn).toPath(),
file("${rootDir}/mode/mode/" + fn).toPath(), REPLACE_EXISTING)
}
}
build.doLast {
// Need to check the existance of the files before using as the files
// will get generated only if Task :core:jar is not being skipped
// Task :core:jar will be skipped if source files are unchanged or jar task is UP-TO-DATE
if (file("${buildDir}/libs/core.jar").exists()) {
// Copying core jar as zip inside the mode folder
Files.copy(file("${buildDir}/libs/core.jar").toPath(),
file("${coreZipPath}").toPath(), REPLACE_EXISTING)
}
// Renaming artifacts for maven publishing
if (file("${buildDir}/libs/core.jar").exists()) {
Files.move(file("${buildDir}/libs/core.jar").toPath(),
file("$buildDir/libs/processing-core-${modeVersion}.jar").toPath(), REPLACE_EXISTING);
}
if (file("${buildDir}/libs/core-sources.jar").exists()) {
Files.move(file("${buildDir}/libs/core-sources.jar").toPath(),
file("$buildDir/libs/processing-core-${modeVersion}-sources.jar").toPath(), REPLACE_EXISTING);
}
if (file("${buildDir}/libs/core.jar.MD5").exists()) {
Files.move(file("${buildDir}/libs/core.jar.MD5").toPath(),
file("$buildDir/libs/processing-core-${modeVersion}.jar.md5").toPath(), REPLACE_EXISTING);
}
}
ext {
libName = 'processing-core'
libVersion = modeVersion
libJar = "${buildDir}/libs/${libName}-${libVersion}.jar"
libSrc = "${buildDir}/libs/${libName}-${libVersion}-sources.jar"
libMd5 = "${buildDir}/libs/${libName}-${libVersion}-sources.jar.md5"
libDependencies = [[name: 'legacy-support-v4', group: 'androidx.legacy', version: v4legacyVersion],
[name: 'wearable', group: 'com.google.android.support', version: wearVersion],
[name: 'android']]
}
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"