Skip to content

Commit 81a3dc6

Browse files
cknittcristianoc
authored andcommitted
Build the whole compiler with dune
1 parent 6e345ff commit 81a3dc6

File tree

166 files changed

+982
-688090
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+982
-688090
lines changed

.gitattributes

-4
This file was deleted.

.github/workflows/ci.yml

+40-42
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525

2626
env:
2727
OCAMLRUNPARAM: b
28+
DUNE_PROFILE: release
2829

2930
steps:
3031
- name: "Windows: Set git to use LF"
@@ -45,6 +46,22 @@ jobs:
4546
opam-pin: false
4647
opam-depext: false
4748

49+
- name: "Install OPAM dependencies"
50+
run: opam install . --deps-only
51+
52+
- name: "Build compiler"
53+
run: |
54+
opam exec -- dune build
55+
./scripts/copyExes.js
56+
57+
- name: Use Node.js
58+
uses: actions/setup-node@v3
59+
with:
60+
node-version: 16
61+
62+
- name: Install npm packages
63+
run: npm ci --ignore-scripts
64+
4865
- name: "Check if syntax subfolder has changed"
4966
id: syntax-diff
5067
shell: bash
@@ -55,25 +72,13 @@ jobs:
5572
echo "syntax_status=changed" >> $GITHUB_ENV
5673
fi
5774
58-
- name: "Syntax: install OPAM dependencies"
59-
if: env.syntax_status == 'changed'
60-
run: opam install . --deps-only
61-
working-directory: res_syntax
62-
63-
- name: "Syntax: build CLI"
64-
if: env.syntax_status == 'changed'
65-
run: opam exec -- dune build
66-
working-directory: res_syntax
67-
6875
- name: "Syntax: Run roundtrip tests"
6976
if: ${{ env.syntax_status == 'changed' && runner.os != 'Windows' }}
70-
run: opam exec -- make roundtrip-test
71-
working-directory: res_syntax
77+
run: opam exec -- make test-syntax-roundtrip
7278

7379
- name: "Syntax: Run tests (Windows)"
7480
if: ${{ env.syntax_status == 'changed' && runner.os == 'Windows' }}
75-
run: opam exec -- make test
76-
working-directory: res_syntax
81+
run: opam exec -- make test-syntax
7782

7883
# Required for ninja build
7984
- name: "Windows: Use MSVC"
@@ -85,26 +90,27 @@ jobs:
8590
- name: Build ninja
8691
run: node scripts/buildNinjaBinary.js
8792

88-
- name: Use Node.js
89-
uses: actions/setup-node@v3
90-
with:
91-
node-version: 16
93+
- name: Build runtime/stdlib
94+
if: runner.os != 'Windows'
95+
run: |
96+
opam exec -- dune exec -- node ./scripts/ninja.js config
97+
opam exec -- dune exec -- node ./scripts/ninja.js build
9298
93-
- name: NPM install
94-
run: opam exec -- npm ci
95-
env:
96-
RESCRIPT_FORCE_REBUILD: 1
99+
- name: Check for changes in lib folder
100+
run: git diff --exit-code lib/js lib/es6
97101

98102
- name: Run tests
99103
if: runner.os != 'Windows'
100-
run: opam exec -- node scripts/ciTest.js -all
104+
run: opam exec -- dune exec -- node scripts/ciTest.js -all
101105

102106
- name: Run tests (Windows)
103107
if: runner.os == 'Windows'
104-
run: opam exec -- node scripts/ciTest.js -mocha -theme -format
108+
run: opam exec -- dune exec -- node scripts/ciTest.js -mocha -theme -format
105109

106-
- name: Get artifact info
107-
run: node .github/workflows/get_artifact_info.js
110+
- name: Prepare artifact upload
111+
run: |
112+
./scripts/prebuilt.js
113+
node .github/workflows/get_artifact_info.js
108114
109115
- name: "Upload artifacts: binaries"
110116
uses: actions/upload-artifact@v3
@@ -119,19 +125,14 @@ jobs:
119125
name: lib-ocaml
120126
path: lib/ocaml
121127

122-
# Important: the ninja build must run after the artifact upload because for some reason
123-
# the bsc.exe created by the ninja build does not find the Pervasives module.
124-
# So this is run here just to test the normal dev workflow, too.
125-
- name: ninja config
126-
if: runner.os != 'Windows'
127-
run: opam exec -- node ./scripts/ninja.js config
128-
129-
- name: ninja build
130-
if: runner.os != 'Windows'
131-
run: opam exec -- node ./scripts/ninja.js build
132-
133-
- name: Check for changes in lib folder
134-
run: git diff --exit-code lib/js lib/es6
128+
- name: "Upload artifacts: cmi cache"
129+
if: runner.os == 'Linux'
130+
uses: actions/upload-artifact@v3
131+
with:
132+
name: cmij-cache
133+
path: |
134+
lib/cmi_cache.bin
135+
lib/cmj_cache.bin
135136
136137
package:
137138
needs: build
@@ -157,9 +158,6 @@ jobs:
157158
- name: Move artifacts
158159
run: ./scripts/moveArtifacts.sh
159160

