diff --git a/Makefile b/Makefile index c97aa25..0806da5 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,9 @@ clean_ios: clean_macos: -rm -rf ports/xcode_macos clean_android: - -rm -rf ports/android/app/build - -find ports -name ".externalNativeBuild" -exec rm -r "{}" \; + -rm -rf pkg/android/app/build + -find pkg -name ".externalNativeBuild" -exec rm -r "{}" \; + $(DIST_BUILD_SCRIPT) android "clean" clean_products: -rm -rf products .PHONY: clean @@ -49,8 +50,6 @@ android_release: $(DIST_BUILD_SCRIPT) android "release" $(DIST_BUILD_SCRIPT) clean_android_project $(DIST_BUILD_SCRIPT) prep_android_example "release" -android_clean: - $(DIST_BUILD_SCRIPT) android "clean" android: android_debug android_release prep_android_debug_example: $(DIST_BUILD_SCRIPT) prep_android_example "debug" diff --git a/dist.sh b/dist.sh old mode 100644 new mode 100755 index c1b56c8..97b0c40 --- a/dist.sh +++ b/dist.sh @@ -38,7 +38,7 @@ BUILD_CONCURRENCY= #"-j 2" OSNAME=$(uname | tr '[A-Z]' '[a-z]') BUILD_TMP=$(pwd)/tmp -ANDROID_PROJ_DIR=$(pwd)/ports/android +ANDROID_PROJ_DIR=$(pwd)/pkg/android XCODE_IOS_PROJ_DIR=$(pwd)/ports/xcode_ios XCODE_IOS_SIMULATOR_PROJ_DIR=$(pwd)/ports/xcode_ios_simulator XCODE_MACOS_PROJ_DIR=$(pwd)/ports/xcode_macos @@ -328,45 +328,49 @@ host() # Set important variables for Android builds set_android_env() { - #JDK=jdk1.8.0_202.jdk # Set ANDROID_HOME because setting sdk.dir in local.properties isn't always reliable - export ANDROID_HOME=/Users/$USER/Library/Android/sdk - export PATH=/Library/Java/JavaVirtualMachines/$JDK/Contents/Home/bin/:${PATH} - export PATH=/Users/$USER/Library/Android/sdk/platform-tools/:${PATH} + #export PATH=/Library/Java/JavaVirtualMachines/$JDK/Contents/Home/bin/:${PATH} + #export PATH=/Users/$USER/Library/Android/sdk/platform-tools/:${PATH} GRADLE_ARGS=--stacktrace - ANDROID_APP_NAME=com.example.mynewestapplication + #ANDROID_APP_NAME=com.example.mynewestapplication + # for our purposes we limit this to execution on macOS + if [[ $OSNAME = *"linux"* ]]; then + export ANDROID_HOME=/usr/lib/android-sdk/ + fi + if [[ $OSNAME = *"darwin"* ]]; then + export ANDROID_HOME=/Users/$USER/Library/Android/sdk + fi } -# Build android AAR from ports/android +# Build android AAR android() { - echo "Executing task: " ${FUNCNAME[ 0 ]} "(" $1 ")" - set_android_env - copy_root_java_sources_to_projects - # NOTE: There's no reason this won't build on linux, it's just that - # for our purposes we limit this to execution on macOS - if [[ ! $OSNAME = *"darwin"* ]]; then - exit 0 - fi - # CMake build files - BUILD_DIR=$(pwd)/tmp/android-$1 - mkdir -p $BUILD_DIR - # If clean requested, remove temp build dir - if [[ $1 = *"clean"* ]]; then - rm -rf $BUILD_DIR - exit 0 - fi - # Where to place results - LIB_OUTPUT_DIR=$(pwd)/lib/$1/android - mkdir -p $LIB_OUTPUT_DIR - # Build - UPPERCASE_CONFIG="$(tr '[:lower:]' '[:upper:]' <<< ${1:0:1})${1:1}" - CMAKE_FLAGS="-DSDK_JNI=1 -DSDK_JNI=ON" - cd $ANDROID_PROJ_DIR - ./gradlew $GRADLE_ARGS assemble$UPPERCASE_CONFIG # assembleRelease / assembleDebug - mv $ANDROID_PROJ_DIR/app/build/outputs/aar/app-$1.aar \ - $LIB_OUTPUT_DIR/libzt-$1.aar - cd - + echo "Executing task: " ${FUNCNAME[ 0 ]} "(" $1 ")" + # Unsure why, but Gradle's build script chokes on this non-source file now + rm -rf ext/ZeroTierOne/ext/miniupnpc/VERSION + export PATH=$ANDROID_HOME/cmdline-tools/tools/bin:$PATH + set_android_env + # Copy source files into project + cp -f src/bindings/java/*.java ${ANDROID_PROJ_DIR}/app/src/main/java/com/zerotier/libzt + # CMake build files + BUILD_DIR=$(pwd)/tmp/android-$1 + mkdir -p $BUILD_DIR + # If clean requested, remove temp build dir + if [[ $1 = *"clean"* ]]; then + rm -rf $BUILD_DIR + exit 0 + fi + # Where to place results + LIB_OUTPUT_DIR=$(pwd)/lib/$1/android + mkdir -p $LIB_OUTPUT_DIR + # Build + UPPERCASE_CONFIG="$(tr '[:lower:]' '[:upper:]' <<< ${1:0:1})${1:1}" + CMAKE_FLAGS="-DSDK_JNI=1 -DSDK_JNI=ON" + cd $ANDROID_PROJ_DIR + ./gradlew $GRADLE_ARGS assemble$UPPERCASE_CONFIG # assembleRelease / assembleDebug + mv $ANDROID_PROJ_DIR/app/build/outputs/aar/*.aar \ + $LIB_OUTPUT_DIR/libzt-$1.aar + cd - } # Remove intermediate object files and/or libraries @@ -493,8 +497,7 @@ android_app_log_filtered() # based projects. copy_root_java_sources_to_projects() { - cp -f src/java/*.java ports/android/app/src/main/java/com/zerotier/libzt - cp -f src/java/*.java ports/java/com/zerotier/libzt/ + cp -f src/bindings/java/*.java ports/java/com/zerotier/libzt/ } # At the end of build stage, print contents and trees for inspection diff --git a/examples/android/ExampleAndroidApp/gradle/wrapper/gradle-wrapper.properties b/examples/android/ExampleAndroidApp/gradle/wrapper/gradle-wrapper.properties index 8333aea..d1dd0fc 100644 --- a/examples/android/ExampleAndroidApp/gradle/wrapper/gradle-wrapper.properties +++ b/examples/android/ExampleAndroidApp/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/examples/android/ExampleAndroidApp/gradlew b/examples/android/ExampleAndroidApp/gradlew old mode 100644 new mode 100755 diff --git a/examples/android/ExampleAndroidApp/gradlew.bat b/examples/android/ExampleAndroidApp/gradlew.bat old mode 100755 new mode 100644 diff --git a/examples/python/zt.i b/examples/python/zt.i new file mode 100644 index 0000000..69aa836 --- /dev/null +++ b/examples/python/zt.i @@ -0,0 +1,30 @@ +/* libzt.i */ + +%begin +%{ +#define SWIG_PYTHON_CAST_MODE +%} + +%include + +#define PYTHON_BUILD 1 + +%module libzt +%{ +#include "../include/ZeroTier.h" +#include "../include/ZeroTierConstants.h" +%} + +%define %cs_callback(TYPE, CSTYPE) + %typemap(ctype) TYPE, TYPE& "void *" + %typemap(in) TYPE %{ $1 = ($1_type)$input; %} + %typemap(in) TYPE& %{ $1 = ($1_type)&$input; %} + %typemap(imtype, out="IntPtr") TYPE, TYPE& "CSTYPE" + %typemap(cstype, out="IntPtr") TYPE, TYPE& "CSTYPE" + %typemap(csin) TYPE, TYPE& "$csinput" +%enddef + +%cs_callback(userCallbackFunc, CSharpCallback) + +%include "../include/ZeroTier.h" +%include "../include/ZeroTierConstants.h" diff --git a/examples/rust/binding-example/Cargo.lock b/examples/rust/binding-example/Cargo.lock new file mode 100644 index 0000000..7c0a5dd --- /dev/null +++ b/examples/rust/binding-example/Cargo.lock @@ -0,0 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "binding-example" +version = "0.1.0" diff --git a/examples/rust/binding-example/Cargo.toml b/examples/rust/binding-example/Cargo.toml new file mode 100644 index 0000000..fe94196 --- /dev/null +++ b/examples/rust/binding-example/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "binding-example" +version = "0.1.0" +authors = ["Joseph Henry "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +#rustc-link-search = ["../../../lib/debug/macos-x86_64/"] + +[dependencies] diff --git a/examples/rust/binding-example/build.rs b/examples/rust/binding-example/build.rs new file mode 100644 index 0000000..bf44483 --- /dev/null +++ b/examples/rust/binding-example/build.rs @@ -0,0 +1,4 @@ +fn main() { + println!("cargo:rustc-flags=-l dylib=c++"); + //println!("cargo:rustc-link-search=."); +} \ No newline at end of file diff --git a/examples/rust/binding-example/src/main.rs b/examples/rust/binding-example/src/main.rs new file mode 100644 index 0000000..cd9f0fd --- /dev/null +++ b/examples/rust/binding-example/src/main.rs @@ -0,0 +1,10 @@ + +#[link(name = "libzt", kind = "dylib")] +extern { + fn zts_socket(address_family: i32) -> i32; +} + +fn main() { + let x = unsafe { zts_socket(100) }; + println!("zts_socket() = {}", x); +} diff --git a/examples/rust/program.c b/examples/rust/program.c new file mode 100644 index 0000000..816f383 --- /dev/null +++ b/examples/rust/program.c @@ -0,0 +1,6 @@ +#include + +int zts_socket(int address_family) +{ + return -777; +} diff --git a/examples/rust/program.h b/examples/rust/program.h new file mode 100644 index 0000000..23847a0 --- /dev/null +++ b/examples/rust/program.h @@ -0,0 +1 @@ +int zts_socket(int address_family); diff --git a/examples/rust/program.rs b/examples/rust/program.rs new file mode 100644 index 0000000..169c9dd --- /dev/null +++ b/examples/rust/program.rs @@ -0,0 +1,5 @@ +/* automatically generated by rust-bindgen 0.56.0 */ + +extern "C" { + pub fn zts_socket(address_family: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} diff --git a/ports/android/.gitignore b/pkg/android/.gitignore similarity index 100% rename from ports/android/.gitignore rename to pkg/android/.gitignore diff --git a/ports/android/.project b/pkg/android/.project similarity index 100% rename from ports/android/.project rename to pkg/android/.project diff --git a/ports/android/.settings/org.eclipse.buildship.core.prefs b/pkg/android/.settings/org.eclipse.buildship.core.prefs similarity index 100% rename from ports/android/.settings/org.eclipse.buildship.core.prefs rename to pkg/android/.settings/org.eclipse.buildship.core.prefs diff --git a/ports/android/app/.gitignore b/pkg/android/app/.gitignore similarity index 100% rename from ports/android/app/.gitignore rename to pkg/android/app/.gitignore diff --git a/ports/android/app/build.gradle b/pkg/android/app/build.gradle similarity index 100% rename from ports/android/app/build.gradle rename to pkg/android/app/build.gradle diff --git a/ports/android/app/proguard-rules.pro b/pkg/android/app/proguard-rules.pro similarity index 100% rename from ports/android/app/proguard-rules.pro rename to pkg/android/app/proguard-rules.pro diff --git a/ports/android/app/src/main/AndroidManifest.xml b/pkg/android/app/src/main/AndroidManifest.xml similarity index 100% rename from ports/android/app/src/main/AndroidManifest.xml rename to pkg/android/app/src/main/AndroidManifest.xml diff --git a/ports/android/app/src/main/java/com/example/zerotier/MainActivity.java b/pkg/android/app/src/main/java/com/example/zerotier/MainActivity.java similarity index 100% rename from ports/android/app/src/main/java/com/example/zerotier/MainActivity.java rename to pkg/android/app/src/main/java/com/example/zerotier/MainActivity.java diff --git a/pkg/android/app/src/main/java/com/zerotier/libzt/README b/pkg/android/app/src/main/java/com/zerotier/libzt/README new file mode 100644 index 0000000..4d871fb --- /dev/null +++ b/pkg/android/app/src/main/java/com/zerotier/libzt/README @@ -0,0 +1 @@ +Before build, Java wrapper sources will be copied here diff --git a/ports/android/build.gradle b/pkg/android/build.gradle similarity index 89% rename from ports/android/build.gradle rename to pkg/android/build.gradle index 2426268..43c0708 100644 --- a/ports/android/build.gradle +++ b/pkg/android/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:3.1.3' // NOTE: Do not place your application dependencies here; they belong diff --git a/ports/android/gradle.properties b/pkg/android/gradle.properties similarity index 100% rename from ports/android/gradle.properties rename to pkg/android/gradle.properties diff --git a/ports/android/gradle/wrapper/gradle-wrapper.properties b/pkg/android/gradle/wrapper/gradle-wrapper.properties similarity index 87% rename from ports/android/gradle/wrapper/gradle-wrapper.properties rename to pkg/android/gradle/wrapper/gradle-wrapper.properties index 472bb68..9fe8d05 100644 --- a/ports/android/gradle/wrapper/gradle-wrapper.properties +++ b/pkg/android/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,3 @@ -#Wed Jul 18 09:57:38 PDT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/pkg/android/gradlew old mode 100644 new mode 100755 similarity index 100% rename from gradlew rename to pkg/android/gradlew diff --git a/gradlew.bat b/pkg/android/gradlew.bat old mode 100755 new mode 100644 similarity index 100% rename from gradlew.bat rename to pkg/android/gradlew.bat diff --git a/ports/android/settings.gradle b/pkg/android/settings.gradle similarity index 100% rename from ports/android/settings.gradle rename to pkg/android/settings.gradle diff --git a/ports/android/app/src/androidTest/java/com/example/zerotier/ExampleInstrumentedTest.java b/ports/android/app/src/androidTest/java/com/example/zerotier/ExampleInstrumentedTest.java deleted file mode 100644 index fe8e36c..0000000 --- a/ports/android/app/src/androidTest/java/com/example/zerotier/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.example.zerotier; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("com.example.zerotier", appContext.getPackageName()); - } -} diff --git a/ports/android/app/src/main/java/com/zerotier/libzt/README b/ports/android/app/src/main/java/com/zerotier/libzt/README deleted file mode 100644 index 062ccae..0000000 --- a/ports/android/app/src/main/java/com/zerotier/libzt/README +++ /dev/null @@ -1 +0,0 @@ -Before build, Java sources are copied here from src/java in the root directory of this repo. diff --git a/ports/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/ports/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index c7bd21d..0000000 --- a/ports/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - diff --git a/ports/android/app/src/main/res/drawable/ic_launcher_background.xml b/ports/android/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index d5fccc5..0000000 --- a/ports/android/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ports/android/app/src/main/res/layout/activity_main.xml b/ports/android/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index 7d8d24e..0000000 --- a/ports/android/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ports/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/ports/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index eca70cf..0000000 --- a/ports/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ports/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/ports/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index eca70cf..0000000 --- a/ports/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ports/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/ports/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index a2f5908..0000000 Binary files a/ports/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/ports/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 1b52399..0000000 Binary files a/ports/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/ports/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index ff10afd..0000000 Binary files a/ports/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/ports/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 115a4c7..0000000 Binary files a/ports/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/ports/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index dcd3cd8..0000000 Binary files a/ports/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/ports/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 459ca60..0000000 Binary files a/ports/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/ports/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 8ca12fe..0000000 Binary files a/ports/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/ports/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 8e19b41..0000000 Binary files a/ports/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/ports/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index b824ebd..0000000 Binary files a/ports/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/ports/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/ports/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 4c19a13..0000000 Binary files a/ports/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/ports/android/app/src/main/res/values/colors.xml b/ports/android/app/src/main/res/values/colors.xml deleted file mode 100644 index 3ab3e9c..0000000 --- a/ports/android/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #3F51B5 - #303F9F - #FF4081 - diff --git a/ports/android/app/src/main/res/values/strings.xml b/ports/android/app/src/main/res/values/strings.xml deleted file mode 100644 index 87c6cc8..0000000 --- a/ports/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - ZeroTier - diff --git a/ports/android/app/src/main/res/values/styles.xml b/ports/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 5885930..0000000 --- a/ports/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/ports/android/app/src/test/java/com/example/zerotier/ExampleUnitTest.java b/ports/android/app/src/test/java/com/example/zerotier/ExampleUnitTest.java deleted file mode 100644 index f0aee30..0000000 --- a/ports/android/app/src/test/java/com/example/zerotier/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.example.zerotier; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/ports/android/gradle/wrapper/gradle-wrapper.jar b/ports/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7a3265e..0000000 Binary files a/ports/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/ports/android/gradlew b/ports/android/gradlew deleted file mode 100644 index cccdd3d..0000000 --- a/ports/android/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# 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 - ;; - 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" - which java >/dev/null 2>&1 || 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 - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/ports/android/gradlew.bat b/ports/android/gradlew.bat deleted file mode 100755 index e95643d..0000000 --- a/ports/android/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega