-
-
Notifications
You must be signed in to change notification settings - Fork 299
Expand file tree
/
Copy pathbuild.gradle
More file actions
110 lines (96 loc) · 3.65 KB
/
build.gradle
File metadata and controls
110 lines (96 loc) · 3.65 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
import org.apache.tools.ant.Project
import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
plugins {
id 'ImportAar'
id 'java-library'
id 'maven-publish'
}
dependencies {
implementation name: "android"
implementation "androidx.legacy:legacy-support-v4:${v4legacyVersion}"
implementation "com.google.android.support:wearable:${wearVersion}"
}
sourceSets.main {
java.srcDir("../../libs/processing-core/src/main/java/")
resources.srcDir("../../libs/processing-core/src/main/")
resources.exclude("AndroidManifest.xml", "**/java/**")
}
tasks.register('sourceJar', Jar) {
dependsOn classes
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveClassifier.set("sources")
from sourceSets.main.allSource
}
// Does not work because of Processing-specific tags in source code, such as @webref
tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
// project.afterEvaluate {
// tasks.named('extractAarJars').configure {
// dependsOn configurations.runtimeClasspath
// }
// }
// project.tasks.named('build').configure {
// finalizedBy('extractAarJars')
// }
artifacts {
// archives javadocJar
archives sourceJar
}
jar.doLast { task ->
ant.checksum file: task.archiveFile.get().asFile
}
tasks.named('clean').configure {
doFirst {
delete "dist"
delete "${coreZipPath}"
}
}
tasks.named('compileJava').configure {
doFirst {
String[] deps = ["wearable.jar"]
deps.each { fn ->
Files.copy(file("${rootDir}/build/libs/${fn}").toPath(),
file("${rootDir}/mode/mode/${fn}").toPath(), REPLACE_EXISTING)
}
}
}
tasks.named('build').configure {
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"