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

chore: Build update #454

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1bc2883
chore: eliminate 'npm link' from the build scripts.
Apr 11, 2020
c03ef91
Update vscode tasks.json
Apr 11, 2020
6c32473
(tool) Update pom.xml removing ref to ../runtime
Apr 15, 2020
db0b346
Relocate runtime build files to runtime/typescript
Apr 15, 2020
5078dfe
Move custom tool under tool/typescript
Apr 15, 2020
63a2325
cleanup target files that should not be checked in
Apr 16, 2020
e260009
Upgrade TypeScript to v2.9.2.
Apr 16, 2020
6f9e2db
Simplify build scripts w/ npm-run-all
Apr 16, 2020
8956cef
Move src/ to runtime/typescript/src
Apr 16, 2020
5a63b25
upgrade to [email protected]
Apr 16, 2020
59d7c4d
Upgrade TypeScript to V3.7.5
Apr 17, 2020
7311cf0
Update build process for speed. Operates across packages in this rep…
Apr 17, 2020
2d5a18c
Reintegrate the cross-platform tests
Apr 17, 2020
6f48f5f
tslint 6.1.1 and fix gripes
Apr 17, 2020
7e5bf51
Fix TestPerformance.ts so tsc doesn't hang
Apr 18, 2020
6fa15a9
more tslint...
Apr 18, 2020
f109206
whitespace in generated file
Apr 18, 2020
436cb61
Integrate eslint, prettier, huskey
Apr 19, 2020
0b2f879
Update CI control files to reflect change in lint, dropping pack steps
Apr 19, 2020
1743b12
Eliminate empty decorators
Apr 19, 2020
2239c13
clean attempts to provide imports without 'dist'
Apr 21, 2020
60e90f4
remove unneeded constructor overloads
Apr 21, 2020
7d02dde
Switch mocha config to .mocharc.yml
Apr 25, 2020
1a19980
Eleminate dependency on mocha-typescriptAll the tests now use the sam…
Apr 25, 2020
53db32a
Setup tsconfig.base.json
Apr 26, 2020
012c274
Implement internal module pattern
Apr 26, 2020
a312203
Merge branch 'build_reorg' into build_update
Apr 26, 2020
5c67dce
Eliminate async after fix of load order problem
Apr 27, 2020
bbb45ac
Mark vscode tsc-watch task as background
Apr 28, 2020
0f6e64b
update profiling to use node CPU profing switch
Apr 29, 2020
6ead312
chore: eliminate 'npm link' from the build scripts.
Apr 11, 2020
f4ab9ef
Update vscode tasks.json
Apr 11, 2020
bf8fae4
(tool) Update pom.xml removing ref to ../runtime
Apr 15, 2020
9526282
Upgrade TypeScript to v2.9.2.
Apr 16, 2020
fe98f17
Relocate runtime build files to runtime/typescript
Apr 15, 2020
8d3e5ac
Move custom tool under tool/typescript
Apr 15, 2020
5265600
cleanup target files that should not be checked in
Apr 16, 2020
3ba137b
Simplify build scripts w/ npm-run-all
Apr 16, 2020
3bfcbf9
Move src/ to runtime/typescript/src
Apr 16, 2020
5cc41de
upgrade to [email protected]
Apr 16, 2020
a487eff
Upgrade TypeScript to V3.7.5
Apr 17, 2020
ae4cdca
Update build process for speed. Operates across packages in this rep…
Apr 17, 2020
de16071
Reintegrate the cross-platform tests
Apr 17, 2020
be049bb
tslint 6.1.1 and fix gripes
Apr 17, 2020
b46004d
Fix TestPerformance.ts so tsc doesn't hang
Apr 18, 2020
d3a8eba
more tslint...
Apr 18, 2020
bbdef8e
whitespace in generated file
Apr 18, 2020
cdd9ce6
Integrate eslint, prettier, huskey
Apr 19, 2020
3344c95
Update CI control files to reflect change in lint, dropping pack steps
Apr 19, 2020
292701d
Eliminate empty decorators
Apr 19, 2020
bd07176
clean attempts to provide imports without 'dist'
Apr 21, 2020
d78bfe2
remove unneeded constructor overloads
Apr 21, 2020
4386de8
Switch mocha config to .mocharc.yml
Apr 25, 2020
df3e765
Eleminate dependency on mocha-typescriptAll the tests now use the sam…
Apr 25, 2020
4c27081
Setup tsconfig.base.json
Apr 26, 2020
6bec2a7
Implement internal module pattern
Apr 26, 2020
1cdd4f6
Eliminate async after fix of load order problem
Apr 27, 2020
2135359
Mark vscode tsc-watch task as background
Apr 28, 2020
3bc4d2a
update profiling to use node CPU profing switch
Apr 29, 2020
cb8d322
Merge branch 'build_update' of https://github.com/BurtHarris/antlr4ts…
Apr 30, 2020
a9b2dd0
touch .appveyor.yml
Apr 30, 2020
5778188
Merge branch 'master' into build_update
Apr 30, 2020
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
22 changes: 10 additions & 12 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
version: 1.0.{build}
image: Visual Studio 2015
init:
- git config --global core.autocrlf true
- git config --global core.autocrlf true
install:
- ps: Install-Product node 10
- npm install -g npm@6
- ps: Install-Product node 10
- npm install -g npm@6
branches:
only:
- master
- master
environment:
JAVA6_HOME: C:/Program Files/Java/jdk1.6.0/jre
build_script:
- npm install
- npm run tslint
- npm run pack-tool
- npm run pack-runtime
- npm install
- npm run lint
test_script:
- npm test
- npm test
artifacts:
- path: 'antlr4ts-*.tgz'
- path: "antlr4ts-*.tgz"
cache:
- node_modules -> **\package.json
- C:\Users\appveyor\.m2 -> **\pom.xml
- node_modules -> **\package.json # do we need child node_modules?
- C:\Users\appveyor\.m2 -> **\pom.xml
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
!.eslintrc.js
node_modules/
dist
gen
cross-target
reference
runtime/typescript/*.js
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-namespace": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-var-requires": 0,
"no-case-declarations": 0,
"no-constant-condition": 0,
"no-inner-declarations": 0
}
}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jspm_packages/
/src/tree/xpath/XPathLexer.ts
gen/
/target/
/tool/target/
tool/typescript/target
doc/

# Visual Studio build output and per-user files
Expand All @@ -60,3 +60,8 @@ bin/

# NPM pack output
*.tgz

**/dist
tsconfig.tsbuildinfo
test/runtime/cross-target/
.antlr/
8 changes: 8 additions & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# mocha.opts:
#
# --require source-map-support/register
# --recursive
# test/dist

spec: test/dist/**/*.js
require: source-map-support/register
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ script:
- nyc --reporter=none mocha --timeout=10000
- nyc report --reporter=text-lcov > coverage.lcov
- codecov
- npm run tslint
- npm run pack-tool
- npm run pack-runtime
- npm run lint
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"donjayamanne.githistory",
"eamodio.gitlens",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"mike-lischke.vscode-antlr4"
]
}
93 changes: 47 additions & 46 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--debug", "-R", "dot"
],
"cwd": "${workspaceRoot}",
"preLaunchTask": "tsc",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"console": "integratedTerminal",
"sourceMaps": true,
"outDir": "${workspaceRoot}/target"
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"outDir": null,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
},
{
"name": "Attach to Process",
"type": "node",
"request": "attach",
"processId": "${command.PickProcess}",
"port": 5858,
"sourceMaps": true,
"outDir": "${workspaceRoot}/target"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Debug Tests",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"stopOnEntry": false,
"args": [
"--debug",
"-R",
"dot"
],
"cwd": "${workspaceRoot}",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"console": "integratedTerminal",
"sourceMaps": true,
"outDir": "${workspaceRoot}/target"
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"outDir": null,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
},
{
"name": "Attach to Process",
"type": "node",
"request": "attach",
"processId": "${command.PickProcess}",
"port": 5858,
"sourceMaps": true,
"outDir": "${workspaceRoot}/target"
}
]
}
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Place your settings in this file to overwrite default and user settings.
{
"typescript.tsdk": "./node_modules/typescript/lib",
"editor.rulers": [
120
]
}
],
"typescript.tsdk": "./node_modules/typescript/lib",
"eslint.lintTask.enable": true
}
44 changes: 29 additions & 15 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "npm",
"type": "shell",
"args": ["run", "tsc-watch"],
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "tsc",
"problemMatcher": ["$tsc"],
"label": "npm: tsc",
"detail": "tsc --build"
},
"isBackground": true,
"problemMatcher": "$tsc"
{
"type": "npm",
"script": "tsc-watch",
"problemMatcher": ["$tsc-watch"],
"label": "npm: tsc-watch",
"detail": "tsc --build --watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"script": "lint",
"problemMatcher": ["$eslint-stylish"],
"label": "eslint: lint whole folder",
"group": "build",
"detail": "eslint . --ext .ts"
}
]
}
48 changes: 36 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ only be considered when sent from users who have signed the

## Building from Source

### NPM vs YARN

There are two significant package managers these days, NPM (which is included with Node.js), and YARN (which has been innovating.) Unfortunately the build process for antlr4ts currently does not support YARN.

We'll try to change that in the future, but for now the desire to ship a stable version 1.0 release overcomes any short-term advantages YARN may offer. So use NPM for now.

If you are deeply into YARN, the problem seems to be in that NPM creates symbolic links in the project root's node_module folder for antlr4ts and antlr4ts-cli, while YARN apparently copies the files instead. Unfortunately, the timing of the copy doesn't work, because under YARN, node_modules\antlr4ts-cli\target\antlr4-typescript-4.7.3-SNAPSHOT-complete.jar doesn't get included because it is copied before its build.

### Prerequisites

Building this repository from source requires several tools:

* Node.js 6.7.x
* Maven 3.3.1+ (3.3.9+ recommended)
* Java Development Kit 1.6+ (1.8+ recommended)
- Node.js 6.7.x
- Maven 3.3.1+ (3.3.9+ recommended)
- Java Development Kit 1.6+ (1.8+ recommended)

Users working in Visual Studio Code should update their workspace settings to specify the paths for the Java Development
Kit and Apache Maven:
Expand Down Expand Up @@ -67,7 +75,7 @@ the actual file name produced by the profiler.
node --prof-process isolate-000001C4B0FF38A0-v8.log >profile.txt
```

The resulting file, `profile.txt` will contain a summary of the results from running a sampling profiler.
The resulting file, `profile.txt` will contain a summary of the results from running a sampling profiler.

## Versioning

Expand Down Expand Up @@ -116,38 +124,54 @@ ability to provide meaningful release notes.
>
> In addition to the above, building the design-time tool requires:
>
> - A Java development kit, 1.8x or greater (see above.)
> - The [Maven](https://maven.apache.org/download.cgi) project system after downloading, [set it up according to these instructions](https://maven.apache.org/install.html).
> - A Java development kit, 1.8x or greater (see above.)
> - The [Maven](https://maven.apache.org/download.cgi) project system after downloading, [set it up according to these instructions](https://maven.apache.org/install.html).
>
> After you clone the project, run `npm install` from the root directory, this will install other runtime- and development-time dependencies.
> After you clone the project, run `npm install` from the root directory, this will install other runtime- and development-time dependencies.
>
> The first time you run `npm install`, it will build and install the current version of the **antlr4ts** tool locally. After that, if you update the tool, you will need to execute the command `npm install tool`. This includes if you pull any updates that change the tool.
> The first time you run `npm install`, it will build and install the current version of the **antlr4ts** tool locally. After that, if you update the tool, you will need to execute the command `npm install tool`. This includes if you pull any updates that change the tool.
>
> ## Dev setup with Visual Studio
>
> Any edition of [Visual Studio 2015](https://www.visualstudio.com/vs/) (or greater) should work, including Communitity Edition.
> You'll want to be sure you have the following VS extensions installed:
>
> - [Node Tools for Visual Studio 1.2](https://www.visualstudio.com/vs/node-js/) (or greater)
> - [TypeScript for Visual Studio 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48593) 2.03 or greater.
>
> You ***should*** be able to run tests from the Test Explorer, etc... but there seems to be an unresolved problem making this work, for now use the command-line method below to be sure you run them all.
> You **_should_** be able to run tests from the Test Explorer, etc... but there seems to be an unresolved problem making this work, for now use the command-line method below to be sure you run them all.
>
> ### Running basic tests should be as simple as...
>
> ```
> npm test
> ```
>
> How we integrate with runtime-testsuite is TBD.
>
> ### Generating test code coverage report
>
> ```
> npm run cover
> npm run cover
> ```
>
> This executes a code-coverage test run, then generates an interactive HTML report in `coverage/lcov-report/index.html`.
>
> ### Java Reference code
> To view the Java code this project was derived from, use the following commands in the project root directory. This *isn't* strictly needed for building the project, and the reference implementation is expected to be fairly stable.
>
> To view the Java code this project was derived from, use the following commands in the project root directory. This _isn't_ strictly needed for building the project, and the reference implementation is expected to be fairly stable.
>
> ```
> git submodule init
> git submodule update
> ```
> The later (update) command may need to be repeated occasionally after another contributor updates the version of reference code.
>
> The later (update) command may need to be repeated occasionally after another contributor updates the version of reference code.

# A note on the build process

The build process for this project has grown organically based on npm scripts. One part of those scripts used the
**npm link** command, and with further experience, this seems to have caused a fragile build situation. As stands the
build can leave npm **global** symlinks pointing into this build directory. They can effect what version of ANTLR4TS
is used by other projects, outside this repository. For this reason, I'm removing them from package.json, but leaving
in place a **npm run unlink** script which can help the cleanup process.
2 changes: 1 addition & 1 deletion antlr4ts.njsproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<TypeScriptOutFile />
<TypeScriptOutDir>$(MSBuildProjectDirectory)\target</TypeScriptOutDir>
<TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
<TypeScriptNoEmitOnError>False</TypeScriptNoEmitOnError>
<TypeScriptMapRoot>$(MSBuildProjectDirectory)\target</TypeScriptMapRoot>
<TypeScriptSourceRoot />
</PropertyGroup>
Expand Down
Loading