160-
- name: Create ninja.tar.gz
161-
run: git -C ninja archive --format=tar.gz HEAD -o ../vendor/ninja.tar.gz
162-
163161
- name: Check artifact list
164162
run: node ./scripts/makeArtifactList.js -check
165163

.github/workflows/get_artifact_info.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
const fs = require("fs");
22
const os = require("os");
33

4-
const artifactPath =
5-
process.platform === "darwin" && process.arch === "arm64"
6-
? process.platform + process.arch
7-
: process.platform;
8-
4+
const artifactPath = require("../../scripts/bin_path").dirName;
95
const artifactName = "binaries-" + artifactPath;
106

7+
console.log("Artifact path:", artifactPath);
8+
119
// Pass artifactPath and artifactName to subsequent GitHub actions
1210
fs.appendFileSync(
1311
process.env.GITHUB_ENV,

.gitignore

+2-59
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,12 @@ _build
4545
.DS_Store
4646

4747
node_modules
48-
oxml
49-
test.json
50-
jscomp/pre_load.js
51-
boot
5248
*.dump
5349
coverage
54-
*.g.js
55-
ppx_tools/
56-
vendor/ocaml/stdlib/target_camlheader
57-
vendor/ocaml/stdlib/target_camlheaderd
58-
man/
59-
lib/ocaml
60-
*.tgz
61-
bin/*
62-
jscomp/bin/*.exe
63-
64-
# for npm publish
6550
*.exe
6651

67-
!bin/bspack
68-
!/bin/bsb
69-
!/bin/bsc
70-
71-
# This is intentional
72-
# so that `npm install && npm intall -g .`
73-
# the second install would use the cached ninja.exe (instead of being ignored)
74-
#
75-
#ninja
7652
.ninja_log
77-
.ninja_deps
7853
.bsdeps
79-
.bs_dir_cache
80-
8154
.bsbuild
8255
lib/prebuilt.ninja
8356
lib/release.ninja
@@ -96,50 +69,20 @@ jscomp/cppoVendor.ninja
9669
jscomp/cppoEnv.ninja
9770
jscomp/bin/bsb
9871
jscomp/bin/bsc
72+
lib/ocaml
9973
lib/bs
10074
lib/js/jscomp/test
10175
jscomp/build_tests/*/lib/
10276
#ignore temporary directory
10377
*.goog.js
10478
*.jsoo.js
10579
*.so
106-
bin/ninja.exe
10780
tmp/
108-
jscomp/ext/hash_set.ml
109-
jscomp/ext/hash_set_poly.ml
110-
jscomp/ext/hash.ml
111-
jscomp/ext/hash_set_ident.ml
112-
jscomp/ext/hash_ident.ml
113-
jscomp/ext/map_ident.ml
114-
jscomp/ext/set_ident.ml
115-
jscomp/ext/hash_set_int.ml
116-
jscomp/ext/hash_int.ml
117-
jscomp/ext/map_int.ml
118-
jscomp/ext/vec_int.ml
119-
jscomp/ext/ordered_hash_map_local_ident.ml
120-
jscomp/ext/ordered_hash_set_string.ml
121-
jscomp/ext/vec.ml
122-
jscomp/ext/set_int.ml
123-
jscomp/ext/hash_set_string.ml
124-
jscomp/ext/hash_string.ml
125-
jscomp/ext/map_string.ml
126-
jscomp/ext/set_string.ml
127-
jscomp/ext/ext_json_parse.ml
128-
jscomp/syntax/reactjs_jsx_ppx_v2.ml
129-
jscomp/syntax/reactjs_jsx_ppx_v3.ml
130-
jscomp/bin/all_ounit_tests.ml
131-
native/
132-
vendor/ocaml
13381
jscomp/.lsp
134-
.vscode/launch.json
13582
tracing*.json
136-
darwin/bsc
13783
.nyc_output
138-
themes
84+
.vscode/launch.json
13985
.vscode/settings.json
140-
*.output # yacc output
141-
jscomp/ml/parser.output
142-
jscomp/ml/lexer.ml
14386

14487
# opam local switch is stored in `_opam` folder
14588
_opam
File renamed without changes.

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ lib/
33
vendor/
44
ninja/
55
res_syntax/
6+
_build/
67
_opam
78
CHANGELOG.md
89
README.md

0 commit comments

Comments
 (0)