|
| 1 | +import java.nio.file.Files |
| 2 | +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING |
| 3 | + |
| 4 | +apply plugin: 'maven' |
| 5 | +apply plugin: 'aar' |
| 6 | + |
| 7 | +dependencies { |
| 8 | + implementation name: "android" |
| 9 | + |
| 10 | + implementationAar "androidx.appcompat:appcompat:${supportLibsVersionAndroidX}" |
| 11 | + implementationAar "com.google.android.support:wearable:${wearVersion}" |
| 12 | +} |
| 13 | + |
| 14 | +task createPom { |
| 15 | + pom { |
| 16 | + project { |
| 17 | + groupId "org.p5android" |
| 18 | + artifactId "processing-core-androidx" |
| 19 | + version "${modeVersionAndroidX}" |
| 20 | + packaging "jar" |
| 21 | + licenses { |
| 22 | + license { |
| 23 | + name "GNU Lesser General Public License, version 2.1" |
| 24 | + url "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt" |
| 25 | + distribution "repo" |
| 26 | + } |
| 27 | + } |
| 28 | + dependencies { |
| 29 | + dependency { |
| 30 | + groupId "androidx.appcompat" |
| 31 | + artifactId "appcompat" |
| 32 | + version "${supportLibsVersionAndroidX}" |
| 33 | + scope "implementation" |
| 34 | + } |
| 35 | + dependency { |
| 36 | + groupId "com.google.android.support" |
| 37 | + artifactId "wearable" |
| 38 | + version "${wearVersion}" |
| 39 | + scope "implementation" |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + }.writeTo("dist/processing-core-androidx-${modeVersionAndroidX}.pom") |
| 44 | +} |
| 45 | + |
| 46 | +sourceSets { |
| 47 | + main { |
| 48 | + java { |
| 49 | + srcDirs = ["src/"] |
| 50 | + } |
| 51 | + resources { |
| 52 | + srcDirs = ["src/"] |
| 53 | + } |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +task sourcesJar(type: Jar, dependsOn: classes) { |
| 58 | + classifier = "sources" |
| 59 | + from sourceSets.main.allSource |
| 60 | +} |
| 61 | + |
| 62 | +// Does not work because of Processing-specific tags in source code, such as @webref |
| 63 | +task javadocJar(type: Jar, dependsOn: javadoc) { |
| 64 | + classifier = "javadoc" |
| 65 | + from javadoc.destinationDir |
| 66 | +} |
| 67 | + |
| 68 | +artifacts { |
| 69 | +// archives javadocJar |
| 70 | + archives sourcesJar |
| 71 | +} |
| 72 | + |
| 73 | +jar.doLast { task -> |
| 74 | + ant.checksum file: task.archivePath |
| 75 | +} |
| 76 | + |
| 77 | +clean.doFirst { |
| 78 | + delete "dist" |
| 79 | + //delete "${coreZipPath}" // TODO - Currently no need to delete. |
| 80 | + // We have not implemented androidx in android mode. |
| 81 | + // Need to declare new variable in root build.gradle for androidx to use in Android Mode for PDE |
| 82 | +} |
| 83 | + |
| 84 | +/* |
| 85 | +// No need to copy these are already there in the mode by core compile. |
| 86 | +// By following task androidx-support jar can be added as ${rootDir}/mode/mode/ by copying from ${rootDir}/build/libs/ |
| 87 | +compileJava.doFirst { |
| 88 | + String[] deps = ["percent.jar", |
| 89 | + "recyclerview-v7.jar", |
| 90 | + "support-compat.jar", |
| 91 | + "support-core-ui.jar", |
| 92 | + "support-core-utils.jar", |
| 93 | + "support-fragment.jar", |
| 94 | + "support-media-compat.jar", |
| 95 | + "support-v4.jar", |
| 96 | + "wearable.jar"] |
| 97 | + for (String fn : deps) { |
| 98 | + Files.copy(file("${rootDir}/build/libs/" + fn).toPath(), |
| 99 | + file("${rootDir}/mode/mode/" + fn).toPath(), REPLACE_EXISTING) |
| 100 | + } |
| 101 | +} |
| 102 | +*/ |
| 103 | + |
| 104 | +build.doLast { |
| 105 | + // TODO - Not adding core-androidx in android mode for now. |
| 106 | + //Files.copy(file("${buildDir}/libs/core.jar").toPath(), |
| 107 | + // file("${coreZipPath}").toPath(), REPLACE_EXISTING) |
| 108 | + |
| 109 | + // Copying the files for release on JCentral |
| 110 | + File distFolder = file("dist") |
| 111 | + distFolder.mkdirs() |
| 112 | + Files.copy(file("${buildDir}/libs/core-androidx.jar").toPath(), |
| 113 | + file("dist/processing-core-androidx-${modeVersionAndroidX}.jar").toPath(), REPLACE_EXISTING) |
| 114 | + Files.copy(file("${buildDir}/libs/core-androidx-sources.jar").toPath(), |
| 115 | + file("dist/processing-core-androidx-${modeVersionAndroidX}-sources.jar").toPath(), REPLACE_EXISTING) |
| 116 | + Files.copy(file("${buildDir}/libs/core-androidx.jar.MD5").toPath(), |
| 117 | + file("dist/processing-core-androidx-${modeVersionAndroidX}.jar.md5").toPath(), REPLACE_EXISTING) |
| 118 | +} |
0 commit comments