diff --git a/apps/armarkers/build.gradle b/apps/armarkers/build.gradle
index 39e15a4e4..bd89203e2 100644
--- a/apps/armarkers/build.gradle
+++ b/apps/armarkers/build.gradle
@@ -3,6 +3,7 @@ plugins {
}
android {
+ compileSdkVersion 33
defaultConfig {
applicationId "processing.tests.armarkers"
minSdkVersion 23
@@ -19,8 +20,8 @@ android {
productFlavors {
}
compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
}
namespace 'armarkers'
}
@@ -32,4 +33,4 @@ dependencies {
implementation project(':libs:processing-ar')
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.ar:core:1.35.0'
-}
+}
\ No newline at end of file
diff --git a/apps/armarkers/src/main/AndroidManifest.xml b/apps/armarkers/src/main/AndroidManifest.xml
index a4adeca84..fcf1ffe6b 100644
--- a/apps/armarkers/src/main/AndroidManifest.xml
+++ b/apps/armarkers/src/main/AndroidManifest.xml
@@ -4,6 +4,7 @@
android:versionCode="1"
android:versionName="1.0">
+
+
-
diff --git a/apps/vrcube/src/main/AndroidManifest.xml b/apps/vrcube/src/main/AndroidManifest.xml
index 152a3c5cc..03513aece 100644
--- a/apps/vrcube/src/main/AndroidManifest.xml
+++ b/apps/vrcube/src/main/AndroidManifest.xml
@@ -12,7 +12,7 @@
android:label="@string/app_name"
android:theme="@style/VrActivityTheme">
diff --git a/apps/wallpaper/src/main/res/values-w820dp/dimens.xml b/apps/wallpaper/src/main/res/values-w820dp/dimens.xml
index 63fc81644..a2d24bc10 100644
--- a/apps/wallpaper/src/main/res/values-w820dp/dimens.xml
+++ b/apps/wallpaper/src/main/res/values-w820dp/dimens.xml
@@ -2,5 +2,5 @@
- 64dp
-
+
+
\ No newline at end of file
diff --git a/apps/wallpaper/src/main/res/values/dimens.xml b/apps/wallpaper/src/main/res/values/dimens.xml
new file mode 100644
index 000000000..9cfe70043
--- /dev/null
+++ b/apps/wallpaper/src/main/res/values/dimens.xml
@@ -0,0 +1,3 @@
+
+ 16dp
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 1894f9995..5bb77278f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.3.1'
+ classpath 'com.android.tools.build:gradle:8.0.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@@ -28,8 +28,28 @@ allprojects {
mavenCentral()
google()
}
+
+ // Set Java compatibility for all projects
+ plugins.withType(JavaPlugin).configureEach {
+ java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(17)
+ }
+ }
+ }
+
+ // Set Android compatibility for all Android projects
+ plugins.withType(com.android.build.gradle.BasePlugin).configureEach {
+ android {
+ compileSdkVersion 33
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_17
+ targetCompatibility JavaVersion.VERSION_17
+ }
+ }
+ }
}
-task clean(type: Delete) {
+tasks.register('clean', Delete) {
delete rootProject.buildDir
}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index aa991fcea..d6e308a63 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 000000000..f5feea6d6
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,252 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
+' "$PWD" ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/libs/processing-ar/src/main/java/processing/ar/RotationHandler.java b/libs/processing-ar/src/main/java/processing/ar/RotationHandler.java
index cece970cc..e11c4b8e3 100644
--- a/libs/processing-ar/src/main/java/processing/ar/RotationHandler.java
+++ b/libs/processing-ar/src/main/java/processing/ar/RotationHandler.java
@@ -18,15 +18,16 @@ public class RotationHandler implements DisplayManager.DisplayListener {
public RotationHandler(Context context) {
this.context = context;
- display = context.getSystemService(WindowManager.class).getDefaultDisplay();
+ WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+ display = windowManager.getDefaultDisplay();
}
public void onResume() {
- context.getSystemService(DisplayManager.class).registerDisplayListener(this, null);
+ ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)).registerDisplayListener(this, null);
}
public void onPause() {
- context.getSystemService(DisplayManager.class).unregisterDisplayListener(this);
+ ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)).unregisterDisplayListener(this);
}
public void onSurfaceChanged(int width, int height) {
@@ -59,4 +60,4 @@ public void onDisplayRemoved(int displayId) {
public void onDisplayChanged(int displayId) {
viewportChanged = true;
}
-}
+}
\ No newline at end of file
diff --git a/libs/processing-core/build.gradle b/libs/processing-core/build.gradle
index 86dcecd81..b7952ec4d 100644
--- a/libs/processing-core/build.gradle
+++ b/libs/processing-core/build.gradle
@@ -3,7 +3,8 @@ plugins {
}
android {
- namespace "processing"
+
+ namespace "processing.core"
defaultConfig {
minSdkVersion 17
diff --git a/libs/processing-core/src/main/java/processing/android/PermissionRequestor.java b/libs/processing-core/src/main/java/processing/android/PermissionRequestor.java
index 0754badc3..deac0d852 100644
--- a/libs/processing-core/src/main/java/processing/android/PermissionRequestor.java
+++ b/libs/processing-core/src/main/java/processing/android/PermissionRequestor.java
@@ -27,6 +27,7 @@
import android.support.v4.os.ResultReceiver;
import androidx.core.app.ActivityCompat;
+import androidx.annotation.RestrictTo;
// A simple utility activity to request permissions in a service.
public class PermissionRequestor extends Activity {
@@ -49,6 +50,7 @@ protected void onStart() {
}
@Override
+ @SuppressWarnings("RestrictedApi")
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
Bundle resultData = new Bundle();
resultData.putStringArray(KEY_PERMISSIONS, permissions);
diff --git a/processing/buildSrc/src/main/groovy/ImportAar.groovy b/processing/buildSrc/src/main/groovy/ImportAar.groovy
new file mode 100644
index 000000000..fc20588f1
--- /dev/null
+++ b/processing/buildSrc/src/main/groovy/ImportAar.groovy
@@ -0,0 +1,237 @@
+// import org.gradle.api.Plugin
+// import org.gradle.api.Project
+// import org.gradle.api.artifacts.Configuration
+// import org.gradle.api.artifacts.transform.TransformAction
+// import org.gradle.api.artifacts.transform.TransformParameters
+// import org.gradle.api.artifacts.transform.InputArtifact
+// import org.gradle.api.artifacts.transform.TransformOutputs
+// import org.gradle.api.file.FileSystemLocation
+// import org.gradle.api.provider.Provider
+// import org.gradle.api.tasks.PathSensitive
+// import org.gradle.api.tasks.PathSensitivity
+
+// import org.gradle.api.attributes.LibraryElements
+// import org.gradle.api.attributes.Usage
+// import org.gradle.api.attributes.Category
+
+// import com.android.build.gradle.internal.dependency.AarTransform
+// import com.android.build.gradle.internal.dependency.ExtractAarTransform
+// import com.android.build.gradle.internal.publishing.AndroidArtifacts
+// import com.android.builder.aar.AarExtractor
+// import com.google.common.collect.ImmutableList
+
+// import java.nio.file.Files
+// import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
+
+
+// import org.gradle.api.Plugin
+// import org.gradle.api.Project
+// import org.gradle.api.artifacts.Configuration
+// import org.gradle.api.artifacts.ResolvedArtifact
+// import java.util.zip.ZipFile
+
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.tasks.TaskAction
+import java.util.zip.ZipFile
+
+/**
+ * Build Gradle plgin needed to use aar files as dependencies in a pure java library project.
+ * Adapted from the following plugin by nekocode
+ * https://github.com/nekocode/Gradle-Import-Aar
+ * Ported to Groovy, and made specific to the needs of the Android mode build process (i.e.: this plugin
+ * is not meant to be used with other projects).
+ * Ported to Gradle 8 replacing the deprecated ArtifactTransform with the new TransformAction API.
+ */
+class ImportAar implements Plugin {
+ final String CONFIG_NAME_POSTFIX = "Aar"
+
+ @Override
+ void apply(Project project) {
+ // def aar = AndroidArtifacts.TYPE_AAR
+ // def jar = AndroidArtifacts.TYPE_JAR
+
+ println ">>> Calling ImportAar"
+
+ // Create a custom resolvable configuration
+ project.configurations.create('aarExtractorResolvable') {
+ canBeResolved = true
+ canBeConsumed = false
+ extendsFrom project.configurations.implementation
+ }
+
+ project.tasks.register('extractAarJars', ExtractAarJarsTask) {
+ group = 'build'
+ description = 'Extracts JAR files from AAR dependencies and places them in build/libs.'
+ }
+
+
+ // project.task('extractAarJars') {
+ // doLast {
+ // println "=======> Calling extractAarJars task"
+
+ // project.configurations.each { Configuration config ->
+ // config.resolvedConfiguration.resolvedArtifacts.each { ResolvedArtifact artifact ->
+ // println "Resolved artifact: ${artifact}"
+ // if (artifact.type == 'aar') {
+ // extractJarFromAar(artifact, project)
+ // }
+ // }
+ // }
+ // }
+ // }
+
+
+
+/*
+ // Create AAR configurations
+ Collection allConfigs = project.getConfigurations().toList()
+ for (Configuration config: allConfigs) {
+ println config
+ Configuration aarConfig = project.configurations.maybeCreate(config.name + CONFIG_NAME_POSTFIX)
+ println aarConfig
+
+ // Add extracted jars to original configuration after project evaluating
+ aarConfig.attributes {
+ attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements, LibraryElements.JAR))
+ attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage, Usage.JAVA_RUNTIME))
+ attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category, Category.LIBRARY))
+ }
+
+ project.afterEvaluate {
+ println "-> In afterEvaluate"
+ aarConfig.resolvedConfiguration.resolvedArtifacts.each { artifact ->
+ File jarFile = artifact.file
+ print "================================================> FILE "
+ println jarFile
+ println jarFile.getName()
+
+ // Add jar file to classpath
+ project.sourceSets.main.compileClasspath += project.files(jarFile)
+
+ File libraryFolder = new File(project.buildDir, "libs")
+ libraryFolder.mkdirs()
+
+ // Strip version number when copying
+ String name = jarFile.name
+ int p = name.lastIndexOf("-")
+ String libName = name.substring(0, p) + ".jar"
+ File libraryJar = new File(libraryFolder, libName)
+ Files.copy(jarFile.toPath(), libraryJar.toPath(), REPLACE_EXISTING)
+ }
+ }
+ }
+
+ // Register aar transform
+ project.dependencies {
+ registerTransform(AarToJarTransform) {
+ from.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements, aar))
+ to.attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements, jar))
+ }
+ }
+ */
+ }
+
+ // void extractJarFromAar(ResolvedArtifact artifact, Project project) {
+ // println "Input AAR: ${aarFile}"
+ // def aarFile = artifact.file
+ // def zipFile = new ZipFile(aarFile)
+ // def entry = zipFile.getEntry('classes.jar')
+ // if (entry) {
+ // project.copy {
+ // from project.zipTree(aarFile)
+ // include 'classes.jar'
+ // into "${project.buildDir}/libs"
+ // rename { "${artifact.name}-${artifact.moduleVersion.id.version}.jar" }
+ // }
+ // }
+ // zipFile.close()
+ // }
+
+
+ // abstract static class AarToJarTransform implements TransformAction {
+ // AarToJarTransform() {
+ // println "AarToJarTransform instantiated"
+ // }
+
+ // @InputArtifact
+ // @PathSensitive(PathSensitivity.NAME_ONLY)
+ // abstract Provider getInputArtifact()
+
+ // @Override
+ // void transform(TransformOutputs outputs) {
+ // File inputFile = inputArtifact.get().asFile
+ // println "Input AAR: ${inputFile}"
+ // File explodedDir = new File(outputs.getOutputDirectory(), "exploded")
+ // println "Exploded Directory: ${explodedDir}"
+
+ // AarExtractor aarExtractor = new AarExtractor()
+ // aarExtractor.extract(inputFile, explodedDir)
+ // File classesJar = new File(new File(explodedDir, "jars"), "classes.jar")
+ // if (classesJar.exists()) {
+ // println "Classes JAR found: ${classesJar}"
+ // String aarName = inputFile.name.replace(".aar", "")
+ // File renamedJar = outputs.file("${aarName}.jar")
+ // Files.copy(classesJar.toPath(), renamedJar.toPath(), REPLACE_EXISTING)
+ // println "Transformed JAR: ${renamedJar}"
+ // } else {
+ // println "Error: classes.jar not found in ${explodedDir}"
+ // }
+ // }
+ // }
+}
+
+
+class ExtractAarJarsTask extends org.gradle.api.DefaultTask {
+ @TaskAction
+ void extractJars() {
+ //File outputDir = new File(project.buildDir, 'libs')
+ File outputDir = new File(System.getProperty("user.dir"), "build/libs")
+ outputDir.mkdirs()
+
+ // Configuration compileClasspath = project.configurations.getByName('implementation')
+ Configuration aarExtractorResolvable = project.configurations.getByName('aarExtractorResolvable')
+
+ // compileClasspath.resolvedConfiguration.resolvedArtifacts.each { artifact ->
+ aarExtractorResolvable.resolvedConfiguration.resolvedArtifacts.each { artifact ->
+ if (artifact.type == 'aar') {
+ File aarFile = artifact.file
+ println "Processing AAR: ${aarFile.name}"
+
+ // Extract the AAR file
+ ZipFile zipFile = new ZipFile(aarFile)
+ zipFile.entries().each { entry ->
+ if (entry.name.endsWith('.jar')) {
+ println "Classes JAR found: ${entry}"
+ String aarName = aarFile.name.replace(".aar", "")
+ String jarName = "${aarName}.jar".replaceFirst(/-\d+(\.\d+)*(?=\.jar$)/, '')
+
+ File jarOutput = new File(outputDir, jarName)
+ jarOutput.parentFile.mkdirs()
+
+ // Write the JAR file to the output directory
+ zipFile.getInputStream(entry).withCloseable { inputStream ->
+ jarOutput.withOutputStream { outputStream ->
+ copyStream(inputStream, outputStream)
+ }
+ }
+ println "Extracted JAR: ${jarOutput.absolutePath}"
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Copies data from an InputStream to an OutputStream.
+ */
+ void copyStream(InputStream input, OutputStream output) {
+ byte[] buffer = new byte[1024]
+ int bytesRead
+ while ((bytesRead = input.read(buffer)) != -1) {
+ output.write(buffer, 0, bytesRead)
+ }
+ }
+}
+
diff --git a/processing/buildSrc/src/main/groovy/processing/android/ImportAar.groovy b/processing/buildSrc/src/main/groovy/processing/android/ImportAar.groovy
deleted file mode 100644
index 8880ff931..000000000
--- a/processing/buildSrc/src/main/groovy/processing/android/ImportAar.groovy
+++ /dev/null
@@ -1,125 +0,0 @@
-package processing.android
-
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.plugins.PluginManager
-import org.gradle.api.plugins.ExtensionContainer
-import org.gradle.plugins.ide.idea.IdeaPlugin
-import org.gradle.plugins.ide.idea.model.IdeaModel
-import org.gradle.plugins.ide.idea.model.IdeaModule
-import org.gradle.api.artifacts.Configuration
-import org.gradle.api.artifacts.transform.ArtifactTransform
-
-import static org.gradle.api.internal.artifacts.ArtifactAttributes.ARTIFACT_FORMAT
-import com.android.build.gradle.internal.dependency.AarTransform
-import com.android.build.gradle.internal.dependency.ExtractAarTransform
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.builder.aar.AarExtractor
-import com.google.common.collect.ImmutableList
-import java.util.regex.Pattern
-import static com.android.SdkConstants.FD_JARS
-import static com.android.SdkConstants.FN_CLASSES_JAR
-
-import java.io.File
-import java.nio.file.Files
-import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
-
-/**
- * Build Gradle plgin needed to use aar files as dependencies in a pure java library project.
- * Adapted from the following plugin by nekocode
- * https://github.com/nekocode/Gradle-Import-Aar
- * Ported to Groovy, and made specific to the needs of the Android mode build process (i.e.: this plugin
- * is not meant to be used with other projects).
- */
-class ImportAar implements Plugin {
-
- final String CONFIG_NAME_POSTFIX = "Aar"
-
- void apply(Project project) {
- def aar = AndroidArtifacts.TYPE_AAR
- def jar = AndroidArtifacts.TYPE_JAR
- def exp = AndroidArtifacts.TYPE_EXPLODED_AAR
-
- // // Create aar configurations
- Collection allConfigs = project.getConfigurations().toList()
- for (Configuration config: allConfigs) {
- Configuration aarConfig = project.configurations.maybeCreate(config.name + CONFIG_NAME_POSTFIX)
-
- // Add extracted jars to original configuration after project evaluating
- aarConfig.getAttributes().attribute(ARTIFACT_FORMAT, jar)
- project.afterEvaluate {
- for (File jarFile: aarConfig) {
- // print "================================================> FILE "
- // println jarFile
- // println jarFile.getName()
- // for (String s: project.sourceSets.main.compileClasspath) {
- // println s
- // }
- // project.getDependencies().add(config.name, project.files(jarFile))
-
- // Add jar file to classpath
- project.sourceSets.main.compileClasspath += project.files(jarFile)
-
- File libraryFolder = new File(System.getProperty("user.dir"), "build/libs")
- libraryFolder.mkdirs()
-
- // Strip version number when copying
- String name = jarFile.getName()
- int p = name.lastIndexOf("-")
- String libName = name.substring(0, p) + ".jar"
- File libraryJar = new File(libraryFolder, libName)
- Files.copy(jarFile.toPath(), libraryJar.toPath(), REPLACE_EXISTING)
- }
-
- }
-
- // Tell Idea about our aar configuration
- PluginManager pluginManager = project.getPluginManager()
- pluginManager.apply(IdeaPlugin.class)
- ExtensionContainer extensions = project.getExtensions()
- // IdeaModel model = extensions.getByType(IdeaModel.class)
- IdeaModel model = extensions.getByName("idea")
- IdeaModule module = model.getModule()
- module.scopes.PROVIDED.plus += [aarConfig]
- }
-
- // Register aar transform
- project.dependencies {
- registerTransform {
- from.attribute(ARTIFACT_FORMAT, aar)
- to.attribute(ARTIFACT_FORMAT, jar)
- artifactTransform(AarJarArtifactTransform.class)
- }
- }
- }
-
- static class AarJarArtifactTransform extends ArtifactTransform {
- @Override
- List transform(File file) {
- // println "Transforming---------------------------------"
- // println outputDirectory
- // println file
- File explodedDir = new File(getOutputDirectory(), "exploded")
- // println explodedDir
-
- AarExtractor aarExtractor = new AarExtractor()
- aarExtractor.extract(file, explodedDir)
- File classesJar = new File(new File(explodedDir, FD_JARS), FN_CLASSES_JAR)
- // println classesJar
-
- // String[] names = file.getPath().split(Pattern.quote(File.separator))
- // print "NAMES "
- // println names
- // print "NAME "
- // println file.getName()
- // String aarName = names[names.length - 4].replace(".aar", "")
- String aarName = file.getName().replace(".aar", "")
- // print "AAR NAME "
- // println aarName
- File renamedJar = new File(getOutputDirectory(), aarName + ".jar")
- renamedJar << classesJar.bytes
-
- return ImmutableList.of(renamedJar)
- }
- }
-}
\ No newline at end of file
diff --git a/processing/buildSrc/src/main/resources/META-INF/gradle-plugins/ImportAar.properties b/processing/buildSrc/src/main/resources/META-INF/gradle-plugins/ImportAar.properties
new file mode 100644
index 000000000..f41e15936
--- /dev/null
+++ b/processing/buildSrc/src/main/resources/META-INF/gradle-plugins/ImportAar.properties
@@ -0,0 +1 @@
+implementation-class=ImportAar
\ No newline at end of file
diff --git a/processing/buildSrc/src/main/resources/META-INF/gradle-plugins/aar.properties b/processing/buildSrc/src/main/resources/META-INF/gradle-plugins/aar.properties
deleted file mode 100644
index 42d81af01..000000000
--- a/processing/buildSrc/src/main/resources/META-INF/gradle-plugins/aar.properties
+++ /dev/null
@@ -1 +0,0 @@
-implementation-class=processing.android.ImportAar
\ No newline at end of file
diff --git a/processing/core/build.gradle b/processing/core/build.gradle
index 3b11369cf..07a8b8b73 100644
--- a/processing/core/build.gradle
+++ b/processing/core/build.gradle
@@ -3,86 +3,96 @@ import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
plugins {
- id 'aar'
+ id 'ImportAar'
+ id 'java-library'
+ id 'maven-publish'
}
dependencies {
implementation name: "android"
- implementationAar "androidx.legacy:legacy-support-v4:${v4legacyVersion}"
- implementationAar "com.google.android.support:wearable:${wearVersion}"
+ implementation "androidx.legacy:legacy-support-v4:${v4legacyVersion}"
+ implementation "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/**'
- }
- }
+sourceSets.main {
+ java.srcDir("../../libs/processing-core/src/main/java/")
+ resources.srcDir("../../libs/processing-core/src/main/")
+ resources.exclude("AndroidManifest.xml", "**/java/**")
}
-task sourceJar(type: Jar, dependsOn: classes) {
+tasks.register('sourceJar', Jar) {
+ dependsOn classes
duplicatesStrategy = DuplicatesStrategy.INCLUDE
- classifier = "sources"
- from sourceSets.main.allSource
+ archiveClassifier.set("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"
+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.archivePath
+ ant.checksum file: task.archiveFile.get().asFile
}
-clean.doFirst {
- delete "dist"
- delete "${coreZipPath}"
+tasks.named('clean').configure {
+ 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)
+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)
+ }
}
}
-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);
+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)
+ }
}
}
@@ -96,4 +106,5 @@ ext {
[name: 'wearable', group: 'com.google.android.support', version: wearVersion],
[name: 'android']]
}
+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
diff --git a/processing/gradle/wrapper/gradle-wrapper.properties b/processing/gradle/wrapper/gradle-wrapper.properties
index aa991fcea..d6e308a63 100644
--- a/processing/gradle/wrapper/gradle-wrapper.properties
+++ b/processing/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/processing/mode/build.gradle b/processing/mode/build.gradle
index fefd9c866..0f34a95d9 100644
--- a/processing/mode/build.gradle
+++ b/processing/mode/build.gradle
@@ -3,12 +3,15 @@ import org.zeroturnaround.zip.ZipUtil
import org.apache.commons.io.FileUtils
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+plugins {
+ id 'java'
+}
// Extend compile to copy the jars from gradle-tooling and slf4j:
// https://stackoverflow.com/a/43602463
configurations {
- implementation.extendsFrom implementationCopy
- implementation.extendsFrom implementationExtract
+ implementationCopy
+ implementationExtract
}
dependencies {
@@ -26,81 +29,74 @@ dependencies {
}
// This task copies the gradle tooling jar into the mode folder
-task copyToLib(type: Copy) {
- from configurations.implementationCopy.files
- into "mode"
+tasks.register("copyToLib", Copy) {
+ from(configurations.implementationCopy)
+ into("mode")
}
-build.dependsOn(copyToLib)
-compileJava.dependsOn(copyToLib)
-sourceSets {
- main {
- java {
- srcDirs = ["src/"]
- }
- }
+tasks.named('build') {
+ dependsOn 'copyToLib'
}
-task getjdi(type: Copy) {
- // This task extracts the jar files inside org.eclipse.jdt.debug, which are
- // jdi.jar and jdimodel.jar and needed to build the debugger.
- from(zipTree(configurations.implementationExtract.files[0])) {
- include '**/*.jar'
- exclude 'META-INF'
- }
- into "mode"
+tasks.named('compileJava') {
+ dependsOn 'copyToLib'
}
-task permissions(type:Exec) {
- // This task retrieves the latest list of Android permissions and adds them
- // to the Permissions.java file. The python scripts requries BeautifulSoup
- workingDir "scripts"
- commandLine "python", "permissions.py"
-}
+sourceSets.main.java.srcDir("src/")
-task wrapper(type: Wrapper) {
- gradleVersion = "${gradlewVersion}" // version required for gradle wrapper
+tasks.register('getjdi', Copy) {
+ // This task extracts the jar files inside org.eclipse.jdt.debug, which are
+ // jdi.jar and jdimodel.jar and needed to build the debugger.
+ from(zipTree(configurations.implementationExtract.singleFile)) {
+ include '**/*.jar'
+ exclude 'META-INF'
+ }
+ into "mode"
}
-wrapper.doLast {
- File wrapperFolder = file("mode/gradlew");
- wrapperFolder.mkdirs();
- file("gradle").renameTo(file("mode/gradlew/gradle"))
- file("gradlew").renameTo(file("mode/gradlew/gradlew"))
- file("gradlew.bat").renameTo(file("mode/gradlew/gradlew.bat"))
- FileUtils.copyDirectory(file("gradle"), file("../debug/gradle"))
- delete "gradle"
- ZipUtil.pack(file("mode/gradlew"), new File("mode/mode/gradlew.zip"));
- delete "mode/gradlew"
+tasks.register('permissions', Exec) {
+ // This task retrieves the latest list of Android permissions and adds them
+ // to the Permissions.java file. The python scripts requries BeautifulSoup
+ workingDir "scripts"
+ commandLine "python", "permissions.py"
}
-clean.doFirst {
- delete fileTree("mode") {
- include "**/*.jar"
- exclude "jdi.jar"
- exclude "jdimodel.jar"
- exclude "istack-commons-runtime.jar"
- exclude "javax.activation-api.jar"
- exclude "jaxb-api.jar"
- exclude "jaxb-jxc.jar"
- exclude "jaxb-runtime.jar"
- exclude "jaxb-xjc.jar"
- exclude "core.jar"
- exclude "pde.jar"
- exclude "JavaMode.jar"
- exclude "org.eclipse.core.contenttype.jar"
- exclude "org.eclipse.core.jobs.jar"
- exclude "org.eclipse.core.resources.jar"
- exclude "org.eclipse.core.runtime.jar"
- exclude "org.eclipse.equinox.common.jar"
- exclude "org.eclipse.equinox.preferences.jar"
- exclude "org.eclipse.jdt.core.jar"
- exclude "org.eclipse.osgi.jar"
- exclude "org.eclipse.text.jar"
+
+tasks.register("wrapper", Wrapper) {
+ gradleVersion = "${gradlewVersion}" // version required for gradle wrapper
+}
+
+tasks.named("wrapper").configure {
+ doLast {
+ def wrapperFolder = file("mode/gradlew")
+ wrapperFolder.mkdirs()
+ file("gradle").renameTo(file("mode/gradlew/gradle"))
+ file("gradlew").renameTo(file("mode/gradlew/gradlew"))
+ file("gradlew.bat").renameTo(file("mode/gradlew/gradlew.bat"))
+ FileUtils.copyDirectory(file("gradle"), file("../debug/gradle"))
+ delete("gradle")
+ ZipUtil.pack(file("mode/gradlew"), new File("mode/mode/gradlew.zip"))
+ delete("mode/gradlew")
}
}
-build.doLast {
- Files.copy(file("$buildDir/libs/mode.jar").toPath(),
- file("mode/AndroidMode.jar").toPath(), REPLACE_EXISTING);
+tasks.named('clean') {
+ doFirst {
+ delete fileTree("mode") {
+ include "**/*.jar"
+ exclude "jdi.jar", "jdimodel.jar", "istack-commons-runtime.jar", "javax.activation-api.jar",
+ "jaxb-api.jar", "jaxb-jxc.jar", "jaxb-runtime.jar", "jaxb-xjc.jar", "core.jar",
+ "pde.jar", "JavaMode.jar", "org.eclipse.core.contenttype.jar", "org.eclipse.core.jobs.jar",
+ "org.eclipse.core.resources.jar", "org.eclipse.core.runtime.jar", "org.eclipse.equinox.common.jar",
+ "org.eclipse.equinox.preferences.jar", "org.eclipse.jdt.core.jar", "org.eclipse.osgi.jar",
+ "org.eclipse.text.jar"
+ }
+ }
}
+
+tasks.named('build') {
+ doLast {
+ Files.copy(file("$buildDir/libs/mode.jar").toPath(),
+ file("mode/AndroidMode.jar").toPath(), REPLACE_EXISTING)
+ }
+}
\ No newline at end of file
diff --git a/processing/mode/libraries/ar/build.gradle b/processing/mode/libraries/ar/build.gradle
index b92c24f08..5b47b90b4 100644
--- a/processing/mode/libraries/ar/build.gradle
+++ b/processing/mode/libraries/ar/build.gradle
@@ -2,36 +2,44 @@ import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
plugins {
- id 'aar'
+ id 'java-library'
+ id 'maven-publish'
}
dependencies {
compileOnly name: "android"
compileOnly "org.p5android:processing-core:${modeVersion}"
- implementationAar "com.google.ar:core:${garVersion}"
+ implementation "com.google.ar:core:${garVersion}"
}
sourceSets {
main {
- java {
- srcDirs = ["../../../../libs/processing-ar/src/main/java/"]
- }
+ java.srcDir("../../../../libs/processing-ar/src/main/java/")
resources {
- srcDirs = ["../../../../libs/processing-ar/src/main/"]
+ srcDir("../../../../libs/processing-ar/src/main/")
exclude "AndroidManifest.xml"
- exclude '**/java/**'
- }
+ exclude "**/java/**"
+ }
}
}
-task sourceJar(type: Jar) {
+java {
+ withSourcesJar()
+}
+
+tasks.named('jar') {
+ duplicatesStrategy = DuplicatesStrategy.INCLUDE
+}
+
+tasks.register("sourceJar", Jar) {
from sourceSets.main.allJava
- archiveClassifier = "sources"
+ archiveClassifier.set("sources")
}
// Does not work because of Processing-specific tags in source code, such as @webref
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = "javadoc"
+tasks.register("javadocJar", Jar) {
+ dependsOn javadoc
+ archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
@@ -40,50 +48,65 @@ artifacts {
archives sourceJar
}
-jar.doLast { task ->
- ant.checksum file: task.archivePath
+tasks.jar {
+ doLast {
+ ant.checksum file: archiveFile.get().asFile
+ }
}
-clean.doFirst {
- delete "dist"
- delete "library/ar.jar"
+tasks.clean {
+ doFirst {
+ delete "dist"
+ delete "library/ar.jar"
+ }
}
-compileJava.doFirst {
- String[] deps = ["core.jar"]
- File libFolder = file("library")
- libFolder.mkdirs()
- for (String fn : deps) {
- Files.copy(file("${rootDir}/build/libs/" + fn).toPath(),
- file("library/" + fn).toPath(), REPLACE_EXISTING);
+tasks.compileJava {
+ doFirst {
+ String[] deps = ["core.jar"]
+ File libFolder = file("library")
+ libFolder.mkdirs()
+ deps.each { String fn ->
+ Files.copy(
+ file("${rootDir}/build/libs/" + fn).toPath(),
+ file("library/" + fn).toPath(),
+ REPLACE_EXISTING
+ )
+ }
}
}
-build.doLast {
- // Copying ar jar to library folder
- File arJar = file("library/ar.jar")
- arJar.mkdirs();
-
- // Need to check the existance of the files before using as the files
- // will get generated only if Task ':mode:libraries:ar:jar' is not being skipped
- // Task ':mode:libraries:ar:jar' will be skipped if source files are unchanged or jar task is UP-TO-DATE
-
- if (file("$buildDir/libs/ar.jar").exists()) {
- Files.copy(file("$buildDir/libs/ar.jar").toPath(),
- arJar.toPath(), REPLACE_EXISTING);
- }
- // Renaming artifacts for maven publishing
- if (file("$buildDir/libs/ar.jar").exists()) {
- Files.move(file("$buildDir/libs/ar.jar").toPath(),
- file("$buildDir/libs/processing-ar-${arLibVersion}.jar").toPath(), REPLACE_EXISTING);
- }
- if (file("$buildDir/libs/ar-sources.jar").exists()) {
- Files.move(file("$buildDir/libs/ar-sources.jar").toPath(),
- file("$buildDir/libs/processing-ar-${arLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
- }
- if (file("$buildDir/libs/ar.jar.MD5").exists()) {
- Files.move(file("$buildDir/libs/ar.jar.MD5").toPath(),
- file("$buildDir/libs/processing-ar-${arLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
+tasks.build {
+ doLast {
+ // Copying ar jar to library folder
+ File arJar = file("library/ar.jar")
+ arJar.mkdirs()
+
+ // Need to check the existance of the files before using as the files
+ // will get generated only if Task ':mode:libraries:ar:jar' is not being skipped
+ // Task ':mode:libraries:ar:jar' will be skipped if source files are unchanged or jar task is UP-TO-DATE
+ def arJarFile = file("$buildDir/libs/ar.jar")
+ if (arJarFile.exists()) {
+ Files.copy(arJarFile.toPath(), arJar.toPath(), REPLACE_EXISTING)
+ }
+
+ // Rename artifacts for Maven publishing
+ def processingArJar = file("$buildDir/libs/processing-ar-${arLibVersion}.jar")
+ if (arJarFile.exists()) {
+ Files.move(arJarFile.toPath(), processingArJar.toPath(), REPLACE_EXISTING)
+ }
+
+ def processingArSourcesJar = file("$buildDir/libs/processing-ar-${arLibVersion}-sources.jar")
+ def arSourcesJar = file("$buildDir/libs/ar-sources.jar")
+ if (arSourcesJar.exists()) {
+ Files.move(arSourcesJar.toPath(), processingArSourcesJar.toPath(), REPLACE_EXISTING)
+ }
+
+ def arMd5File = file("$buildDir/libs/ar.jar.MD5")
+ def processingArMd5File = file("$buildDir/libs/processing-ar-${arLibVersion}.jar.md5")
+ if (arMd5File.exists()) {
+ Files.move(arMd5File.toPath(), processingArMd5File.toPath(), REPLACE_EXISTING)
+ }
}
}
@@ -96,4 +119,5 @@ ext {
libDependencies = [[group: 'org.p5android', name: 'processing-core', version: modeVersion],
[group: 'com.google.ar', name: 'core', version: garVersion]]
}
+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
diff --git a/processing/mode/libraries/vr/build.gradle b/processing/mode/libraries/vr/build.gradle
index fb09fbdaa..b223c4910 100644
--- a/processing/mode/libraries/vr/build.gradle
+++ b/processing/mode/libraries/vr/build.gradle
@@ -2,7 +2,8 @@ import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
plugins {
- id 'aar'
+ id 'java-library'
+ id 'maven-publish'
}
dependencies {
@@ -14,25 +15,37 @@ dependencies {
// implementationAar "com.google.vr:sdk-base:${gvrVersion}"
// fix for Issue #718
- implementationAar fileTree(dir: "../../../../libs/google-vr/", include: ["*.aar"])
-}
-
-task sourceJar(type: Jar, dependsOn: classes) {
- classifier = "sources"
- from sourceSets.main.allSource
+ implementation fileTree(dir: "../../../../libs/google-vr/", include: ["*.aar"])
}
sourceSets {
main {
- java {
- srcDirs = ["../../../../libs/processing-vr/src/main/java/"]
+ java.srcDir("../../../../libs/processing-vr/src/main/java/")
+ resources {
+ srcDir("../../../../libs/processing-vr/src/main/")
+ exclude "AndroidManifest.xml"
+ exclude "**/java/**"
}
}
}
+java {
+ withSourcesJar()
+}
+
+tasks.named('jar') {
+ duplicatesStrategy = DuplicatesStrategy.INCLUDE
+}
+
+tasks.register("sourceJar", Jar) {
+ from sourceSets.main.allJava
+ archiveClassifier.set("sources")
+}
+
// Does not work because of Processing-specific tags in source code, such as @webref
-task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = "javadoc"
+tasks.register("javadocJar", Jar) {
+ dependsOn javadoc
+ archiveClassifier.set("javadoc")
from javadoc.destinationDir
}
@@ -41,53 +54,67 @@ artifacts {
archives sourceJar
}
-jar.doLast { task ->
- ant.checksum file: task.archivePath
+tasks.jar {
+ doLast {
+ ant.checksum file: archiveFile.get().asFile
+ }
}
-clean.doFirst {
- delete "dist"
- delete "library/vr.jar"
+tasks.clean {
+ doFirst {
+ delete "dist"
+ delete "library/vr.jar"
+ }
}
-compileJava.doFirst {
- String[] deps = ["sdk-audio.jar",
- "sdk-base.jar",
- "sdk-common.jar"]
- File libFolder = file("library")
- libFolder.mkdirs()
- for (String fn : deps) {
- Files.copy(file("${rootDir}/build/libs/" + fn).toPath(),
- file("library/" + fn).toPath(), REPLACE_EXISTING);
+tasks.compileJava {
+ doFirst {
+ String[] deps = ["sdk-audio.jar",
+ "sdk-base.jar",
+ "sdk-common.jar"]
+ File libFolder = file("library")
+ libFolder.mkdirs()
+ deps.each { String fn ->
+ Files.copy(
+ file("${rootDir}/build/libs/" + fn).toPath(),
+ file("library/" + fn).toPath(),
+ REPLACE_EXISTING
+ )
+ }
}
}
-build.doLast {
- // Copying vr jar to library folder
- File vrJar = file("library/vr.jar")
- vrJar.mkdirs();
+tasks.build {
+ doLast {
+ // Copying vr jar to library folder
+ File vrJar = file("library/vr.jar")
+ vrJar.mkdirs()
+
+ // Need to check the existance of the files before using as the files
+ // will get generated only if Task ':mode:libraries:vr:jar' is not being skipped
+ // Task ':mode:libraries:vr:jar' will be skipped if source files are unchanged or jar task is UP-TO-DATE
+ def vrJarFile = file("$buildDir/libs/vr.jar")
+ if (vrJarFile.exists()) {
+ Files.copy(vrJarFile.toPath(), vrJar.toPath(), REPLACE_EXISTING)
+ }
- // Need to check the existance of the files before using as the files
- // will get generated only if Task ':mode:libraries:vr:jar' is not being skipped
- // Task ':mode:libraries:vr:jar' will be skipped if source files are unchanged or jar task is UP-TO-DATE
+ // Renaming artifacts for maven publishing
+ def processingVrJar = file("$buildDir/libs/processing-vr-${vrLibVersion}.jar")
+ if (vrJarFile.exists()) {
+ Files.move(vrJarFile.toPath(), processingVrJar.toPath(), REPLACE_EXISTING)
+ }
- if (file("$buildDir/libs/vr.jar").exists()) {
- Files.copy(file("$buildDir/libs/vr.jar").toPath(),
- vrJar.toPath(), REPLACE_EXISTING);
- }
+ def processingVrSourcesJar = file("$buildDir/libs/processing-vr-${vrLibVersion}-sources.jar")
+ def vrSourcesJar = file("$buildDir/libs/vr-sources.jar")
+ if (vrSourcesJar.exists()) {
+ Files.move(vrSourcesJar.toPath(), processingVrSourcesJar.toPath(), REPLACE_EXISTING)
+ }
- // Renaming artifacts for maven publishing
- if (file("$buildDir/libs/vr.jar").exists()) {
- Files.move(file("$buildDir/libs/vr.jar").toPath(),
- file("$buildDir/libs/processing-vr-${vrLibVersion}.jar").toPath(), REPLACE_EXISTING);
- }
- if (file("$buildDir/libs/vr-sources.jar").exists()) {
- Files.move(file("$buildDir/libs/vr-sources.jar").toPath(),
- file("$buildDir/libs/processing-vr-${vrLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
- }
- if (file("$buildDir/libs/vr.jar.MD5").exists()) {
- Files.move(file("$buildDir/libs/vr.jar.MD5").toPath(),
- file("$buildDir/libs/processing-vr-${vrLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
+ def vrMd5File = file("$buildDir/libs/vr.jar.MD5")
+ def processingVrMd5File = file("$buildDir/libs/processing-vr-${vrLibVersion}.jar.md5")
+ if (vrMd5File.exists()) {
+ Files.move(vrMd5File.toPath(), processingVrMd5File.toPath(), REPLACE_EXISTING)
+ }
}
}
@@ -101,4 +128,5 @@ ext {
[group: 'com.google.vr', name: 'sdk-base', version: gvrVersion],
[group: 'com.google.vr', name: 'sdk-audio', version: gvrVersion]]
}
+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
diff --git a/settings.gradle b/settings.gradle
index bca87ed5d..193a03378 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':libs:processing-core', 'libs:google-vr',':libs:processing-vr', ':libs:processing-ar', ':apps:simple', ':apps:wallpaper', ':apps:vrcube', ':apps:arscene', ':apps:watchface', ':apps:fast2d', ':apps:armarkers'
\ No newline at end of file
+include ':libs:processing-core', 'libs:google-vr',':libs:processing-vr', ':libs:processing-ar', ':apps:simple', ':apps:wallpaper', ':apps:arscene', ':apps:watchface', ':apps:fast2d', ':apps:armarkers'
\ No newline at end of file