Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try a better prod binary name #146

Merged
merged 3 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# 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
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}}

Expand Down Expand Up @@ -42,20 +55,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 rescript-editor-analysis.exe ${{matrix.artifact-folder}}
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
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
8 changes: 5 additions & 3 deletions analysis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion analysis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions analysis/src/Cli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,45 @@ 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.

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 () =
Expand Down
2 changes: 1 addition & 1 deletion analysis/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion server/analysis_binaries/README.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 3 additions & 2 deletions server/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down