Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d8bdc1

Browse files
authored
Makefile improvements: playground (#7997)
* Makefile improvements: playground* Makefile: use cargo release mode when building in CI* Fix
1 parentb7e8c2f commit5d8bdc1

File tree

5 files changed

+46
-17
lines changed

5 files changed

+46
-17
lines changed

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ jobs:
294294
id:ninja-build-cache
295295
uses:actions/cache@v4
296296
with:
297-
path:packages/@rescript/${{matrix.node-target }}/bin/ninja.exe
298-
key:ninja-build-v1-${{ matrix.os }}-${{ hashFiles('ninja/src/**') }}
297+
path:ninja/ninja${{runner.os == 'Windows' && '.exe' || '' }}
298+
key:ninja-build-v2-${{ matrix.os }}-${{ hashFiles('ninja/src/**') }}
299299

300300
-name:Setup Python for ninja build
301301
if:steps.ninja-build-cache.outputs.cache-hit != 'true'
@@ -320,7 +320,6 @@ jobs:
320320
run:node scripts/buildNinjaBinary.js
321321

322322
-name:Copy ninja exe to platform bin dir
323-
if:steps.ninja-build-cache.outputs.cache-hit != 'true'
324323
run:node scripts/copyExes.js --ninja
325324

326325
-name:"Syntax: Run tests"
@@ -330,7 +329,7 @@ jobs:
330329
shell:bash
331330

332331
-name:Build @rescript/runtime
333-
run:yarn workspace @rescript/runtimerescriptbuild
332+
run:yarn workspace @rescript/runtime build
334333
shell:bash
335334

336335
-name:Check for changes in @rescript/runtime/lib
@@ -404,7 +403,7 @@ jobs:
404403

405404
-name:Build playground compiler
406405
if:matrix.build_playground
407-
run:opam exec -- make playground playground-cmijs
406+
run:opam exec -- make playground
408407

409408
-name:Test playground compiler
410409
if:matrix.build_playground

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*~
22
_build
3+
_build_playground
34
*.obj
45
*.out
56
*.compile

‎Makefile‎

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,22 @@ clean-ninja:
9595

9696
REWATCH_SOURCES =$(shell find rewatch/src -name '*.rs') rewatch/Cargo.toml rewatch/Cargo.lock rewatch/rust-toolchain.toml
9797
RESCRIPT_EXE =$(BIN_DIR)/rescript.exe
98+
ifdefCI
99+
REWATCH_PROFILE := release
100+
REWATCH_CARGO_FLAGS := --release
101+
else
102+
REWATCH_PROFILE := debug
103+
REWATCH_CARGO_FLAGS :=
104+
endif
105+
REWATCH_TARGET := rewatch/target/$(REWATCH_PROFILE)/rescript$(PLATFORM_EXE_EXT)
98106

99107
rewatch:$(RESCRIPT_EXE)
100108

101-
$(RESCRIPT_EXE):rewatch/target/debug/rescript$(PLATFORM_EXE_EXT)
109+
$(RESCRIPT_EXE):$(REWATCH_TARGET)
102110
$(call COPY_EXE,$<,$@)
103111

104-
rewatch/target/debug/rescript$(PLATFORM_EXE_EXT):$(REWATCH_SOURCES)
105-
cargo build --manifest-path rewatch/Cargo.toml
112+
$(REWATCH_TARGET):$(REWATCH_SOURCES)
113+
cargo build --manifest-path rewatch/Cargo.toml$(REWATCH_CARGO_FLAGS)
106114

107115
clean-rewatch:
108116
cargo clean --manifest-path rewatch/Cargo.toml&& rm -rf rewatch/target&& rm -f$(RESCRIPT_EXE)
@@ -182,27 +190,47 @@ test-rewatch: lib
182190

183191
test-all: test test-gentype test-analysis test-tools test-rewatch
184192

185-
# Builds the core playground bundle (without the relevant cmijs files for the runtime)
186-
playground: |$(YARN_INSTALL_STAMP)
187-
dune build --profile browser
188-
cp -f ./_build/default/compiler/jsoo/jsoo_playground_main.bc.js packages/playground/compiler.js
193+
# Playground
194+
195+
PLAYGROUND_BUILD_DIR := ./_build_playground
196+
PLAYGROUND_BUILD_STAMP :=$(PLAYGROUND_BUILD_DIR)/log# touched by dune on each build
197+
PLAYGROUND_COMPILER := packages/playground/compiler.js
198+
PLAYGROUND_CMI_BUILD_STAMP := packages/playground/.buildstamp# touched by playground npm build script
199+
200+
playground: playground-compiler playground-cmijs
201+
202+
playground-compiler:$(PLAYGROUND_COMPILER)
203+
204+
$(PLAYGROUND_COMPILER):$(PLAYGROUND_BUILD_STAMP)
205+
206+
$(PLAYGROUND_BUILD_STAMP):$(COMPILER_SOURCES)
207+
dune build --profile browser --build-dir$(PLAYGROUND_BUILD_DIR)
208+
cp -f$(PLAYGROUND_BUILD_DIR)/default/compiler/jsoo/jsoo_playground_main.bc.js$(PLAYGROUND_COMPILER)
189209

190210
# Creates all the relevant core and third party cmij files to side-load together with the playground bundle
191-
playground-cmijs: |$(YARN_INSTALL_STAMP)# should also depend on artifacts, but that causes an attempt to copy binaries for JSOO
211+
playground-cmijs:$(PLAYGROUND_CMI_BUILD_STAMP)
212+
213+
$(PLAYGROUND_CMI_BUILD_STAMP):$(RUNTIME_BUILD_STAMP)$(NINJA_EXE)
192214
yarn workspace playground build
193215

216+
playground-test: playground
217+
yarn workspace playgroundtest
218+
194219
# Builds the playground, runs some e2e tests and releases the playground to the
195220
# Cloudflare R2 (requires Rclone `rescript:` remote)
196-
playground-release: playground playground-cmijs |$(YARN_INSTALL_STAMP)
197-
yarn workspace playgroundtest
221+
playground-release: playground-test
198222
yarn workspace playground upload-bundle
199223

224+
# Format
225+
200226
format: |$(YARN_INSTALL_STAMP)
201227
./scripts/format.sh
202228

203229
checkformat: |$(YARN_INSTALL_STAMP)
204230
./scripts/format_check.sh
205231

232+
# Clean
233+
206234
clean-gentype:
207235
make -C tests/gentype_tests/typescript-react-example clean
208236
make -C tests/gentype_tests/stdlib-no-shims clean
@@ -216,4 +244,4 @@ dev-container:
216244

217245
.DEFAULT_GOAL := build
218246

219-
.PHONY: yarn-install build ninja rewatch compiler lib artifacts bench test test-analysis test-tools test-syntax test-syntax-roundtrip test-gentype test-rewatch test-all playground playground-cmijs playground-release format checkformat clean-ninja clean-rewatch clean-compiler clean-lib clean-gentype clean-tests clean dev-container
247+
.PHONY: yarn-install build ninja rewatch compiler lib artifacts bench test test-analysis test-tools test-syntax test-syntax-roundtrip test-gentype test-rewatch test-all playground playground-compiler playground-test playground-cmijs playground-release format checkformat clean-ninja clean-rewatch clean-compiler clean-lib clean-gentype clean-tests clean dev-container

‎packages/playground/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ yarn.lock
3434
/compiler.js
3535

3636
.tmp/
37+
.buildstamp

‎packages/playground/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"clean":"rescript clean",
77
"test":"node ./playground_test.cjs",
8-
"build":"rescript clean && rescript-legacy build && node scripts/generate_cmijs.mjs && rollup -c",
8+
"build":"rescript clean && rescript-legacy build && node scripts/generate_cmijs.mjs && rollup -c && touch .buildstamp",
99
"upload-bundle":"node scripts/upload_bundle.mjs",
1010
"serve-bundle":"node serve-bundle.mjs"
1111
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp