Skip to content

Commit fb1400a

Browse files
authored
Try a better prod binary name (#146)
* Try a better prod binary name This is so that in activity monitor and other places, they look idiomatic and debuggable * Unify with dev binary name * Provide link to the matrix merge semantic and syntax
1 parent a1074e1 commit fb1400a

File tree

8 files changed

+49
-34
lines changed

8 files changed

+49
-34
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [macos-latest, ubuntu-latest, windows-latest]
15+
# syntax explanation:
16+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations
17+
include:
18+
- os: macos-latest
19+
build: eval $(opam env) && cd analysis && make test
20+
artifact-folder: darwin
21+
- os: ubuntu-latest
22+
build: eval $(opam env) && cd analysis && make test
23+
artifact-folder: linux
24+
- os: windows-latest
25+
# CI windows running the binary somehow stucks. Not sure why. Disable for now.
26+
build: "cd analysis && & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make"
27+
artifact-folder: win32
1528

1629
runs-on: ${{matrix.os}}
1730

@@ -42,20 +55,19 @@ jobs:
4255
# - run: opam pin add rescript-editor-support.dev . --no-action
4356
# - run: opam install . --deps-only --with-doc --with-test
4457

45-
- run: eval $(opam env) && cd analysis && make test
46-
if: matrix.os != 'windows-latest'
47-
# CI windows running the binary somehow stucks. Not sure why. Disable for now.
48-
- run: "cd analysis && & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make"
49-
if: matrix.os == 'windows-latest'
58+
- name: Build and test
59+
run: ${{matrix.build}}
5060

5161
# Also avoids artifacts upload permission loss:
5262
# https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss
5363
- name: Compress files
54-
run: >
55-
mv analysis/run.exe ${{matrix.os}}-run.exe &&
56-
tar -cvf binary.tar ${{matrix.os}}-run.exe
64+
run: |
65+
cd analysis
66+
mkdir ${{matrix.artifact-folder}}
67+
mv rescript-editor-analysis.exe ${{matrix.artifact-folder}}
68+
tar -cvf binary.tar ${{matrix.artifact-folder}}
5769
5870
- uses: actions/upload-artifact@v2
5971
with:
60-
name: ${{matrix.os}}-run.exe
61-
path: binary.tar
72+
name: ${{matrix.os}}
73+
path: analysis/binary.tar

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Thanks for your interest. Below is an informal spec of how the plugin's server c
1111
│ └── extension.ts // Language Client entry point
1212
├── analysis // Native binary powering hover, autocomplete, etc.
1313
│ ├── src
14-
│ └── run.exe // Dev-time analysis binary
14+
│ └── rescript-editor-analysis.exe // Dev-time analysis binary
1515
├── package.json // The extension manifest
1616
└── server // Language Server. Usable standalone
1717
├── src
@@ -164,6 +164,6 @@ Currently the release is vetted and done by @chenglou.
164164

165165
- Bump the version properly in `package.json` and `server/package.json` and their lockfiles and make a new commit.
166166
- Make sure @ryyppy is aware of your changes. He needs to sync them over to the vim plugin.
167-
- 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`.
167+
- Download and unzip the 3 platforms' production binaries from the Github CI. Put them into `server/analysis_binaries`.
168168
- 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.
169169
- 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.

analysis/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ OCAMLOPT = ocamlopt.opt
66
OCAMLFLAGS = -g -w +26+27+32+33+39 -bin-annot -I +compiler-libs $(INCLUDES)
77
OCAMLDEP = ocamldep.opt
88

9+
OUTPUT = rescript-editor-analysis.exe
10+
911
%.cmi : %.mli
1012
@echo Building $@
1113
@$(OCAMLOPT) $(OCAMLFLAGS) -c $<
@@ -19,13 +21,13 @@ depend:
1921

2022
SOURCE_FILES = $(shell $(OCAMLDEP) -sort `find src -name "*.ml"` | sed -E "s/\.ml/.cmx/g")
2123

22-
run.exe: $(SOURCE_FILES)
24+
$(OUTPUT): $(SOURCE_FILES)
2325
@echo Linking...
24-
@$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o run.exe \
26+
@$(OCAMLOPT) $(OCAMLFLAGS) -O2 -o $(OUTPUT) \
2527
-I +compiler-libs unix.cmxa str.cmxa ocamlcommon.cmxa $(INCLUDES) $(SOURCE_FILES)
2628
@echo Done!
2729

28-
build-native: run.exe depend
30+
build-native: $(OUTPUT) depend
2931

3032
dce: build-native
3133
../node_modules/.bin/reanalyze -dce-cmt src -suppress src/vendor

analysis/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ See main CONTRIBUTING.md's repo structure. Additionally, `examples/` is a conven
1313
## Usage
1414

1515
```sh
16-
./run.exe --help
16+
./rescript-editor-analysis.exe --help
1717
```
1818

1919
## History

analysis/src/Cli.ml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,45 @@ let help =
33
**Private CLI For rescript-vscode usage only**
44

55
Examples:
6-
./run.exe complete src/MyFile.res 0 4 currentContent.res
7-
./run.exe definition src/MyFile.res 9 3
8-
./run.exe dump src/MyFile.res src/MyFile2.res
9-
./run.exe documentSymbol src/Foo.res
10-
./run.exe hover src/MyFile.res 10 2
11-
./run.exe references src/MyFile.res 10 2
12-
./run.exe test src/MyFile.res
6+
./rescript-editor-analysis.exe complete src/MyFile.res 0 4 currentContent.res
7+
./rescript-editor-analysis.exe definition src/MyFile.res 9 3
8+
./rescript-editor-analysis.exe dump src/MyFile.res src/MyFile2.res
9+
./rescript-editor-analysis.exe documentSymbol src/Foo.res
10+
./rescript-editor-analysis.exe hover src/MyFile.res 10 2
11+
./rescript-editor-analysis.exe references src/MyFile.res 10 2
12+
./rescript-editor-analysis.exe test src/MyFile.res
1313

1414
Note: coordinates are zero-based, so the first position is 0 0.
1515

1616
Options:
1717
complete: compute autocomplete for MyFile.res at line 0 and column 4,
1818
where MyFile.res is being edited and the editor content is in file current.res.
1919

20-
./run.exe complete src/MyFile.res 0 4 current.res
20+
./rescript-editor-analysis.exe complete src/MyFile.res 0 4 current.res
2121

2222
definition: get definition for item in MyFile.res at line 10 column 2:
2323

24-
./run.exe definition src/MyFile.res 10 2
24+
./rescript-editor-analysis.exe definition src/MyFile.res 10 2
2525

2626
dump: for debugging, show all definitions and hovers for MyFile.res and MyFile.res:
2727

28-
./run.exe dump src/Foo.res src/MyFile.res
28+
./rescript-editor-analysis.exe dump src/Foo.res src/MyFile.res
2929

3030
documentSymbol: get all symbols declared in MyFile.res
3131

32-
./run.exe documentSymbol src/MyFile.res
32+
./rescript-editor-analysis.exe documentSymbol src/MyFile.res
3333

3434
hover: get inferred type for MyFile.res at line 10 column 2:
3535

36-
./run.exe hover src/MyFile.res 10 2
36+
./rescript-editor-analysis.exe hover src/MyFile.res 10 2
3737

3838
references: get all references to item in MyFile.res at line 10 column 2:
3939

40-
./run.exe references src/MyFile.res 10 2
40+
./rescript-editor-analysis.exe references src/MyFile.res 10 2
4141

4242
test: run tests specified by special comments in file src/MyFile.res
4343

44-
./run.exe test src/src/MyFile.res
44+
./rescript-editor-analysis.exe test src/src/MyFile.res
4545
|}
4646

4747
let main () =

analysis/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function exp {
33
}
44

55
for file in tests/src/*.res[i]; do
6-
./run.exe test $file &> $(exp $file)
6+
./rescript-editor-analysis.exe test $file &> $(exp $file)
77
done
88

99
warningYellow='\033[0;33m'

server/analysis_binaries/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
We store the analysis production binaries here.
1+
Put the `linux`, `darwin` and `win32` folders unzipped from CI here. These are the production binaries.

server/src/constants.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ export let analysisDevPath = path.join(
2020
path.dirname(__dirname),
2121
"..",
2222
"analysis",
23-
"run.exe"
23+
"rescript-editor-analysis.exe"
2424
);
2525
export let analysisProdPath = path.join(
2626
path.dirname(__dirname),
2727
"analysis_binaries",
28-
process.platform + "-run.exe"
28+
process.platform,
29+
"rescript-editor-analysis.exe"
2930
);
3031

3132
// can't use the native bsb since we might need the watcher -w flag, which is only in the js wrapper

0 commit comments

Comments
 (0)