Skip to content

Core AndroidX support and creation of distributions for JCentre #616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 1, 2021
Merged
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ allprojects {
versions.load(project.rootProject.file("mode/version.properties").newDataInputStream())
ext.targetSdkVersion = versions.getProperty("android-platform")
ext.supportLibsVersion = versions.getProperty("com.android.support%support-v4")
ext.supportLibsVersionAndroidX=versions.getProperty("androidx.appcompat%appcompat")
ext.wearVersion = versions.getProperty("com.google.android.support%wearable")
ext.gvrVersion = versions.getProperty("com.google.vr")
ext.garVersion = versions.getProperty("com.google.ar")
Expand All @@ -39,6 +40,7 @@ allprojects {
Properties modeProperties = new Properties()
modeProperties.load(project.rootProject.file("mode/mode.properties").newDataInputStream())
ext.modeVersion = modeProperties.getProperty("prettyVersion")
ext.modeVersionAndroidX = modeProperties.getProperty("prettyVersionAndroidX")

Properties vrProperties = new Properties()
vrProperties.load(project.rootProject.file("mode/libraries/vr/library.properties").newDataInputStream())
Expand All @@ -49,6 +51,7 @@ allprojects {
ext.arLibVersion = arProperties.getProperty("prettyVersion")



def fn = project.rootProject.file("local.properties")
if (!fn.exists()) {
if (System.env["ANDROID_SDK"] != null) {
Expand Down
118 changes: 118 additions & 0 deletions core-androidx/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING

apply plugin: 'maven'
apply plugin: 'aar'

dependencies {
implementation name: "android"

implementationAar "androidx.appcompat:appcompat:${supportLibsVersionAndroidX}"
implementationAar "com.google.android.support:wearable:${wearVersion}"
}

task createPom {
pom {
project {
groupId "org.p5android"
artifactId "processing-core-androidx"
version "${modeVersionAndroidX}"
packaging "jar"
licenses {
license {
name "GNU Lesser General Public License, version 2.1"
url "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt"
distribution "repo"
}
}
dependencies {
dependency {
groupId "androidx.appcompat"
artifactId "appcompat"
version "${supportLibsVersionAndroidX}"
scope "implementation"
}
dependency {
groupId "com.google.android.support"
artifactId "wearable"
version "${wearVersion}"
scope "implementation"
}
}
}
}.writeTo("dist/processing-core-androidx-${modeVersionAndroidX}.pom")
}

sourceSets {
main {
java {
srcDirs = ["src/"]
}
resources {
srcDirs = ["src/"]
}
}
}

task sourcesJar(type: Jar, dependsOn: classes) {
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 sourcesJar
}

jar.doLast { task ->
ant.checksum file: task.archivePath
}

clean.doFirst {
delete "dist"
//delete "${coreZipPath}" // TODO - Currently no need to delete.
// We have not implemented androidx in android mode.
// Need to declare new variable in root build.gradle for androidx to use in Android Mode for PDE
}

/*
// No need to copy these are already there in the mode by core compile.
// By following task androidx-support jar can be added as ${rootDir}/mode/mode/ by copying from ${rootDir}/build/libs/
compileJava.doFirst {
String[] deps = ["percent.jar",
"recyclerview-v7.jar",
"support-compat.jar",
"support-core-ui.jar",
"support-core-utils.jar",
"support-fragment.jar",
"support-media-compat.jar",
"support-v4.jar",
"wearable.jar"]
for (String fn : deps) {
Files.copy(file("${rootDir}/build/libs/" + fn).toPath(),
file("${rootDir}/mode/mode/" + fn).toPath(), REPLACE_EXISTING)
}
}
*/

build.doLast {
// TODO - Not adding core-androidx in android mode for now.
//Files.copy(file("${buildDir}/libs/core.jar").toPath(),
// file("${coreZipPath}").toPath(), REPLACE_EXISTING)

// Copying the files for release on JCentral
File distFolder = file("dist")
distFolder.mkdirs()
Files.copy(file("${buildDir}/libs/core-androidx.jar").toPath(),
file("dist/processing-core-androidx-${modeVersionAndroidX}.jar").toPath(), REPLACE_EXISTING)
Files.copy(file("${buildDir}/libs/core-androidx-sources.jar").toPath(),
file("dist/processing-core-androidx-${modeVersionAndroidX}-sources.jar").toPath(), REPLACE_EXISTING)
Files.copy(file("${buildDir}/libs/core-androidx.jar.MD5").toPath(),
file("dist/processing-core-androidx-${modeVersionAndroidX}.jar.md5").toPath(), REPLACE_EXISTING)
}
32 changes: 32 additions & 0 deletions core-androidx/src/assets/shaders/ColorFrag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Part of the Processing project - http://processing.org

Copyright (c) 2012-16 The Processing Foundation
Copyright (c) 2004-12 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/

#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif

varying vec4 vertColor;

void main() {
gl_FragColor = vertColor;
}
34 changes: 34 additions & 0 deletions core-androidx/src/assets/shaders/ColorVert.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Part of the Processing project - http://processing.org

Copyright (c) 2012-16 The Processing Foundation
Copyright (c) 2004-12 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/

uniform mat4 transformMatrix;

attribute vec4 position;
attribute vec4 color;

varying vec4 vertColor;

void main() {
gl_Position = transformMatrix * position;

vertColor = color;
}
33 changes: 33 additions & 0 deletions core-androidx/src/assets/shaders/LightFrag.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Part of the Processing project - http://processing.org

Copyright (c) 2012-16 The Processing Foundation
Copyright (c) 2004-12 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/

#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif

varying vec4 vertColor;
varying vec4 backVertColor;

void main() {
gl_FragColor = gl_FrontFacing ? vertColor : backVertColor;
}
Loading