diff --git a/.gitignore b/.gitignore
index 51f76d8009..0ad77f1eb0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
dist
build
local
+local.properties
distribute-*
tests/temp
org
diff --git a/.travis.yml b/.travis.yml
index 40142dfcc6..f6517b5fe1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,6 @@ python:
- "3.4"
install:
- "pip install ."
- - "ant"
+ - "ant java"
script:
- "python setup.py test"
\ No newline at end of file
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000000..0fd57fa2b9
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.rst b/README.rst
index 64b64a9abe..11900715a2 100644
--- a/README.rst
+++ b/README.rst
@@ -65,18 +65,40 @@ run on any Java 1.7+ VM.
Next step - you need to compile the Python support libraries:
- $ ant
+ $ ant java
-This will create a `dist` directory that contains `python.jar`. You will need to
-make sure that this `python.jar` support file is in your classpath::
+This will create a `dist` directory that contains `python-java.jar`.
- $ java -XX:-UseSplitVerifier -classpath dist/python.jar:. python.example
+You can then run the example.class that was generated, ensuring that
+the `python-java.jar` support file is in your classpath::
+
+ $ java -XX:-UseSplitVerifier -classpath dist/python-java.jar:. python.example
Hello, World
The ``-CC:-UseSplitVerifier`` argument is necessary to turn off stack map
verification in Java 7. This could be addressed by computing stack maps
for generated code.
+Android
+~~~~~~~
+
+To compile for Android, you'll need to `download the Android SDK`_. You only
+need the standalone SDK (see "Other install options") - you don't have to
+download the fully Android Studio if you don't want to.
+
+Once you've downloaded and installed the SDK, create a `local.properties`
+in the top level `voc` project directory, containing a single line::
+
+ sdk.dir=/sdk
+
+You can then run `ant` to compile `dist/python-android.jar`::
+
+ $ ant android
+
+You can then add `dist/python-android.jar` to your Android project.
+
+.. _download the Android SDK: https://developer.android.com/sdk/index.html
+
Documentation
-------------
diff --git a/ant.properties b/ant.properties
new file mode 100644
index 0000000000..b0971e891e
--- /dev/null
+++ b/ant.properties
@@ -0,0 +1,17 @@
+# This file is used to override default values used by the Ant build system.
+#
+# This file must be checked into Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+# 'source.dir' for the location of your java source folder and
+# 'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+# 'key.store' for the location of your keystore and
+# 'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+
diff --git a/build-android.xml b/build-android.xml
new file mode 100644
index 0000000000..a54a0a6340
--- /dev/null
+++ b/build-android.xml
@@ -0,0 +1,181 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Instrumenting classes from ${out.absolute.dir}/classes...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Creating library output jar file...
+
+
+
+
+
+
+ Custom jar packaging exclusion: ${android.package.excludes}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build-java.xml b/build-java.xml
new file mode 100644
index 0000000000..83a40934a2
--- /dev/null
+++ b/build-java.xml
@@ -0,0 +1,29 @@
+
+
+ Build Python support libraries for voc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.xml b/build.xml
index d377d2d6b9..ad90941867 100644
--- a/build.xml
+++ b/build.xml
@@ -1,44 +1,22 @@
-
+
Build Python support libraries for voc
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/project.properties b/project.properties
new file mode 100644
index 0000000000..1e4d8b5f82
--- /dev/null
+++ b/project.properties
@@ -0,0 +1,27 @@
+# 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
+
+android.library=true
+# Project target.
+target=android-14
+source.dir=python
+out.dir=dist
+out.classes.absolute.dir=build/android
+# Nasty hack - we don't want all these cruft directories to be created,
+# so set them to a directory that we know *will* be created.
+resource.absolute.dir=build
+gen.absolute.dir=build
+out.res.absolute.dir=build
+out.rs.obj.absolute.dir=build
+out.rs.libs.absolute.dir=build
+out.aidl.absolute.dir=build
+out.dexed.absolute.dir=build
diff --git a/python/common/python/platform.java b/python/common/python/platform.java
index e2756ba63f..b07aa9e2b3 100644
--- a/python/common/python/platform.java
+++ b/python/common/python/platform.java
@@ -11,7 +11,7 @@ public class platform extends org.python.types.Module {
java.lang.Class platform_class;
if (vendor.equals("Oracle Corporation")) {
- platform_class_name = "python.OraclePlatform";
+ platform_class_name = "python.JavaPlatform";
} else if (vendor.equals("The Android Project")) {
platform_class_name = "python.AndroidPlatform";
} else {
diff --git a/python/oracle/python/OraclePlatform.java b/python/java/python/JavaPlatform.java
similarity index 74%
rename from python/oracle/python/OraclePlatform.java
rename to python/java/python/JavaPlatform.java
index df87c986ce..178d6eeaac 100644
--- a/python/oracle/python/OraclePlatform.java
+++ b/python/java/python/JavaPlatform.java
@@ -4,8 +4,8 @@
import java.lang.management.ThreadMXBean;
-class OraclePlatform implements python.PythonPlatform {
- public OraclePlatform() {}
+class JavaPlatform implements python.PythonPlatform {
+ public JavaPlatform() {}
public long clock() {
ThreadMXBean tmxb = ManagementFactory.getThreadMXBean();
diff --git a/tests/utils.py b/tests/utils.py
index 605f7a03d4..6b57b6e998 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -97,7 +97,7 @@ def runAsJava(test_dir, main_code, extra_code=None):
transpiler.write(test_dir, verbosity=0)
proc = subprocess.Popen(
- ["java", "-classpath", "../../dist/python.jar:.", "-XX:-UseSplitVerifier", "python.test"],
+ ["java", "-classpath", "../../dist/python-java.jar:.", "-XX:-UseSplitVerifier", "python.test"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,