From 2a65409d38a82404065df1be35f17fc473d7df3b Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Mon, 26 Apr 2021 05:36:14 -0700 Subject: [PATCH 1/3] Try a better prod binary name This is so that in activity monitor and other places, they look idiomatic and debuggable --- .github/workflows/ci.yml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80219cba0..72ac7c6c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,18 @@ jobs: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] + # weird syntax + include: + - os: macos-latest + build: eval $(opam env) && cd analysis && make test + artifact-folder: darwin + - os: ubuntu-latest + build: eval $(opam env) && cd analysis && make test + artifact-folder: linux + - os: windows-latest + # CI windows running the binary somehow stucks. Not sure why. Disable for now. + build: "cd analysis && & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make" + artifact-folder: win32 runs-on: ${{matrix.os}} @@ -42,20 +54,19 @@ jobs: # - run: opam pin add rescript-editor-support.dev . --no-action # - run: opam install . --deps-only --with-doc --with-test - - run: eval $(opam env) && cd analysis && make test - if: matrix.os != 'windows-latest' - # CI windows running the binary somehow stucks. Not sure why. Disable for now. - - run: "cd analysis && & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make" - if: matrix.os == 'windows-latest' + - name: Build and test + run: ${{matrix.build}} # Also avoids artifacts upload permission loss: # https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss - name: Compress files - run: > - mv analysis/run.exe ${{matrix.os}}-run.exe && - tar -cvf binary.tar ${{matrix.os}}-run.exe + run: | + cd analysis + mkdir ${{matrix.artifact-folder}} + mv run.exe ${{matrix.artifact-folder}}/rescript-editor-analysis.exe + tar -cvf binary.tar ${{matrix.artifact-folder}} - uses: actions/upload-artifact@v2 with: - name: ${{matrix.os}}-run.exe - path: binary.tar + name: ${{matrix.os}} + path: analysis/binary.tar From d01d1e4a851bb9182010ae11d0a4b54f2e6a634c Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Mon, 26 Apr 2021 07:03:07 -0700 Subject: [PATCH 2/3] Unify with dev binary name --- .github/workflows/ci.yml | 2 +- CONTRIBUTING.md | 4 ++-- analysis/Makefile | 8 +++++--- analysis/README.md | 2 +- analysis/src/Cli.ml | 28 ++++++++++++++-------------- analysis/test.sh | 2 +- server/analysis_binaries/README.md | 2 +- server/src/constants.ts | 5 +++-- 8 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72ac7c6c3..5fb991a82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: run: | cd analysis mkdir ${{matrix.artifact-folder}} - mv run.exe ${{matrix.artifact-folder}}/rescript-editor-analysis.exe + mv rescript-editor-analysis.exe ${{matrix.artifact-folder}} tar -cvf binary.tar ${{matrix.artifact-folder}} - uses: actions/upload-artifact@v2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5dee74953..6a6aee07b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ Thanks for your interest. Below is an informal spec of how the plugin's server c │ └── extension.ts // Language Client entry point ├── analysis // Native binary powering hover, autocomplete, etc. │ ├── src -│ └── run.exe // Dev-time analysis binary +│ └── rescript-editor-analysis.exe // Dev-time analysis binary ├── package.json // The extension manifest └── server // Language Server. Usable standalone ├── src @@ -164,6 +164,6 @@ Currently the release is vetted and done by @chenglou. - Bump the version properly in `package.json` and `server/package.json` and their lockfiles and make a new commit. - Make sure @ryyppy is aware of your changes. He needs to sync them over to the vim plugin. -- Download and unzip the 3 platforms' production binaries from the Github CI. Put them into `server/analysis_binaries`. Name them `darwin-run.exe`, `linux-run.exe` and `win32-run.exe`. +- Download and unzip the 3 platforms' production binaries from the Github CI. Put them into `server/analysis_binaries`. - Use `vsce publish` to publish. Official VSCode guide [here](https://code.visualstudio.com/api/working-with-extensions/publishing-extension). Only @chenglou has the publishing rights right now. - Not done! Make a new manual release [here](https://github.com/rescript-lang/rescript-vscode/releases); use `vsce package` to package up a standalone `.vsix` plugin and attach it onto that new release. This is for folks who don't use the VSCode marketplace. diff --git a/analysis/Makefile b/analysis/Makefile index e172ab3a3..91dcc18ca 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -6,6 +6,8 @@ OCAMLOPT = ocamlopt.opt OCAMLFLAGS = -g -w +26+27+32+33+39 -bin-annot -I +compiler-libs $(INCLUDES) OCAMLDEP = ocamldep.opt +OUTPUT = rescript-editor-analysis.exe + %.cmi : %.mli @echo Building $@ @$(OCAMLOPT) $(OCAMLFLAGS) -c $< @@ -19,13 +21,13 @@ depend: SOURCE_FILES = $(shell $(OCAMLDEP) -sort `find src -name "*.ml"` | sed -E "s/\.ml/.cmx/g") -run.exe: $(SOURCE_FILES) +$(OUTPUT): $(SOURCE_FILES) @echo Linking... - @$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o run.exe \ + @$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o $(OUTPUT) \ -I +compiler-libs unix.cmxa str.cmxa ocamlcommon.cmxa $(INCLUDES) $(SOURCE_FILES) @echo Done! -build-native: run.exe depend +build-native: $(OUTPUT) depend dce: build-native ../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor diff --git a/analysis/README.md b/analysis/README.md index 9817082d9..73e453e26 100644 --- a/analysis/README.md +++ b/analysis/README.md @@ -13,7 +13,7 @@ See main CONTRIBUTING.md's repo structure. Additionally, `examples/` is a conven ## Usage ```sh -./run.exe --help +./rescript-editor-analysis.exe --help ``` ## History diff --git a/analysis/src/Cli.ml b/analysis/src/Cli.ml index c79f95737..7095efc64 100644 --- a/analysis/src/Cli.ml +++ b/analysis/src/Cli.ml @@ -3,13 +3,13 @@ let help = **Private CLI For rescript-vscode usage only** Examples: - ./run.exe complete src/MyFile.res 0 4 currentContent.res - ./run.exe definition src/MyFile.res 9 3 - ./run.exe dump src/MyFile.res src/MyFile2.res - ./run.exe documentSymbol src/Foo.res - ./run.exe hover src/MyFile.res 10 2 - ./run.exe references src/MyFile.res 10 2 - ./run.exe test src/MyFile.res + ./rescript-editor-analysis.exe complete src/MyFile.res 0 4 currentContent.res + ./rescript-editor-analysis.exe definition src/MyFile.res 9 3 + ./rescript-editor-analysis.exe dump src/MyFile.res src/MyFile2.res + ./rescript-editor-analysis.exe documentSymbol src/Foo.res + ./rescript-editor-analysis.exe hover src/MyFile.res 10 2 + ./rescript-editor-analysis.exe references src/MyFile.res 10 2 + ./rescript-editor-analysis.exe test src/MyFile.res Note: coordinates are zero-based, so the first position is 0 0. @@ -17,31 +17,31 @@ Options: complete: compute autocomplete for MyFile.res at line 0 and column 4, where MyFile.res is being edited and the editor content is in file current.res. - ./run.exe complete src/MyFile.res 0 4 current.res + ./rescript-editor-analysis.exe complete src/MyFile.res 0 4 current.res definition: get definition for item in MyFile.res at line 10 column 2: - ./run.exe definition src/MyFile.res 10 2 + ./rescript-editor-analysis.exe definition src/MyFile.res 10 2 dump: for debugging, show all definitions and hovers for MyFile.res and MyFile.res: - ./run.exe dump src/Foo.res src/MyFile.res + ./rescript-editor-analysis.exe dump src/Foo.res src/MyFile.res documentSymbol: get all symbols declared in MyFile.res - ./run.exe documentSymbol src/MyFile.res + ./rescript-editor-analysis.exe documentSymbol src/MyFile.res hover: get inferred type for MyFile.res at line 10 column 2: - ./run.exe hover src/MyFile.res 10 2 + ./rescript-editor-analysis.exe hover src/MyFile.res 10 2 references: get all references to item in MyFile.res at line 10 column 2: - ./run.exe references src/MyFile.res 10 2 + ./rescript-editor-analysis.exe references src/MyFile.res 10 2 test: run tests specified by special comments in file src/MyFile.res - ./run.exe test src/src/MyFile.res + ./rescript-editor-analysis.exe test src/src/MyFile.res |} let main () = diff --git a/analysis/test.sh b/analysis/test.sh index f913f8158..96683edc3 100755 --- a/analysis/test.sh +++ b/analysis/test.sh @@ -3,7 +3,7 @@ function exp { } for file in tests/src/*.res[i]; do - ./run.exe test $file &> $(exp $file) + ./rescript-editor-analysis.exe test $file &> $(exp $file) done warningYellow='\033[0;33m' diff --git a/server/analysis_binaries/README.md b/server/analysis_binaries/README.md index 446d9f444..cf21cf272 100644 --- a/server/analysis_binaries/README.md +++ b/server/analysis_binaries/README.md @@ -1 +1 @@ -We store the analysis production binaries here. +Put the `linux`, `darwin` and `win32` folders unzipped from CI here. These are the production binaries. diff --git a/server/src/constants.ts b/server/src/constants.ts index e694e3ff3..a7469b0b2 100644 --- a/server/src/constants.ts +++ b/server/src/constants.ts @@ -20,12 +20,13 @@ export let analysisDevPath = path.join( path.dirname(__dirname), "..", "analysis", - "run.exe" + "rescript-editor-analysis.exe" ); export let analysisProdPath = path.join( path.dirname(__dirname), "analysis_binaries", - process.platform + "-run.exe" + process.platform, + "rescript-editor-analysis.exe" ); // can't use the native bsb since we might need the watcher -w flag, which is only in the js wrapper From e8978d62ff4ee2b01868776d2ab98192e95030c6 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Mon, 26 Apr 2021 21:38:31 -0700 Subject: [PATCH 3/3] Provide link to the matrix merge semantic and syntax --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fb991a82..9fe3857ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,8 @@ jobs: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] - # weird syntax + # syntax explanation: + # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations include: - os: macos-latest build: eval $(opam env) && cd analysis && make test