From 320582a55c9ba1f91d70a3f120413e305fda2962 Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 3 Sep 2018 18:29:00 +0200 Subject: cleanup Nim's examples/ directory; closes #7725 --- .../cross_calculator/android/AndroidManifest.xml | 18 ----- examples/cross_calculator/android/build.xml | 92 ---------------------- examples/cross_calculator/android/custom_rules.xml | 17 ---- examples/cross_calculator/android/jni/Android.mk | 32 -------- .../cross_calculator/android/jni/backend-jni.c | 42 ---------- .../cross_calculator/android/project.properties | 14 ---- examples/cross_calculator/android/readme.txt | 24 ------ .../android/res/layout/cross_calculator.xml | 72 ----------------- .../android/res/values/strings.xml | 4 - .../cross_calculator/android/scripts/jnibuild.sh | 22 ------ .../cross_calculator/android/scripts/nimbuild.sh | 34 -------- examples/cross_calculator/android/scripts/tags.sh | 13 --- .../nimrod/crosscalculator/CrossCalculator.java | 80 ------------------- 13 files changed, 464 deletions(-) delete mode 100644 examples/cross_calculator/android/AndroidManifest.xml delete mode 100644 examples/cross_calculator/android/build.xml delete mode 100644 examples/cross_calculator/android/custom_rules.xml delete mode 100644 examples/cross_calculator/android/jni/Android.mk delete mode 100644 examples/cross_calculator/android/jni/backend-jni.c delete mode 100644 examples/cross_calculator/android/project.properties delete mode 100644 examples/cross_calculator/android/readme.txt delete mode 100644 examples/cross_calculator/android/res/layout/cross_calculator.xml delete mode 100644 examples/cross_calculator/android/res/values/strings.xml delete mode 100644 examples/cross_calculator/android/scripts/jnibuild.sh delete mode 100644 examples/cross_calculator/android/scripts/nimbuild.sh delete mode 100644 examples/cross_calculator/android/scripts/tags.sh delete mode 100644 examples/cross_calculator/android/src/com/github/nimrod/crosscalculator/CrossCalculator.java (limited to 'examples/cross_calculator/android') diff --git a/examples/cross_calculator/android/AndroidManifest.xml b/examples/cross_calculator/android/AndroidManifest.xml deleted file mode 100644 index 05b96fb50..000000000 --- a/examples/cross_calculator/android/AndroidManifest.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - diff --git a/examples/cross_calculator/android/build.xml b/examples/cross_calculator/android/build.xml deleted file mode 100644 index d7c88432a..000000000 --- a/examples/cross_calculator/android/build.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cross_calculator/android/custom_rules.xml b/examples/cross_calculator/android/custom_rules.xml deleted file mode 100644 index 91783a50e..000000000 --- a/examples/cross_calculator/android/custom_rules.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/examples/cross_calculator/android/jni/Android.mk b/examples/cross_calculator/android/jni/Android.mk deleted file mode 100644 index c1a0feac3..000000000 --- a/examples/cross_calculator/android/jni/Android.mk +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2009 The Android Open Source Project -# -# 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 -# -# http://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. -# -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := nimrod -LOCAL_SRC_FILES := nimcache/backend.c nimcache/system.c -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/nimcache - -include $(BUILD_STATIC_LIBRARY) - -include $(CLEAR_VARS) - -LOCAL_MODULE := backend-jni -LOCAL_SRC_FILES := backend-jni.c -LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -LOCAL_STATIC_LIBRARIES := nimrod - -include $(BUILD_SHARED_LIBRARY) diff --git a/examples/cross_calculator/android/jni/backend-jni.c b/examples/cross_calculator/android/jni/backend-jni.c deleted file mode 100644 index 3d65458ec..000000000 --- a/examples/cross_calculator/android/jni/backend-jni.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * 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 - * - * http://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. - * - */ -#include -#include -#include "backend-jni.h" -#include "backend.h" - -#define TAG "backend-jni.c" - -jint JNICALL Java_com_github_nimrod_crosscalculator_CrossCalculator_myAdd - (JNIEnv *env, jobject thiz, jint a, jint b) -{ - char buf[256]; - const jint ret = myAdd(a, b); - // Using logging from inside the native bridge to log-debug. - sprintf(buf, "a %d + b %d = ret %d", a, b, ret); - __android_log_write(ANDROID_LOG_DEBUG, TAG, buf); - return ret; -} - -void JNICALL Java_com_github_nimrod_crosscalculator_CrossCalculator_initNimMain - (JNIEnv *env, jclass thiz) -{ - NimMain(); - __android_log_write(ANDROID_LOG_DEBUG, TAG, "Nimrod initialised"); -} - -// vim:tabstop=2 shiftwidth=2 syntax=c diff --git a/examples/cross_calculator/android/project.properties b/examples/cross_calculator/android/project.properties deleted file mode 100644 index 9fb894d9b..000000000 --- a/examples/cross_calculator/android/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-3 diff --git a/examples/cross_calculator/android/readme.txt b/examples/cross_calculator/android/readme.txt deleted file mode 100644 index 96bd403ca..000000000 --- a/examples/cross_calculator/android/readme.txt +++ /dev/null @@ -1,24 +0,0 @@ -In this directory you will find the Android platform cross-calculator sample. - -Due to the nature of Android being java and Nim generating C code, the build -process is slightly more complex because jni code has to be written to bridge -both languages. In a distant future it may be possible for Nim to generate -the whole jni bridge, but for the moment this is manual work. - -For the jni bridge to work first the java code is compiled with the Nim code -just declared as a native method which will be resolved at runtime. The scripts -nimbuild.sh and jnibuild.sh are in charge of building the Nim code and -generating the jni bridge from the java code respectively. Finally, the -ndk-build command from the android ndk tools has to be run to build the binary -library which will be installed along the final apk. - -All these steps are wrapped in the ant build script through the customization -of the -post-compile rule. If you have the android ndk tools installed and you -modify scripts/nimbuild.sh to point to the directory where you have Nim -installed on your system, you can simply run "ant debug" to build everything. - -Once the apk is built you can install it on your device or emulator with the -command "adb install bin/CrossCalculator-debug.apk". - -This example runs against the Android level 3 API, meaning devices from -Android 1.5 and above should be able to run the generated binary. diff --git a/examples/cross_calculator/android/res/layout/cross_calculator.xml b/examples/cross_calculator/android/res/layout/cross_calculator.xml deleted file mode 100644 index 11531334c..000000000 --- a/examples/cross_calculator/android/res/layout/cross_calculator.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - -