Permalink
Browse files

tweak gradle scripts

  • Loading branch information...
1 parent 396d523 commit 476f2903d37e63c97c93acba3edac6eb824cc5c8 @codeanticode codeanticode committed Jan 2, 2017
Showing with 58 additions and 47 deletions.
  1. +12 −19 build.gradle
  2. +1 −1 core/.classpath
  3. +36 −22 core/build.gradle
  4. +6 −3 core/build.xml
  5. +3 −2 gradle.properties
View
@@ -1,6 +1,7 @@
buildscript {
repositories {
- mavenCentral()
+ //mavenCentral()
+ jcenter()
}
dependencies {
@@ -15,18 +16,17 @@ apply plugin: 'java'
allprojects {
apply plugin: 'java'
- // Find location of Android-17 android jar relative to ANDROID_HOME
- ext.android_23 = "$sdkdir/platforms/android-23"
+ // Find location of android jar relative to ANDROID_HOME
+ ext.android_platform = "$sdkdir/platforms/android-$sdkver"
repositories {
- //jcenter()
- mavenCentral()
- flatDir { dirs 'core/library', android_23 }
+ jcenter()
+ //mavenCentral()
+ flatDir { dirs 'core/library', android_platform}
}
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
-
+ sourceCompatibility = 1.7
+ targetCompatibility = 1.7
}
@@ -37,9 +37,6 @@ dependencies {
compile group: 'org.processing', name: 'core', version: '3.2.3'
compile group: 'org.processing', name: 'pde', version: '3.2.3'
compile group: 'org.processing', name: 'java-mode', version: '3.2.3'
-
-
-
}
sourceSets {
@@ -51,15 +48,11 @@ sourceSets {
}
-
-
import java.nio.file.Files
import org.zeroturnaround.zip.ZipUtil
import org.apache.commons.io.FileUtils
import static java.nio.file.StandardCopyOption.*;
-
-
task dist {
try {
def root = "$buildDir/zip/AndroidMode"
@@ -71,13 +64,13 @@ task dist {
FileUtils.copyDirectory(file("theme"), file("$root/theme"))
Files.copy(file("$buildDir/libs/processing-android.jar").toPath(),
- file("$root/mode/AndroidMode.jar").toPath(), REPLACE_EXISTING);
+ file("$root/mode/AndroidMode.jar").toPath(), REPLACE_EXISTING);
Files.copy(file("core/build/libs/android-core.zip").toPath(),
- file("$root/android-core.zip").toPath(), REPLACE_EXISTING);
+ file("$root/android-core.zip").toPath(), REPLACE_EXISTING);
Files.copy(file("mode.properties").toPath(),
- file("$root/mode.properties").toPath(), REPLACE_EXISTING);
+ file("$root/mode.properties").toPath(), REPLACE_EXISTING);
ZipUtil.pack(file("$buildDir/zip"), new File("release/AndroidMode.zip"))
Files.copy(file("mode.properties").toPath(),
View
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="var" path="ANDROID_LIB"/>
- <classpathentry kind="lib" path="library/wearable-1.3.0-classes.jar"/>
<classpathentry kind="lib" path="library/android-support-v4.jar"/>
+ <classpathentry kind="lib" path="library/wearable-1.4.0-classes.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View
@@ -2,72 +2,86 @@ apply plugin: 'java'
buildscript {
repositories {
- mavenCentral()
+// mavenCentral()
+ jcenter()
}
dependencies {
classpath group: 'commons-io', name: 'commons-io', version: '2.5'
classpath group: 'org.zeroturnaround', name: 'zt-zip', version: '1.9'
-
}
}
-// Find location of Android-23 android jar relative to ANDROID_HOME
-def android_23 = "$sdkdir/platforms/android-23"
+// Find location of android jar relative to ANDROID_HOME
+def android_platform = "$sdkdir/platforms/android-$sdkver"
+// Check to see if required API exists
+// TODO: Look for any higher SDK and use it.
+if (!file(android_platform).exists()) {
+ logger.error "Android SDK $sdkver could not be found in $sdkdir"
+}
repositories {
//jcenter()
- flatDir {dirs 'library', android_23}
-}
-
-// Check to see if API 23 exists
-// TODO: Look for any 23+ SDK and use it.
-if (!file(android_23).exists()) {
- logger.error "Android SDK 23 could not be found in $sdkdir"
+ flatDir {dirs 'library', android_platform}
}
-
-
dependencies {
compile name: 'android'
+
+ // android-support-v4.jar is in $sdkdir/extras/android/support/v4
compile name: 'android-support-v4'
- compile name: 'wearable-1.3.0-classes'
+
+ // Could not find the source of the wearable aars in Android Studio, so far
+ // these two repositories seem to have up-to-date versions:
+ // http://mvn.sibext.com/com/google/android/support/wearable/
+ // http://uiq3.sourceforge.net/Repository/com/google/android/support/wearable/
+ // MavenCentral and JCenter don't seem to have any wearable file.
+ // Use the wear-update script to create a new wearable-$version-classes jar
+ compile name: 'wearable-1.4.0-classes'
}
sourceSets {
main {
java {
srcDirs = ['src/']
}
+ resources {
+ srcDirs = ['src/']
+ }
}
}
// Create Jar
-jar {
+jar {
manifest {
attributes(
"Manifest-Version": "1.0",
"Gradle-Version": "$gradle.gradleVersion"
)
}
+
}
import groovy.util.AntBuilder
+import java.nio.file.Files
+import static java.nio.file.StandardCopyOption.*;
-import org.apache.commons.io.FileUtils
+//import org.apache.commons.io.FileUtils
+//import org.zeroturnaround.zip.ZipUtil
-import org.zeroturnaround.zip.ZipUtil
task dist {
doLast {
- // Copy shaders to build dir
- FileUtils.copyDirectory(file("src/assets"), file("$buildDir/zip/assets"))
- FileUtils.copyDirectory(file("$buildDir/classes/main"), file("$buildDir/zip/"))
-
- ZipUtil.pack(file("$buildDir/zip"), new File("$buildDir/libs/android-core.zip"))
+ // make copy of jar file as zip
+ Files.copy(file("$buildDir/libs/core.jar").toPath(),
+ file("$buildDir/libs/android-core.zip").toPath(), REPLACE_EXISTING);
+
+ //FileUtils.copyDirectory(file("src/assets"), file("$buildDir/zip/assets"))
+ //FileUtils.copyDirectory(file("$buildDir/classes/main"), file("$buildDir/zip/"))
+ //ZipUtil.pack(file("$buildDir/zip"), new File("$buildDir/libs/android-core.zip"))
}
}
View
@@ -11,7 +11,10 @@
<!-- Android platform to build the core library -->
<property name="android.platform" value="android-23" />
-
+
+ <!-- Wear version to build the core library -->
+ <property name="wear.version" value="1.4.0" />
+
<!-- oh ant, you're so cute and convoluted -->
<target name="build" depends="sdk_chatter,actual_build" />
@@ -38,8 +41,8 @@
encoding="UTF-8"
includeAntRuntime="false"
bootclasspath="${env.ANDROID_SDK}/platforms/${android.platform}/android.jar;
- library/wearable-1.3.0-classes.jar;
- library/android-support-v4.jar"
+ library/android-support-v4.jar;
+ library/wearable-${wear.version}-classes.jar"
srcdir="src" destdir="bin" />
<!-- Copy the shaders to the bin folder.
View
@@ -1,2 +1,3 @@
-// Set your Android SDK location here
-sdkdir=/Users/andres/code/android/sdk
+// Set your Android SDK location and version here
+sdkdir=/Users/andres/code/android/sdk
+sdkver=23

0 comments on commit 476f290

Please sign in to comment.