@@ -3,38 +3,34 @@ import java.nio.file.Files
3
3
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
4
4
5
5
plugins {
6
- id ' aar'
6
+ id ' ImportAar'
7
+ id ' java-library'
8
+ id ' maven-publish'
7
9
}
8
10
9
11
dependencies {
10
12
implementation name : " android"
11
- implementationAar " androidx.legacy:legacy-support-v4:${ v4legacyVersion} "
12
- implementationAar " com.google.android.support:wearable:${ wearVersion} "
13
+ implementation " androidx.legacy:legacy-support-v4:${ v4legacyVersion} "
14
+ implementation " com.google.android.support:wearable:${ wearVersion} "
13
15
}
14
16
15
- sourceSets {
16
- main {
17
- java {
18
- srcDirs = [" ../../libs/processing-core/src/main/java/" ]
19
- }
20
- resources {
21
- srcDirs = [" ../../libs/processing-core/src/main/" ]
22
- exclude " AndroidManifest.xml"
23
- exclude ' **/java/**'
24
- }
25
- }
17
+ sourceSets. main {
18
+ java. srcDir(" ../../libs/processing-core/src/main/java/" )
19
+ resources. srcDir(" ../../libs/processing-core/src/main/" )
20
+ resources. exclude(" AndroidManifest.xml" , " **/java/**" )
26
21
}
27
22
28
- task sourceJar (type : Jar , dependsOn : classes) {
23
+ tasks. register(' sourceJar' , Jar ) {
24
+ dependsOn classes
29
25
duplicatesStrategy = DuplicatesStrategy . INCLUDE
30
- classifier = " sources"
31
- from sourceSets. main. allSource
26
+ archiveClassifier . set( " sources" )
27
+ from sourceSets. main. allSource
32
28
}
33
29
34
-
35
30
// Does not work because of Processing-specific tags in source code, such as @webref
36
- task javadocJar (type : Jar , dependsOn : javadoc) {
37
- classifier = " javadoc"
31
+ tasks. register(' javadocJar' , Jar ) {
32
+ dependsOn javadoc
33
+ archiveClassifier. set(" javadoc" )
38
34
from javadoc. destinationDir
39
35
}
40
36
@@ -44,45 +40,49 @@ artifacts {
44
40
}
45
41
46
42
jar. doLast { task ->
47
- ant. checksum file : task. archivePath
43
+ ant. checksum file : task. archiveFile . get() . asFile
48
44
}
49
45
50
- clean. doFirst {
51
- delete " dist"
52
- delete " ${ coreZipPath} "
46
+ tasks. named(' clean' ). configure {
47
+ doFirst {
48
+ delete " dist"
49
+ delete " ${ coreZipPath} "
50
+ }
53
51
}
54
52
55
- compileJava. doFirst {
56
- String [] deps = [" wearable.jar" ]
57
- for (String fn : deps) {
58
- Files . copy(file(" ${ rootDir} /build/libs/" + fn). toPath(),
59
- file(" ${ rootDir} /mode/mode/" + fn). toPath(), REPLACE_EXISTING )
53
+ tasks. named(' compileJava' ). configure {
54
+ doFirst {
55
+ String [] deps = [" wearable.jar" ]
56
+ deps. each { fn ->
57
+ Files . copy(file(" ${ rootDir} /build/libs/${ fn} " ). toPath(),
58
+ file(" ${ rootDir} /mode/mode/${ fn} " ). toPath(), REPLACE_EXISTING )
59
+ }
60
60
}
61
61
}
62
62
63
- build. doLast {
64
-
65
- // Need to check the existance of the files before using as the files
66
- // will get generated only if Task :core:jar is not being skipped
67
- // Task :core:jar will be skipped if source files are unchanged or jar task is UP-TO-DATE
68
-
69
- if (file( " ${ buildDir } /libs/ core. jar" ) . exists()) {
70
- // Copying core jar as zip inside the mode folder
71
- Files . copy( file(" ${ buildDir } /libs/core.jar " ). toPath(),
72
- file( " ${ coreZipPath } " ) . toPath(), REPLACE_EXISTING )
73
- }
74
- // Renaming artifacts for maven publishing
75
- if (file(" ${ buildDir} /libs/core.jar" ). exists()) {
76
- Files . move( file(" ${ buildDir} /libs/core.jar" ). toPath(),
77
- file( " $b uildDir /libs/processing-core- ${ modeVersion } .jar " ) . toPath(), REPLACE_EXISTING );
78
- }
79
- if (file(" ${ buildDir} /libs/core-sources.jar" ). exists()) {
80
- Files . move( file(" ${ buildDir} /libs/core-sources.jar" ). toPath(),
81
- file( " $b uildDir /libs/processing-core- ${ modeVersion } -sources.jar " ) . toPath(), REPLACE_EXISTING );
82
- }
83
- if (file(" ${ buildDir} /libs/core.jar.MD5" ). exists()) {
84
- Files . move( file(" ${ buildDir} /libs/core.jar.MD5 " ). toPath(),
85
- file( " $b uildDir /libs/processing-core- ${ modeVersion } .jar.md5 " ) . toPath(), REPLACE_EXISTING );
63
+ tasks . named( ' build' ) . configure {
64
+ doLast {
65
+ // Need to check the existance of the files before using as the files
66
+ // will get generated only if Task :core:jar is not being skipped
67
+ // Task :core:jar will be skipped if source files are unchanged or jar task is UP-TO-DATE
68
+ if (file( " ${ buildDir } /libs/core.jar " ) . exists()) {
69
+ // Copying core jar as zip inside the mode folder
70
+ Files . copy(file( " ${ buildDir } /libs/core. jar" ) . toPath(),
71
+ file(" ${ coreZipPath } " ). toPath(), REPLACE_EXISTING )
72
+ }
73
+ // Renaming artifacts for maven publishing
74
+ if (file( " ${ buildDir } /libs/core.jar " ) . exists()) {
75
+ Files . move (file(" ${ buildDir} /libs/core.jar" ). toPath(),
76
+ file(" $buildDir /libs/processing- core- ${ modeVersion } .jar" ). toPath(), REPLACE_EXISTING )
77
+ }
78
+ if (file( " ${ buildDir } /libs/core-sources.jar " ) . exists()) {
79
+ Files . move (file(" ${ buildDir} /libs/core-sources.jar" ). toPath(),
80
+ file(" $buildDir /libs/processing- core-${ modeVersion } - sources.jar" ). toPath(), REPLACE_EXISTING )
81
+ }
82
+ if (file( " ${ buildDir } /libs/core.jar.MD5 " ) . exists()) {
83
+ Files . move (file(" ${ buildDir} /libs/core.jar.MD5" ). toPath(),
84
+ file(" $buildDir /libs/processing- core- ${ modeVersion } .jar.md5 " ). toPath(), REPLACE_EXISTING )
85
+ }
86
86
}
87
87
}
88
88
96
96
[name : ' wearable' , group : ' com.google.android.support' , version : wearVersion],
97
97
[name : ' android' ]]
98
98
}
99
+
99
100
apply from : " ${ rootProject.projectDir} /scripts/publish-module.gradle"
0 commit comments