Skip to content

Commit

Permalink
Merge pull request #32 from lefessan/z-2023-09-29-fix-vsix-build
Browse files Browse the repository at this point in the history
Some improvements in the generation of VSIX
  • Loading branch information
lefessan authored Sep 29, 2023
2 parents f0c945a + 9d96fa3 commit 8215ad4
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 3,930 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _build
/_opam
/_build
.drom.config
/dist
/_dist
/node_modules
/yarn-error.log
/yarn.lock
Expand All @@ -28,5 +28,6 @@ ATTIC
*.vsix
*.opam.locked
/emacs/lsp-superbol-customs.el
/_out


4 changes: 2 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
**
!assets/
!dist/
!_dist/
!languages/
!snippets/
!syntaxes/
!README.md
!CHANGELOG.md
!LICENSE
!LICENSE.md
!package.json
!astexplorer/dist/index.html
57 changes: 48 additions & 9 deletions Makefile.header
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,71 @@ LSP_MODE_SRCDIR ?= ../lsp-mode
all: superbol-free
superbol-free: build
$(CP) _build/default/src/lsp/superbol-free/main.exe superbol-free
cp -f package.json package.json.prev
./superbol-free json vscode --gen package.json
diff -u package.json.prev package.json && rm -f package.json.prev

.PHONY: compile
compile: build
yarn esbuild _build/default/$(SRCDIR)/$(PROJECT).bc.js \
.PHONY: build-debug yarn-debug

build-debug:
opam exec -- dune build $(SRCDIR)/$(PROJECT).bc.js --profile=release
mkdir -p _out
$(CP) _build/default/$(SRCDIR)/$(PROJECT).bc.js _out/
$(MAKE) yarn-debug

# Use 'make build-debug' before to copy the JS file in _out/
yarn-debug:
yarn esbuild _out/$(PROJECT).bc.js \
--bundle \
--external:vscode \
--outdir=dist \
--outdir=_dist \
--platform=node \
--target=es6 \
--sourcemap
# the last command generated dist/$(PROJECT).bs.js
# the last command generated _dist/$(PROJECT).bs.js

.PHONY: compile-release
compile-release:
.PHONY: build-release yarn-release

build-release:
opam exec -- dune build $(SRCDIR)/$(PROJECT).bc.js --profile=release
yarn esbuild _build/default/$(SRCDIR)/$(PROJECT).bc.js \
mkdir -p _out
$(CP) _build/default/$(SRCDIR)/$(PROJECT).bc.js _out/
$(MAKE) yarn-release

# Use 'make build-release' before to copy the JS file in _out/
yarn-release:
yarn esbuild _out/$(PROJECT).bc.js \
--bundle \
--external:vscode \
--outdir=dist \
--outdir=_dist \
--platform=node \
--target=es6 \
--minify-whitespace \
--minify-syntax \
--sourcemap \
--sources-content=false

.PHONY: vsix-package vsix-debug vsix-release deploy-vsce deploy-ovsx vsix-step

vsix-debug: build-debug
$(MAKE) vsix-package

vsix-release: build-release
$(MAKE) vsix-package

vsix-clean: clean
rm -rf _out _dist *.vsix

# need 'make build-debug' or 'make build-release' before
vsix-package:
vsce package --out superbol-vscode-platform.vsix --yarn

deploy-vsce:
vsce publish --packagePath superbol-vscode-platform.vsix --yarn

deploy-ovsx:
ovsx publish --yarn

.PHONY: clean-execs
distclean: clean-execs
clean-execs:
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ yarn install

Finally build the extension with:
```bash
drom build
make compile
yarn package
make vsix-debug
```

### Add the extension to VSCode
Expand Down
162 changes: 79 additions & 83 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,39 @@
{
"name": "superbol",
"displayName": "Superbol COBOL",
"description": "Provides a COBOL mode in VSCode based on Superbol",
"license": "MIT",
"version": "0.1.0",
"publisher": "ocamlpro",
"repository": {
"type": "git",
"url": "https://github.com/OCamlPro/superbol-vscode-platform"
},
"homepage": "https://ocamlpro.com/cobol",
"author": {
"name": "OCamlPro SAS",
"email": "[email protected]"
},
"keywords": [
"cobol",
"gnucobol"
],
"engines": {
"vscode": "^1.64.0"
},
"categories": [
"Formatters",
"Programming Languages",
"Linters",
"Snippets",
"Other"
],
"activationEvents": [
"onLanguage:cobol",
"onDebug"
],
"contributes": {
"languages": [
"breakpoints": [
{
"id": "cobol",
"aliases": [
"COBOL"
],
"filenamePatterns": [
"*.cbl",
"*.cob"
]
"language": "COBOL"
}
],
"configuration": {
"title": "Superbol COBOL",
"properties": {
"superbol.globalFormatTakesSelection": {
"type": "boolean",
"default": false,
"description": "If something is selected, only format the selection"
},
"superbol.path": {
"default": "",
"description": "Path to the `superbol` command"
}
}
},
"debuggers": [
{
"type": "cobol",
"label": "GnuCOBOL Debugger",
"program": "gdb",
"languages": [
"cobol"
],
"program": "gdb",
"args": [
"--init-eval-command=\"source /usr/local/bin/cobcd.py\""
],
"configurationAttributes": {
"launch": {
"type": "cobol",
Expand Down Expand Up @@ -83,57 +62,66 @@
]
}
],
"breakpoints": [
"languages": [
{
"language": "COBOL"
"id": "cobol",
"aliases": [
"COBOL"
],
"filenamePatterns": [
"*.cbl",
"*.cob"
]
}
],
"configuration": {
"title": "Superbol COBOL",
"properties": {
"superbol.globalFormatTakesSelection": {
"type": "boolean",
"default": false,
"description": "If something is selected, only format the selection"
},
"superbol.path": {
"type": "string",
"default": "",
"description": "Path to the `superbol` command"
}
}
},
"taskDefinitions": [
{
"type": "superbol",
"properties": {
"copybooks": {
"type": "array",
"description": "The list of copybooks paths"
},
"sourceFormat": {
"type": "string",
"description": "The source format of the code"
},
"dialect": {
"type": "string",
"description": "The COBOL dialect used"
},
"forDebugging": {
"type": "boolean",
"description": "Build for debugging"
},
"extensions": {
"type": "array",
"description": "Add cobol file extensions"
}
}
{
"type": "superbol",
"properties": {
"copybooks": {
"type": "array",
"description": "The list of copybooks paths"
},
"sourceFormat": {
"description": "The source format of the code"
},
"dialect": {
"description": "The COBOL dialect used"
},
"forDebugging": {
"type": "boolean",
"description": "Build for debugging"
},
"extensions": {
"type": "array",
"description": "Add cobol file extensions"
}
}
}
]
},
"main": "./dist/superbol_vscode_platform.bc.js",
"name": "superbol",
"displayName": "Superbol Studio OSS",
"description": "Provides a COBOL mode in VSCode, based on SuperBOL Language Server Protocol for COBOL",
"license": "MIT",
"version": "0.1.0",
"repository": {
"type": "git",
"url": "https://github.com/OCamlPro/superbol-studio-oss"
},
"homepage": "https://get-superbol.com",
"author": {
"name": "SuperBOL at OCamlPro",
"email": "[email protected]"
},
"keywords": [
"cobol",
"gnucobol"
],
"main": "./_dist/superbol_vscode_platform.bc.js",
"scripts": {
"compile": "make compile",
"release": "make release",
"package": "vsce package --out superbol-vscode-platform.vsix --yarn",
"deploy:vsce": "vsce publish --packagePath superbol-vscode-platform.vsix --yarn",
"deploy:ovsx": "ovsx publish --yarn"
Expand All @@ -155,5 +143,13 @@
"prettier": "^2.5.1",
"vsce": "^2.15.0",
"vscode-test": "1.6.1"
}
}
},
"publisher": "ocamlpro",
"categories": [
"Formatters",
"Programming Languages",
"Linters",
"Snippets",
"Other"
]
}
2 changes: 1 addition & 1 deletion src/lsp/superbol_free_lib/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let public_subcommands = [
Command_texi2rst.cmd ;
Command_indent_range.cmd;
Command_indent_file.cmd;
Command_json_package.cmd;
Command_json_vscode.cmd;
]

let main ?style_renderer ?utf_8 () =
Expand Down
Loading

0 comments on commit 8215ad4

Please sign in to comment.