nix: map android arch to status-go builds
Fixes partially #15595 In order to build less targets, when not needed we introduce this mapping logic. If only specific ABI is required - status-go will have the same arhitecuture.
This commit is contained in:
parent
e0f83384a2
commit
34f7a48503
|
@ -15,19 +15,11 @@ rec {
|
||||||
];
|
];
|
||||||
|
|
||||||
inputsFrom = [
|
inputsFrom = [
|
||||||
release
|
(release {})
|
||||||
androidShell
|
androidShell
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export ANDROID_SDK_ROOT="${androidPkgs.sdk}"
|
|
||||||
export ANDROID_NDK_ROOT="${androidPkgs.ndk}"
|
|
||||||
|
|
||||||
export STATUS_NIX_MAVEN_REPO="${deps.gradle}"
|
|
||||||
|
|
||||||
# required by some makefile targets
|
|
||||||
export STATUS_GO_ANDROID_LIBDIR=${status-go}
|
|
||||||
|
|
||||||
# check if node modules changed and if so install them
|
# check if node modules changed and if so install them
|
||||||
$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh ${deps.nodejs-patched}
|
$STATUS_MOBILE_HOME/nix/scripts/node_modules.sh ${deps.nodejs-patched}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -30,6 +30,9 @@ let
|
||||||
# Pass secretsFile for POKT_TOKEN to jsbundle build
|
# Pass secretsFile for POKT_TOKEN to jsbundle build
|
||||||
builtJsBundle = jsbundle { inherit secretsFile; };
|
builtJsBundle = jsbundle { inherit secretsFile; };
|
||||||
|
|
||||||
|
# Map ANDROID_ABI_INCLUDE to status-go targets
|
||||||
|
androidAbiIncludeSplit = lib.splitString ";" androidAbiInclude;
|
||||||
|
|
||||||
|
|
||||||
envFileName =
|
envFileName =
|
||||||
if androidAbiInclude == "x86" then ".env.e2e"
|
if androidAbiInclude == "x86" then ".env.e2e"
|
||||||
|
@ -77,20 +80,25 @@ in stdenv.mkDerivation rec {
|
||||||
ANDROID_ABI_SPLIT = androidAbiSplit;
|
ANDROID_ABI_SPLIT = androidAbiSplit;
|
||||||
ANDROID_ABI_INCLUDE = androidAbiInclude;
|
ANDROID_ABI_INCLUDE = androidAbiInclude;
|
||||||
|
|
||||||
# Android SDK/NDK for use by Gradle
|
|
||||||
ANDROID_SDK_ROOT = "${androidPkgs.sdk}";
|
|
||||||
ANDROID_NDK_ROOT = "${androidPkgs.ndk}";
|
|
||||||
|
|
||||||
# Fix for ERR_OSSL_EVP_UNSUPPORTED error.
|
# Fix for ERR_OSSL_EVP_UNSUPPORTED error.
|
||||||
NODE_OPTIONS = "--openssl-legacy-provider";
|
NODE_OPTIONS = "--openssl-legacy-provider";
|
||||||
|
|
||||||
# Used by the Android Gradle build script in android/build.gradle
|
|
||||||
STATUS_GO_ANDROID_LIBDIR = status-go;
|
|
||||||
|
|
||||||
phases = [
|
phases = [
|
||||||
"unpackPhase" "secretsPhase" "buildPhase" "checkPhase" "installPhase"
|
"shellHook" "unpackPhase" "secretsPhase" "buildPhase" "checkPhase" "installPhase"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# We use shellHook as a single place to setup env vars for both build derivation and shell
|
||||||
|
shellHook = ''
|
||||||
|
# Used by the Android Gradle build script in android/build.gradle
|
||||||
|
export STATUS_GO_ANDROID_LIBDIR=${ status-go { abis = androidAbiIncludeSplit; } }
|
||||||
|
|
||||||
|
# Android SDK/NDK for use by Gradle
|
||||||
|
export ANDROID_SDK_ROOT="${androidPkgs.sdk}"
|
||||||
|
export ANDROID_NDK_ROOT="${androidPkgs.ndk}"
|
||||||
|
|
||||||
|
export STATUS_NIX_MAVEN_REPO="${deps.gradle}"
|
||||||
|
'';
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
cp -ar $src/. ./
|
cp -ar $src/. ./
|
||||||
chmod u+w -R ./
|
chmod u+w -R ./
|
||||||
|
|
|
@ -66,7 +66,7 @@ let
|
||||||
# helpers for use with target argument
|
# helpers for use with target argument
|
||||||
ios = targets.mobile.ios.shell;
|
ios = targets.mobile.ios.shell;
|
||||||
android = targets.mobile.android.shell;
|
android = targets.mobile.android.shell;
|
||||||
status-go = targets.status-go.mobile.android;
|
status-go = targets.status-go.mobile.android {};
|
||||||
};
|
};
|
||||||
|
|
||||||
# for merging the default shell with others
|
# for merging the default shell with others
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
{ callPackage, meta, source, goBuildLdFlags }:
|
{ callPackage, meta, source, goBuildLdFlags }:
|
||||||
|
|
||||||
{
|
{
|
||||||
android = callPackage ./build.nix {
|
android = {abis ? [ "armeabi-v7a" "arm64-v8a" "x86" ]}: callPackage ./build.nix {
|
||||||
platform = "android";
|
platform = "android";
|
||||||
platformVersion = "23";
|
platformVersion = "23";
|
||||||
targets = [ "android/arm" "android/arm64" "android/386" ];
|
# Hide different arch naming in gomobile from Android builds.
|
||||||
|
targets = let
|
||||||
|
abiMap = {
|
||||||
|
"armeabi-v7a" = "android/arm";
|
||||||
|
"arm64-v8a" = "android/arm64";
|
||||||
|
"x86" = "android/386";
|
||||||
|
"x86_64" = "android/amd64";
|
||||||
|
};
|
||||||
|
in map (arch: abiMap."${arch}") abis;
|
||||||
outputFileName = "status-go-${source.shortRev}.aar";
|
outputFileName = "status-go-${source.shortRev}.aar";
|
||||||
inherit meta source goBuildLdFlags;
|
inherit meta source goBuildLdFlags;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue