From 2ac0630ef8884a1f13467b72ca4287823aa4ba30 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 | 73 ++++++++++--------- ci/Jenkinsfile.android | 2 +- ci/Jenkinsfile.ios | 2 +- .../{add-gcroots.sh => add-nix-gcroots.sh} | 2 +- 4 files changed, 43 insertions(+), 36 deletions(-) rename scripts/{add-gcroots.sh => add-nix-gcroots.sh} (78%) diff --git a/Makefile b/Makefile index 9aa380aa79..e6fc258c2d 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,21 +40,6 @@ else SHELL := ./nix/shell.sh endif -# Main targets - -_fix-perms: SHELL := /bin/sh -_fix-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 - git clean -dxf -f - -watchman-clean: export _NIX_ATTR := targets.watchman.shell -watchman-clean: - watchman watch-del $${STATUS_REACT_HOME} - shell: ##@prepare Enter into a pre-configured shell ifndef IN_NIX_SHELL @ENTER_NIX_SHELL @@ -61,34 +47,55 @@ else @echo "${YELLOW}Nix shell is already active$(RESET)" endif -add-gcroots: SHELL := /bin/sh -add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being garbage collected - scripts/add-gcroots.sh +#---------------- +# General targets +#---------------- -clean-nix: SHELL := /bin/sh -clean-nix: ##@nix Remove complete nix setup - sudo rm -rf /nix ~/.nix-profile ~/.nix-defexpr ~/.nix-channels ~/.cache/nix ~/.status .nix-gcroots +_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) -update-npm-nix: SHELL := /bin/sh -update-npm-nix: ##@nix Update node2nix expressions based on current package.json - nix/desktop/realm-node/generate-nix.sh +clean: SHELL := /bin/sh +clean: _fix-node-perms ##@prepare Remove all output folders + git clean -dxf -f -update-gradle-nix: SHELL := /bin/sh -update-gradle-nix: ##@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/tools/lein/generate-nix.sh nix/lein +watchman-clean: export _NIX_ATTR := targets.watchman.shell +watchman-clean: ##@prepare Delete repo directory from watchman + watchman watch-del $${STATUS_REACT_HOME} disable-githooks: SHELL := /bin/sh -disable-githooks: +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~ +#---------------- +# Nix targets +#---------------- + +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 + +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 + +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 + +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 + #---------------- # Release builds #---------------- diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 4227ea9615..575ec884df 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 1a040aadac..e8e7791a81 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 95a5e2f649..0a551f6170 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