Skip to content
Snippets Groups Projects
Commit 46ad1e5a authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

some customizations to set up gradle with chaquopy

parent c6e21612
No related branches found
No related tags found
No related merge requests found
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.chaquo.python'
}
android {
......@@ -14,6 +15,15 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
python {
version "3.9"
buildPython "python3.9"
}
}
buildTypes {
......@@ -45,4 +55,4 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
\ No newline at end of file
}
from kivy.app import App
from kivy.uix.label import Label
class MainApp(App):
def build(self):
label = Label(text='Hello from Kivy',
size_hint=(.5, .5),
pos_hint={'center_x': .5, 'center_y': .5})
return label
if __name__ == '__main__':
app = MainApp()
app.run()
......@@ -3,6 +3,7 @@ plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'com.chaquo.python' version '13.0.0' apply false
}
task clean(type: Delete) {
......
......@@ -28,7 +28,9 @@
};
};
outputs = { self, nixpkgs, flake-utils, mach-nix-flake, buildozerSrc, pythonForAndroidSrc, ... }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let
flake-utils.lib.eachSystem [
"x86_64-linux"
] (system: let
mach-nix = mach-nix-flake.lib.${system};
pkgs = import nixpkgs {
......@@ -68,10 +70,69 @@
androidComposition = pkgs.callPackage ./android.nix { inherit cmakeVersion; };
getBuildInputs = getInputs: xs: builtins.foldl' (accum: drv: (getInputs drv) ++ accum) [] xs;
chaquopy-env = mach-nix.mkPython {
python = "python39";
requirements = ''
chaquopy
'';
};
in {
packages.default = pkgs.androidenv.buildApp {
name = "PrivateStorage Mobile";
src = ./app;
release = false;
platformVersions = [ "27" ];
includeNDK = false;
};
apps.emulator = {
type = "app";
program = let
emulator = pkgs.androidenv.emulateApp {
name = "PrivateStorage Mobile";
platformVersion = "27";
abiVersion = "x86_64";
systemImageType = "default";
app = ./app/app/build/outputs/apk/debug/app-debug.apk;
package = "MyApp";
activity = "MainActivity";
};
in
"${emulator}/bin/emulate-it???";
};
devShells.gradle = pkgs.mkShell rec {
name = "nix-native";
version = "2022.11.09";
ANDROIDSDK = "${androidComposition.androidsdk}/libexec/android-sdk";
ANDROIDNDK = "${ANDROIDSDK}/ndk-bundle";
buildInputs = with pkgs; [
# XXXX
# gradle finds an aapk2 from some random tgz it downloads from internet instead of from our ANDROIDSDK! GREAT!!!!!!!!!!11111
#
# Fix the one it downloads, if it didn't already root you, with:
#
# patchelf --set-interpreter <correct ld.so> ~/.gradle/<...path to aapt2>
gradle
ant
# openjdk8
android-studio
android-tools
python39
];
};
devShells.default = self.devShells.${system}.gradle;
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/android.section.md
# is a good reference for this stuff.
devShells.default = pkgs.mkShell rec {
devShells.kivy = pkgs.mkShell rec {
name = "ps-mobile";
version = "2022.10.21";
......@@ -86,6 +147,7 @@
buildInputs = with pkgs; [
android-studio
android-tools
kivy-env
# Kivy and python-for-android depend on:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment