nix: refactor updating Gradle dependencies
changes: - Moved Gradle deps setup to `nix/deps/gradle` - Dropped `nix/mobile/android/maven-and-npm-deps/maven` - Used GNU Parallel to optimize `nix/deps/gradle/generate.sh` - Move Maven+Node shell setup from `release-android.nix` to Android shell - Moved AAPT2 patching to `nix/pkgs/aapt2` - Drop `patchPhase` and `gradlew` use from `release-android.nix` - Simplify symlinking `{mobile,desktop}/js_files/*` - Add new `nodejs` shell and merge it with `clojure` and `gradle` - Re-created Gradle deps files with new scripts: - `nix/deps/gradle/proj.list` - `nix/deps/gradle/deps.list` - `nix/deps/gradle/deps.urls` - `nix/deps/gradle/deps.nix` Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
45f1d58832
commit
ed4d0a1ed9
|
@ -174,6 +174,7 @@ conan.cmake
|
|||
/.ran-setup
|
||||
/.nix-gcroots/
|
||||
/result
|
||||
/nix/deps/gradle/deps.urls.old
|
||||
|
||||
# modules
|
||||
status-modules/translations
|
||||
|
@ -192,4 +193,4 @@ status-modules/resources
|
|||
trace.edn
|
||||
|
||||
/app/
|
||||
project.clj
|
||||
project.clj
|
||||
|
|
13
Makefile
13
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: nix-add-gcroots clean nix-clean disable-githooks react-native-android react-native-ios react-native-desktop test release _list _fix-node-perms _tmpdir-mk _tmpdir-rm
|
||||
.PHONY: nix-add-gcroots clean nix-clean react-native-android react-native-ios react-native-desktop test release _list _fix-node-perms _tmpdir-mk _tmpdir-rm
|
||||
|
||||
help: SHELL := /bin/sh
|
||||
help: ##@other Show this help
|
||||
|
@ -89,11 +89,12 @@ nix-add-gcroots: export TARGET := default
|
|||
nix-add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected
|
||||
nix/scripts/gcroots.sh
|
||||
|
||||
nix-update-gradle: export TARGET := gradle
|
||||
nix-update-gradle: ##@nix Update maven nix expressions based on current gradle setup
|
||||
nix/mobile/android/maven-and-npm-deps/maven/generate-nix.sh
|
||||
nix/deps/gradle/generate.sh
|
||||
|
||||
nix-update-clojure: export TARGET := clojure
|
||||
nix-update-clojure: ##@nix Update maven nix expressions based on current clojure setup
|
||||
nix-update-clojure: ##@nix Update maven Nix expressions based on current clojure setup
|
||||
nix/deps/clojure/generate.sh
|
||||
|
||||
nix-update-gems: export TARGET := default
|
||||
|
@ -160,7 +161,7 @@ release-android: export ANDROID_ABI_INCLUDE ?= armeabi-v7a;arm64-v8a;x86
|
|||
release-android: keystore ##@build build release for Android
|
||||
scripts/release-android.sh
|
||||
|
||||
release-ios: export TARGET ?= ios
|
||||
release-ios: export TARGET := ios
|
||||
release-ios: export BUILD_ENV ?= prod
|
||||
release-ios: watchman-clean ##@build build release for iOS release
|
||||
@git clean -dxf -f target/ios && \
|
||||
|
@ -183,7 +184,7 @@ prod-build-android: jsbundle-android ##@legacy temporary legacy alias for jsbund
|
|||
@echo "${YELLOW}This a deprecated target name, use jsbundle-android.$(RESET)"
|
||||
|
||||
jsbundle-android: SHELL := /bin/sh
|
||||
jsbundle-android: export TARGET ?= android
|
||||
jsbundle-android: export TARGET := android
|
||||
jsbundle-android: export BUILD_ENV ?= prod
|
||||
jsbundle-android: ##@jsbundle Compile JavaScript and Clojurescript into app directory
|
||||
# Call nix-build to build the 'targets.mobile.android.jsbundle' attribute and copy the.js files to the project root
|
||||
|
@ -193,7 +194,7 @@ jsbundle-android: ##@jsbundle Compile JavaScript and Clojurescript into app dire
|
|||
prod-build-ios: jsbundle-ios ##@legacy temporary legacy alias for jsbundle-ios
|
||||
@echo "${YELLOW}This a deprecated target name, use jsbundle-ios.$(RESET)"
|
||||
|
||||
jsbundle-ios: export TARGET ?= ios
|
||||
jsbundle-ios: export TARGET := ios
|
||||
jsbundle-ios: export BUILD_ENV ?= prod
|
||||
jsbundle-ios: ##@jsbundle Compile JavaScript and Clojure into index.ios.js
|
||||
yarn shadow-cljs release ios
|
||||
|
|
|
@ -20,10 +20,8 @@ buildscript {
|
|||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:${project.ext.gradlePluginVersion}"
|
||||
classpath 'de.undercouch:gradle-download-task:3.1.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
// WARNING: Do not place your application dependencies here!
|
||||
// They belong in the individual module build.gradle files.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ pipeline {
|
|||
stage('Build') { stages {
|
||||
stage('JSBundle') {
|
||||
steps {
|
||||
script { nix.shell('make jsbundle-ios') }
|
||||
script { sh 'make jsbundle-ios' }
|
||||
}
|
||||
}
|
||||
stage('Bundle') {
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
{ stdenv, lib, writeShellScriptBin, fetchurl }:
|
||||
|
||||
# Put the downloaded files in a fake Maven repository
|
||||
name: source:
|
||||
{ stdenv, lib, pkgs, fetchurl, writeShellScriptBin }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
removeSuffix optionalString splitString concatMapStrings
|
||||
attrByPath attrValues last makeOverridable;
|
||||
|
||||
inherit (pkgs) aapt2;
|
||||
|
||||
deps = import ./deps.nix;
|
||||
|
||||
# some .jar files have an `-aot` suffix that doesn't work for .pom files
|
||||
getPOM = jarUrl: "${removeSuffix "-aot" jarUrl}.pom";
|
||||
|
||||
|
@ -51,21 +52,18 @@ let
|
|||
${optionalString (jar.sha1 != "") ''
|
||||
echo "${jar.sha1}" > "${dep.path}.${dep.type}.sha1"
|
||||
''}
|
||||
|
||||
${if dep.postCopy != "" then ''
|
||||
depPath="$PWD/${dep.path}"
|
||||
# postCopy can't modify the jar if it's a symlink
|
||||
rm "${dep.path}.${dep.type}"
|
||||
cp "${jar-download}" "${dep.path}.${dep.type}"
|
||||
${dep.postCopy}
|
||||
unset depPath
|
||||
'' else ""
|
||||
}
|
||||
'')
|
||||
(attrValues source)));
|
||||
(attrValues deps)));
|
||||
|
||||
in makeOverridable stdenv.mkDerivation {
|
||||
inherit name;
|
||||
phases = [ "buildPhase" ];
|
||||
name = "status-react-maven-deps";
|
||||
buildInputs = [ aapt2 ];
|
||||
phases = [ "buildPhase" "patchPhase" ];
|
||||
buildPhase = "${script}/bin/create-local-maven-repo";
|
||||
# Patched AAPT2
|
||||
patchPhase = ''
|
||||
aapt2_dir=$out/com/android/tools/build/aapt2/${aapt2.version}
|
||||
mkdir -p $aapt2_dir
|
||||
ln -sf ${aapt2}/* $aapt2_dir
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,508 @@
|
|||
androidx.activity:activity:1.1.0
|
||||
androidx.annotation:annotation:1.0.0
|
||||
androidx.annotation:annotation:1.1.0
|
||||
androidx.appcompat:appcompat-resources:1.1.0
|
||||
androidx.appcompat:appcompat:1.0.0
|
||||
androidx.appcompat:appcompat:1.0.2
|
||||
androidx.appcompat:appcompat:1.1.0
|
||||
androidx.appcompat:appcompat:1.1.0-rc01
|
||||
androidx.arch.core:core-common:2.0.0
|
||||
androidx.arch.core:core-common:2.1.0
|
||||
androidx.arch.core:core-runtime:2.0.0
|
||||
androidx.arch.core:core-runtime:2.1.0
|
||||
androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
|
||||
androidx.cardview:cardview:1.0.0
|
||||
androidx.collection:collection:1.0.0
|
||||
androidx.collection:collection:1.1.0
|
||||
androidx.coordinatorlayout:coordinatorlayout:1.0.0
|
||||
androidx.coordinatorlayout:coordinatorlayout:1.1.0
|
||||
androidx.core:core:1.0.1
|
||||
androidx.core:core:1.1.0
|
||||
androidx.cursoradapter:cursoradapter:1.0.0
|
||||
androidx.customview:customview:1.0.0
|
||||
androidx.databinding:databinding-common:3.2.1
|
||||
androidx.databinding:databinding-common:3.3.1
|
||||
androidx.databinding:databinding-common:3.5.3
|
||||
androidx.databinding:databinding-compiler-common:3.2.1
|
||||
androidx.databinding:databinding-compiler-common:3.3.1
|
||||
androidx.databinding:databinding-compiler-common:3.5.3
|
||||
androidx.documentfile:documentfile:1.0.0
|
||||
androidx.drawerlayout:drawerlayout:1.0.0
|
||||
androidx.exifinterface:exifinterface:1.0.0
|
||||
androidx.fragment:fragment:1.0.0
|
||||
androidx.fragment:fragment:1.2.1
|
||||
androidx.interpolator:interpolator:1.0.0
|
||||
androidx.legacy:legacy-support-core-ui:1.0.0
|
||||
androidx.legacy:legacy-support-core-utils:1.0.0
|
||||
androidx.legacy:legacy-support-v4:1.0.0
|
||||
androidx.lifecycle:lifecycle-common:2.0.0
|
||||
androidx.lifecycle:lifecycle-common:2.2.0
|
||||
androidx.lifecycle:lifecycle-livedata-core:2.0.0
|
||||
androidx.lifecycle:lifecycle-livedata-core:2.2.0
|
||||
androidx.lifecycle:lifecycle-livedata:2.0.0
|
||||
androidx.lifecycle:lifecycle-runtime:2.0.0
|
||||
androidx.lifecycle:lifecycle-runtime:2.2.0
|
||||
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0
|
||||
androidx.lifecycle:lifecycle-viewmodel:2.0.0
|
||||
androidx.lifecycle:lifecycle-viewmodel:2.2.0
|
||||
androidx.loader:loader:1.0.0
|
||||
androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
|
||||
androidx.media:media:1.0.0
|
||||
androidx.multidex:multidex:2.0.1
|
||||
androidx.print:print:1.0.0
|
||||
androidx.recyclerview:recyclerview:1.0.0
|
||||
androidx.recyclerview:recyclerview:1.1.0
|
||||
androidx.savedstate:savedstate:1.0.0
|
||||
androidx.slidingpanelayout:slidingpanelayout:1.0.0
|
||||
androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
|
||||
androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02
|
||||
androidx.transition:transition:1.1.0
|
||||
androidx.transition:transition:1.2.0
|
||||
androidx.vectordrawable:vectordrawable-animated:1.0.0
|
||||
androidx.vectordrawable:vectordrawable-animated:1.1.0
|
||||
androidx.vectordrawable:vectordrawable:1.0.1
|
||||
androidx.vectordrawable:vectordrawable:1.1.0
|
||||
androidx.versionedparcelable:versionedparcelable:1.0.0
|
||||
androidx.versionedparcelable:versionedparcelable:1.1.0
|
||||
androidx.viewpager2:viewpager2:1.0.0
|
||||
androidx.viewpager:viewpager:1.0.0
|
||||
commons-codec:commons-codec:1.4
|
||||
commons-codec:commons-codec:1.6
|
||||
commons-codec:commons-codec:1.9
|
||||
commons-codec:commons-codec:1.10
|
||||
commons-io:commons-io:2.4
|
||||
commons-logging:commons-logging:1.1.1
|
||||
commons-logging:commons-logging:1.2
|
||||
com.adobe.xmp:xmpcore:5.1.3
|
||||
com.afollestad.material-dialogs:commons:0.9.6.0
|
||||
com.afollestad.material-dialogs:core:0.9.6.0
|
||||
com.android.databinding:baseLibrary:1.0-rc5
|
||||
com.android.databinding:baseLibrary:2.2.3
|
||||
com.android.databinding:baseLibrary:3.0.0
|
||||
com.android.databinding:baseLibrary:3.0.1
|
||||
com.android.databinding:baseLibrary:3.2.1
|
||||
com.android.databinding:baseLibrary:3.3.1
|
||||
com.android.databinding:baseLibrary:3.5.3
|
||||
com.android.databinding:compilerCommon:1.0-rc5
|
||||
com.android.databinding:compilerCommon:2.2.3
|
||||
com.android.databinding:compilerCommon:3.0.0
|
||||
com.android.databinding:compilerCommon:3.0.1
|
||||
com.android.support:appcompat-v7:28.0.0
|
||||
com.android.support:appcompat-v7:androidx.appcompat:appcompat:1.0.2
|
||||
com.android.support:appcompat-v7:androidx.appcompat:appcompat:1.1.0
|
||||
com.android.tools.analytics-library:crash:26.2.1
|
||||
com.android.tools.analytics-library:crash:26.3.1
|
||||
com.android.tools.analytics-library:crash:26.5.3
|
||||
com.android.tools.analytics-library:protos:25.2.3
|
||||
com.android.tools.analytics-library:protos:26.0.0
|
||||
com.android.tools.analytics-library:protos:26.0.1
|
||||
com.android.tools.analytics-library:protos:26.2.1
|
||||
com.android.tools.analytics-library:protos:26.3.1
|
||||
com.android.tools.analytics-library:protos:26.5.3
|
||||
com.android.tools.analytics-library:shared:25.2.3
|
||||
com.android.tools.analytics-library:shared:26.0.0
|
||||
com.android.tools.analytics-library:shared:26.0.1
|
||||
com.android.tools.analytics-library:shared:26.2.1
|
||||
com.android.tools.analytics-library:shared:26.3.1
|
||||
com.android.tools.analytics-library:shared:26.5.3
|
||||
com.android.tools.analytics-library:tracker:25.2.3
|
||||
com.android.tools.analytics-library:tracker:26.0.0
|
||||
com.android.tools.analytics-library:tracker:26.0.1
|
||||
com.android.tools.analytics-library:tracker:26.2.1
|
||||
com.android.tools.analytics-library:tracker:26.3.1
|
||||
com.android.tools.analytics-library:tracker:26.5.3
|
||||
com.android.tools.build.jetifier:jetifier-core:1.0.0-alpha10
|
||||
com.android.tools.build.jetifier:jetifier-core:1.0.0-beta02
|
||||
com.android.tools.build.jetifier:jetifier-core:1.0.0-beta04
|
||||
com.android.tools.build.jetifier:jetifier-processor:1.0.0-alpha10
|
||||
com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02
|
||||
com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04
|
||||
com.android.tools.build:aapt2-proto:0.3.1
|
||||
com.android.tools.build:aapt2-proto:0.4.0
|
||||
com.android.tools.build:apksig:3.0.0
|
||||
com.android.tools.build:apksig:3.0.1
|
||||
com.android.tools.build:apksig:3.2.1
|
||||
com.android.tools.build:apksig:3.3.1
|
||||
com.android.tools.build:apksig:3.5.3
|
||||
com.android.tools.build:apkzlib:3.2.1
|
||||
com.android.tools.build:apkzlib:3.3.1
|
||||
com.android.tools.build:apkzlib:3.5.3
|
||||
com.android.tools.build:builder-model:1.1.3
|
||||
com.android.tools.build:builder-model:1.3.1
|
||||
com.android.tools.build:builder-model:1.5.0
|
||||
com.android.tools.build:builder-model:2.2.3
|
||||
com.android.tools.build:builder-model:3.0.0
|
||||
com.android.tools.build:builder-model:3.0.1
|
||||
com.android.tools.build:builder-model:3.2.1
|
||||
com.android.tools.build:builder-model:3.3.1
|
||||
com.android.tools.build:builder-model:3.5.3
|
||||
com.android.tools.build:builder-test-api:1.1.3
|
||||
com.android.tools.build:builder-test-api:1.3.1
|
||||
com.android.tools.build:builder-test-api:1.5.0
|
||||
com.android.tools.build:builder-test-api:2.2.3
|
||||
com.android.tools.build:builder-test-api:3.0.0
|
||||
com.android.tools.build:builder-test-api:3.0.1
|
||||
com.android.tools.build:builder-test-api:3.2.1
|
||||
com.android.tools.build:builder-test-api:3.3.1
|
||||
com.android.tools.build:builder-test-api:3.5.3
|
||||
com.android.tools.build:builder:1.1.3
|
||||
com.android.tools.build:builder:1.3.1
|
||||
com.android.tools.build:builder:1.5.0
|
||||
com.android.tools.build:builder:2.2.3
|
||||
com.android.tools.build:builder:3.0.0
|
||||
com.android.tools.build:builder:3.0.1
|
||||
com.android.tools.build:builder:3.2.1
|
||||
com.android.tools.build:builder:3.3.1
|
||||
com.android.tools.build:builder:3.5.3
|
||||
com.android.tools.build:bundletool:0.5.0
|
||||
com.android.tools.build:bundletool:0.6.0
|
||||
com.android.tools.build:bundletool:0.9.0
|
||||
com.android.tools.build:gradle-api:2.2.3
|
||||
com.android.tools.build:gradle-api:3.0.0
|
||||
com.android.tools.build:gradle-api:3.0.1
|
||||
com.android.tools.build:gradle-api:3.2.1
|
||||
com.android.tools.build:gradle-api:3.3.1
|
||||
com.android.tools.build:gradle-api:3.5.3
|
||||
com.android.tools.build:gradle-core:1.1.3
|
||||
com.android.tools.build:gradle-core:1.3.1
|
||||
com.android.tools.build:gradle-core:1.5.0
|
||||
com.android.tools.build:gradle-core:2.2.3
|
||||
com.android.tools.build:gradle-core:3.0.0
|
||||
com.android.tools.build:gradle-core:3.0.1
|
||||
com.android.tools.build:gradle:1.1.3
|
||||
com.android.tools.build:gradle:1.3.1
|
||||
com.android.tools.build:gradle:1.5.0
|
||||
com.android.tools.build:gradle:2.2.3
|
||||
com.android.tools.build:gradle:3.0.0
|
||||
com.android.tools.build:gradle:3.0.1
|
||||
com.android.tools.build:gradle:3.2.1
|
||||
com.android.tools.build:gradle:3.3.1
|
||||
com.android.tools.build:gradle:3.5.3
|
||||
com.android.tools.build:manifest-merger:24.1.3
|
||||
com.android.tools.build:manifest-merger:24.3.1
|
||||
com.android.tools.build:manifest-merger:24.5.0
|
||||
com.android.tools.build:manifest-merger:25.2.3
|
||||
com.android.tools.build:manifest-merger:26.0.0
|
||||
com.android.tools.build:manifest-merger:26.0.1
|
||||
com.android.tools.build:manifest-merger:26.2.1
|
||||
com.android.tools.build:manifest-merger:26.3.1
|
||||
com.android.tools.build:manifest-merger:26.5.3
|
||||
com.android.tools.build:transform-api:1.5.0
|
||||
com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api
|
||||
com.android.tools.ddms:ddmlib:24.1.3
|
||||
com.android.tools.ddms:ddmlib:24.3.1
|
||||
com.android.tools.ddms:ddmlib:24.5.0
|
||||
com.android.tools.ddms:ddmlib:25.2.3
|
||||
com.android.tools.ddms:ddmlib:26.0.0
|
||||
com.android.tools.ddms:ddmlib:26.0.1
|
||||
com.android.tools.ddms:ddmlib:26.2.1
|
||||
com.android.tools.ddms:ddmlib:26.3.1
|
||||
com.android.tools.ddms:ddmlib:26.5.3
|
||||
com.android.tools.external.com-intellij:intellij-core:26.0.0
|
||||
com.android.tools.external.com-intellij:intellij-core:26.0.1
|
||||
com.android.tools.external.com-intellij:intellij-core:26.5.3
|
||||
com.android.tools.external.com-intellij:kotlin-compiler:26.5.3
|
||||
com.android.tools.external.com-intellij:uast:145.597.4
|
||||
com.android.tools.external.lombok:lombok-ast:0.2.3
|
||||
com.android.tools.external.org-jetbrains:uast:26.0.0
|
||||
com.android.tools.external.org-jetbrains:uast:26.0.1
|
||||
com.android.tools.external.org-jetbrains:uast:26.5.3
|
||||
com.android.tools.jack:jack-api:0.9.0
|
||||
com.android.tools.jack:jack-api:0.11.0
|
||||
com.android.tools.jill:jill-api:0.9.0
|
||||
com.android.tools.jill:jill-api:0.10.0
|
||||
com.android.tools.layoutlib:layoutlib-api:24.1.3
|
||||
com.android.tools.layoutlib:layoutlib-api:24.3.1
|
||||
com.android.tools.layoutlib:layoutlib-api:24.5.0
|
||||
com.android.tools.layoutlib:layoutlib-api:25.2.3
|
||||
com.android.tools.layoutlib:layoutlib-api:26.0.0
|
||||
com.android.tools.layoutlib:layoutlib-api:26.0.1
|
||||
com.android.tools.layoutlib:layoutlib-api:26.2.1
|
||||
com.android.tools.layoutlib:layoutlib-api:26.3.1
|
||||
com.android.tools.layoutlib:layoutlib-api:26.5.3
|
||||
com.android.tools.lint:lint-api:24.1.3
|
||||
com.android.tools.lint:lint-api:24.3.1
|
||||
com.android.tools.lint:lint-api:24.5.0
|
||||
com.android.tools.lint:lint-api:25.2.3
|
||||
com.android.tools.lint:lint-api:26.0.0
|
||||
com.android.tools.lint:lint-api:26.0.1
|
||||
com.android.tools.lint:lint-api:26.5.3
|
||||
com.android.tools.lint:lint-checks:24.1.3
|
||||
com.android.tools.lint:lint-checks:24.3.1
|
||||
com.android.tools.lint:lint-checks:24.5.0
|
||||
com.android.tools.lint:lint-checks:25.2.3
|
||||
com.android.tools.lint:lint-checks:26.0.0
|
||||
com.android.tools.lint:lint-checks:26.0.1
|
||||
com.android.tools.lint:lint-checks:26.5.3
|
||||
com.android.tools.lint:lint-gradle-api:26.2.1
|
||||
com.android.tools.lint:lint-gradle-api:26.3.1
|
||||
com.android.tools.lint:lint-gradle-api:26.5.3
|
||||
com.android.tools.lint:lint-gradle:26.5.3
|
||||
com.android.tools.lint:lint:24.1.3
|
||||
com.android.tools.lint:lint:24.3.1
|
||||
com.android.tools.lint:lint:24.5.0
|
||||
com.android.tools.lint:lint:25.2.3
|
||||
com.android.tools.lint:lint:26.0.0
|
||||
com.android.tools.lint:lint:26.0.1
|
||||
com.android.tools.lint:lint:26.5.3
|
||||
com.android.tools:annotations:24.1.3
|
||||
com.android.tools:annotations:24.3.1
|
||||
com.android.tools:annotations:24.5.0
|
||||
com.android.tools:annotations:25.2.3
|
||||
com.android.tools:annotations:26.0.0
|
||||
com.android.tools:annotations:26.0.1
|
||||
com.android.tools:annotations:26.2.1
|
||||
com.android.tools:annotations:26.3.1
|
||||
com.android.tools:annotations:26.5.3
|
||||
com.android.tools:common:24.1.3
|
||||
com.android.tools:common:24.3.1
|
||||
com.android.tools:common:24.5.0
|
||||
com.android.tools:common:25.2.3
|
||||
com.android.tools:common:26.0.0
|
||||
com.android.tools:common:26.0.1
|
||||
com.android.tools:common:26.2.1
|
||||
com.android.tools:common:26.3.1
|
||||
com.android.tools:common:26.5.3
|
||||
com.android.tools:dvlib:24.1.3
|
||||
com.android.tools:dvlib:24.3.1
|
||||
com.android.tools:dvlib:24.5.0
|
||||
com.android.tools:dvlib:25.2.3
|
||||
com.android.tools:dvlib:26.0.0
|
||||
com.android.tools:dvlib:26.0.1
|
||||
com.android.tools:dvlib:26.2.1
|
||||
com.android.tools:dvlib:26.3.1
|
||||
com.android.tools:dvlib:26.5.3
|
||||
com.android.tools:repository:25.2.3
|
||||
com.android.tools:repository:26.0.0
|
||||
com.android.tools:repository:26.0.1
|
||||
com.android.tools:repository:26.2.1
|
||||
com.android.tools:repository:26.3.1
|
||||
com.android.tools:repository:26.5.3
|
||||
com.android.tools:sdklib:24.1.3
|
||||
com.android.tools:sdklib:24.3.1
|
||||
com.android.tools:sdklib:24.5.0
|
||||
com.android.tools:sdklib:25.2.3
|
||||
com.android.tools:sdklib:26.0.0
|
||||
com.android.tools:sdklib:26.0.1
|
||||
com.android.tools:sdklib:26.2.1
|
||||
com.android.tools:sdklib:26.3.1
|
||||
com.android.tools:sdklib:26.5.3
|
||||
com.android.tools:sdk-common:24.1.3
|
||||
com.android.tools:sdk-common:24.3.1
|
||||
com.android.tools:sdk-common:24.5.0
|
||||
com.android.tools:sdk-common:25.2.3
|
||||
com.android.tools:sdk-common:26.0.0
|
||||
com.android.tools:sdk-common:26.0.1
|
||||
com.android.tools:sdk-common:26.2.1
|
||||
com.android.tools:sdk-common:26.3.1
|
||||
com.android.tools:sdk-common:26.5.3
|
||||
com.drewnoakes:metadata-extractor:2.11.0
|
||||
com.facebook.conceal:conceal:1.1.3
|
||||
com.facebook.fbjni:fbjni-java-only:0.0.3
|
||||
com.facebook.flipper:flipper-fresco-plugin:0.33.1
|
||||
com.facebook.flipper:flipper-network-plugin:0.33.1
|
||||
com.facebook.flipper:flipper:0.33.1
|
||||
com.facebook.fresco:animated-base:2.0.0
|
||||
com.facebook.fresco:animated-drawable:2.0.0
|
||||
com.facebook.fresco:animated-gif:2.0.0
|
||||
com.facebook.fresco:drawee:2.0.0
|
||||
com.facebook.fresco:fbcore:2.0.0
|
||||
com.facebook.fresco:flipper:2.0.0
|
||||
com.facebook.fresco:fresco:2.0.0
|
||||
com.facebook.fresco:imagepipeline-base:2.0.0
|
||||
com.facebook.fresco:imagepipeline-okhttp3:2.0.0
|
||||
com.facebook.fresco:imagepipeline:2.0.0
|
||||
com.facebook.fresco:nativeimagefilters:2.0.0
|
||||
com.facebook.fresco:nativeimagetranscoder:2.0.0
|
||||
com.facebook.fresco:stetho:2.0.0
|
||||
com.facebook.infer.annotation:infer-annotation:0.11.2
|
||||
com.facebook.react:react-native:0.62.2
|
||||
com.facebook.soloader:annotation:0.8.0
|
||||
com.facebook.soloader:annotation:0.8.2
|
||||
com.facebook.soloader:nativeloader:0.8.0
|
||||
com.facebook.soloader:nativeloader:0.8.2
|
||||
com.facebook.soloader:soloader:0.8.0
|
||||
com.facebook.soloader:soloader:0.8.2
|
||||
com.facebook.yoga:proguard-annotations:1.14.1
|
||||
com.github.status-im.status-keycard-java:android:3.0.1
|
||||
com.github.status-im.status-keycard-java:lib:3.0.1
|
||||
com.github.status-im:function:0.0.1
|
||||
com.github.yalantis:ucrop:2.2.2-native
|
||||
com.googlecode.json-simple:json-simple:1.1
|
||||
com.googlecode.juniversalchardet:juniversalchardet:1.0.3
|
||||
com.google.android.gms:play-services-auth-base:16.0.0
|
||||
com.google.android.gms:play-services-basement:16.1.0
|
||||
com.google.android.gms:play-services-base:16.0.1
|
||||
com.google.android.gms:play-services-clearcut:16.0.0
|
||||
com.google.android.gms:play-services-flags:16.0.1
|
||||
com.google.android.gms:play-services-phenotype:16.0.0
|
||||
com.google.android.gms:play-services-stats:16.0.1
|
||||
com.google.android.gms:play-services-tasks:16.0.1
|
||||
com.google.android.gms:play-services-vision-common:17.0.2
|
||||
com.google.android.gms:play-services-vision-image-label:17.0.2
|
||||
com.google.android.gms:play-services-vision:17.0.2
|
||||
com.google.android.material:material:1.1.0
|
||||
com.google.auto.value:auto-value:1.5.2
|
||||
com.google.code.findbugs:jsr305:1.3.9
|
||||
com.google.code.findbugs:jsr305:3.0.2
|
||||
com.google.code.gson:gson:2.2.4
|
||||
com.google.code.gson:gson:2.3
|
||||
com.google.code.gson:gson:2.8.0
|
||||
com.google.code.gson:gson:2.8.5
|
||||
com.google.errorprone:error_prone_annotations:2.0.18
|
||||
com.google.errorprone:error_prone_annotations:2.2.0
|
||||
com.google.errorprone:error_prone_annotations:2.3.1
|
||||
com.google.firebase:firebase-common:16.0.3
|
||||
com.google.firebase:firebase-iid-interop:16.0.1
|
||||
com.google.firebase:firebase-iid:17.0.3
|
||||
com.google.firebase:firebase-ml-common:17.0.0
|
||||
com.google.firebase:firebase-ml-vision-face-model:17.0.2
|
||||
com.google.firebase:firebase-ml-vision:19.0.3
|
||||
com.google.guava:failureaccess:1.0.1
|
||||
com.google.guava:guava:17.0
|
||||
com.google.guava:guava:18.0
|
||||
com.google.guava:guava:22.0
|
||||
com.google.guava:guava:23.0
|
||||
com.google.guava:guava:26.0-jre
|
||||
com.google.guava:guava:27.0.1-jre
|
||||
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|
||||
com.google.j2objc:j2objc-annotations:1.1
|
||||
com.google.jimfs:jimfs:1.1
|
||||
com.google.protobuf:protobuf-java-util:3.4.0
|
||||
com.google.protobuf:protobuf-java:2.5.0
|
||||
com.google.protobuf:protobuf-java:3.0.0
|
||||
com.google.protobuf:protobuf-java:3.4.0
|
||||
com.google.zxing:core:3.3.3
|
||||
com.intellij:annotations:12.0
|
||||
com.parse.bolts:bolts-tasks:1.4.0
|
||||
com.squareup.okhttp3:okhttp-urlconnection:3.12.1
|
||||
com.squareup.okhttp3:okhttp:3.12.1
|
||||
com.squareup.okhttp3:okhttp:3.14.1
|
||||
com.squareup.okio:okio:1.15.0
|
||||
com.squareup.okio:okio:1.17.2
|
||||
com.squareup:javapoet:1.8.0
|
||||
com.squareup:javawriter:2.5.0
|
||||
com.sun.activation:javax.activation:1.2.0
|
||||
com.sun.istack:istack-commons-runtime:2.21
|
||||
com.sun.xml.fastinfoset:FastInfoset:1.2.13
|
||||
com.tunnelvisionlabs:antlr4-annotations:4.5
|
||||
com.tunnelvisionlabs:antlr4-runtime:4.5
|
||||
com.tunnelvisionlabs:antlr4:4.5
|
||||
de.undercouch:gradle-download-task:3.4.3
|
||||
it.unimi.dsi:fastutil:7.2.0
|
||||
javax.inject:javax.inject:1
|
||||
javax.xml.bind:jaxb-api:2.2.12-b140109.1041
|
||||
junit:junit:4.12
|
||||
me.zhanghai.android.materialprogressbar:library:1.4.2
|
||||
net.sf.jopt-simple:jopt-simple:4.9
|
||||
net.sf.kxml:kxml2:2.3.0
|
||||
net.sf.proguard:proguard-base:5.1
|
||||
net.sf.proguard:proguard-base:5.2.1
|
||||
net.sf.proguard:proguard-base:5.3.3
|
||||
net.sf.proguard:proguard-base:6.0.3
|
||||
net.sf.proguard:proguard-gradle:5.1
|
||||
net.sf.proguard:proguard-gradle:5.2.1
|
||||
net.sf.proguard:proguard-gradle:5.3.3
|
||||
net.sf.proguard:proguard-gradle:6.0.3
|
||||
org.abego.treelayout:org.abego.treelayout.core:1.0.1
|
||||
org.antlr:ST4:4.0.8
|
||||
org.antlr:antlr4:4.5.3
|
||||
org.antlr:antlr-runtime:3.5.2
|
||||
org.antlr:antlr:3.5.2
|
||||
org.apache.commons:commons-compress:1.8.1
|
||||
org.apache.commons:commons-compress:1.12
|
||||
org.apache.commons:commons-lang3:3.3.2
|
||||
org.apache.commons:commons-lang3:3.9
|
||||
org.apache.httpcomponents:httpclient:4.1.1
|
||||
org.apache.httpcomponents:httpclient:4.2.6
|
||||
org.apache.httpcomponents:httpclient:4.5.2
|
||||
org.apache.httpcomponents:httpclient:4.5.3
|
||||
org.apache.httpcomponents:httpclient:4.5.6
|
||||
org.apache.httpcomponents:httpcore:4.1
|
||||
org.apache.httpcomponents:httpcore:4.2.5
|
||||
org.apache.httpcomponents:httpcore:4.4.5
|
||||
org.apache.httpcomponents:httpcore:4.4.6
|
||||
org.apache.httpcomponents:httpcore:4.4.10
|
||||
org.apache.httpcomponents:httpmime:4.1
|
||||
org.apache.httpcomponents:httpmime:4.5.2
|
||||
org.apache.httpcomponents:httpmime:4.5.6
|
||||
org.bouncycastle:bcpkix-jdk15on:1.48
|
||||
org.bouncycastle:bcpkix-jdk15on:1.56
|
||||
org.bouncycastle:bcprov-jdk15on:1.48
|
||||
org.bouncycastle:bcprov-jdk15on:1.56
|
||||
org.bouncycastle:bcprov-jdk15on:1.60
|
||||
org.checkerframework:checker-qual:2.5.2
|
||||
org.codehaus.groovy:groovy-all:2.4.15
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.14
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.17
|
||||
org.conscrypt:conscrypt-android:2.0.0
|
||||
org.eclipse.jdt.core.compiler:ecj:4.4
|
||||
org.eclipse.jdt.core.compiler:ecj:4.4.2
|
||||
org.eclipse.jdt.core.compiler:ecj:4.5.1
|
||||
org.eclipse.jdt.core.compiler:ecj:4.6.1
|
||||
org.glassfish.jaxb:jaxb-core:2.2.11
|
||||
org.glassfish.jaxb:jaxb-runtime:2.2.11
|
||||
org.glassfish.jaxb:txw2:2.2.11
|
||||
org.hamcrest:hamcrest-core:1.3
|
||||
org.jacoco:org.jacoco.core:0.7.4.201502262128
|
||||
org.jacoco:org.jacoco.core:0.7.5.201505241946
|
||||
org.jacoco:org.jacoco.report:0.7.4.201502262128
|
||||
org.jacoco:org.jacoco.report:0.7.5.201505241946
|
||||
org.jdom:jdom2:2.0.6
|
||||
org.jetbrains.intellij.deps:trove4j:1.0.20181211
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1
|
||||
org.jetbrains.kotlin:kotlin-android-extensions:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-build-common:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-compiler-runner:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-daemon-client:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-native-utils:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-reflect:1.1.3-2
|
||||
org.jetbrains.kotlin:kotlin-reflect:1.2.0
|
||||
org.jetbrains.kotlin:kotlin-reflect:1.3.20
|
||||
org.jetbrains.kotlin:kotlin-reflect:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-scripting-common:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-scripting-jvm:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-script-runtime:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-stdlib-common:1.2.71
|
||||
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.20
|
||||
org.jetbrains.kotlin:kotlin-stdlib-common:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.71
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.20
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.71
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.20
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2
|
||||
org.jetbrains.kotlin:kotlin-stdlib:1.2.71
|
||||
org.jetbrains.kotlin:kotlin-stdlib:1.3.20
|
||||
org.jetbrains.kotlin:kotlin-stdlib:1.3.50
|
||||
org.jetbrains.kotlin:kotlin-util-io:1.3.50
|
||||
org.jetbrains.trove4j:trove4j:20160824
|
||||
org.jetbrains:annotations:13.0
|
||||
org.jvnet.staxex:stax-ex:1.7.7
|
||||
org.ow2.asm:asm-analysis:5.0.3
|
||||
org.ow2.asm:asm-analysis:5.0.4
|
||||
org.ow2.asm:asm-analysis:5.1
|
||||
org.ow2.asm:asm-analysis:6.0
|
||||
org.ow2.asm:asm-commons:5.0.4
|
||||
org.ow2.asm:asm-commons:5.1
|
||||
org.ow2.asm:asm-commons:6.0
|
||||
org.ow2.asm:asm-debug-all:5.0.1
|
||||
org.ow2.asm:asm-tree:5.0.3
|
||||
org.ow2.asm:asm-tree:5.0.4
|
||||
org.ow2.asm:asm-tree:5.1
|
||||
org.ow2.asm:asm-tree:6.0
|
||||
org.ow2.asm:asm-util:5.1
|
||||
org.ow2.asm:asm-util:6.0
|
||||
org.ow2.asm:asm:5.0.3
|
||||
org.ow2.asm:asm:5.0.4
|
||||
org.ow2.asm:asm:5.1
|
||||
org.ow2.asm:asm:6.0
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,81 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -z "${IN_NIX_SHELL}" ]]; then
|
||||
echo "Remember to call 'make shell'!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This script takes care of generating/updating the maven-sources.nix file
|
||||
# representing the offline Maven repo containing the dependencies
|
||||
# required to build the project
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
THIS_SCRIPT=$(realpath --relative-to="${GIT_ROOT}" ${BASH_SOURCE})
|
||||
CUR_DIR=$(cd "${BASH_SOURCE%/*}" && pwd)
|
||||
source "${GIT_ROOT}/scripts/colors.sh"
|
||||
|
||||
PROJ_LIST="${CUR_DIR}/proj.list"
|
||||
DEPS_LIST="${CUR_DIR}/deps.list"
|
||||
DEPS_URLS="${CUR_DIR}/deps.urls"
|
||||
DEPS_NIX="${CUR_DIR}/deps.nix"
|
||||
|
||||
# Raise limit of file descriptors
|
||||
ulimit -n 16384
|
||||
|
||||
# This needs to be used by all instances of determine_url.sh
|
||||
# but needs to be fresh on every run of generate.sh.
|
||||
# Helps mvn not re-download same stuff over and over again.
|
||||
export MVN_REPO_CACHE='/tmp/maven-repo-cache'
|
||||
trap "rm -rf ${MVN_REPO_CACHE}" ERR EXIT HUP INT
|
||||
|
||||
echo "Regenerating Nix files..."
|
||||
|
||||
# Gradle needs to be run in 'android' subfolder
|
||||
cd $GIT_ROOT/android
|
||||
|
||||
# Stop gradle daemons to avoid locking
|
||||
./gradlew --stop >/dev/null
|
||||
|
||||
# Generate list of Gradle sub-projects ----------------------------------------
|
||||
${CUR_DIR}/get_projects.sh | sort -u -o ${PROJ_LIST}
|
||||
|
||||
echo -e "Found ${GRN}$(wc -l < ${PROJ_LIST})${RST} sub-projects..."
|
||||
|
||||
# Check each sub-project in parallel, the ":" is for local deps ---------------
|
||||
PROJECTS=$(cat ${PROJ_LIST})
|
||||
${CUR_DIR}/get_deps.sh ":" ${PROJECTS[@]} \
|
||||
| sort -uV -o ${DEPS_LIST}
|
||||
|
||||
echo -e "\033[2KFound ${GRN}$(wc -l < ${DEPS_LIST})${RST} direct dependencies..."
|
||||
|
||||
# Save old URLs file to improve search
|
||||
if [[ ! -s "${DEPS_URLS}.old" ]] && [[ -s "${DEPS_URLS}" ]]; then
|
||||
mv "${DEPS_URLS}" "${DEPS_URLS}.old"
|
||||
fi
|
||||
|
||||
# Find download URLs for each dependency --------------------------------------
|
||||
# The AWK call removes duplicates using different repos.
|
||||
DEPENDENCIES=$(cat ${DEPS_LIST})
|
||||
parallel --will-cite \
|
||||
${CUR_DIR}/get_urls.sh \
|
||||
::: ${DEPENDENCIES[@]} \
|
||||
| awk -F'/' '{db[$NF]++;if(db[$NF]==1){print}}' \
|
||||
| sort -uV -o ${DEPS_URLS}
|
||||
|
||||
echo -e "\033[2KFound ${GRN}$(wc -l < ${DEPS_URLS})${RST} dependency URLs..."
|
||||
|
||||
# Open the Nix attribute set --------------------------------------------------
|
||||
echo -e "# Generated by ${THIS_SCRIPT}\n{" > ${DEPS_NIX}
|
||||
|
||||
# Format URLs into a Nix consumable file.
|
||||
URLS=$(cat ${DEPS_URLS})
|
||||
parallel --will-cite --keep-order \
|
||||
"${CUR_DIR}/url2nix.sh" \
|
||||
::: ${URLS} \
|
||||
>> ${DEPS_NIX}
|
||||
|
||||
# Close the Nix attribute set
|
||||
echo "}" >> ${DEPS_NIX}
|
||||
|
||||
echo -e "\033[2KGenerated Nix deps file: ${DEPS_NIX}"
|
||||
echo -e "${GRN}Done${RST}"
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeu
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
# Gradle needs to be run in 'android' subfolder
|
||||
cd $GIT_ROOT/android
|
||||
|
||||
# AWK script to catch only non-test deps
|
||||
AWK_SCRIPT='
|
||||
/^(classpath|[a-zA-Z]+ - .*)$/{
|
||||
if ($1 ~ "test") { next; }
|
||||
while ($0!="") { print; getline; }
|
||||
}
|
||||
'
|
||||
|
||||
# Run the gradle command for a project:
|
||||
# - ':buildEnvironment' to get build tools
|
||||
# - ':dependencies' to get direct deps limited those by
|
||||
# implementation config to avoid test dependencies
|
||||
DEPS=("${@}")
|
||||
declare -a BUILD_DEPS
|
||||
declare -a NORMAL_DEPS
|
||||
for i in "${!DEPS[@]}"; do
|
||||
BUILD_DEPS[${i}]="${DEPS[${i}]}:buildEnvironment"
|
||||
NORMAL_DEPS[${i}]="${DEPS[${i}]}:dependencies"
|
||||
done
|
||||
|
||||
# And clean up the output by:
|
||||
# - keep only lines that start with \--- or +---
|
||||
# - drop lines that end with (*) or (n) but don't start with (+)
|
||||
# - drop lines that refer to a project
|
||||
# - drop entries starting with `status-im:` like `status-go`
|
||||
# - drop entries that aren't just the name of the dependency
|
||||
# - extract the package name and version, ignoring version range indications,
|
||||
# such as in `com.google.android.gms:play-services-ads:[15.0.1,16.0.0) -> 15.0.1`
|
||||
|
||||
./gradlew --no-daemon --console plain \
|
||||
"${BUILD_DEPS[@]}" \
|
||||
"${NORMAL_DEPS[@]}" \
|
||||
| awk "${AWK_SCRIPT}" \
|
||||
| grep -e '[\\\+]---' \
|
||||
| sed -E 's;.*[\\\+]--- ([^ ]+:)(.+ -> )?([^ ]+).*$;\1\3;' \
|
||||
| grep --invert-match -E \
|
||||
-e '^[a-z]+$' \
|
||||
-e '^:?[^:]+$' \
|
||||
-e '--- project :' \
|
||||
-e '^(#|status-im:)' \
|
||||
-e '(\+|unspecified)$' \
|
||||
-e '^[^+].+ \([\*n]\)$'
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeu
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
# Gradle needs to be run in 'android' subfolder
|
||||
cd $GIT_ROOT/android
|
||||
|
||||
# Print all our sub-projects
|
||||
./gradlew projects --no-daemon --console plain 2>&1 \
|
||||
| grep "Project ':" \
|
||||
| sed -E "s;^.--- Project '\:([@_a-zA-Z0-9\-]+)';\1;"
|
|
@ -0,0 +1,186 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
CUR_DIR=$(cd "${BASH_SOURCE%/*}" && pwd)
|
||||
# Gradle needs to be run in 'android' subfolder
|
||||
cd ${GIT_ROOT}/android
|
||||
|
||||
function join_by {
|
||||
local IFS="$1"; shift; echo "$*";
|
||||
}
|
||||
|
||||
# sources REPOS associative array
|
||||
source ${CUR_DIR}/repos.sh
|
||||
mavenSourcesSedFilter=$(join_by '|' ${REPOS[@]})
|
||||
|
||||
# Converts a URL to a Maven package ID (e.g. https://dl.google.com/dl/android/maven2/android/arch/core/common/1.0.0/common-1.0.0 -> android.arch.core:common:1.0.0)
|
||||
function getPackageIdFromURL() {
|
||||
local url="${1}"
|
||||
local path=$(echo ${url} | sed -E "s;(${mavenSourcesSedFilter})/(.+);\2;")
|
||||
|
||||
IFS='/' read -ra tokens <<< "${path}"
|
||||
local groupLength=$(( ${#tokens[@]} - 3 ))
|
||||
local groupId=''
|
||||
for ((i=0;i<${groupLength};i++)); do
|
||||
if [ $i -eq 0 ]; then
|
||||
groupId=${tokens[i]}
|
||||
else
|
||||
groupId="${groupId}.${tokens[i]}"
|
||||
fi
|
||||
done
|
||||
artifactId=${tokens[-3]}
|
||||
version="${tokens[-2]}"
|
||||
echo "${groupId}:${artifactId}:${version}"
|
||||
}
|
||||
|
||||
# Formats the components of a Maven package ID as a URL path component (e.g. android/arch/core/common/1.0.0/common-1.0.0)
|
||||
function getPath() {
|
||||
local tokens=("${@}")
|
||||
local groupId=${tokens[0]}
|
||||
local artifactId=${tokens[1]}
|
||||
local version=${tokens[2]}
|
||||
if [[ "${version}" == "jar" ]] || [[ "${version}" == "aar" ]]; then
|
||||
local version=${tokens[3]}
|
||||
fi
|
||||
|
||||
groupId=$(echo ${groupId} | tr '.' '/')
|
||||
echo "${groupId}/${artifactId}/${version}/${artifactId}-${version}"
|
||||
}
|
||||
|
||||
# Tries to download a POM, fails on 404
|
||||
function tryGetPOMFromURL() {
|
||||
# Using nix-prefetch-url so it's already downloaded for next step
|
||||
FETCH_OUT=$(nix-prefetch-url --print-path "${1}.pom" 2>/dev/null)
|
||||
RVAL=${?}
|
||||
POM_PATH=$(echo "${FETCH_OUT}" | tail -n1)
|
||||
# We symlink the POM it can be used with retrieveAdditionalDependencies
|
||||
if [[ ${RVAL} -eq 0 ]] && [[ ! -L "${TMP_POM_SYMLINK}" ]]; then
|
||||
ln -s "${POM_PATH}" "${TMP_POM_SYMLINK}"
|
||||
fi
|
||||
return ${RVAL}
|
||||
}
|
||||
|
||||
# Given the components of a package ID, will loop through known repositories to figure out a source for the package
|
||||
function determineArtifactUrl() {
|
||||
# Parse dependency ID into components (group ID, artifact ID, version)
|
||||
IFS=':' read -ra tokens <<< "${1}"
|
||||
local groupId=${tokens[0]}
|
||||
[ -z "${groupId}" ] && return
|
||||
local path=$(getPath "${tokens[@]}")
|
||||
|
||||
# check old file for URL to avoid making requests if possible
|
||||
if [[ -s "${CUR_DIR}/deps.urls.old" ]]; then
|
||||
local url=$(grep ${path} ${CUR_DIR}/deps.urls.old | sort -V | head -n1)
|
||||
if [[ -n "${url}" ]]; then
|
||||
# Make sure we symlink the POM
|
||||
tryGetPOMFromURL "${url}"
|
||||
echo "${url}"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# otherwise try to find it via fetching
|
||||
for mavenSourceUrl in ${REPOS[@]}; do
|
||||
if tryGetPOMFromURL "${mavenSourceUrl}/${path}"; then
|
||||
echo "${mavenSourceUrl}/${path}"
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo "<NOTFOUND>"
|
||||
}
|
||||
|
||||
function retrieveAdditionalDependencies() {
|
||||
# It is not enough to output the dependencies in deps, we must also ask maven to report
|
||||
# the dependencies for each individual POM file. Instead of parsing the dependency tree itself though,
|
||||
# we look at what packages maven downloads from the internet into the local repo,
|
||||
# which avoids us having to do a deep search, and does not report duplicates
|
||||
echo -n > ${TMP_MVN_DEP_TREE}
|
||||
|
||||
mvn dependency:list --batch-mode --file "${1}" \
|
||||
--define includeScope=compile \
|
||||
--define excludeScope=test \
|
||||
--define maven.repo.local=${MVN_REPO_CACHE} \
|
||||
> ${TMP_MVN_DEP_TREE} 2>&1 || echo -n
|
||||
|
||||
local additional_deps=( $(cat ${TMP_MVN_DEP_TREE} \
|
||||
| grep -E 'Downloaded from [^:]+: [^ ]+\.(pom|jar|aar)' \
|
||||
| sed -E "s;^\[INFO\] Downloaded from [^:]+: ([^ ]+)\.(pom|jar|aar) .*$;\1;") )
|
||||
|
||||
local missing_additional_deps=( $(cat ${TMP_MVN_DEP_TREE} \
|
||||
| grep -E "The POM for .+:.+:(pom|jar):.+ is missing" \
|
||||
| sed -E "s;^.*The POM for (.+:.+:(pom|jar):.+) is missing.*$;\1;") )
|
||||
|
||||
for additional_dep_url in ${additional_deps[@]}; do
|
||||
local additional_dep_id=$(getPackageIdFromURL ${additional_dep_url})
|
||||
|
||||
# See if we already have this dependency in $deps
|
||||
local alreadyExists=0
|
||||
for _dep in ${deps[@]}; do
|
||||
if [[ "${additional_dep_id}" = "${_dep}" ]]; then
|
||||
alreadyExists=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[[ ${alreadyExists} -eq 0 ]] && echo "${additional_dep_url}" || continue
|
||||
done
|
||||
|
||||
for additional_dep_id in ${missing_additional_deps[@]}; do
|
||||
# these are un-fetchable
|
||||
[[ "${additional_dep_id}" = *":unspecified" ]] && continue
|
||||
|
||||
# See if we already have this dependency in $deps
|
||||
local alreadyExists=0
|
||||
for _dep in ${deps[@]}; do
|
||||
if [ "${additional_dep_id}" = "${_dep}" ]; then
|
||||
alreadyExists=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${alreadyExists} -eq 0 ]]; then
|
||||
artifactUrl=$(determineArtifactUrl ${additional_dep_id})
|
||||
|
||||
[[ -z "${artifactUrl}" ]] && continue
|
||||
|
||||
if [[ "${artifactUrl}" = "<NOTFOUND>" ]]; then
|
||||
# Some dependencies don't contain a normal format, so we ignore them (e.g. `com.squareup.okhttp:okhttp:{strictly`)
|
||||
echo -e "\033[2K ! Failed to find URL for: ${additional_dep_id}" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "${artifactUrl}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# The only argument is the file with the deps list
|
||||
DEP="${1}"
|
||||
if [[ -z "${DEP}" ]]; then
|
||||
echo "No argument given!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This will be a symlink to downloaded POM file
|
||||
TMP_POM_SYMLINK=$(mktemp --tmpdir -u fetch-maven-deps-XXXXX.pom)
|
||||
TMP_MVN_DEP_TREE=$(mktemp --tmpdir mvn-dep-tree-XXXXX.txt)
|
||||
|
||||
# To make maven always re-download dependencies
|
||||
# WARNING: If this is not cleared after full run this won't work
|
||||
TMP_MVN_REPO=$(mktemp -d) # this is for when this script is run by hand
|
||||
MVN_REPO_CACHE=${MVN_REPO_CACHE:-${TMP_MVN_REPO}}
|
||||
|
||||
trap "rm -rf ${TMP_POM_SYMLINK} ${TMP_MVN_DEP_TREE}" ERR EXIT HUP INT
|
||||
|
||||
echo -en "\033[2K - Finding URL: ${DEP}\r" >&2
|
||||
|
||||
FOUND_URL=$(determineArtifactUrl ${DEP})
|
||||
|
||||
if [ -z "${FOUND_URL}" ] || [ "${FOUND_URL}" = "<NOTFOUND>" ]; then
|
||||
# Some dependencies don't contain a normal format
|
||||
echo -e "\033[2K ! Failed to find URL for: ${DEP}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "${FOUND_URL}"
|
||||
|
||||
retrieveAdditionalDependencies "${TMP_POM_SYMLINK}"
|
|
@ -0,0 +1,28 @@
|
|||
app
|
||||
react-native-background-timer
|
||||
react-native-camera
|
||||
react-native-community_clipboard
|
||||
react-native-community_masked-view
|
||||
react-native-community_netinfo
|
||||
react-native-config
|
||||
react-native-dark-mode
|
||||
react-native-dialogs
|
||||
react-native-fs
|
||||
react-native-gesture-handler
|
||||
react-native-haptic-feedback
|
||||
react-native-image-crop-picker
|
||||
react-native-image-resizer
|
||||
react-native-keychain
|
||||
react-native-languages
|
||||
react-native-mail
|
||||
react-native-nfc-manager
|
||||
react-native-reanimated
|
||||
react-native-safe-area-context
|
||||
react-native-screens
|
||||
react-native-shake
|
||||
react-native-splash-screen
|
||||
react-native-status
|
||||
react-native-status-keycard
|
||||
react-native-svg
|
||||
react-native-touch-id
|
||||
react-native-webview
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This defines URLs of Maven repos we know about and use.
|
||||
# Should be ordered to reduce number of URL checks.
|
||||
# Sorted on the frequency of different repos in deps.urls.
|
||||
declare -a REPOS=(
|
||||
"https://repo.maven.apache.org/maven2"
|
||||
"https://dl.google.com/dl/android/maven2"
|
||||
"https://repository.sonatype.org/content/groups/sonatype-public-grid"
|
||||
"https://plugins.gradle.org/m2"
|
||||
"https://maven.java.net/content/repositories/releases"
|
||||
"https://jcenter.bintray.com"
|
||||
"https://jitpack.io"
|
||||
"https://repo1.maven.org/maven2"
|
||||
)
|
|
@ -0,0 +1,21 @@
|
|||
{ pkgs ? import ../../pkgs.nix { } }:
|
||||
|
||||
let
|
||||
status-go = pkgs.callPackage ../../status-go { };
|
||||
nodeJsDeps = pkgs.callPackage ../nodejs { };
|
||||
in pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
curl flock # used in reset-node_modules.sh
|
||||
git gradle jq maven nodejs
|
||||
];
|
||||
inputsFrom = [ pkgs.androidShell ];
|
||||
shellHook = ''
|
||||
# Gradle checks for this being set
|
||||
export STATUS_GO_ANDROID_LIBDIR=${status-go.mobile.android}
|
||||
|
||||
# Necessary for reset-node_modules.sh
|
||||
export STATUS_REACT_HOME=$(realpath ../../../)
|
||||
|
||||
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh "${nodeJsDeps}"
|
||||
'';
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# This script takes a deps.list file and builds a Nix expression
|
||||
# that can be used by maven-repo-builder.nix to produce a path to
|
||||
# a local Maven repository.
|
||||
#
|
||||
|
||||
CUR_DIR=$(cd "${BASH_SOURCE%/*}" && pwd)
|
||||
|
||||
# sources REPOS associative array
|
||||
source ${CUR_DIR}/repos.sh
|
||||
|
||||
function nix_fetch() {
|
||||
nix-prefetch-url --print-path --type sha256 "${1}" 2>/dev/null
|
||||
}
|
||||
|
||||
function get_nix_path() {
|
||||
nix_fetch "${1}" | tail -n1
|
||||
}
|
||||
|
||||
function get_nix_sha() {
|
||||
nix_fetch "${1}" | head -n1
|
||||
}
|
||||
|
||||
function get_sha1() {
|
||||
sha1sum "${1}" | cut -d' ' -f1
|
||||
}
|
||||
|
||||
# Assumes REPOS from repos.sh is available
|
||||
function match_repo_url() {
|
||||
for REPO_URL in "${REPOS[@]}"; do
|
||||
if [[ "$1" = ${REPO_URL}* ]]; then
|
||||
echo "${REPO_URL}"
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo " ! Failed to match a repo for: ${1}" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ -z "${1}" ]]; then
|
||||
echo "Required argument not given!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OBJ_REL_URL=${1}
|
||||
|
||||
echo -en "\033[2K - Nix entry for: ${1##*/}\r" >&2
|
||||
|
||||
REPO_URL=$(match_repo_url "${OBJ_REL_URL}")
|
||||
|
||||
if [[ -z "${REPO_URL}" ]]; then
|
||||
echo "\r\n ? REPO_URL: ${REPO_URL}" >&2
|
||||
fi
|
||||
# Get the relative path without full URL
|
||||
OBJ_REL_NAME="${OBJ_REL_URL#${REPO_URL}/}"
|
||||
|
||||
# Dependency might be a JAR or an AAR
|
||||
if nix_fetch "${OBJ_REL_URL}.jar" &>/dev/null; then
|
||||
OBJ_TYPE="jar"
|
||||
elif nix_fetch "${OBJ_REL_URL}.aar" &>/dev/null; then
|
||||
OBJ_TYPE="aar"
|
||||
else
|
||||
OBJ_TYPE="pom"
|
||||
fi
|
||||
|
||||
# Some deps have only a POM, nor JAR or AAR
|
||||
if [[ "${OBJ_TYPE}" != "pom" ]]; then
|
||||
OBJ_PATH=$(get_nix_path "${OBJ_REL_URL}.${OBJ_TYPE}")
|
||||
OBJ_SHA256=$(get_nix_sha "${OBJ_REL_URL}.${OBJ_TYPE}")
|
||||
OBJ_SHA1=$(get_sha1 "${OBJ_PATH}")
|
||||
fi
|
||||
|
||||
POM_PATH=$(get_nix_path "${OBJ_REL_URL}.pom")
|
||||
if [[ -z "${POM_PATH}" ]]; then
|
||||
echo " ! Failed to fetch: ${OBJ_REL_URL}.pom" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
POM_SHA256=$(get_nix_sha "${OBJ_REL_URL}.pom")
|
||||
POM_SHA1=$(get_sha1 "${POM_PATH}")
|
||||
|
||||
# Format into a Nix attrset entry
|
||||
echo -n "
|
||||
\"${OBJ_REL_NAME}\" =
|
||||
{
|
||||
host = \"${REPO_URL}\";
|
||||
path = \"${OBJ_REL_NAME}\";
|
||||
type = \"${OBJ_TYPE}\";"
|
||||
if [[ -n "${POM_SHA256}" ]]; then
|
||||
echo -n "
|
||||
pom = {
|
||||
sha1 = \"${POM_SHA1}\";
|
||||
sha256 = \"${POM_SHA256}\";
|
||||
};"
|
||||
fi
|
||||
if [[ -n "${OBJ_SHA256}" ]]; then
|
||||
echo -n "
|
||||
jar = {
|
||||
sha1 = \"${OBJ_SHA1}\";
|
||||
sha256 = \"${OBJ_SHA256}\";
|
||||
};"
|
||||
fi
|
||||
echo -n "
|
||||
};
|
||||
"
|
|
@ -1,10 +1,7 @@
|
|||
{ lib, pkgs, newScope, mkShell
|
||||
, status-go, localMavenRepoBuilder
|
||||
, gradle, androidPkgs, androidShell }:
|
||||
{ lib, pkgs, callPackage, mkShell
|
||||
, status-go, gradle, androidPkgs, androidShell }:
|
||||
|
||||
let
|
||||
callPackage = newScope { inherit localMavenRepoBuilder; };
|
||||
|
||||
# Import a jsbundle compiled out of clojure codebase
|
||||
jsbundle = callPackage ./jsbundle { };
|
||||
|
||||
|
@ -19,13 +16,9 @@ let
|
|||
inherit gradle mavenAndNpmDeps jsbundle status-go watchmanFactory;
|
||||
};
|
||||
|
||||
generate-maven-and-npm-deps-shell = callPackage ./maven-and-npm-deps/maven/shell.nix {
|
||||
inherit status-go;
|
||||
};
|
||||
|
||||
in {
|
||||
# TARGETS
|
||||
inherit release jsbundle generate-maven-and-npm-deps-shell;
|
||||
inherit release jsbundle;
|
||||
|
||||
shell = mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
|
@ -33,12 +26,12 @@ in {
|
|||
gradle
|
||||
lsof # used in start-react-native.sh
|
||||
flock # used in reset-node_modules.sh
|
||||
mavenAndNpmDeps
|
||||
];
|
||||
|
||||
inputsFrom = [
|
||||
gradle
|
||||
release
|
||||
mavenAndNpmDeps.shell
|
||||
androidShell
|
||||
];
|
||||
|
||||
|
@ -46,12 +39,20 @@ in {
|
|||
export ANDROID_SDK_ROOT="${androidPkgs}"
|
||||
export ANDROID_NDK_ROOT="${androidPkgs}/ndk-bundle"
|
||||
|
||||
export STATUSREACT_NIX_MAVEN_REPO="${mavenAndNpmDeps}/.m2/repository"
|
||||
|
||||
# required by some makefile targets
|
||||
export STATUS_GO_ANDROID_LIBDIR=${status-go}
|
||||
|
||||
# check if node modules changed and if so install them
|
||||
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh \
|
||||
"${mavenAndNpmDeps.drv}/project"
|
||||
{
|
||||
cd "$STATUS_REACT_HOME"
|
||||
|
||||
# Set up symlinks to mobile enviroment in project root
|
||||
ln -sf ./mobile/js_files/* ./
|
||||
|
||||
# check if node modules changed and if so install them
|
||||
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh ${mavenAndNpmDeps}/project
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
#
|
||||
|
||||
{ target ? "android"
|
||||
, stdenv, lib, deps, pkgs
|
||||
, localMavenRepoBuilder }:
|
||||
, stdenv, lib, deps, pkgs }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "status-react-build-jsbundle-${target}";
|
||||
|
|
|
@ -3,181 +3,158 @@
|
|||
# as well as a local version of the Maven repository required by Gradle scripts
|
||||
#
|
||||
|
||||
{ stdenv, lib, callPackage, pkgs, deps, mkShell
|
||||
, localMavenRepoBuilder }:
|
||||
{ stdenv, lib, callPackage, pkgs, deps, mkShell }:
|
||||
|
||||
# fake build to pre-download deps into fixed-output derivation
|
||||
let
|
||||
mavenLocalRepo = callPackage ./maven { inherit localMavenRepoBuilder stdenv; };
|
||||
# Place build target directories in NIX_BUILD_TOP (normally represents /build)
|
||||
projectBuildDir = "$NIX_BUILD_TOP/project";
|
||||
mavenRepoDir = "$NIX_BUILD_TOP/.m2/repository";
|
||||
reactNativeDepsDir = "$NIX_BUILD_TOP/deps"; # Use local writable deps, otherwise (probably due to some interaction between Nix sandboxing and Java) gradle will fail copying directly from the nix store
|
||||
|
||||
# fake build to pre-download deps into fixed-output derivation
|
||||
drv =
|
||||
let
|
||||
# Place build target directories in NIX_BUILD_TOP (normally represents /build)
|
||||
projectBuildDir = "$NIX_BUILD_TOP/project";
|
||||
mavenRepoDir = "$NIX_BUILD_TOP/.m2/repository";
|
||||
reactNativeDepsDir = "$NIX_BUILD_TOP/deps"; # Use local writable deps, otherwise (probably due to some interaction between Nix sandboxing and Java) gradle will fail copying directly from the nix store
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "status-react-patched-npm-gradle-modules";
|
||||
src =
|
||||
let path = ./../../../..; # Import the root /android and /mobile/js_files folders clean of any build artifacts
|
||||
in builtins.path { # We use builtins.path so that we can name the resulting derivation, otherwise the name would be taken from the checkout directory, which is outside of our control
|
||||
inherit path;
|
||||
name = "status-react-source-gradle-install";
|
||||
filter =
|
||||
# Keep this filter as restrictive as possible in order to avoid unnecessary rebuilds and limit closure size
|
||||
lib.mkFilter {
|
||||
root = path;
|
||||
include = [
|
||||
"android/.*" "status-modules/.*"
|
||||
"resources/.*" "mobile/js_files/.*" ".babelrc"
|
||||
];
|
||||
exclude = [
|
||||
".*.keystore" "node_modules"
|
||||
];
|
||||
};
|
||||
};
|
||||
phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ];
|
||||
nativeBuildInputs = [ deps.nodejs ];
|
||||
buildInputs = with pkgs; [ gradle nodejs file zlib mavenLocalRepo ];
|
||||
propagatedBuildInputs = [ deps.react-native ];
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
in stdenv.mkDerivation {
|
||||
name = "status-react-patched-npm-gradle-modules";
|
||||
src =
|
||||
let path = ./../../../..; # Import the root /android and /mobile/js_files folders clean of any build artifacts
|
||||
in builtins.path { # We use builtins.path so that we can name the resulting derivation, otherwise the name would be taken from the checkout directory, which is outside of our control
|
||||
inherit path;
|
||||
name = "status-react-source-gradle-install";
|
||||
filter =
|
||||
# Keep this filter as restrictive as possible in order to avoid unnecessary rebuilds and limit closure size
|
||||
lib.mkFilter {
|
||||
root = path;
|
||||
include = [
|
||||
"android/.*" "resources/.*"
|
||||
"mobile/js_files/.*" ".babelrc"
|
||||
];
|
||||
exclude = [
|
||||
".*.keystore" "node_modules"
|
||||
];
|
||||
};
|
||||
};
|
||||
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
|
||||
nativeBuildInputs = [ deps.nodejs ];
|
||||
buildInputs = with pkgs; [ gradle nodejs file zlib deps.gradle ];
|
||||
propagatedBuildInputs = [ deps.react-native ];
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
|
||||
# Copy project directory
|
||||
mkdir -p ${projectBuildDir}
|
||||
cp -a $src/. ${projectBuildDir}
|
||||
chmod u+w ${projectBuildDir}
|
||||
cd ${projectBuildDir}
|
||||
# Copy project directory
|
||||
mkdir -p ${projectBuildDir}
|
||||
cp -a $src/. ${projectBuildDir}
|
||||
chmod u+w ${projectBuildDir}
|
||||
cd ${projectBuildDir}
|
||||
|
||||
# Copy RN maven dependencies and make them writable, otherwise Gradle copy fails (since the top-level directory is read-only, Java isn't smart enough to copy the child files/folders into that target directory)
|
||||
mkdir -p ${mavenRepoDir}
|
||||
cp -a ${mavenLocalRepo}/. ${mavenRepoDir}
|
||||
cp -a ${deps.react-native}/deps ${reactNativeDepsDir}
|
||||
find ${reactNativeDepsDir} -maxdepth 1 -type d -exec chmod -R u+w {} \;
|
||||
# Copy RN maven dependencies and make them writable, otherwise Gradle copy fails (since the top-level directory is read-only, Java isn't smart enough to copy the child files/folders into that target directory)
|
||||
mkdir -p ${mavenRepoDir}
|
||||
cp -a ${deps.gradle}/. ${mavenRepoDir}
|
||||
cp -a ${deps.react-native}/deps ${reactNativeDepsDir}
|
||||
find ${reactNativeDepsDir} -maxdepth 1 -type d -exec chmod -R u+w {} \;
|
||||
|
||||
# Copy node_modules from Nix store
|
||||
rm -rf ${projectBuildDir}/node_modules
|
||||
mkdir -p ${projectBuildDir}/node_modules
|
||||
cp -a ${deps.nodejs}/node_modules/. ${projectBuildDir}/node_modules/
|
||||
# Copy node_modules from Nix store
|
||||
rm -rf ${projectBuildDir}/node_modules
|
||||
mkdir -p ${projectBuildDir}/node_modules
|
||||
cp -a ${deps.nodejs}/node_modules/. ${projectBuildDir}/node_modules/
|
||||
|
||||
# Ensure that module was correctly installed
|
||||
[ -d ${projectBuildDir}/node_modules/jsc-android/dist ] || exit 1
|
||||
# Ensure that module was correctly installed
|
||||
[ -d ${projectBuildDir}/node_modules/jsc-android/dist ] || exit 1
|
||||
|
||||
# Adjust permissions
|
||||
chmod -R u+w ${projectBuildDir}
|
||||
# Adjust permissions
|
||||
chmod -R u+w ${projectBuildDir}
|
||||
|
||||
cp -R ${projectBuildDir}/status-modules/ ${projectBuildDir}/node_modules/status-modules/
|
||||
# Create a dummy VERSION, since we don't want this expression to be invalidated just because the version changed
|
||||
echo '0.0.1' > ${projectBuildDir}/VERSION
|
||||
|
||||
# Create a dummy VERSION, since we don't want this expression to be invalidated just because the version changed
|
||||
echo '0.0.1' > ${projectBuildDir}/VERSION
|
||||
runHook postUnpack
|
||||
'';
|
||||
patchPhase = ''
|
||||
runHook prePatch
|
||||
|
||||
runHook postUnpack
|
||||
'';
|
||||
patchPhase = ''
|
||||
runHook prePatch
|
||||
prevSet=$-
|
||||
set -e
|
||||
|
||||
prevSet=$-
|
||||
set -e
|
||||
patchShebangs ${projectBuildDir}
|
||||
|
||||
patchShebangs ${projectBuildDir}
|
||||
function patchMavenSource() {
|
||||
set +e
|
||||
|
||||
function patchMavenSource() {
|
||||
set +e
|
||||
local targetGradleFile="$1"
|
||||
local source="$2"
|
||||
local deriv="$3"
|
||||
grep "$source" $targetGradleFile > /dev/null && \
|
||||
substituteInPlace $targetGradleFile --replace "$source" "$deriv"
|
||||
}
|
||||
|
||||
local targetGradleFile="$1"
|
||||
local source="$2"
|
||||
local deriv="$3"
|
||||
grep "$source" $targetGradleFile > /dev/null && \
|
||||
substituteInPlace $targetGradleFile --replace "$source" "$deriv"
|
||||
}
|
||||
function patchMavenSources() {
|
||||
set +e
|
||||
|
||||
function patchMavenSources() {
|
||||
set +e
|
||||
local targetGradleFile="$1"
|
||||
local deriv="$2"
|
||||
patchMavenSource $targetGradleFile 'mavenCentral()' 'mavenLocal()'
|
||||
patchMavenSource $targetGradleFile 'google()' 'mavenLocal()'
|
||||
patchMavenSource $targetGradleFile 'jcenter()' 'mavenLocal()'
|
||||
grep 'https://maven.google.com' $targetGradleFile > /dev/null && \
|
||||
substituteInPlace $targetGradleFile --replace 'https://maven.google.com' "$deriv"
|
||||
grep 'https://jitpack.io' $targetGradleFile > /dev/null && \
|
||||
substituteInPlace $targetGradleFile --replace 'https://jitpack.io' "$deriv"
|
||||
}
|
||||
|
||||
local targetGradleFile="$1"
|
||||
local deriv="$2"
|
||||
patchMavenSource $targetGradleFile 'mavenCentral()' 'mavenLocal()'
|
||||
patchMavenSource $targetGradleFile 'google()' 'mavenLocal()'
|
||||
patchMavenSource $targetGradleFile 'jcenter()' 'mavenLocal()'
|
||||
grep 'https://maven.google.com' $targetGradleFile > /dev/null && \
|
||||
substituteInPlace $targetGradleFile --replace 'https://maven.google.com' "$deriv"
|
||||
grep 'https://jitpack.io' $targetGradleFile > /dev/null && \
|
||||
substituteInPlace $targetGradleFile --replace 'https://jitpack.io' "$deriv"
|
||||
}
|
||||
# Patch maven and google central repositories with our own local directories. This prevents the builder from downloading Maven artifacts
|
||||
patchMavenSources 'android/build.gradle' '${deps.gradle}'
|
||||
for f in `find ${projectBuildDir}/node_modules/ -name build.gradle`; do
|
||||
patchMavenSources $f '${deps.gradle}'
|
||||
done
|
||||
|
||||
# Patch maven and google central repositories with our own local directories. This prevents the builder from downloading Maven artifacts
|
||||
patchMavenSources 'android/build.gradle' '${mavenLocalRepo}'
|
||||
for f in `find ${projectBuildDir}/node_modules/ -name build.gradle`; do
|
||||
patchMavenSources $f '${mavenLocalRepo}'
|
||||
done
|
||||
# Do not add a BuildId to the generated libraries, for reproducibility
|
||||
substituteInPlace ${projectBuildDir}/node_modules/react-native/ReactAndroid/src/main/jni/Application.mk \
|
||||
--replace \
|
||||
'-Wl,--build-id' \
|
||||
'-Wl,--build-id=none'
|
||||
|
||||
# Do not add a BuildId to the generated libraries, for reproducibility
|
||||
substituteInPlace ${projectBuildDir}/node_modules/react-native/ReactAndroid/src/main/jni/Application.mk \
|
||||
--replace \
|
||||
'-Wl,--build-id' \
|
||||
'-Wl,--build-id=none'
|
||||
# Disable Gradle daemon and caching, since that causes rebuilds (and subsequently errors) anyway due to cache being considered stale
|
||||
substituteInPlace ${projectBuildDir}/android/gradle.properties \
|
||||
--replace \
|
||||
'org.gradle.jvmargs=-Xmx8704M' \
|
||||
'org.gradle.jvmargs=-Xmx8704M
|
||||
org.gradle.daemon=false
|
||||
org.gradle.caching=false'
|
||||
|
||||
# Disable Gradle daemon and caching, since that causes rebuilds (and subsequently errors) anyway due to cache being considered stale
|
||||
substituteInPlace ${projectBuildDir}/android/gradle.properties \
|
||||
--replace \
|
||||
'org.gradle.jvmargs=-Xmx8704M' \
|
||||
'org.gradle.jvmargs=-Xmx8704M
|
||||
org.gradle.daemon=false
|
||||
org.gradle.caching=false'
|
||||
# Patch the path to nodejs in project.ext.react
|
||||
substituteInPlace ${projectBuildDir}/android/app/build.gradle \
|
||||
--replace \
|
||||
'nodeExecutableAndArgs: ["node"' \
|
||||
'nodeExecutableAndArgs: ["${pkgs.nodejs}/bin/node"'
|
||||
|
||||
# Patch the path to nodejs in project.ext.react
|
||||
substituteInPlace ${projectBuildDir}/android/app/build.gradle \
|
||||
--replace \
|
||||
'nodeExecutableAndArgs: ["node"' \
|
||||
'nodeExecutableAndArgs: ["${pkgs.nodejs}/bin/node"'
|
||||
# Fix bugs in Hermes usage (https://github.com/facebook/react-native/issues/25601#issuecomment-510856047)
|
||||
# - Make PR builds also count as release builds
|
||||
# - Fix issue where hermes command is being called with same input/output file
|
||||
substituteInPlace ${projectBuildDir}/node_modules/react-native/react.gradle \
|
||||
--replace \
|
||||
'targetName.toLowerCase().contains("release")' \
|
||||
'!targetName.toLowerCase().contains("debug")'
|
||||
|
||||
# Fix bugs in Hermes usage (https://github.com/facebook/react-native/issues/25601#issuecomment-510856047)
|
||||
# - Make PR builds also count as release builds
|
||||
# - Fix issue where hermes command is being called with same input/output file
|
||||
substituteInPlace ${projectBuildDir}/node_modules/react-native/react.gradle \
|
||||
--replace \
|
||||
'targetName.toLowerCase().contains("release")' \
|
||||
'!targetName.toLowerCase().contains("debug")'
|
||||
# Patch dependencies which are not yet ported to AndroidX
|
||||
npx jetify
|
||||
|
||||
# Patch dependencies which are not yet ported to AndroidX
|
||||
npx jetify
|
||||
set $prevSet
|
||||
|
||||
set $prevSet
|
||||
runHook postPatch
|
||||
'';
|
||||
installPhase = ''
|
||||
rm -rf $out
|
||||
mkdir -p $out/{project,.m2/repository}
|
||||
|
||||
runHook postPatch
|
||||
'';
|
||||
installPhase = ''
|
||||
rm -rf $out
|
||||
mkdir -p $out/{project,.m2/repository}
|
||||
# TODO: maybe node_modules/react-native/ReactAndroid/build/{tmp,generated} can be discarded?
|
||||
cp -R ${mavenRepoDir} $out/.m2/
|
||||
cp -R ${projectBuildDir}/{android,node_modules}/ $out/project
|
||||
'';
|
||||
|
||||
# TODO: maybe node_modules/react-native/ReactAndroid/build/{tmp,generated} can be discarded?
|
||||
cp -R ${mavenRepoDir} $out/.m2/
|
||||
cp -R ${projectBuildDir}/{android,node_modules}/ $out/project
|
||||
'';
|
||||
fixupPhase = ''
|
||||
# Patch prepareJSC so that it doesn't subsequently try to build NDK libs
|
||||
#substituteInPlace $out/project/node_modules/react-native/ReactAndroid/build.gradle \
|
||||
# --replace \
|
||||
# 'packageReactNdkLibs(dependsOn: buildReactNdkLib, ' \
|
||||
# 'packageReactNdkLibs('
|
||||
'';
|
||||
# The ELF types are incompatible with the host platform, so let's not even try
|
||||
# TODO: Use Android NDK to strip binaries manually
|
||||
dontPatchELF = true;
|
||||
dontStripHost = true;
|
||||
|
||||
# The ELF types are incompatible with the host platform, so let's not even try
|
||||
# TODO: Use Android NDK to strip binaries manually
|
||||
dontPatchELF = true;
|
||||
dontStripHost = true;
|
||||
|
||||
# Take whole sources into consideration when calculating sha
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
};
|
||||
|
||||
in {
|
||||
inherit drv;
|
||||
shell = mkShell {
|
||||
shellHook = ''
|
||||
export STATUSREACT_NIX_MAVEN_REPO="${drv}/.m2/repository"
|
||||
'';
|
||||
};
|
||||
# Take whole sources into consideration when calculating sha
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
{ stdenv,
|
||||
localMavenRepoBuilder, zip, unzip }:
|
||||
|
||||
let
|
||||
mavenLocalRepo = (localMavenRepoBuilder "status-react-maven-deps" mavenSourceFiles).overrideDerivation (oldAttrs: {
|
||||
# Add the zip and unzip tools that we'll use in the postCopy step
|
||||
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ (stdenv.lib.optionals stdenv.isLinux [ zip unzip ]);
|
||||
});
|
||||
mavenSourceFiles =
|
||||
let
|
||||
srcs = import ./maven-sources.nix { };
|
||||
# Warning: This must be the same as gradlePluginVersion android/gradle.properties
|
||||
version = "3.5.3-5435860";
|
||||
aapt2NativePkg = "https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/${version}/aapt2-${version}-linux";
|
||||
in srcs // (if !stdenv.isLinux then { } else {
|
||||
# On Linux, we need to patch the interpreter in Java packages that contain native executables to use Nix's interpreter instead
|
||||
"${aapt2NativePkg}" = srcs."${aapt2NativePkg}" // {
|
||||
postCopy = ''
|
||||
[ -n "$NIX_CC" ] || exit 1 # We need an stdenv with a compiler
|
||||
|
||||
prevSet=$-
|
||||
set -e
|
||||
|
||||
# Patch executables from maven dependency to use Nix's interpreter
|
||||
tmpDir=$(mktemp -d)
|
||||
unzip $depPath.jar -d $tmpDir
|
||||
for exe in `find $tmpDir/ -type f -executable`; do
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $exe
|
||||
done
|
||||
|
||||
# Rebuild the .jar file with patched binaries
|
||||
pushd $tmpDir > /dev/null
|
||||
chmod u+w $depPath.jar
|
||||
zip -fr $depPath.jar
|
||||
chmod $depPath.jar --reference=$depPath.jar.sha1
|
||||
popd > /dev/null
|
||||
rm -rf $tmpDir
|
||||
|
||||
set $prevSet
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
in mavenLocalRepo
|
|
@ -1,221 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -Eeu
|
||||
|
||||
# This script takes care of generating/updating the maven-inputs.txt file.
|
||||
# For this, we:
|
||||
# 1. query the projects in the main gradle project
|
||||
# 2. loop through each of the projects, querying its dependencies
|
||||
# 3. add each one to maven-inputs.txt
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
current_dir=$(cd "${BASH_SOURCE%/*}" && pwd)
|
||||
gradle_opts="--console plain"
|
||||
tmp_pom_filename=$(mktemp --tmpdir fetch-maven-deps-XXXX.pom)
|
||||
tmp_mvn_dep_tree_filename=$(mktemp --tmpdir mvn-dep-tree-XXXX.txt)
|
||||
deps_file_path=$(mktemp --tmpdir fetch-maven-deps-XXXX-deps.txt)
|
||||
|
||||
function join_by { local IFS="$1"; shift; echo "$*"; }
|
||||
|
||||
mavenSources=( \
|
||||
https://dl.google.com/dl/android/maven2 \
|
||||
https://jcenter.bintray.com \
|
||||
https://plugins.gradle.org/m2 \
|
||||
https://repo.maven.apache.org/maven2 \
|
||||
https://maven.fabric.io/public \
|
||||
https://jitpack.io \
|
||||
)
|
||||
mavenSourcesSedFilter=$(join_by '|' ${mavenSources[@]})
|
||||
|
||||
# Converts a URL to a Maven package ID (e.g. https://dl.google.com/dl/android/maven2/android/arch/core/common/1.0.0/common-1.0.0 -> android.arch.core:common:1.0.0)
|
||||
function getPackageIdFromURL() {
|
||||
local url="$1"
|
||||
local path=$(echo $url | sed -E "s;($mavenSourcesSedFilter)/(.+);\2;")
|
||||
|
||||
IFS='/' read -ra tokens <<< "$path"
|
||||
local groupLength=$(( ${#tokens[@]} - 3 ))
|
||||
local groupId=''
|
||||
for ((i=0;i<$groupLength;i++)); do
|
||||
if [ $i -eq 0 ]; then
|
||||
groupId=${tokens[i]}
|
||||
else
|
||||
groupId="${groupId}.${tokens[i]}"
|
||||
fi
|
||||
done
|
||||
artifactId=${tokens[-3]}
|
||||
version="${tokens[-2]}"
|
||||
echo "$groupId:$artifactId:$version"
|
||||
}
|
||||
|
||||
# Formats the components of a Maven package ID as a URL path component (e.g. android/arch/core/common/1.0.0/common-1.0.0)
|
||||
function getPath() {
|
||||
local tokens=("$@")
|
||||
local groupId=${tokens[0]}
|
||||
local artifactId=${tokens[1]}
|
||||
local version=${tokens[2]}
|
||||
|
||||
groupId=$(echo $groupId | tr '.' '/')
|
||||
echo "$groupId/$artifactId/$version/$artifactId-$version"
|
||||
}
|
||||
|
||||
# Tries to download a POM to $tmp_pom_filename given a base URL (also checks for empty files)
|
||||
function tryGetPOMFromURL() {
|
||||
local url="$1"
|
||||
|
||||
rm -f $tmp_pom_filename
|
||||
curl --output $tmp_pom_filename --silent --fail --location "$url.pom" && test -s $tmp_pom_filename
|
||||
}
|
||||
|
||||
# Given the components of a package ID, will loop through known repositories to figure out a source for the package
|
||||
function determineArtifactUrl() {
|
||||
# Parse dependency ID into components (group ID, artifact ID, version)
|
||||
IFS=':' read -ra tokens <<< "$1"
|
||||
local groupId=${tokens[0]}
|
||||
[ -z "$groupId" ] && return
|
||||
local artifactId=${tokens[1]}
|
||||
local version=$(echo "${tokens[2]}" | cut -d'@' -f1)
|
||||
|
||||
local path=$(getPath "${tokens[@]}")
|
||||
for mavenSourceUrl in ${mavenSources[@]}; do
|
||||
if tryGetPOMFromURL "$mavenSourceUrl/$path"; then
|
||||
echo "$mavenSourceUrl/$path"
|
||||
return
|
||||
fi
|
||||
done
|
||||
echo "<NOTFOUND>"
|
||||
}
|
||||
|
||||
# Executes a gradle dependencies command and returns the output package IDs
|
||||
function runGradleDepsCommand() {
|
||||
echo "Computing maven dependencies with \`gradle $1 $gradle_opts\`..." > /dev/stderr
|
||||
# Add a comment header with the command we're running (useful for debugging)
|
||||
echo "# $1"
|
||||
|
||||
# Run the gradle command and:
|
||||
# - remove lines that end with (*) or (n) but don't start with (+)
|
||||
# - keep only lines that start with \--- or +---
|
||||
# - remove lines that refer to a project
|
||||
# - extract the package name and version, ignoring version range indications, such as in `com.google.android.gms:play-services-ads:[15.0.1,16.0.0) -> 15.0.1`
|
||||
gradle $1 $gradle_opts \
|
||||
| grep --invert-match -E "^[^+].+ \([\*n]\)$" \
|
||||
| grep -e "[\\\+]---" \
|
||||
| grep --invert-match -e "--- project :" \
|
||||
| sed -E "s;.*[\\\+]--- ([^ ]+:)(.+ -> )?([^ ]+).*$;\1\3;"
|
||||
}
|
||||
|
||||
function retrieveAdditionalDependencies() {
|
||||
# It is not enough to output the dependencies in deps, we must also ask maven to report
|
||||
# the dependencies for each individual POM file. Instead of parsing the dependency tree itself though,
|
||||
# we look at what packages maven downloads from the internet into the local repo,
|
||||
# which avoids us having to do a deep search, and does not report duplicates
|
||||
echo -n > $tmp_mvn_dep_tree_filename
|
||||
mvn dependency:tree -B -Dmaven.repo.local=$mvn_tmp_repo -f "$1" > $tmp_mvn_dep_tree_filename 2>&1 || echo -n
|
||||
local additional_deps=( $(cat $tmp_mvn_dep_tree_filename \
|
||||
| grep -E 'Downloaded from [^:]+: [^ ]+\.(pom|jar|aar)' \
|
||||
| sed -E "s;^\[INFO\] Downloaded from [^:]+: ([^ ]+)\.(pom|jar|aar) .*$;\1;") )
|
||||
local missing_additional_deps=( $(cat $tmp_mvn_dep_tree_filename \
|
||||
| grep -E "The POM for .+:.+:(pom|jar):.+ is missing" \
|
||||
| sed -E "s;^.*The POM for (.+:.+:(pom|jar):.+) is missing.*$;\1;") )
|
||||
|
||||
for additional_dep_url in ${additional_deps[@]}; do
|
||||
local additional_dep_id=$(getPackageIdFromURL $additional_dep_url)
|
||||
|
||||
# See if we already have this dependency in $deps
|
||||
local alreadyExists=0
|
||||
for _dep in ${deps[@]}; do
|
||||
if [ "$additional_dep_id" = "$_dep" ]; then
|
||||
alreadyExists=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ $alreadyExists -eq 0 ] && echo "$additional_dep_url" || continue
|
||||
done
|
||||
|
||||
for additional_dep_id in ${missing_additional_deps[@]}; do
|
||||
# See if we already have this dependency in $deps
|
||||
local alreadyExists=0
|
||||
for _dep in ${deps[@]}; do
|
||||
if [ "$additional_dep_id" = "$_dep" ]; then
|
||||
alreadyExists=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $alreadyExists -eq 0 ]; then
|
||||
artifactUrl=$(determineArtifactUrl $additional_dep_id)
|
||||
if [ -z "$artifactUrl" ]; then
|
||||
continue
|
||||
elif [ "$artifactUrl" = "<NOTFOUND>" ]; then
|
||||
# Some dependencies don't contain a normal format, so we ignore them (e.g. `com.squareup.okhttp:okhttp:{strictly`)
|
||||
echo "Failed to determine source of $dep, ignoring..." > /dev/stderr
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$artifactUrl"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
mvn_tmp_repo=$(mktemp -d)
|
||||
trap "rm -rf $mvn_tmp_repo $tmp_pom_filename $deps_file_path $tmp_mvn_dep_tree_filename" ERR EXIT HUP INT
|
||||
|
||||
rnModules=$(node ./node_modules/react-native/cli.js config | jq -r '.dependencies | keys | .[]')
|
||||
|
||||
pushd $GIT_ROOT/android > /dev/null
|
||||
|
||||
gradleProjects=$(gradle projects $gradle_opts 2>&1 \
|
||||
| grep "Project ':" \
|
||||
| sed -E "s;^.--- Project '\:([@_a-zA-Z0-9\-]+)';\1;")
|
||||
projects=( ${gradleProjects[@]} ${rnModules[@]} )
|
||||
IFS=$'\n' sortedProjects=($(sort -u <<<"${projects[*]}"))
|
||||
unset IFS
|
||||
|
||||
echo -n > $deps_file_path
|
||||
# TODO: try to limit unnecessary dependencies brought in by passing e.g. `--configuration releaseCompileClasspath` to the `gradle *:dependencies` command
|
||||
runGradleDepsCommand 'buildEnvironment' >> $deps_file_path
|
||||
for project in ${sortedProjects[@]}; do
|
||||
runGradleDepsCommand ${project}:buildEnvironment >> $deps_file_path
|
||||
runGradleDepsCommand ${project}:dependencies >> $deps_file_path
|
||||
done
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
# Read the deps file into memory, sorting and getting rid of comments, project names and duplicates
|
||||
IFS=$'\n' deps=( $(cat $deps_file_path \
|
||||
| grep --invert-match -E '^#.*$' \
|
||||
| grep --invert-match -E '^[a-z]+$' \
|
||||
| grep --invert-match -E '^:?[^:]+$' \
|
||||
| sort -uV) )
|
||||
unset IFS
|
||||
rm -f $deps_file_path
|
||||
|
||||
lineCount=${#deps[@]}
|
||||
currentLine=0
|
||||
pstr="[=======================================================================]"
|
||||
|
||||
echo "Determining URLs for ${#deps[@]} packages..." > /dev/stderr
|
||||
for dep in ${deps[@]}; do
|
||||
currentLine=$(( $currentLine + 1 ))
|
||||
pd=$(( $currentLine * 73 / $lineCount ))
|
||||
printf "\r%3d.%1d%% %.${pd}s" $(( $currentLine * 100 / $lineCount )) $(( ($currentLine * 1000 / $lineCount) % 10 )) $pstr > /dev/stderr
|
||||
|
||||
[ -z "$dep" ] && continue
|
||||
# Ignore own dependencies (e.g. status-im:status-go:v0.30.0-beta.0)
|
||||
if [[ "$dep" == "status-im:"* ]]; then
|
||||
echo "Ignoring $dep" > /dev/stderr
|
||||
continue
|
||||
fi
|
||||
|
||||
artifactUrl=$(determineArtifactUrl $dep)
|
||||
if [ -z "$artifactUrl" ]; then
|
||||
continue
|
||||
elif [ "$artifactUrl" = "<NOTFOUND>" ]; then
|
||||
# Some dependencies don't contain a normal format, so we ignore them (e.g. `com.squareup.okhttp:okhttp:{strictly`)
|
||||
echo "Failed to determine source of $dep, ignoring..." > /dev/stderr
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$artifactUrl"
|
||||
|
||||
retrieveAdditionalDependencies $tmp_pom_filename
|
||||
done
|
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -z "${IN_NIX_SHELL}" ]]; then
|
||||
echo "Remember to call 'make shell'!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# This script takes care of generating/updating the maven-sources.nix file
|
||||
# representing the offline Maven repo containing the dependencies
|
||||
# required to build the project
|
||||
#
|
||||
|
||||
set -Eeu
|
||||
|
||||
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
|
||||
current_dir=$(cd "${BASH_SOURCE%/*}" && pwd)
|
||||
inputs_file_path="${current_dir}/maven-inputs.txt"
|
||||
output_nix_file_path="${current_dir}/maven-sources.nix"
|
||||
inputs2nix="${GIT_ROOT}/nix/mobile/android/maven-and-npm-deps/maven/maven-inputs2nix.sh"
|
||||
|
||||
echo "Regenerating Nix files, this process should take about 90 minutes"
|
||||
nix-shell --run "set -Eeuo pipefail; LC_ALL=C ${current_dir}/fetch-maven-deps.sh | sort -u -o ${inputs_file_path}" \
|
||||
-A targets.mobile.android.generate-maven-and-npm-deps-shell --show-trace "${GIT_ROOT}/default.nix"
|
||||
|
||||
pushd ${current_dir}
|
||||
${inputs2nix} ${inputs_file_path} > ${output_nix_file_path}
|
||||
echo "Done"
|
||||
popd
|
|
@ -1,157 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# This script takes a maven-inputs.txt file and builds a Nix expression that can be used by maven-repo-builder.nix to produce a path to a local Maven repository
|
||||
#
|
||||
|
||||
function getSHA() {
|
||||
nix-prefetch-url --type sha256 "$1" 2> /dev/null
|
||||
}
|
||||
|
||||
_tmp=$(mktemp)
|
||||
sort $1 | uniq > $_tmp
|
||||
trap "rm $_tmp" EXIT INT
|
||||
|
||||
apacheUrl='https://repo.maven.apache.org/maven2'
|
||||
clojarsUrl='https://repo.clojars.org'
|
||||
fabricUrl='https://maven.fabric.io/public'
|
||||
googleUrl='https://dl.google.com/dl/android/maven2'
|
||||
gradleUrl='http://repo.gradle.org/gradle/libs-releases-local'
|
||||
gradlePluginsUrl='https://plugins.gradle.org/m2'
|
||||
javaUrl='https://maven.java.net/content/repositories/releases'
|
||||
jcenterUrl='https://jcenter.bintray.com'
|
||||
jitpackUrl='https://jitpack.io'
|
||||
mavenUrl='https://repo1.maven.org/maven2'
|
||||
sonatypeSnapshotsUrl='https://oss.sonatype.org/content/repositories/snapshots'
|
||||
sonatypePublicGridUrl='https://repository.sonatype.org/content/groups/sonatype-public-grid'
|
||||
|
||||
# Writes Nix attribute set describing a package (represented by its URL)
|
||||
function writeEntry() {
|
||||
local depurl=$1
|
||||
if [[ "$depurl" = "$apacheUrl"* ]]; then
|
||||
host='apache'
|
||||
prefix=$apacheUrl
|
||||
elif [[ "$depurl" = "$clojarsUrl"* ]]; then
|
||||
host='clojars'
|
||||
prefix=$clojarsUrl
|
||||
elif [[ "$depurl" = "$fabricUrl"* ]]; then
|
||||
host='fabric-io'
|
||||
prefix=$fabricUrl
|
||||
elif [[ "$depurl" = "$googleUrl"* ]]; then
|
||||
host='google'
|
||||
prefix=$googleUrl
|
||||
elif [[ "$depurl" = "$gradleUrl"* ]]; then
|
||||
host='gradle'
|
||||
prefix=$gradleUrl
|
||||
elif [[ "$depurl" = "$gradlePluginsUrl"* ]]; then
|
||||
host='gradlePlugins'
|
||||
prefix=$gradlePluginsUrl
|
||||
elif [[ "$depurl" = "$jcenterUrl"* ]]; then
|
||||
host='jcenter'
|
||||
prefix=$jcenterUrl
|
||||
elif [[ "$depurl" = "$jitpackUrl"* ]]; then
|
||||
host='jitpack'
|
||||
prefix=$jitpackUrl
|
||||
elif [[ "$depurl" = "$javaUrl"* ]]; then
|
||||
host='java'
|
||||
prefix=$javaUrl
|
||||
elif [[ "$depurl" = "$mavenUrl"* ]]; then
|
||||
host='maven'
|
||||
prefix=$mavenUrl
|
||||
elif [[ "$depurl" = "$sonatypeSnapshotsUrl"* ]]; then
|
||||
host='sonatypeSnapshots'
|
||||
prefix=$sonatypeSnapshotsUrl
|
||||
elif [[ "$depurl" = "$sonatypePublicGridUrl"* ]]; then
|
||||
host='sonatypePublicGrid'
|
||||
prefix=$sonatypePublicGridUrl
|
||||
else
|
||||
echo "Unknown host in $depurl, exiting."
|
||||
exit 1
|
||||
fi
|
||||
deppath="${depurl/$prefix\//}"
|
||||
pom_sha256=$(getSHA "$depurl.pom")
|
||||
[ -n "$pom_sha256" ] && pom_sha1=$(curl -s --location "$depurl.pom.sha1") || unset pom_sha1
|
||||
jar_sha256=$(getSHA "$depurl.jar")
|
||||
type='jar'
|
||||
if [ -z "$jar_sha256" ]; then
|
||||
jar_sha256=$(getSHA "$depurl.aar")
|
||||
[ -n "$jar_sha256" ] && type='aar'
|
||||
fi
|
||||
[ -n "$jar_sha256" ] && jar_sha1=$(curl -s --location "$depurl.${type}.sha1") || unset jar_sha1
|
||||
|
||||
if [ -z "$pom_sha256" ] && [ -z "$jar_sha256" ] && [ -z "$aar_sha256" ]; then
|
||||
echo "Warning: failed to download $depurl" > /dev/stderr
|
||||
echo "Exiting." > /dev/stderr
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n " \"$depurl\" =
|
||||
{
|
||||
host = repositories.$host;
|
||||
path =
|
||||
\"$deppath\";
|
||||
type = \"$type\";"
|
||||
if [ -n "$pom_sha256" ]; then
|
||||
echo -n "
|
||||
pom = {
|
||||
sha1 = \"$pom_sha1\";
|
||||
sha256 = \"$pom_sha256\";
|
||||
};"
|
||||
fi
|
||||
if [ -n "$jar_sha256" ]; then
|
||||
echo -n "
|
||||
jar = {
|
||||
sha1 = \"$jar_sha1\";
|
||||
sha256 = \"$jar_sha256\";
|
||||
};"
|
||||
fi
|
||||
echo "
|
||||
};"
|
||||
}
|
||||
|
||||
lineCount=$(wc -l $1 | cut -f 1 -d ' ')
|
||||
currentLine=0
|
||||
pstr="[=======================================================================]"
|
||||
|
||||
echo "# Auto-generated by $(realpath --relative-to="$(dirname $1)" ${BASH_SOURCE})
|
||||
{ }:
|
||||
|
||||
let
|
||||
repositories = {
|
||||
apache = \"$mavenUrl\";
|
||||
clojars = \"$clojarsUrl\";
|
||||
fabric-io = \"$fabricUrl\";
|
||||
google = \"$googleUrl\";
|
||||
gradle = \"$gradleUrl\";
|
||||
gradlePlugins = \"$gradlePluginsUrl\";
|
||||
java = \"$javaUrl\";
|
||||
jcenter = \"$jcenterUrl\";
|
||||
jitpack = \"$jitpackUrl\";
|
||||
maven = \"$mavenUrl\";
|
||||
sonatypeSnapshots =
|
||||
\"$sonatypeSnapshotsUrl\";
|
||||
sonatypePublicGrid =
|
||||
\"$sonatypePublicGridUrl\";
|
||||
};
|
||||
|
||||
in {"
|
||||
echo "Generating Nix file from $1..." > /dev/stderr
|
||||
while read depurl
|
||||
do
|
||||
currentLine=$(( $currentLine + 1 ))
|
||||
pd=$(( $currentLine * 73 / $lineCount ))
|
||||
printf "\r%3d.%1d%% %.${pd}s" $(( $currentLine * 100 / $lineCount )) $(( ($currentLine * 1000 / $lineCount) % 10 )) $pstr > /dev/stderr
|
||||
|
||||
if [ -z "$depurl" ]; then
|
||||
continue
|
||||
fi
|
||||
writeEntry $depurl
|
||||
|
||||
# com.android.tools.build:aapt2 package also includes a platform-specific package, so we should add that too
|
||||
if [[ "$depurl" = *'com/android/tools/build/aapt2/'* ]]; then
|
||||
writeEntry "$depurl-linux"
|
||||
writeEntry "$depurl-osx"
|
||||
fi
|
||||
done < $_tmp
|
||||
|
||||
echo "}"
|
|
@ -1,17 +0,0 @@
|
|||
{ mkShell, pkgs
|
||||
, projectNodePackage, androidShell, status-go }:
|
||||
|
||||
mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
curl flock # used in reset-node_modules.sh
|
||||
git gradle jq maven nodejs
|
||||
projectNodePackage
|
||||
];
|
||||
inputsFrom = [ androidShell ];
|
||||
shellHook = ''
|
||||
# Gradle check for this being set
|
||||
export STATUS_GO_ANDROID_LIBDIR=${status-go}
|
||||
|
||||
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh "${projectNodePackage}"
|
||||
'';
|
||||
}
|
|
@ -23,8 +23,8 @@ let
|
|||
name = "status-react-build-${baseName}";
|
||||
|
||||
gradleHome = "$NIX_BUILD_TOP/.gradle";
|
||||
localMavenRepo = "${mavenAndNpmDeps.drv}/.m2/repository";
|
||||
sourceProjectDir = "${mavenAndNpmDeps.drv}/project";
|
||||
localMavenRepo = "${mavenAndNpmDeps}/.m2/repository";
|
||||
sourceProjectDir = "${mavenAndNpmDeps}/project";
|
||||
envFileName = if (buildType == "release" || buildType == "nightly" || buildType == "e2e")
|
||||
then ".env.${buildType}"
|
||||
else if buildType != "" then ".env.jenkins"
|
||||
|
@ -75,11 +75,8 @@ in stdenv.mkDerivation rec {
|
|||
# Used by the Android Gradle build script in android/build.gradle
|
||||
STATUS_GO_ANDROID_LIBDIR = "${status-go}";
|
||||
|
||||
# Used by the Android Gradle wrapper in android/gradlew
|
||||
STATUSREACT_NIX_MAVEN_REPO = "${mavenAndNpmDeps.drv}/.m2/repository";
|
||||
|
||||
phases = [
|
||||
"unpackPhase" "patchPhase" "secretPhase" "buildPhase" "checkPhase" "installPhase"
|
||||
"unpackPhase" "secretPhase" "buildPhase" "checkPhase" "installPhase"
|
||||
];
|
||||
|
||||
unpackPhase = ''
|
||||
|
@ -117,17 +114,6 @@ in stdenv.mkDerivation rec {
|
|||
chmod -R u+w $d
|
||||
done
|
||||
'';
|
||||
patchPhase = ''
|
||||
prevSet=$-
|
||||
set -e
|
||||
|
||||
substituteInPlace $PROJECT/android/gradlew \
|
||||
--replace \
|
||||
'exec gradle' \
|
||||
"exec gradle -Dmaven.repo.local='${localMavenRepo}' --offline ${toString gradleOpts}"
|
||||
|
||||
set $prevSet
|
||||
'';
|
||||
secretPhase = optionalString (secretsFile != "") ''
|
||||
source "${secretsFile}"
|
||||
'';
|
||||
|
@ -148,8 +134,9 @@ in stdenv.mkDerivation rec {
|
|||
chmod -R +w $PROJECT/android
|
||||
|
||||
pushd $PROJECT/android
|
||||
${adhocEnvVars} ./gradlew \
|
||||
--stacktrace \
|
||||
${adhocEnvVars} gradle ${toString gradleOpts} \
|
||||
--offline --stacktrace \
|
||||
-Dmaven.repo.local='${localMavenRepo}' \
|
||||
-PversionCode=${toString buildNumber} \
|
||||
assemble${gradleBuildType} \
|
||||
|| exit 1
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
let
|
||||
inherit (lib) catAttrs concatStrings optional unique;
|
||||
|
||||
localMavenRepoBuilder = callPackage ../tools/maven/maven-repo-builder.nix { };
|
||||
|
||||
fastlane = callPackage ./fastlane { };
|
||||
|
||||
android = callPackage ./android {
|
||||
inherit localMavenRepoBuilder;
|
||||
status-go = status-go.mobile.android;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,17 +23,15 @@ in {
|
|||
];
|
||||
|
||||
shellHook = ''
|
||||
pushd "$STATUS_REACT_HOME" > /dev/null
|
||||
{
|
||||
cd "$STATUS_REACT_HOME"
|
||||
|
||||
# Set up symlinks to mobile enviroment in project root
|
||||
ln -sf ./mobile/js_files/metro.config.js ./metro.config.js
|
||||
ln -sf ./mobile/js_files/package.json ./package.json
|
||||
ln -sf ./mobile/js_files/yarn.lock ./yarn.lock
|
||||
ln -sf ./mobile/js_files/* ./
|
||||
|
||||
# check if node modules changed and if so install them
|
||||
./nix/mobile/reset-node_modules.sh "${deps.nodejs}"
|
||||
}
|
||||
popd > /dev/null
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Check if we need to copy node_modules (e.g. in case it has been modified after last copy)
|
||||
# Check if we need to copy node_modules.
|
||||
# (e.g. in case it has been modified after last copy)
|
||||
#
|
||||
# The reasoning for a (mostly) read-only node_modules folder:
|
||||
# ideally we’d symlink the folder directly to the Nix store
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
# For more details see:
|
||||
# - https://nixos.wiki/wiki/Overlays
|
||||
# - https://nixos.org/nixos/nix-pills/callpackage-design-pattern.html
|
||||
#
|
||||
|
||||
self: super:
|
||||
|
||||
|
@ -23,6 +22,7 @@ in {
|
|||
# Project dependencies
|
||||
deps = {
|
||||
clojure = callPackage ./deps/clojure { };
|
||||
gradle = callPackage ./deps/gradle { };
|
||||
nodejs = callPackage ./deps/nodejs { };
|
||||
react-native = callPackage ./deps/react-native { };
|
||||
};
|
||||
|
@ -38,6 +38,7 @@ in {
|
|||
nodejs = super.pkgs.nodejs-12_x;
|
||||
|
||||
# Custom packages
|
||||
aapt2 = callPackage ./pkgs/aapt2 { };
|
||||
gomobile = callPackage ./pkgs/gomobile { };
|
||||
qt5custom = callPackage ./pkgs/qt5custom { };
|
||||
qtkeychain-src = callPackage ./pkgs/qtkeychain-src { };
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
# This is the Android Asset Packaging Tool(AAPT2).
|
||||
# It is used by Gradle to package Android app resources.
|
||||
# See: https://developer.android.com/studio/command-line/aapt2
|
||||
|
||||
{ stdenv, deps, pkgs, fetchurl }:
|
||||
|
||||
let
|
||||
inherit (pkgs) zip unzip;
|
||||
|
||||
pname = "aapt2";
|
||||
# Warning: This must be the same as gradlePluginVersion android/gradle.properties
|
||||
version = "3.5.3-5435860";
|
||||
|
||||
pkgPath = "com/android/tools/build/aapt2";
|
||||
repoUrl = "https://dl.google.com/dl/android/maven2";
|
||||
|
||||
filenames = {
|
||||
jar = "${pname}-${version}-linux.jar";
|
||||
pom = "${pname}-${version}.pom";
|
||||
};
|
||||
|
||||
urls = {
|
||||
jar = fetchurl {
|
||||
url = "${repoUrl}/${pkgPath}/${version}/${filenames.jar}";
|
||||
sha256 = "05gln93wfj4l5b0zfn6ipkx0i9p0x928ygwkrcfyl58aslxg5gx2";
|
||||
};
|
||||
sha = fetchurl {
|
||||
url = "${repoUrl}/${pkgPath}/${version}/${filenames.jar}.sha1";
|
||||
sha256 = "0rr7ly0f3w5jw0q985hmxmv8q2nlw1k72n6kl7kcmj4a7i479q90";
|
||||
};
|
||||
pom = fetchurl {
|
||||
url = "${repoUrl}/${pkgPath}/${version}/${filenames.pom}";
|
||||
sha256 = "1kdjfmrd4h2qljsdlqmyskin0564csg0q8j7bynag17w511bn4d3";
|
||||
};
|
||||
};
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
inherit pname version;
|
||||
|
||||
srcs = with urls; [ jar sha pom ];
|
||||
phases = [ "unpackPhase" "patchPhase" ];
|
||||
|
||||
unpackPhase = ''
|
||||
mkdir -p $out
|
||||
for src in $srcs; do
|
||||
local filename=$(basename $src)
|
||||
cp $src $out/''${filename#*-}
|
||||
done
|
||||
'';
|
||||
|
||||
# On Linux, we need to patch the interpreter in Java packages
|
||||
# that contain native executables to use Nix's interpreter instead.
|
||||
patchPhase = ''
|
||||
# We need an stdenv with a compiler
|
||||
[[ -n "$NIX_CC" ]] || exit 1
|
||||
|
||||
# Patch executables from maven dependency to use Nix's interpreter
|
||||
tmpDir=$(mktemp -d)
|
||||
${unzip}/bin/unzip $out/${filenames.jar} -d $tmpDir
|
||||
for exe in `find $tmpDir/ -type f -executable`; do
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $exe
|
||||
done
|
||||
|
||||
# Rebuild the .jar file with patched binaries
|
||||
pushd $tmpDir > /dev/null
|
||||
chmod u+w $out/${filenames.jar}
|
||||
${zip}/bin/zip -fr $out/${filenames.jar}
|
||||
chmod $out/${filenames.jar} --reference=$out/${filenames.jar}.sha1
|
||||
popd > /dev/null
|
||||
rm -rf $tmpDir
|
||||
'';
|
||||
}
|
|
@ -6,20 +6,20 @@
|
|||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) lib stdenv;
|
||||
inherit (pkgs) lib stdenv mkShell;
|
||||
|
||||
# everything else we define in nix/ dir
|
||||
targets = pkgs.callPackage ./targets.nix { inherit config; };
|
||||
|
||||
# the default shell that is used when target is not specified
|
||||
# it is also merged with all the other shells
|
||||
default = pkgs.mkShell {
|
||||
default = mkShell {
|
||||
name = "status-react-shell"; # for identifying all shells
|
||||
|
||||
buildInputs = with pkgs; lib.unique ([
|
||||
# core utilities that should always be present in a shell
|
||||
bash curl wget file unzip flock
|
||||
git gnumake jq ncurses gnugrep
|
||||
git gnumake jq ncurses gnugrep parallel
|
||||
# build specific utilities
|
||||
clojure maven watchman
|
||||
# other nice to have stuff
|
||||
|
@ -43,26 +43,47 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
# Combines with many other shells
|
||||
node-sh = mkShell {
|
||||
buildInputs = [ pkgs.androidPkgs ];
|
||||
shellHook = ''
|
||||
export STATUS_REACT_HOME=$(git rev-parse --show-toplevel)
|
||||
$STATUS_REACT_HOME/nix/mobile/reset-node_modules.sh ${pkgs.deps.nodejs}
|
||||
'';
|
||||
};
|
||||
|
||||
# An attrset for easier merging with default shell
|
||||
shells = {
|
||||
inherit default;
|
||||
nodejs = node-sh;
|
||||
|
||||
# for calling clojure targets in CI or Makefile
|
||||
clojure = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ clojure flock maven nodejs openjdk ];
|
||||
clojure = mkShell {
|
||||
buildInputs = with pkgs; [ clojure flock maven openjdk ];
|
||||
inputsFrom = [ node-sh ];
|
||||
};
|
||||
|
||||
# for 'make watchman-clean'
|
||||
watchman = pkgs.mkShell {
|
||||
buildInputs = [ pkgs.watchman ];
|
||||
watchman = mkShell {
|
||||
buildInputs = with pkgs; [ watchman ];
|
||||
};
|
||||
|
||||
# for running fastlane commands alone
|
||||
fastlane = targets.mobile.fastlane.shell;
|
||||
|
||||
# for running gradle by hand
|
||||
gradle = mkShell {
|
||||
buildInputs = with pkgs; [ gradle maven ];
|
||||
inputsFrom = [ node-sh ];
|
||||
shellHook = ''
|
||||
export STATUS_GO_ANDROID_LIBDIR="DUMMY"
|
||||
export ANDROID_SDK_ROOT="${pkgs.androidPkgs}"
|
||||
export ANDROID_NDK_ROOT="${pkgs.androidPkgs}/ndk-bundle"
|
||||
'';
|
||||
};
|
||||
|
||||
# for 'scripts/generate-keystore.sh'
|
||||
keytool = pkgs.mkShell {
|
||||
buildInputs = [ pkgs.openjdk8 ];
|
||||
keytool = mkShell {
|
||||
buildInputs = with pkgs; [ openjdk8 ];
|
||||
};
|
||||
|
||||
# for targets that need 'adb' and other SDK/NDK tools
|
||||
|
@ -82,4 +103,6 @@ let
|
|||
|
||||
# values here can be selected using `nix-shell --attr shells.$TARGET default.nix`
|
||||
# the nix/scripts/shell.sh wrapper does this for us and expects TARGET to be set
|
||||
in lib.mapAttrs mergeDefaultShell shells
|
||||
in {
|
||||
inherit default;
|
||||
} // lib.mapAttrs mergeDefaultShell shells
|
||||
|
|
Loading…
Reference in New Issue