Skip to content

Commit bd43932

Browse files
committed
fix: 🐛 Reorder pxt package installation to avoid CI crash
1 parent defe4c6 commit bd43932

3 files changed

Lines changed: 41 additions & 11 deletions

File tree

Makefile

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,52 @@ prepare:
1616
git config core.hooksPath .hooks
1717

1818
.PHONY: setup
19-
setup: prepare clean $(PXT)
19+
setup: deepclean $(PXT) $(PXT_INSTALL_LIBRARIES) build-pxt-core
20+
@echo "Setup makecode-steami"
2021

2122
.PHONY : clean
2223
clean : ;@$(call _clean)
2324

25+
.PHONY : clean-pxt-core
26+
clean-pxt-core : ;@$(call _clean_pxt_core)
27+
28+
.PHONY : clean-pxt-common-packages
29+
clean-pxt-common-packages : ;@$(call _clean_pxt_common_packages)
30+
2431
.PHONY : clean-local-certificates
25-
clean-local-certificates:;@$(call _clean_pxt_steami_backend_certificates)
32+
clean-local-certificates : ;@$(call _clean_pxt_steami_backend_certificates)
2633

2734
.PHONY : deepclean
2835
deepclean : ;@$(call _deepclean)
2936

3037
# Create make rule for each PXT command
3138
$(foreach command,$(PXT_COMMANDS),$(eval $(call _call_pxt_command_template,$(command),$(command),$(PXT))))
3239

33-
# Create install rules for each node package
34-
$(eval $(call _install_node_package_template,makecode-steami,.))
40+
# Create install rules for each pxt package
3541
$(foreach target,$(PXT_LIBRARIES),$(eval $(call _install_node_package_template,$(target),$(target))))
3642

43+
.PHONY : install-makecode-steami
44+
install-makecode-steami: node_modules/.package-lock.json package-lock.json
45+
46+
node_modules/.package-lock.json package-lock.json:
47+
@$(call install_node_package,.)
48+
3749
# Install pxt CLI
38-
$(PXT) : | install-makecode-steami $(addprefix install-,$(PXT_LIBRARIES)) pxt/built/target.json
50+
$(PXT) : install-makecode-steami
51+
52+
.NOTPARALLEL : $(PXT) setup
3953

4054
# Build pxt cli
4155
pxt/built/target.json : pxt/node_modules/.package-lock.json
4256
@echo "Build pxt core"
43-
cd pxt || exit
44-
npm run build
57+
@$(call _build_pxt_core)
58+
59+
.PHONY : build-pxt-core
60+
build-pxt-core : install-pxt
61+
@echo "Building pxt core ..."
62+
$(call _build_pxt_core)
63+
@echo "pxt core built"
64+
4565

4666
# Create build rule by aliasing pxt buildtarget command
4767
.PHONY : build

commons.mk

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ define deepclean_node_package
2828

2929
endef
3030

31-
define _clean_static
31+
define _clean_pxt_static_build
3232
echo "Clean static build"
3333
$(call _remove_directory_if_exist,static)
3434

@@ -45,9 +45,12 @@ define _clean_pxt_steami
4545
fi
4646
else
4747
echo "pxt not found ! \n Manual cleanning"
48+
$(call _remove_directory_if_exist,pxt-steami/.pxt)
4849
$(call _remove_directory_if_exist,pxt-steami/built)
50+
$(call _remove_directory_if_exist,pxt-steami/projects)
4951
$(call _remove_directory_if_exist,pxt-steami/libs/core/built)
5052
$(call _remove_directory_if_exist,pxt-steami/libs/blocksprj/built)
53+
$(call _remove_directory_if_exist,pxt-steami/libs/tsprj/built)
5154
fi
5255

5356
endef
@@ -73,13 +76,13 @@ define _clean_pxt_steami_backend_certificates
7376
endef
7477

7578
define _clean
76-
$(call _clean_static)
79+
$(call _clean_pxt_static_build)
7780
$(call _clean_pxt_steami)
7881

7982
endef
8083

8184
define _clean_all
82-
$(call _clean_static)
85+
$(call _clean_pxt_static_build)
8386
$(call _clean_pxt_steami)
8487
$(call _clean_pxt_common_packages)
8588
$(call _clean_pxt_core)

pxt.mk

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PXT_LIBRARIES := pxt pxt-common-packages pxt-steami pxt-steami-backend
2+
PXT_INSTALL_LIBRARIES := $(addprefix install-,$(PXT_LIBRARIES))
23
PXT_COMMANDS := add buildcss buildjres buildsimjs buildsprites buildtarget bump checkdocs checkpkgcfg ci console deploy extract help init install npminstallnative run serve staticpkg tag testghpkgs update usedblocks
34
# Arguments par défaut pour chaque commande PXT
45
PXT_ADD_ARGS ?=
@@ -26,7 +27,7 @@ PXT_TESTGHPKGS_ARGS ?=
2627
PXT_UPDATE_ARGS ?=
2728
PXT_USEDBLOCKS_ARGS ?=
2829

29-
PXT="/workspaces/makecode-steami/node_modules/.bin/pxt"
30+
PXT="$(shell pwd)/node_modules/.bin/pxt"
3031

3132
define pxt_command
3233
echo "PXT = $(PXT)"
@@ -57,4 +58,10 @@ install-$1: $2/node_modules/.package-lock.json $2/package-lock.json
5758
$2/node_modules/.package-lock.json $2/package-lock.json: $2/package.json
5859
@$$(call install_node_package,$$(<D))
5960

61+
endef
62+
63+
define _build_pxt_core
64+
@echo "Build pxt core"
65+
cd pxt || exit
66+
npm run build
6067
endef

0 commit comments

Comments
 (0)