From 5f491380ed268c218835e9f26d9646c9458f1b7c Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Tue, 23 Jul 2019 08:19:48 +0200 Subject: [PATCH] nix: fix target OS for add-nix-gcroots.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- Makefile | 69 ++++++++++--------- ci/Jenkinsfile.android | 2 +- ci/Jenkinsfile.ios | 2 +- .../{add-gcroots.sh => add-nix-gcroots.sh} | 2 +- 4 files changed, 41 insertions(+), 34 deletions(-) rename scripts/{add-gcroots.sh => add-nix-gcroots.sh} (78%) diff --git a/Makefile b/Makefile index 9aa380aa7997..e6fc258c2dd3 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ -.PHONY: add-gcroots clean clean-nix disable-githooks react-native-android react-native-ios react-native-desktop test release _list _fix-perms +.PHONY: nix-add-gcroots clean nix-clean disable-githooks react-native-android react-native-ios react-native-desktop test release _list _fix-node-perms +help: SHELL := /bin/sh help: ##@other Show this help @perl -e '$(HELP_FUN)' $(MAKEFILE_LIST) @@ -39,56 +40,62 @@ else SHELL := ./nix/shell.sh endif -# Main targets +shell: ##@prepare Enter into a pre-configured shell +ifndef IN_NIX_SHELL + @ENTER_NIX_SHELL +else + @echo "${YELLOW}Nix shell is already active$(RESET)" +endif + +#---------------- +# General targets +#---------------- -_fix-perms: SHELL := /bin/sh -_fix-perms: ##@prepare Fix permissions so that directory can be cleaned +_fix-node-perms: SHELL := /bin/sh +_fix-node-perms: ##@prepare Fix permissions so that directory can be cleaned $(shell test -d node_modules && chmod -R 744 node_modules) $(shell test -d node_modules.tmp && chmod -R 744 node_modules.tmp) clean: SHELL := /bin/sh -clean: _fix-perms ##@prepare Remove all output folders +clean: _fix-node-perms ##@prepare Remove all output folders git clean -dxf -f watchman-clean: export _NIX_ATTR := targets.watchman.shell -watchman-clean: +watchman-clean: ##@prepare Delete repo directory from watchman watchman watch-del $${STATUS_REACT_HOME} -shell: ##@prepare Enter into a pre-configured shell -ifndef IN_NIX_SHELL - @ENTER_NIX_SHELL -else - @echo "${YELLOW}Nix shell is already active$(RESET)" -endif +disable-githooks: SHELL := /bin/sh +disable-githooks: ##@prepare Disables lein githooks + @rm -f ${env.WORKSPACE}/.git/hooks/pre-commit && \ + sed -i'~' -e 's|\[rasom/lein-githooks|;; [rasom/lein-githooks|' \ + -e 's|:githooks|;; :githooks|' \ + -e 's|:pre-commit|;; :pre-commit|' project.clj; \ + rm project.clj~ -add-gcroots: SHELL := /bin/sh -add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected - scripts/add-gcroots.sh +#---------------- +# Nix targets +#---------------- -clean-nix: SHELL := /bin/sh -clean-nix: ##@nix Remove complete nix setup +nix-clean: SHELL := /bin/sh +nix-clean: ##@nix Remove complete nix setup sudo rm -rf /nix ~/.nix-profile ~/.nix-defexpr ~/.nix-channels ~/.cache/nix ~/.status .nix-gcroots -update-npm-nix: SHELL := /bin/sh -update-npm-nix: ##@nix Update node2nix expressions based on current package.json +nix-add-gcroots: SHELL := /bin/sh +nix-add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected + scripts/add-nix-gcroots.sh + +nix-update-npm: SHELL := /bin/sh +nix-update-npm: ##@nix Update node2nix expressions based on current package.json nix/desktop/realm-node/generate-nix.sh -update-gradle-nix: SHELL := /bin/sh -update-gradle-nix: ##@nix Update maven nix expressions based on current gradle setup +nix-update-gradle: SHELL := /bin/sh +nix-update-gradle: ##@nix Update maven nix expressions based on current gradle setup nix/mobile/android/maven-and-npm-deps/maven/generate-nix.sh -update-lein-nix: SHELL := /bin/sh -update-lein-nix: ##@nix Update maven nix expressions based on current lein setup +nix-update-lein: SHELL := /bin/sh +nix-update-lein: ##@nix Update maven nix expressions based on current lein setup nix/tools/lein/generate-nix.sh nix/lein -disable-githooks: SHELL := /bin/sh -disable-githooks: - @rm -f ${env.WORKSPACE}/.git/hooks/pre-commit && \ - sed -i'~' -e 's|\[rasom/lein-githooks|;; [rasom/lein-githooks|' \ - -e 's|:githooks|;; :githooks|' \ - -e 's|:pre-commit|;; :pre-commit|' project.clj; \ - rm project.clj~ - #---------------- # Release builds #---------------- diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 4227ea96159b..575ec884df6c 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -122,6 +122,6 @@ pipeline { post { success { script { load('ci/github.groovy').notifyPR(true) } } failure { script { load('ci/github.groovy').notifyPR(false) } } - always { sh 'make _fix-perms' } + always { sh 'make _fix-node-perms' } } } diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 1a040aadacea..e8e7791a81ca 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -105,6 +105,6 @@ pipeline { post { success { script { load('ci/github.groovy').notifyPR(true) } } failure { script { load('ci/github.groovy').notifyPR(false) } } - always { sh 'make _fix-perms' } + always { sh 'make _fix-node-perms' } } } diff --git a/scripts/add-gcroots.sh b/scripts/add-nix-gcroots.sh similarity index 78% rename from scripts/add-gcroots.sh rename to scripts/add-nix-gcroots.sh index 95a5e2f649c6..0a551f617031 100755 --- a/scripts/add-gcroots.sh +++ b/scripts/add-nix-gcroots.sh @@ -9,6 +9,6 @@ GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) rm -rf .nix-gcroots mkdir .nix-gcroots -drv=$(nix-instantiate ${GIT_ROOT}/shell.nix) +drv=$(nix-instantiate --argstr target-os all --add-root ${GIT_ROOT}/shell.nix) refs=$(nix-store --query --references $drv) nix-store -r $refs --indirect --add-root $GIT_ROOT/.nix-gcroots/shell.dep