-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
p4a support for creating aar libraries
* ported @xuhcc's PR 1063 to recent p4a master * added python3.8 support to pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonUtil.java * openssl recipe switched to version '1.1.1e' because in 1.1.1 there was a print without () * bootstraps dirs are cumulatively copied based on their inheritance, can be arbitrarily deep * add symlink param to copy_files, when set the copy target are symlinked * support for the aar directive in buildozer * create a 'p4a aar' command, so that lots of cluttering conditionals can be moved away from toolchain.apk() * began to remove ant support (@inclement allowed me to do so) * renamed library bootstrap to service_library, because that describe it better * test setup setup_testlib_service.py
- Loading branch information
Showing
20 changed files
with
553 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
# put files here that you need to un-blacklist | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from pythonforandroid.bootstraps.service_only import ServiceOnlyBootstrap | ||
|
||
|
||
class ServiceLibraryBootstrap(ServiceOnlyBootstrap): | ||
|
||
name = 'service_library' | ||
|
||
|
||
bootstrap = ServiceLibraryBootstrap() |
6 changes: 6 additions & 0 deletions
6
pythonforandroid/bootstraps/service_library/build/jni/application/src/bootstrap_name.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
#define BOOTSTRAP_NAME_LIBRARY | ||
#define BOOTSTRAP_USES_NO_SDL_HEADERS | ||
|
||
const char bootstrap_name[] = "service_library"; | ||
|
9 changes: 9 additions & 0 deletions
9
...droid/bootstraps/service_library/build/src/main/java/org/kivy/android/PythonActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.kivy.android; | ||
|
||
import android.app.Activity; | ||
|
||
// Required by PythonService class | ||
public class PythonActivity extends Activity { | ||
|
||
} | ||
|
115 changes: 115 additions & 0 deletions
115
...ndroid/bootstraps/service_library/build/src/main/java/org/renpy/android/AssetExtract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// This string is autogenerated by ChangeAppSettings.sh, do not change | ||
// spaces amount | ||
package org.renpy.android; | ||
|
||
import java.io.*; | ||
|
||
import android.content.Context; | ||
import android.util.Log; | ||
|
||
import java.io.BufferedInputStream; | ||
import java.io.BufferedOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.File; | ||
|
||
import java.util.zip.GZIPInputStream; | ||
|
||
import android.content.res.AssetManager; | ||
|
||
import org.kamranzafar.jtar.*; | ||
|
||
public class AssetExtract { | ||
|
||
private AssetManager mAssetManager = null; | ||
private Context ctx = null; | ||
|
||
public AssetExtract(Context context) { | ||
ctx = context; | ||
mAssetManager = ctx.getAssets(); | ||
} | ||
|
||
public boolean extractTar(String asset, String target) { | ||
|
||
byte buf[] = new byte[1024 * 1024]; | ||
|
||
InputStream assetStream = null; | ||
TarInputStream tis = null; | ||
|
||
try { | ||
assetStream = mAssetManager.open(asset, AssetManager.ACCESS_STREAMING); | ||
tis = new TarInputStream(new BufferedInputStream(new GZIPInputStream(new BufferedInputStream(assetStream, 8192)), 8192)); | ||
} catch (IOException e) { | ||
Log.e("python", "opening up extract tar", e); | ||
return false; | ||
} | ||
|
||
while (true) { | ||
TarEntry entry = null; | ||
|
||
try { | ||
entry = tis.getNextEntry(); | ||
} catch ( java.io.IOException e ) { | ||
Log.e("python", "extracting tar", e); | ||
return false; | ||
} | ||
|
||
if ( entry == null ) { | ||
break; | ||
} | ||
|
||
Log.v("python", "extracting " + entry.getName()); | ||
|
||
if (entry.isDirectory()) { | ||
|
||
try { | ||
new File(target +"/" + entry.getName()).mkdirs(); | ||
} catch ( SecurityException e ) { }; | ||
|
||
continue; | ||
} | ||
|
||
OutputStream out = null; | ||
String path = target + "/" + entry.getName(); | ||
|
||
try { | ||
out = new BufferedOutputStream(new FileOutputStream(path), 8192); | ||
} catch ( FileNotFoundException e ) { | ||
} catch ( SecurityException e ) { }; | ||
|
||
if ( out == null ) { | ||
Log.e("python", "could not open " + path); | ||
return false; | ||
} | ||
|
||
try { | ||
while (true) { | ||
int len = tis.read(buf); | ||
|
||
if (len == -1) { | ||
break; | ||
} | ||
|
||
out.write(buf, 0, len); | ||
} | ||
|
||
out.flush(); | ||
out.close(); | ||
} catch ( java.io.IOException e ) { | ||
Log.e("python", "extracting zip", e); | ||
return false; | ||
} | ||
} | ||
|
||
try { | ||
tis.close(); | ||
assetStream.close(); | ||
} catch (IOException e) { | ||
// pass | ||
} | ||
|
||
return true; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
pythonforandroid/bootstraps/service_library/build/templates/AndroidManifest.tmpl.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="{{ args.package }}" | ||
android:versionCode="{{ args.numeric_version }}" | ||
android:versionName="{{ args.version }}"> | ||
|
||
<!-- Android 2.3.3 --> | ||
<uses-sdk android:minSdkVersion="{{ args.min_sdk_version }}" android:targetSdkVersion="{{ android_api }}" /> | ||
|
||
<application> | ||
{% for name in service_names %} | ||
<service android:name="{{ args.package }}.Service{{ name|capitalize }}" | ||
android:process=":service_{{ name }}" | ||
android:exported="true" /> | ||
{% endfor %} | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.