mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Compare commits
433 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bf4a4b18c | ||
|
|
8a01553c49 | ||
|
|
21b913845f | ||
|
|
220e4feb1d | ||
|
|
13884c0457 | ||
|
|
b3bb6ebc6e | ||
|
|
424eb90dd8 | ||
|
|
df804d0729 | ||
|
|
79269cdfd5 | ||
|
|
2a650d4d74 | ||
|
|
017b4ecdb3 | ||
|
|
9c84bf3fd5 | ||
|
|
397b54a8c3 | ||
|
|
cb3604c0a1 | ||
|
|
1a7f0673ea | ||
|
|
0d043207b9 | ||
|
|
f995dea971 | ||
|
|
49e20488bc | ||
|
|
3e47b27192 | ||
|
|
f4fa18ec05 | ||
|
|
c6d1fa2b7d | ||
|
|
c4df7667ff | ||
|
|
6a303cfa25 | ||
|
|
4ffa5cc1da | ||
|
|
172e1cf3bf | ||
|
|
e6a32e52f5 | ||
|
|
d2b6f6844d | ||
|
|
e9ef95ef1f | ||
|
|
10eeb5374f | ||
|
|
332951bc8e | ||
|
|
4daf3280ff | ||
|
|
87bb2c74d9 | ||
|
|
ba011853a0 | ||
|
|
461a158ac3 | ||
|
|
85f59f1103 | ||
|
|
335b9f445f | ||
|
|
7cda45c904 | ||
|
|
4159fdc1a3 | ||
|
|
190da30979 | ||
|
|
ed9c74b900 | ||
|
|
6783766c33 | ||
|
|
b27018b379 | ||
|
|
021d07e04a | ||
|
|
bf0baec392 | ||
|
|
923cbac400 | ||
|
|
ab938f2536 | ||
|
|
a55b1804e9 | ||
|
|
4bfa6b3a5d | ||
|
|
d20f24be18 | ||
|
|
8a17bae7a6 | ||
|
|
d14c73fad5 | ||
|
|
ce878e1def | ||
|
|
a64a0d1db6 | ||
|
|
feab43f16d | ||
|
|
0d60fe775f | ||
|
|
6680be6a73 | ||
|
|
e026ab85a7 | ||
|
|
e53c903205 | ||
|
|
03dbe8565f | ||
|
|
708793cb23 | ||
|
|
43ae4fb0aa | ||
|
|
6b1d552277 | ||
|
|
f24f576b72 | ||
|
|
c23328564f | ||
|
|
cd6dd3dafa | ||
|
|
4081e15bef | ||
|
|
b05e3813d1 | ||
|
|
3048311f40 | ||
|
|
1045392d91 | ||
|
|
7b23ca8ee7 | ||
|
|
4d67eca8bb | ||
|
|
74c4b7311e | ||
|
|
713c74adfd | ||
|
|
408a8a6f19 | ||
|
|
e1485e49d3 | ||
|
|
30b66934cd | ||
|
|
fd49c081c2 | ||
|
|
1327120024 | ||
|
|
d2b5043972 | ||
|
|
a0e55ea3fd | ||
|
|
1f32de29c1 | ||
|
|
12be06d682 | ||
|
|
27ca9b13f8 | ||
|
|
be45905830 | ||
|
|
05d0a89655 | ||
|
|
3ba575dcd0 | ||
|
|
3e200b7f0f | ||
|
|
cbce1f7008 | ||
|
|
e99101447e | ||
|
|
0ddb326e44 | ||
|
|
460446a15c | ||
|
|
4eea24997f | ||
|
|
0b1e9c7c66 | ||
|
|
d51a7a9eb7 | ||
|
|
0f0b959e14 | ||
|
|
b2ceb09e4d | ||
|
|
53953f5cda | ||
|
|
fbd5e819a2 | ||
|
|
bdc391d376 | ||
|
|
6b618fb121 | ||
|
|
1f3e59c9f9 | ||
|
|
1956078c8c | ||
|
|
11230f59fc | ||
|
|
21bad7a01f | ||
|
|
6f9a27ecc7 | ||
|
|
c504113d13 | ||
|
|
c92ff60592 | ||
|
|
e9013d1a2a | ||
|
|
9c4580fe40 | ||
|
|
cb060cb5db | ||
|
|
6c3d85cc45 | ||
|
|
14ae89e87c | ||
|
|
24c48f025d | ||
|
|
f0a556f004 | ||
|
|
fd4d6abb4d | ||
|
|
41cc839380 | ||
|
|
c2a4380b96 | ||
|
|
6f402ac79f | ||
|
|
bf7c1306b1 | ||
|
|
c1509cf09d | ||
|
|
014bca031c | ||
|
|
4f864fd5bd | ||
|
|
2da67567e4 | ||
|
|
5b19d2b1fc | ||
|
|
a6837dcd40 | ||
|
|
af80751a1f | ||
|
|
dd02597c3b | ||
|
|
2926a3cbd8 | ||
|
|
b02bb3bfd4 | ||
|
|
67a4683bb1 | ||
|
|
9baee1c22c | ||
|
|
8cb67b4f9d | ||
|
|
0cd47bc328 | ||
|
|
07fb58d5e1 | ||
|
|
2d80d5e611 | ||
|
|
4bd63b615b | ||
|
|
335f667507 | ||
|
|
1819036d7d | ||
|
|
4f76f116ac | ||
|
|
1eba7c7d2a | ||
|
|
83234dd52c | ||
|
|
bae23b7fce | ||
|
|
3db61eaa82 | ||
|
|
5cf85a0361 | ||
|
|
ffe27f5bde | ||
|
|
78bcd9d54c | ||
|
|
1a9797f0ff | ||
|
|
0de94ff8a4 | ||
|
|
472233d9a7 | ||
|
|
f69e31b0d5 | ||
|
|
60b696cc31 | ||
|
|
549037f744 | ||
|
|
ca5e1e6133 | ||
|
|
3e3ff163db | ||
|
|
ca755365ce | ||
|
|
ea979de19f | ||
|
|
473ddfcdf1 | ||
|
|
a627285a4c | ||
|
|
322847469d | ||
|
|
6c5fac997f | ||
|
|
1871fd383e | ||
|
|
f5b147ca4b | ||
|
|
9d2b206156 | ||
|
|
a372c76e07 | ||
|
|
b1ce07d3ae | ||
|
|
bc09fb30d8 | ||
|
|
c13f219318 | ||
|
|
6b018c5d06 | ||
|
|
e69158d9b2 | ||
|
|
520cfb780a | ||
|
|
e686fed209 | ||
|
|
80ab19ac23 | ||
|
|
25228fa58e | ||
|
|
676d35090f | ||
|
|
e1a36a356c | ||
|
|
3274c0b734 | ||
|
|
9c95e1289f | ||
|
|
ef29871b62 | ||
|
|
a2a87f8d2b | ||
|
|
83c01c6bcb | ||
|
|
c1d850804c | ||
|
|
6590d5f58a | ||
|
|
a225925bc4 | ||
|
|
ab39f1f44f | ||
|
|
8d89364d72 | ||
|
|
af2bc859d1 | ||
|
|
8e72fdaa52 | ||
|
|
e9661f90d0 | ||
|
|
30b111034d | ||
|
|
df18359309 | ||
|
|
03857e0afd | ||
|
|
eaf1e08752 | ||
|
|
d39ceffa94 | ||
|
|
406b171c66 | ||
|
|
6d89b9e203 | ||
|
|
733bb69d25 | ||
|
|
4609694141 | ||
|
|
3be0c5130a | ||
|
|
e50b512580 | ||
|
|
eb62d054de | ||
|
|
e870a309c0 | ||
|
|
3afd3b0ff3 | ||
|
|
e3a2ed95d4 | ||
|
|
20c4f085c8 | ||
|
|
02af7e9299 | ||
|
|
0ae9b36d93 | ||
|
|
2bbb2842e5 | ||
|
|
a5b4eeb932 | ||
|
|
44de602e52 | ||
|
|
63fb4e2827 | ||
|
|
0a839c7321 | ||
|
|
e9747a61ac | ||
|
|
43c3bf4d24 | ||
|
|
0bf642d200 | ||
|
|
b2b69376c4 | ||
|
|
38ad60478c | ||
|
|
cf6a7198f9 | ||
|
|
ac8a926a70 | ||
|
|
aef7244939 | ||
|
|
628e2adc64 | ||
|
|
0c58f09e59 | ||
|
|
e3baf5c443 | ||
|
|
f70bf590cd | ||
|
|
473a414bc3 | ||
|
|
9ad4ec6464 | ||
|
|
a15c315a1c | ||
|
|
58036bb364 | ||
|
|
8a3509e006 | ||
|
|
1d3ead4031 | ||
|
|
498bb47d7f | ||
|
|
f2df9f3917 | ||
|
|
0414ab6e6a | ||
|
|
14a7a5534f | ||
|
|
edc60e0ad1 | ||
|
|
1a97e3de06 | ||
|
|
f5b1bd0bc2 | ||
|
|
05d7e24e66 | ||
|
|
83842ee9e1 | ||
|
|
a13039b14b | ||
|
|
8fce79f385 | ||
|
|
2efea63000 | ||
|
|
c208abf0c5 | ||
|
|
1359354387 | ||
|
|
cd0f9b71c5 | ||
|
|
04ec9caad1 | ||
|
|
259306a8db | ||
|
|
36a8991682 | ||
|
|
1461929f86 | ||
|
|
4bfc549927 | ||
|
|
40db0d6f6f | ||
|
|
6aac0b6056 | ||
|
|
8e234d9b2d | ||
|
|
70819252a9 | ||
|
|
ba264d8311 | ||
|
|
5de002e5c1 | ||
|
|
0b771abad2 | ||
|
|
00041c8ecd | ||
|
|
0225d6d9f9 | ||
|
|
fb4260d71c | ||
|
|
fa253158f4 | ||
|
|
45e3c6ae49 | ||
|
|
d526fe0f7f | ||
|
|
5707b58fda | ||
|
|
1a9f72dfe0 | ||
|
|
078f3a2b54 | ||
|
|
5bcfb9ab32 | ||
|
|
9bd45cf66a | ||
|
|
89c48bbe75 | ||
|
|
6b549696c5 | ||
|
|
3aaf8a24bf | ||
|
|
41ffd6e8ae | ||
|
|
c0a6f3e012 | ||
|
|
eae8de0373 | ||
|
|
23ec6ac567 | ||
|
|
f4cfb4a5ef | ||
|
|
80a9c82813 | ||
|
|
bcd6178d67 | ||
|
|
f10e281ffc | ||
|
|
c2b32fd64a | ||
|
|
80f150dfb4 | ||
|
|
a5c5fcbde1 | ||
|
|
0d76e845d5 | ||
|
|
979d50eb0e | ||
|
|
7099922c35 | ||
|
|
b54b4a4445 | ||
|
|
03989a5af0 | ||
|
|
1847c2e322 | ||
|
|
f7371e9ed5 | ||
|
|
f696274740 | ||
|
|
1c48320ce0 | ||
|
|
96ecf79d32 | ||
|
|
6d243e0ac8 | ||
|
|
8bf60f133f | ||
|
|
3b9a3aba87 | ||
|
|
f0c986858a | ||
|
|
7ee13b4afb | ||
|
|
bca4102542 | ||
|
|
31ac8d6acc | ||
|
|
e82b7615b3 | ||
|
|
6f10f7a21a | ||
|
|
46fb68214f | ||
|
|
c2381424bc | ||
|
|
31328e79be | ||
|
|
96657e300a | ||
|
|
a2e6aa9e64 | ||
|
|
8c2d79e9cf | ||
|
|
cd140b5527 | ||
|
|
a0456bf4f7 | ||
|
|
55e3947cf7 | ||
|
|
db5156e4cd | ||
|
|
eece0677a7 | ||
|
|
24e8c20511 | ||
|
|
886717d330 | ||
|
|
26b27a616a | ||
|
|
0c663e5555 | ||
|
|
0f087915f6 | ||
|
|
a78fa9c0f2 | ||
|
|
b1752ea635 | ||
|
|
ec150917c2 | ||
|
|
7a9a69c439 | ||
|
|
9e9862c6f0 | ||
|
|
7b76d929cd | ||
|
|
1811dfa423 | ||
|
|
3abbc8fd97 | ||
|
|
4b88b67bed | ||
|
|
a2734807ca | ||
|
|
d0d4df313e | ||
|
|
1efd5e6502 | ||
|
|
b12cac0ac3 | ||
|
|
578aa6ccd2 | ||
|
|
3b90530717 | ||
|
|
f199c7a63c | ||
|
|
50a2526d1f | ||
|
|
7fb8a28b59 | ||
|
|
30a825438e | ||
|
|
f63da13210 | ||
|
|
08d73675d4 | ||
|
|
f0f6c00a0e | ||
|
|
965458ca74 | ||
|
|
b30f7ee41c | ||
|
|
a2eb53ce0b | ||
|
|
619c816e7f | ||
|
|
3d6fb7a8fa | ||
|
|
891624c085 | ||
|
|
a7c4686980 | ||
|
|
93aa052856 | ||
|
|
61d05f6782 | ||
|
|
60ccae48f1 | ||
|
|
4b454581fd | ||
|
|
f0aadebd2c | ||
|
|
d3f0ac7954 | ||
|
|
134f76c17f | ||
|
|
b9c877a109 | ||
|
|
aa243a8aae | ||
|
|
e5c1c6f544 | ||
|
|
9e9f85079e | ||
|
|
ae8e2e1f89 | ||
|
|
b2c70e9301 | ||
|
|
e022f4a0d1 | ||
|
|
8bc32e6371 | ||
|
|
f739c47984 | ||
|
|
13fb9fdfd2 | ||
|
|
9a5f51bfbf | ||
|
|
06bab6a38c | ||
|
|
c35a14d8fd | ||
|
|
b914073147 | ||
|
|
04ae18143b | ||
|
|
efe8e81b6e | ||
|
|
c33ddfabf9 | ||
|
|
8ec5451e64 | ||
|
|
20853ddf7e | ||
|
|
091d4cb924 | ||
|
|
cd0210c88a | ||
|
|
ed10f984b6 | ||
|
|
087a6a0810 | ||
|
|
495b4ee7c2 | ||
|
|
7833c28b7a | ||
|
|
bbfb68b082 | ||
|
|
b32e7a777c | ||
|
|
a327889d05 | ||
|
|
5ac89e5a49 | ||
|
|
849653927a | ||
|
|
3545483fc1 | ||
|
|
e5a1896414 | ||
|
|
bec8e72688 | ||
|
|
86748e6d69 | ||
|
|
596f09f754 | ||
|
|
563e25f073 | ||
|
|
1800d0baaf | ||
|
|
2182658301 | ||
|
|
3990719054 | ||
|
|
071b510fba | ||
|
|
d2d2ade9f7 | ||
|
|
d97d2e5c91 | ||
|
|
a6ba44e435 | ||
|
|
4967e630fb | ||
|
|
2508464fde | ||
|
|
782623cba9 | ||
|
|
36045c5381 | ||
|
|
7e49167530 | ||
|
|
a680a2a7dc | ||
|
|
4734451f5f | ||
|
|
dafb780987 | ||
|
|
5fba3e31b4 | ||
|
|
0315020cf0 | ||
|
|
6dca896768 | ||
|
|
90454fbe87 | ||
|
|
f9b2136494 | ||
|
|
3d1c1aefb3 | ||
|
|
e6a65599fd | ||
|
|
32ac907403 | ||
|
|
3af05d62b2 | ||
|
|
b5d8dfa509 | ||
|
|
612987d1e5 | ||
|
|
916598e029 | ||
|
|
c45c634938 | ||
|
|
1bed0d0733 | ||
|
|
e0075b7633 | ||
|
|
0029767561 | ||
|
|
93f9828d04 | ||
|
|
c484af0901 | ||
|
|
b2a96bbe50 | ||
|
|
2414f43757 | ||
|
|
22c54a9917 | ||
|
|
a14c0351ba | ||
|
|
31f75a46c8 | ||
|
|
08d1e9cd73 | ||
|
|
0da83b5d4b | ||
|
|
37d7266751 | ||
|
|
ddfb61b46a | ||
|
|
9a2e8cffed | ||
|
|
e9299d1991 | ||
|
|
08d97cc795 |
9
.gitattributes
vendored
Normal file
9
.gitattributes
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
* text=auto
|
||||
|
||||
LICENSE.txt eol=crlf
|
||||
ThirdPartyNotices.txt eol=crlf
|
||||
|
||||
*.bat eol=crlf
|
||||
*.cmd eol=crlf
|
||||
*.ps1 eol=lf
|
||||
*.sh eol=lf
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,6 +6,7 @@ node_modules/
|
||||
out/
|
||||
out-build/
|
||||
out-editor/
|
||||
out-editor-esm/
|
||||
out-editor-min/
|
||||
out-monaco-editor-core/
|
||||
out-vscode/
|
||||
|
||||
@@ -32,8 +32,6 @@ addons:
|
||||
|
||||
before_install:
|
||||
- git submodule update --init --recursive
|
||||
- git clone --depth 1 https://github.com/creationix/nvm.git ./.nvm
|
||||
- source ./.nvm/nvm.sh
|
||||
- nvm install 8.9.1
|
||||
- nvm use 8.9.1
|
||||
- npm i -g yarn
|
||||
|
||||
4
.vscode/extensions.json
vendored
4
.vscode/extensions.json
vendored
@@ -1,9 +1,9 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"eg2.tslint",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"msjsdiag.debugger-for-chrome"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
9
.vscode/launch.json
vendored
9
.vscode/launch.json
vendored
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
@@ -9,7 +8,7 @@
|
||||
"program": "${workspaceFolder}/node_modules/gulp/bin/gulp.js",
|
||||
"stopOnEntry": true,
|
||||
"args": [
|
||||
"watch-extension:json-client"
|
||||
"hygiene"
|
||||
],
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
@@ -87,7 +86,11 @@
|
||||
"runtimeArgs": [
|
||||
"--inspect=5875"
|
||||
],
|
||||
"webRoot": "${workspaceFolder}"
|
||||
"skipFiles": [
|
||||
"**/winjs*.js"
|
||||
],
|
||||
"webRoot": "${workspaceFolder}",
|
||||
"timeout": 15000
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
|
||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -10,6 +10,9 @@
|
||||
"when": "$(basename).ts"
|
||||
}
|
||||
},
|
||||
"files.associations": {
|
||||
"OSSREADME.json": "jsonc"
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/bower_components": true,
|
||||
@@ -37,4 +40,4 @@
|
||||
],
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
||||
}
|
||||
|
||||
2
.yarnrc
2
.yarnrc
@@ -1,3 +1,3 @@
|
||||
disturl "https://atom.io/download/electron"
|
||||
target "1.7.11"
|
||||
target "1.7.12"
|
||||
runtime "electron"
|
||||
|
||||
79
CHANGELOG.md
79
CHANGELOG.md
@@ -1,5 +1,84 @@
|
||||
# Change Log
|
||||
|
||||
## Version 0.31.4
|
||||
* Release date: July 19, 2018
|
||||
* Release status: Public Preview
|
||||
|
||||
## What's new in this version
|
||||
* SQL Server Agent for SQL Operations Studio extension improvements
|
||||
* Added view of Alerts, Operators, and Proxies and icons on left pane
|
||||
* Added dialogs for New Job, New Job Step, New Alert, and New Operator
|
||||
* Added Delete Job, Delete Alert, and Delete Operator (right-click)
|
||||
* Added Previous Runs visualization
|
||||
* Added Filters for each column name
|
||||
* SQL Server Profiler for SQL Operations Studio extension improvements
|
||||
* Added Hotkeys to quickly launch and start/stop Profiler
|
||||
* Added 5 Default Templates to view Extended Events
|
||||
* Added Server/Database connection name
|
||||
* Added support for Azure SQL Database instances
|
||||
* Added suggestion to exit Profiler when tab is closed when Profiler is still running
|
||||
* Release of Combine Scripts Extension
|
||||
* Wizard and Dialog Extensibility
|
||||
* Fix GitHub Issues
|
||||
|
||||
## Version 0.30.6
|
||||
* Release date: June 20, 2018
|
||||
* Release status: Public Preview
|
||||
|
||||
## What's new in this version
|
||||
* **SQL Server Profiler for SQL Operations Studio *Preview*** extension initial release
|
||||
* The new **SQL Data Warehouse** extension includes rich customizable dashboard widgets surfacing insights to your data warehouse. This unlocks key scenarios around managing and tuning your data warehouse to ensure it is optimized for consistent performance.
|
||||
* **Edit Data "Filtering and Sorting"** support
|
||||
* **SQL Server Agent for SQL Operations Studio *Preview*** extension enhancements for Jobs and Job History views
|
||||
* Improved **Wizard & Dialog UI Builder Framework** extensibility APIs
|
||||
* Update VS Code Platform source code integrating [March 2018 (1.22)](https://code.visualstudio.com/updates/v1_22) and [April 2018 (1.23)](https://code.visualstudio.com/updates/v1_23) releases
|
||||
* Fix GitHub Issues
|
||||
|
||||
## Version 0.29.3
|
||||
* Release date: May 7, 2018
|
||||
* Release status: Public Preview
|
||||
|
||||
## What's new in this version
|
||||
The May release is focused on stabilization and bug fixes leading up to the Build conference. This build contains the following highlights.
|
||||
|
||||
* Announcing **Redgate SQL Search** extension available in Extension Manager
|
||||
* Community Localization available for 10 languages: **German, Spanish, French, Italian, Japanese, Korean, Portuguese, Russian, Simplified Chinese and Traditional Chinese!**
|
||||
* Reduced telemetry collection, improved [opt-out](https://github.com/Microsoft/sqlopsstudio/wiki/How-to-Disable-Telemetry-Reporting) experience and in-product links to [Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement)
|
||||
* Extension Manager has improved Marketplace experience to easily discover community extensions
|
||||
* SQL Agent extension Jobs and Job History view improvement
|
||||
* Updates for **whoisactive** and **Server Reports** extensions
|
||||
* Continue to fix GitHub issues
|
||||
|
||||
## Version 0.28.6
|
||||
* Release date: April 25, 2018
|
||||
* Release status: Public Preview
|
||||
|
||||
## What's new in this version
|
||||
The April Public Preview release contains some of the following highlights.
|
||||
|
||||
* Improvements to SQL Agent *Preview* extension
|
||||
* Accessibility improvements for keyboard navigation, screen reader support and high-contrast mode.
|
||||
* Improved large and protected file support for saving Admin protected and >256M files within SQL Ops Studio
|
||||
* Integrated Terminal splitting to work with multiple open terminals at once
|
||||
* Reduced installation on-disk file count foot print for faster installs and startup times
|
||||
* Improvements to Server Reports extension
|
||||
* Continue to fix GitHub issues
|
||||
|
||||
## Version 0.27.3
|
||||
* Release date: March 28, 2017
|
||||
* Release status: Public Preview
|
||||
|
||||
## What's new in this version
|
||||
The March Public Preview release enables some key aspects of the SQL Operations
|
||||
Studio extensibility story. Here are some highlights in this release.
|
||||
|
||||
* Enhance the Manage Dashboard extensibility model to support tabbed Insights and Configuration panes
|
||||
* Dashboard Insights extensions for `sp_whoisactive` from [whoisactive.com](http://whoisactive.com)
|
||||
* Extension Manager enables simple acquisition of 1st-party and 3rd-party extensions
|
||||
* Add additional Extensibility APIs for `connection` and `objectexplorer` management
|
||||
* Community Localization open for 10 languages
|
||||
* Continue to fix important customer impacting GitHub issues
|
||||
|
||||
## Version 0.26.7
|
||||
* Release date: February 16, 2017
|
||||
* Release status: Public Preview Hotfix 1
|
||||
|
||||
10
LICENSE.txt
10
LICENSE.txt
@@ -4,11 +4,11 @@ MICROSOFT SQL OPERATIONS STUDIO
|
||||
|
||||
Microsoft Corporation ("Microsoft") grants you a nonexclusive, perpetual,
|
||||
royalty-free right to use, copy, and modify the software code provided by us
|
||||
("Software Code"). You may not sublicense the Software Code or any use of it
|
||||
(except to your affiliates and to vendors to perform work on your behalf)
|
||||
through distribution, network access, service agreement, lease, rental, or
|
||||
otherwise. Unless applicable law gives you more rights, Microsoft reserves all
|
||||
other rights not expressly granted herein, whether by implication, estoppel or
|
||||
("Software Code"). You may not sublicense the Software Code or any use of it
|
||||
(except to your affiliates and to vendors to perform work on your behalf)
|
||||
through distribution, network access, service agreement, lease, rental, or
|
||||
otherwise. Unless applicable law gives you more rights, Microsoft reserves all
|
||||
other rights not expressly granted herein, whether by implication, estoppel or
|
||||
otherwise.
|
||||
|
||||
THE SOFTWARE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||
|
||||
384
OSSREADME.json
384
OSSREADME.json
@@ -808,5 +808,389 @@
|
||||
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE",
|
||||
"SOFTWARE"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mdn-data",
|
||||
"version": "1.1.12",
|
||||
"repositoryURL": "https://github.com/mdn/data",
|
||||
"license": "MPL",
|
||||
"licenseDetail": [
|
||||
"Mozilla Public License Version 2.0",
|
||||
"",
|
||||
"Copyright (c) 2018 Mozilla Corporation",
|
||||
"",
|
||||
"==================================",
|
||||
"",
|
||||
"1. Definitions",
|
||||
"--------------",
|
||||
"",
|
||||
"1.1. \"Contributor\"",
|
||||
" means each individual or legal entity that creates, contributes to",
|
||||
" the creation of, or owns Covered Software.",
|
||||
"",
|
||||
"1.2. \"Contributor Version\"",
|
||||
" means the combination of the Contributions of others (if any) used",
|
||||
" by a Contributor and that particular Contributor's Contribution.",
|
||||
"",
|
||||
"1.3. \"Contribution\"",
|
||||
" means Covered Software of a particular Contributor.",
|
||||
"",
|
||||
"1.4. \"Covered Software\"",
|
||||
" means Source Code Form to which the initial Contributor has attached",
|
||||
" the notice in Exhibit A, the Executable Form of such Source Code",
|
||||
" Form, and Modifications of such Source Code Form, in each case",
|
||||
" including portions thereof.",
|
||||
"",
|
||||
"1.5. \"Incompatible With Secondary Licenses\"",
|
||||
" means",
|
||||
"",
|
||||
" (a) that the initial Contributor has attached the notice described",
|
||||
" in Exhibit B to the Covered Software; or",
|
||||
"",
|
||||
" (b) that the Covered Software was made available under the terms of",
|
||||
" version 1.1 or earlier of the License, but not also under the",
|
||||
" terms of a Secondary License.",
|
||||
"",
|
||||
"1.6. \"Executable Form\"",
|
||||
" means any form of the work other than Source Code Form.",
|
||||
"",
|
||||
"1.7. \"Larger Work\"",
|
||||
" means a work that combines Covered Software with other material, in",
|
||||
" a separate file or files, that is not Covered Software.",
|
||||
"",
|
||||
"1.8. \"License\"",
|
||||
" means this document.",
|
||||
"",
|
||||
"1.9. \"Licensable\"",
|
||||
" means having the right to grant, to the maximum extent possible,",
|
||||
" whether at the time of the initial grant or subsequently, any and",
|
||||
" all of the rights conveyed by this License.",
|
||||
"",
|
||||
"1.10. \"Modifications\"",
|
||||
" means any of the following:",
|
||||
"",
|
||||
" (a) any file in Source Code Form that results from an addition to,",
|
||||
" deletion from, or modification of the contents of Covered",
|
||||
" Software; or",
|
||||
"",
|
||||
" (b) any new file in Source Code Form that contains any Covered",
|
||||
" Software.",
|
||||
"",
|
||||
"1.11. \"Patent Claims\" of a Contributor",
|
||||
" means any patent claim(s), including without limitation, method,",
|
||||
" process, and apparatus claims, in any patent Licensable by such",
|
||||
" Contributor that would be infringed, but for the grant of the",
|
||||
" License, by the making, using, selling, offering for sale, having",
|
||||
" made, import, or transfer of either its Contributions or its",
|
||||
" Contributor Version.",
|
||||
"",
|
||||
"1.12. \"Secondary License\"",
|
||||
" means either the GNU General Public License, Version 2.0, the GNU",
|
||||
" Lesser General Public License, Version 2.1, the GNU Affero General",
|
||||
" Public License, Version 3.0, or any later versions of those",
|
||||
" licenses.",
|
||||
"",
|
||||
"1.13. \"Source Code Form\"",
|
||||
" means the form of the work preferred for making modifications.",
|
||||
"",
|
||||
"1.14. \"You\" (or \"Your\")",
|
||||
" means an individual or a legal entity exercising rights under this",
|
||||
" License. For legal entities, \"You\" includes any entity that",
|
||||
" controls, is controlled by, or is under common control with You. For",
|
||||
" purposes of this definition, \"control\" means (a) the power, direct",
|
||||
" or indirect, to cause the direction or management of such entity,",
|
||||
" whether by contract or otherwise, or (b) ownership of more than",
|
||||
" fifty percent (50%) of the outstanding shares or beneficial",
|
||||
" ownership of such entity.",
|
||||
"",
|
||||
"2. License Grants and Conditions",
|
||||
"--------------------------------",
|
||||
"",
|
||||
"2.1. Grants",
|
||||
"",
|
||||
"Each Contributor hereby grants You a world-wide, royalty-free,",
|
||||
"non-exclusive license:",
|
||||
"",
|
||||
"(a) under intellectual property rights (other than patent or trademark)",
|
||||
" Licensable by such Contributor to use, reproduce, make available,",
|
||||
" modify, display, perform, distribute, and otherwise exploit its",
|
||||
" Contributions, either on an unmodified basis, with Modifications, or",
|
||||
" as part of a Larger Work; and",
|
||||
"",
|
||||
"(b) under Patent Claims of such Contributor to make, use, sell, offer",
|
||||
" for sale, have made, import, and otherwise transfer either its",
|
||||
" Contributions or its Contributor Version.",
|
||||
"",
|
||||
"2.2. Effective Date",
|
||||
"",
|
||||
"The licenses granted in Section 2.1 with respect to any Contribution",
|
||||
"become effective for each Contribution on the date the Contributor first",
|
||||
"distributes such Contribution.",
|
||||
"",
|
||||
"2.3. Limitations on Grant Scope",
|
||||
"",
|
||||
"The licenses granted in this Section 2 are the only rights granted under",
|
||||
"this License. No additional rights or licenses will be implied from the",
|
||||
"distribution or licensing of Covered Software under this License.",
|
||||
"Notwithstanding Section 2.1(b) above, no patent license is granted by a",
|
||||
"Contributor:",
|
||||
"",
|
||||
"(a) for any code that a Contributor has removed from Covered Software;",
|
||||
" or",
|
||||
"",
|
||||
"(b) for infringements caused by: (i) Your and any other third party's",
|
||||
" modifications of Covered Software, or (ii) the combination of its",
|
||||
" Contributions with other software (except as part of its Contributor",
|
||||
" Version); or",
|
||||
"",
|
||||
"(c) under Patent Claims infringed by Covered Software in the absence of",
|
||||
" its Contributions.",
|
||||
"",
|
||||
"This License does not grant any rights in the trademarks, service marks,",
|
||||
"or logos of any Contributor (except as may be necessary to comply with",
|
||||
"the notice requirements in Section 3.4).",
|
||||
"",
|
||||
"2.4. Subsequent Licenses",
|
||||
"",
|
||||
"No Contributor makes additional grants as a result of Your choice to",
|
||||
"distribute the Covered Software under a subsequent version of this",
|
||||
"License (see Section 10.2) or under the terms of a Secondary License (if",
|
||||
"permitted under the terms of Section 3.3).",
|
||||
"",
|
||||
"2.5. Representation",
|
||||
"",
|
||||
"Each Contributor represents that the Contributor believes its",
|
||||
"Contributions are its original creation(s) or it has sufficient rights",
|
||||
"to grant the rights to its Contributions conveyed by this License.",
|
||||
"",
|
||||
"2.6. Fair Use",
|
||||
"",
|
||||
"This License is not intended to limit any rights You have under",
|
||||
"applicable copyright doctrines of fair use, fair dealing, or other",
|
||||
"equivalents.",
|
||||
"",
|
||||
"2.7. Conditions",
|
||||
"",
|
||||
"Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted",
|
||||
"in Section 2.1.",
|
||||
"",
|
||||
"3. Responsibilities",
|
||||
"-------------------",
|
||||
"",
|
||||
"3.1. Distribution of Source Form",
|
||||
"",
|
||||
"All distribution of Covered Software in Source Code Form, including any",
|
||||
"Modifications that You create or to which You contribute, must be under",
|
||||
"the terms of this License. You must inform recipients that the Source",
|
||||
"Code Form of the Covered Software is governed by the terms of this",
|
||||
"License, and how they can obtain a copy of this License. You may not",
|
||||
"attempt to alter or restrict the recipients' rights in the Source Code",
|
||||
"Form.",
|
||||
"",
|
||||
"3.2. Distribution of Executable Form",
|
||||
"",
|
||||
"If You distribute Covered Software in Executable Form then:",
|
||||
"",
|
||||
"(a) such Covered Software must also be made available in Source Code",
|
||||
" Form, as described in Section 3.1, and You must inform recipients of",
|
||||
" the Executable Form how they can obtain a copy of such Source Code",
|
||||
" Form by reasonable means in a timely manner, at a charge no more",
|
||||
" than the cost of distribution to the recipient; and",
|
||||
"",
|
||||
"(b) You may distribute such Executable Form under the terms of this",
|
||||
" License, or sublicense it under different terms, provided that the",
|
||||
" license for the Executable Form does not attempt to limit or alter",
|
||||
" the recipients' rights in the Source Code Form under this License.",
|
||||
"",
|
||||
"3.3. Distribution of a Larger Work",
|
||||
"",
|
||||
"You may create and distribute a Larger Work under terms of Your choice,",
|
||||
"provided that You also comply with the requirements of this License for",
|
||||
"the Covered Software. If the Larger Work is a combination of Covered",
|
||||
"Software with a work governed by one or more Secondary Licenses, and the",
|
||||
"Covered Software is not Incompatible With Secondary Licenses, this",
|
||||
"License permits You to additionally distribute such Covered Software",
|
||||
"under the terms of such Secondary License(s), so that the recipient of",
|
||||
"the Larger Work may, at their option, further distribute the Covered",
|
||||
"Software under the terms of either this License or such Secondary",
|
||||
"License(s).",
|
||||
"",
|
||||
"3.4. Notices",
|
||||
"",
|
||||
"You may not remove or alter the substance of any license notices",
|
||||
"(including copyright notices, patent notices, disclaimers of warranty,",
|
||||
"or limitations of liability) contained within the Source Code Form of",
|
||||
"the Covered Software, except that You may alter any license notices to",
|
||||
"the extent required to remedy known factual inaccuracies.",
|
||||
"",
|
||||
"3.5. Application of Additional Terms",
|
||||
"",
|
||||
"You may choose to offer, and to charge a fee for, warranty, support,",
|
||||
"indemnity or liability obligations to one or more recipients of Covered",
|
||||
"Software. However, You may do so only on Your own behalf, and not on",
|
||||
"behalf of any Contributor. You must make it absolutely clear that any",
|
||||
"such warranty, support, indemnity, or liability obligation is offered by",
|
||||
"You alone, and You hereby agree to indemnify every Contributor for any",
|
||||
"liability incurred by such Contributor as a result of warranty, support,",
|
||||
"indemnity or liability terms You offer. You may include additional",
|
||||
"disclaimers of warranty and limitations of liability specific to any",
|
||||
"jurisdiction.",
|
||||
"",
|
||||
"4. Inability to Comply Due to Statute or Regulation",
|
||||
"---------------------------------------------------",
|
||||
"",
|
||||
"If it is impossible for You to comply with any of the terms of this",
|
||||
"License with respect to some or all of the Covered Software due to",
|
||||
"statute, judicial order, or regulation then You must: (a) comply with",
|
||||
"the terms of this License to the maximum extent possible; and (b)",
|
||||
"describe the limitations and the code they affect. Such description must",
|
||||
"be placed in a text file included with all distributions of the Covered",
|
||||
"Software under this License. Except to the extent prohibited by statute",
|
||||
"or regulation, such description must be sufficiently detailed for a",
|
||||
"recipient of ordinary skill to be able to understand it.",
|
||||
"",
|
||||
"5. Termination",
|
||||
"--------------",
|
||||
"",
|
||||
"5.1. The rights granted under this License will terminate automatically",
|
||||
"if You fail to comply with any of its terms. However, if You become",
|
||||
"compliant, then the rights granted under this License from a particular",
|
||||
"Contributor are reinstated (a) provisionally, unless and until such",
|
||||
"Contributor explicitly and finally terminates Your grants, and (b) on an",
|
||||
"ongoing basis, if such Contributor fails to notify You of the",
|
||||
"non-compliance by some reasonable means prior to 60 days after You have",
|
||||
"come back into compliance. Moreover, Your grants from a particular",
|
||||
"Contributor are reinstated on an ongoing basis if such Contributor",
|
||||
"notifies You of the non-compliance by some reasonable means, this is the",
|
||||
"first time You have received notice of non-compliance with this License",
|
||||
"from such Contributor, and You become compliant prior to 30 days after",
|
||||
"Your receipt of the notice.",
|
||||
"",
|
||||
"5.2. If You initiate litigation against any entity by asserting a patent",
|
||||
"infringement claim (excluding declaratory judgment actions,",
|
||||
"counter-claims, and cross-claims) alleging that a Contributor Version",
|
||||
"directly or indirectly infringes any patent, then the rights granted to",
|
||||
"You by any and all Contributors for the Covered Software under Section",
|
||||
"2.1 of this License shall terminate.",
|
||||
"",
|
||||
"5.3. In the event of termination under Sections 5.1 or 5.2 above, all",
|
||||
"end user license agreements (excluding distributors and resellers) which",
|
||||
"have been validly granted by You or Your distributors under this License",
|
||||
"prior to termination shall survive termination.",
|
||||
"",
|
||||
"************************************************************************",
|
||||
"* *",
|
||||
"* 6. Disclaimer of Warranty *",
|
||||
"* ------------------------- *",
|
||||
"* *",
|
||||
"* Covered Software is provided under this License on an \"as is\" *",
|
||||
"* basis, without warranty of any kind, either expressed, implied, or *",
|
||||
"* statutory, including, without limitation, warranties that the *",
|
||||
"* Covered Software is free of defects, merchantable, fit for a *",
|
||||
"* particular purpose or non-infringing. The entire risk as to the *",
|
||||
"* quality and performance of the Covered Software is with You. *",
|
||||
"* Should any Covered Software prove defective in any respect, You *",
|
||||
"* (not any Contributor) assume the cost of any necessary servicing, *",
|
||||
"* repair, or correction. This disclaimer of warranty constitutes an *",
|
||||
"* essential part of this License. No use of any Covered Software is *",
|
||||
"* authorized under this License except under this disclaimer. *",
|
||||
"* *",
|
||||
"************************************************************************",
|
||||
"",
|
||||
"************************************************************************",
|
||||
"* *",
|
||||
"* 7. Limitation of Liability *",
|
||||
"* -------------------------- *",
|
||||
"* *",
|
||||
"* Under no circumstances and under no legal theory, whether tort *",
|
||||
"* (including negligence), contract, or otherwise, shall any *",
|
||||
"* Contributor, or anyone who distributes Covered Software as *",
|
||||
"* permitted above, be liable to You for any direct, indirect, *",
|
||||
"* special, incidental, or consequential damages of any character *",
|
||||
"* including, without limitation, damages for lost profits, loss of *",
|
||||
"* goodwill, work stoppage, computer failure or malfunction, or any *",
|
||||
"* and all other commercial damages or losses, even if such party *",
|
||||
"* shall have been informed of the possibility of such damages. This *",
|
||||
"* limitation of liability shall not apply to liability for death or *",
|
||||
"* personal injury resulting from such party's negligence to the *",
|
||||
"* extent applicable law prohibits such limitation. Some *",
|
||||
"* jurisdictions do not allow the exclusion or limitation of *",
|
||||
"* incidental or consequential damages, so this exclusion and *",
|
||||
"* limitation may not apply to You. *",
|
||||
"* *",
|
||||
"************************************************************************",
|
||||
"",
|
||||
"8. Litigation",
|
||||
"-------------",
|
||||
"",
|
||||
"Any litigation relating to this License may be brought only in the",
|
||||
"courts of a jurisdiction where the defendant maintains its principal",
|
||||
"place of business and such litigation shall be governed by laws of that",
|
||||
"jurisdiction, without reference to its conflict-of-law provisions.",
|
||||
"Nothing in this Section shall prevent a party's ability to bring",
|
||||
"cross-claims or counter-claims.",
|
||||
"",
|
||||
"9. Miscellaneous",
|
||||
"----------------",
|
||||
"",
|
||||
"This License represents the complete agreement concerning the subject",
|
||||
"matter hereof. If any provision of this License is held to be",
|
||||
"unenforceable, such provision shall be reformed only to the extent",
|
||||
"necessary to make it enforceable. Any law or regulation which provides",
|
||||
"that the language of a contract shall be construed against the drafter",
|
||||
"shall not be used to construe this License against a Contributor.",
|
||||
"",
|
||||
"10. Versions of the License",
|
||||
"---------------------------",
|
||||
"",
|
||||
"10.1. New Versions",
|
||||
"",
|
||||
"Mozilla Foundation is the license steward. Except as provided in Section",
|
||||
"10.3, no one other than the license steward has the right to modify or",
|
||||
"publish new versions of this License. Each version will be given a",
|
||||
"distinguishing version number.",
|
||||
"",
|
||||
"10.2. Effect of New Versions",
|
||||
"",
|
||||
"You may distribute the Covered Software under the terms of the version",
|
||||
"of the License under which You originally received the Covered Software,",
|
||||
"or under the terms of any subsequent version published by the license",
|
||||
"steward.",
|
||||
"",
|
||||
"10.3. Modified Versions",
|
||||
"",
|
||||
"If you create software not governed by this License, and you want to",
|
||||
"create a new license for such software, you may create and use a",
|
||||
"modified version of this License if you rename the license and remove",
|
||||
"any references to the name of the license steward (except to note that",
|
||||
"such modified license differs from this License).",
|
||||
"",
|
||||
"10.4. Distributing Source Code Form that is Incompatible With Secondary",
|
||||
"Licenses",
|
||||
"",
|
||||
"If You choose to distribute Source Code Form that is Incompatible With",
|
||||
"Secondary Licenses under the terms of this version of the License, the",
|
||||
"notice described in Exhibit B of this License must be attached.",
|
||||
"",
|
||||
"Exhibit A - Source Code Form License Notice",
|
||||
"-------------------------------------------",
|
||||
"",
|
||||
" This Source Code Form is subject to the terms of the Mozilla Public",
|
||||
" License, v. 2.0. If a copy of the MPL was not distributed with this",
|
||||
" file, You can obtain one at http://mozilla.org/MPL/2.0/.",
|
||||
"",
|
||||
"If it is not possible or desirable to put the notice in a particular",
|
||||
"file, then You may include the notice in a location (such as a LICENSE",
|
||||
"file in a relevant directory) where a recipient would be likely to look",
|
||||
"for such a notice.",
|
||||
"",
|
||||
"You may add additional accurate notices of copyright ownership.",
|
||||
"",
|
||||
"Exhibit B - \"Incompatible With Secondary Licenses\" Notice",
|
||||
"---------------------------------------------------------",
|
||||
"",
|
||||
" This Source Code Form is \"Incompatible With Secondary Licenses\", as",
|
||||
" defined by the Mozilla Public License, v. 2.0."
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
40
README.md
40
README.md
@@ -4,16 +4,16 @@
|
||||
|
||||
SQL Operations Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.
|
||||
|
||||
**Download SQL Operations Studio February Public Preview**
|
||||
**Download SQL Operations Studio June Public Preview**
|
||||
|
||||
Platform | Link
|
||||
-- | --
|
||||
Windows Setup Installer | https://go.microsoft.com/fwlink/?linkid=867998
|
||||
Windows ZIP | https://go.microsoft.com/fwlink/?linkid=867997
|
||||
macOS ZIP | https://go.microsoft.com/fwlink/?linkid=867999
|
||||
Linux TAR.GZ | https://go.microsoft.com/fwlink/?linkid=868000
|
||||
Linux DEB | https://go.microsoft.com/fwlink/?linkid=868002
|
||||
Linux RPM | https://go.microsoft.com/fwlink/?linkid=868001
|
||||
Windows Setup Installer | https://go.microsoft.com/fwlink/?linkid=2005949
|
||||
Windows ZIP | https://go.microsoft.com/fwlink/?linkid=2005950
|
||||
macOS ZIP | https://go.microsoft.com/fwlink/?linkid=2005959
|
||||
Linux TAR.GZ | https://go.microsoft.com/fwlink/?linkid=2005960
|
||||
Linux RPM | https://go.microsoft.com/fwlink/?linkid=2006083
|
||||
Linux DEB | https://go.microsoft.com/fwlink/?linkid=2006084
|
||||
|
||||
Go to our [download page](https://aka.ms/sqlopsstudio) for more specific instructions.
|
||||
|
||||
@@ -21,14 +21,6 @@ Try out the latest insiders build from `master` at https://github.com/Microsoft/
|
||||
|
||||
See the [change log](https://github.com/Microsoft/sqlopsstudio/blob/master/CHANGELOG.md) for additional details of what's in this release.
|
||||
|
||||
**Design Discussions**
|
||||
|
||||
The SQL Operations Studio team would like to incorporate community feedback earlier in the development process. To facilitate this, we'd like to share our designs while features are actively being built.
|
||||
|
||||
We're currently collecting input on the **SQL Agent** experience and enhancements to the Manage Dashboard that we're calling **"Command Center"**. We'll add additional design feedback requests below as we start work in new feature areas. Please leave comments on these issues to help us understand your requirements and shape feature development.
|
||||
|
||||
* [#750 Seeking community feedback on SQL Agent UX prototype](https://github.com/Microsoft/sqlopsstudio/issues/750)
|
||||
|
||||
**Feature Highlights**
|
||||
|
||||
- Cross-Platform DB management for Windows, macOS and Linux with simple XCopy deployment
|
||||
@@ -69,6 +61,9 @@ The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.micro
|
||||
## Contributions and "thank you"
|
||||
We would like to thank all our users who raised issues, and in particular the following users who helped contribute fixes:
|
||||
|
||||
* lanceklinger `Fix for double clicking column handle in results table #1504`
|
||||
* westerncj for `Removed duplicate contribution from README.md (#753)`
|
||||
* ntovas for `Fix for duplicate extensions shown in "Save File" dialog. (#779)`
|
||||
* SebastianPfliegel for `Add cursor snippet (#475)`
|
||||
* mikaoelitiana for fix: `revert README and CONTRIBUTING after last VSCode merge (#574)`
|
||||
* alextercete for `Reinstate menu item to install from VSIX (#682)`
|
||||
@@ -79,6 +74,21 @@ We would like to thank all our users who raised issues, and in particular the fo
|
||||
* stebet for `Fix #153: Fixing sql snippets that failed on a DB with case-sensitive collation. (#152)`
|
||||
* SebastianPfliegel `Remove sqlExtensionHelp (#312)`
|
||||
* olljanat for `Implemented npm version check (#314)`
|
||||
* Adam Mechanic for helping with the `whoisactive` extension
|
||||
* All community localization contributors
|
||||
* French: Adrien Clerbois, ANAS BELABBES, Antoine Griffard, Arian Papillon, Eric Macarez, Eric Van Thorre, Jérémy LANDON, Matthias GROSPERRIN, Maxime COQUEREL, Olivier Guinart, thierry DEMAN-BARCELÒ, Thomas Potier
|
||||
* Italian: Aldo Donetti, Alessandro Alpi, Andrea Dottor, Bruni Luca, Gianluca Hotz, Luca Nardi, Luigi Bruno, Marco Dal Pino, Mirco Vanini, Pasquale Ceglie, Riccardo Cappello, Sergio Govoni, Stefano Demiliani
|
||||
* German: Anna Henke-Gunvaldson, Ben Weissman, David Ullmer, J.M. ., Kai Modo, Konstantin Staschill, Kostja Klein, Lennart Trunk, Markus Ehrenmüller-Jensen, Mascha Kroenlein, Matthias Knoll, Mourad Louha, Thomas Hütter, Wolfgang Straßer
|
||||
* Spanish: Alberto Poblacion, Andy Gonzalez, Carlos Mendible, Christian Araujo, Daniel D, Eickhel Mendoza, Ernesto Cardenas, Ivan Toledo Ivanovic, Fran Diaz, JESUS GIL, Jorge Serrano Pérez, José Saturnino Pimentel Juárez, Mauricio Hidalgo, Pablo Iglesias, Rikhardo Estrada Rdez, Thierry DEMAN, YOLANDA CUESTA ALTIERI
|
||||
* Japanese: Fujio Kojima, Kazushi KAMEGAWA, Masayoshi Yamada, Masayuki Ozawa , Seiji Momoto, Takashi Kanai, Takayoshi Tanaka, Yoshihisa Ozaki, 庄垣内治
|
||||
* Chinese (simplified): DAN YE, Joel Yang, Lynne Dong, Ryan(Yu) Zhang, Sheng Jiang, Wei Zhang, Zhiliang Xu
|
||||
* Chinese (Traditional): Bruce Chen, Chiayi Yen, Kevin Yang, Winnie Lin, 保哥 Will, 謝政廷
|
||||
* Korean: Do-Kyun Kim, Evelyn Kim, Helen Jung, Hong Jmee, jeongwoo choi, Jun Hyoung Lee, Jungsun Kim정선, Justin Yoo, Kavrith mucha, Kiwoong Youm, MinGyu Ju, MVP_JUNO BEA, Sejun Kim, SOONMAN KWON, sung man ko, Yeongrak Choi, younggun kim, Youngjae Kim, 소영 이
|
||||
* Russian: Andrey Veselov, Anton Fontanov, Anton Savin, Elena Ostrovskaia, Igor Babichev, Maxim Zelensky, Rodion Fedechkin, Tasha T, Vladimir Zyryanov
|
||||
* Portuguese Brazil: Daniel de Sousa, Diogo Duarte, Douglas Correa, Douglas Eccker, José Emanuel Mendes, Marcelo Fernandes, Marcondes Alexandre, Roberto Fonseca, Rodrigo Crespi
|
||||
|
||||
|
||||
And of course we'd like to thank the authors of all upstream dependencies. Please see a full list in the [ThirdPartyNotices.txt](https://raw.githubusercontent.com/Microsoft/sqlopsstudio/master/ThirdPartyNotices.txt)
|
||||
|
||||
## License
|
||||
|
||||
|
||||
12
build/builtInExtensions.json
Normal file
12
build/builtInExtensions.json
Normal file
@@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"name": "ms-vscode.node-debug",
|
||||
"version": "1.23.3",
|
||||
"repo": "https://github.com/Microsoft/vscode-node-debug"
|
||||
},
|
||||
{
|
||||
"name": "ms-vscode.node-debug2",
|
||||
"version": "1.23.5",
|
||||
"repo": "https://github.com/Microsoft/vscode-node-debug2"
|
||||
}
|
||||
]
|
||||
20
build/builtin/.eslintrc
Normal file
20
build/builtin/.eslintrc
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"browser": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"no-cond-assign": 0,
|
||||
"no-unused-vars": 1,
|
||||
"no-extra-semi": "warn",
|
||||
"semi": "warn"
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"experimentalObjectRestSpread": true
|
||||
}
|
||||
}
|
||||
}
|
||||
126
build/builtin/browser-main.js
Normal file
126
build/builtin/browser-main.js
Normal file
@@ -0,0 +1,126 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
// @ts-ignore review
|
||||
const { remote } = require('electron');
|
||||
const dialog = remote.dialog;
|
||||
|
||||
const builtInExtensionsPath = path.join(__dirname, '..', 'builtInExtensions.json');
|
||||
const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json');
|
||||
|
||||
function readJson(filePath) {
|
||||
return JSON.parse(fs.readFileSync(filePath, { encoding: 'utf8' }));
|
||||
}
|
||||
|
||||
function writeJson(filePath, obj) {
|
||||
fs.writeFileSync(filePath, JSON.stringify(obj, null, 2));
|
||||
}
|
||||
|
||||
function renderOption(form, id, title, value, checked) {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'radio';
|
||||
input.id = id;
|
||||
input.name = 'choice';
|
||||
input.value = value;
|
||||
input.checked = !!checked;
|
||||
form.appendChild(input);
|
||||
|
||||
const label = document.createElement('label');
|
||||
label.setAttribute('for', id);
|
||||
label.textContent = title;
|
||||
form.appendChild(label);
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
function render(el, state) {
|
||||
function setState(state) {
|
||||
try {
|
||||
writeJson(controlFilePath, state.control);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
el.innerHTML = '';
|
||||
render(el, state);
|
||||
}
|
||||
|
||||
const ul = document.createElement('ul');
|
||||
const { builtin, control } = state;
|
||||
|
||||
for (const ext of builtin) {
|
||||
const controlState = control[ext.name] || 'marketplace';
|
||||
|
||||
const li = document.createElement('li');
|
||||
ul.appendChild(li);
|
||||
|
||||
const name = document.createElement('code');
|
||||
name.textContent = ext.name;
|
||||
li.appendChild(name);
|
||||
|
||||
const form = document.createElement('form');
|
||||
li.appendChild(form);
|
||||
|
||||
const marketplaceInput = renderOption(form, `marketplace-${ext.name}`, 'Marketplace', 'marketplace', controlState === 'marketplace');
|
||||
marketplaceInput.onchange = function () {
|
||||
control[ext.name] = 'marketplace';
|
||||
setState({ builtin, control });
|
||||
};
|
||||
|
||||
const disabledInput = renderOption(form, `disabled-${ext.name}`, 'Disabled', 'disabled', controlState === 'disabled');
|
||||
disabledInput.onchange = function () {
|
||||
control[ext.name] = 'disabled';
|
||||
setState({ builtin, control });
|
||||
};
|
||||
|
||||
let local = undefined;
|
||||
|
||||
if (controlState !== 'marketplace' && controlState !== 'disabled') {
|
||||
local = controlState;
|
||||
}
|
||||
|
||||
const localInput = renderOption(form, `local-${ext.name}`, 'Local', 'local', !!local);
|
||||
localInput.onchange = function () {
|
||||
const result = dialog.showOpenDialog(remote.getCurrentWindow(), {
|
||||
title: 'Choose Folder',
|
||||
properties: ['openDirectory']
|
||||
});
|
||||
|
||||
if (result && result.length >= 1) {
|
||||
control[ext.name] = result[0];
|
||||
}
|
||||
|
||||
setState({ builtin, control });
|
||||
};
|
||||
|
||||
if (local) {
|
||||
const localSpan = document.createElement('code');
|
||||
localSpan.className = 'local';
|
||||
localSpan.textContent = local;
|
||||
form.appendChild(localSpan);
|
||||
}
|
||||
}
|
||||
|
||||
el.appendChild(ul);
|
||||
}
|
||||
|
||||
function main() {
|
||||
const el = document.getElementById('extensions');
|
||||
const builtin = readJson(builtInExtensionsPath);
|
||||
let control;
|
||||
|
||||
try {
|
||||
control = readJson(controlFilePath);
|
||||
} catch (err) {
|
||||
control = {};
|
||||
}
|
||||
|
||||
render(el, { builtin, control });
|
||||
}
|
||||
|
||||
window.onload = main;
|
||||
46
build/builtin/index.html
Normal file
46
build/builtin/index.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Manage Built-in Extensions</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script src="browser-main.js"></script>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: 'Menlo', 'Courier New', 'Courier', monospace;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style: none;
|
||||
padding: 0.3em 0;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
form {
|
||||
padding: 0.3em 0 0.3em 0.3em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Built-in Extensions</h1>
|
||||
<div id="extensions"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
20
build/builtin/main.js
Normal file
20
build/builtin/main.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const url = require('url');
|
||||
const path = require('path');
|
||||
|
||||
let window = null;
|
||||
|
||||
app.once('ready', () => {
|
||||
window = new BrowserWindow({ width: 800, height: 600 });
|
||||
window.setMenuBarVisibility(false);
|
||||
window.loadURL(url.format({ pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true }));
|
||||
// window.webContents.openDevTools();
|
||||
window.once('closed', () => window = null);
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => app.quit());
|
||||
5
build/builtin/package.json
Normal file
5
build/builtin/package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "builtin",
|
||||
"version": "0.1.0",
|
||||
"main": "main.js"
|
||||
}
|
||||
@@ -3,15 +3,19 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
var gulp = require('gulp');
|
||||
var path = require('path');
|
||||
var util = require('./lib/util');
|
||||
var common = require('./lib/optimize');
|
||||
var es = require('event-stream');
|
||||
var File = require('vinyl');
|
||||
const gulp = require('gulp');
|
||||
const path = require('path');
|
||||
const util = require('./lib/util');
|
||||
const common = require('./lib/optimize');
|
||||
const es = require('event-stream');
|
||||
const File = require('vinyl');
|
||||
const i18n = require('./lib/i18n');
|
||||
const standalone = require('./lib/standalone');
|
||||
const cp = require('child_process');
|
||||
|
||||
var root = path.dirname(__dirname);
|
||||
var sha1 = util.getVersion(root);
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
var semver = require('./monaco/package.json').version;
|
||||
var headerVersion = semver + '(' + sha1 + ')';
|
||||
|
||||
@@ -21,14 +25,14 @@ var editorEntryPoints = [
|
||||
{
|
||||
name: 'vs/editor/editor.main',
|
||||
include: [],
|
||||
exclude: [ 'vs/css', 'vs/nls' ],
|
||||
prepend: [ 'out-build/vs/css.js', 'out-build/vs/nls.js' ],
|
||||
exclude: ['vs/css', 'vs/nls'],
|
||||
prepend: ['out-build/vs/css.js', 'out-build/vs/nls.js'],
|
||||
},
|
||||
{
|
||||
name: 'vs/base/common/worker/simpleWorker',
|
||||
include: [ 'vs/editor/common/services/editorSimpleWorker' ],
|
||||
prepend: [ 'vs/loader.js' ],
|
||||
append: [ 'vs/base/worker/workerMain' ],
|
||||
include: ['vs/editor/common/services/editorSimpleWorker'],
|
||||
prepend: ['vs/loader.js'],
|
||||
append: ['vs/base/worker/workerMain'],
|
||||
dest: 'vs/base/worker/workerMain.js'
|
||||
}
|
||||
];
|
||||
@@ -70,6 +74,8 @@ function editorLoaderConfig() {
|
||||
return result;
|
||||
}
|
||||
|
||||
const languages = i18n.defaultLanguages.concat([]); // i18n.defaultLanguages.concat(process.env.VSCODE_QUALITY !== 'stable' ? i18n.extraLanguages : []);
|
||||
|
||||
gulp.task('clean-optimized-editor', util.rimraf('out-editor'));
|
||||
gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-client-build'], common.optimizeTask({
|
||||
entryPoints: editorEntryPoints,
|
||||
@@ -79,14 +85,37 @@ gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-client-build'],
|
||||
bundleLoader: false,
|
||||
header: BUNDLED_FILE_HEADER,
|
||||
bundleInfo: true,
|
||||
out: 'out-editor'
|
||||
out: 'out-editor',
|
||||
languages: languages
|
||||
}));
|
||||
|
||||
gulp.task('clean-minified-editor', util.rimraf('out-editor-min'));
|
||||
gulp.task('minify-editor', ['clean-minified-editor', 'optimize-editor'], common.minifyTask('out-editor'));
|
||||
|
||||
gulp.task('clean-editor-esm', util.rimraf('out-editor-esm'));
|
||||
gulp.task('extract-editor-esm', ['clean-editor-esm', 'clean-editor-distro'], function () {
|
||||
standalone.createESMSourcesAndResources({
|
||||
entryPoints: [
|
||||
'vs/editor/editor.main',
|
||||
'vs/editor/editor.worker'
|
||||
],
|
||||
outFolder: './out-editor-esm/src',
|
||||
outResourcesFolder: './out-monaco-editor-core/esm',
|
||||
redirects: {
|
||||
'vs/base/browser/ui/octiconLabel/octiconLabel': 'vs/base/browser/ui/octiconLabel/octiconLabel.mock',
|
||||
'vs/nls': 'vs/nls.mock',
|
||||
}
|
||||
});
|
||||
});
|
||||
gulp.task('compile-editor-esm', ['extract-editor-esm', 'clean-editor-distro'], function () {
|
||||
const result = cp.spawnSync(`node`, [`../node_modules/.bin/tsc`], {
|
||||
cwd: path.join(__dirname, '../out-editor-esm')
|
||||
});
|
||||
console.log(result.stdout.toString());
|
||||
});
|
||||
|
||||
gulp.task('clean-editor-distro', util.rimraf('out-monaco-editor-core'));
|
||||
gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-editor'], function() {
|
||||
gulp.task('editor-distro', ['clean-editor-distro', 'compile-editor-esm', 'minify-editor', 'optimize-editor'], function () {
|
||||
return es.merge(
|
||||
// other assets
|
||||
es.merge(
|
||||
@@ -95,19 +124,30 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed
|
||||
gulp.src('src/vs/monaco.d.ts')
|
||||
).pipe(gulp.dest('out-monaco-editor-core')),
|
||||
|
||||
// place the .d.ts in the esm folder
|
||||
gulp.src('src/vs/monaco.d.ts')
|
||||
.pipe(es.through(function (data) {
|
||||
this.emit('data', new File({
|
||||
path: data.path.replace(/monaco\.d\.ts/, 'editor.api.d.ts'),
|
||||
base: data.base,
|
||||
contents: data.contents
|
||||
}));
|
||||
}))
|
||||
.pipe(gulp.dest('out-monaco-editor-core/esm/vs/editor')),
|
||||
|
||||
// package.json
|
||||
gulp.src('build/monaco/package.json')
|
||||
.pipe(es.through(function(data) {
|
||||
.pipe(es.through(function (data) {
|
||||
var json = JSON.parse(data.contents.toString());
|
||||
json.private = false;
|
||||
data.contents = new Buffer(JSON.stringify(json, null, ' '));
|
||||
data.contents = Buffer.from(JSON.stringify(json, null, ' '));
|
||||
this.emit('data', data);
|
||||
}))
|
||||
.pipe(gulp.dest('out-monaco-editor-core')),
|
||||
|
||||
// README.md
|
||||
gulp.src('build/monaco/README-npm.md')
|
||||
.pipe(es.through(function(data) {
|
||||
.pipe(es.through(function (data) {
|
||||
this.emit('data', new File({
|
||||
path: data.path.replace(/README-npm\.md/, 'README.md'),
|
||||
base: data.base,
|
||||
@@ -124,10 +164,10 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed
|
||||
// min folder
|
||||
es.merge(
|
||||
gulp.src('out-editor-min/**/*')
|
||||
).pipe(filterStream(function(path) {
|
||||
).pipe(filterStream(function (path) {
|
||||
// no map files
|
||||
return !/(\.js\.map$)|(nls\.metadata\.json$)|(bundleInfo\.json$)/.test(path);
|
||||
})).pipe(es.through(function(data) {
|
||||
})).pipe(es.through(function (data) {
|
||||
// tweak the sourceMappingURL
|
||||
if (!/\.js$/.test(data.path)) {
|
||||
this.emit('data', data);
|
||||
@@ -140,49 +180,50 @@ gulp.task('editor-distro', ['clean-editor-distro', 'minify-editor', 'optimize-ed
|
||||
var newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
|
||||
strContents = strContents.replace(/\/\/\# sourceMappingURL=[^ ]+$/, newStr);
|
||||
|
||||
data.contents = new Buffer(strContents);
|
||||
data.contents = Buffer.from(strContents);
|
||||
this.emit('data', data);
|
||||
})).pipe(gulp.dest('out-monaco-editor-core/min')),
|
||||
|
||||
// min-maps folder
|
||||
es.merge(
|
||||
gulp.src('out-editor-min/**/*')
|
||||
).pipe(filterStream(function(path) {
|
||||
).pipe(filterStream(function (path) {
|
||||
// no map files
|
||||
return /\.js\.map$/.test(path);
|
||||
})).pipe(gulp.dest('out-monaco-editor-core/min-maps'))
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('analyze-editor-distro', function() {
|
||||
gulp.task('analyze-editor-distro', function () {
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
var bundleInfo = require('../out-editor/bundleInfo.json');
|
||||
var graph = bundleInfo.graph;
|
||||
var bundles = bundleInfo.bundles;
|
||||
|
||||
var inverseGraph = {};
|
||||
Object.keys(graph).forEach(function(module) {
|
||||
Object.keys(graph).forEach(function (module) {
|
||||
var dependencies = graph[module];
|
||||
dependencies.forEach(function(dep) {
|
||||
dependencies.forEach(function (dep) {
|
||||
inverseGraph[dep] = inverseGraph[dep] || [];
|
||||
inverseGraph[dep].push(module);
|
||||
});
|
||||
});
|
||||
|
||||
var detailed = {};
|
||||
Object.keys(bundles).forEach(function(entryPoint) {
|
||||
Object.keys(bundles).forEach(function (entryPoint) {
|
||||
var included = bundles[entryPoint];
|
||||
var includedMap = {};
|
||||
included.forEach(function(included) {
|
||||
included.forEach(function (included) {
|
||||
includedMap[included] = true;
|
||||
});
|
||||
|
||||
var explanation = [];
|
||||
included.map(function(included) {
|
||||
included.map(function (included) {
|
||||
if (included.indexOf('!') >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var reason = (inverseGraph[included]||[]).filter(function(mod) {
|
||||
var reason = (inverseGraph[included] || []).filter(function (mod) {
|
||||
return !!includedMap[mod];
|
||||
});
|
||||
explanation.push({
|
||||
@@ -198,10 +239,67 @@ gulp.task('analyze-editor-distro', function() {
|
||||
});
|
||||
|
||||
function filterStream(testFunc) {
|
||||
return es.through(function(data) {
|
||||
return es.through(function (data) {
|
||||
if (!testFunc(data.relative)) {
|
||||
return;
|
||||
}
|
||||
this.emit('data', data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//#region monaco type checking
|
||||
|
||||
function createTscCompileTask(watch) {
|
||||
return () => {
|
||||
const createReporter = require('./lib/reporter').createReporter;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const args = ['./node_modules/.bin/tsc', '-p', './src/tsconfig.monaco.json', '--noEmit'];
|
||||
if (watch) {
|
||||
args.push('-w');
|
||||
}
|
||||
const child = cp.spawn(`node`, args, {
|
||||
cwd: path.join(__dirname, '..'),
|
||||
// stdio: [null, 'pipe', 'inherit']
|
||||
});
|
||||
let errors = [];
|
||||
let reporter = createReporter();
|
||||
let report;
|
||||
let magic = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g; // https://stackoverflow.com/questions/25245716/remove-all-ansi-colors-styles-from-strings
|
||||
|
||||
child.stdout.on('data', data => {
|
||||
let str = String(data);
|
||||
str = str.replace(magic, '').trim();
|
||||
if (str.indexOf('Starting compilation') >= 0 || str.indexOf('File change detected') >= 0) {
|
||||
errors.length = 0;
|
||||
report = reporter.end(false);
|
||||
|
||||
} else if (str.indexOf('Compilation complete') >= 0) {
|
||||
report.end();
|
||||
|
||||
} else if (str) {
|
||||
let match = /(.*\(\d+,\d+\): )(.*: )(.*)/.exec(str);
|
||||
if (match) {
|
||||
// trying to massage the message so that it matches the gulp-tsb error messages
|
||||
// e.g. src/vs/base/common/strings.ts(663,5): error TS2322: Type '1234' is not assignable to type 'string'.
|
||||
let fullpath = path.join(root, match[1]);
|
||||
let message = match[3];
|
||||
// @ts-ignore
|
||||
reporter(fullpath + message);
|
||||
} else {
|
||||
// @ts-ignore
|
||||
reporter(str);
|
||||
}
|
||||
}
|
||||
});
|
||||
child.on('exit', resolve);
|
||||
child.on('error', reject);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
gulp.task('monaco-typecheck-watch', createTscCompileTask(true));
|
||||
gulp.task('monaco-typecheck', createTscCompileTask(false));
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -20,6 +20,8 @@ const sourcemaps = require('gulp-sourcemaps');
|
||||
const nlsDev = require('vscode-nls-dev');
|
||||
const root = path.dirname(__dirname);
|
||||
const commit = util.getVersion(root);
|
||||
const i18n = require('./lib/i18n');
|
||||
const plumber = require('gulp-plumber');
|
||||
|
||||
const extensionsPath = path.join(path.dirname(__dirname), 'extensions');
|
||||
|
||||
@@ -29,7 +31,8 @@ const compilations = glob.sync('**/tsconfig.json', {
|
||||
});
|
||||
|
||||
const getBaseUrl = out => `https://ticino.blob.core.windows.net/sourcemaps/${commit}/${out}`;
|
||||
const languages = ['chs', 'cht', 'jpn', 'kor', 'deu', 'fra', 'esn', 'rus', 'ita'];
|
||||
|
||||
const languages = i18n.defaultLanguages.concat(process.env.VSCODE_QUALITY !== 'stable' ? i18n.extraLanguages : []);
|
||||
|
||||
const tasks = compilations.map(function (tsconfigFile) {
|
||||
const absolutePath = path.join(extensionsPath, tsconfigFile);
|
||||
@@ -55,9 +58,19 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
const srcBase = path.join(root, 'src');
|
||||
const src = path.join(srcBase, '**');
|
||||
const out = path.join(root, 'out');
|
||||
const i18n = path.join(__dirname, '..', 'i18n');
|
||||
const i18nPath = path.join(__dirname, '..', 'i18n');
|
||||
const baseUrl = getBaseUrl(out);
|
||||
|
||||
let headerId, headerOut;
|
||||
let index = relativeDirname.indexOf('/');
|
||||
if (index < 0) {
|
||||
headerId = 'vscode.' + relativeDirname;
|
||||
headerOut = 'out';
|
||||
} else {
|
||||
headerId = 'vscode.' + relativeDirname.substr(0, index);
|
||||
headerOut = relativeDirname.substr(index + 1) + '/out';
|
||||
}
|
||||
|
||||
function createPipeline(build, emitError) {
|
||||
const reporter = createReporter();
|
||||
|
||||
@@ -70,6 +83,13 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
const input = es.through();
|
||||
const tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true });
|
||||
const output = input
|
||||
.pipe(plumber({
|
||||
errorHandler: function (err) {
|
||||
if (err && !err.__reporter__) {
|
||||
reporter(err);
|
||||
}
|
||||
}
|
||||
}))
|
||||
.pipe(tsFilter)
|
||||
.pipe(util.loadSourcemaps())
|
||||
.pipe(compilation())
|
||||
@@ -82,7 +102,9 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
sourceRoot: '../src'
|
||||
}))
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(build ? nlsDev.createAdditionalLanguageFiles(languages, i18n, out) : es.through())
|
||||
.pipe(build ? nlsDev.createAdditionalLanguageFiles(languages, i18nPath, out) : es.through())
|
||||
.pipe(build ? nlsDev.bundleMetaDataFiles(headerId, headerOut) : es.through())
|
||||
.pipe(build ? nlsDev.bundleLanguageFiles() : es.through())
|
||||
.pipe(reporter.end(emitError));
|
||||
|
||||
return es.duplex(input, output);
|
||||
@@ -129,7 +151,7 @@ const tasks = compilations.map(function (tsconfigFile) {
|
||||
const watchInput = watcher(src, srcOpts);
|
||||
|
||||
return watchInput
|
||||
.pipe(util.incremental(() => pipeline(true), input))
|
||||
.pipe(util.incremental(() => pipeline(), input))
|
||||
.pipe(gulp.dest(out));
|
||||
});
|
||||
|
||||
|
||||
@@ -12,7 +12,11 @@ const gulptslint = require('gulp-tslint');
|
||||
const gulpeslint = require('gulp-eslint');
|
||||
const tsfmt = require('typescript-formatter');
|
||||
const tslint = require('tslint');
|
||||
const VinylFile = require('vinyl');
|
||||
const vfs = require('vinyl-fs');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const pall = require('p-all');
|
||||
|
||||
/**
|
||||
* Hygiene works by creating cascading subsets of all our files and
|
||||
@@ -29,55 +33,56 @@ const all = [
|
||||
'extensions/**/*',
|
||||
'scripts/**/*',
|
||||
'src/**/*',
|
||||
'test/**/*'
|
||||
];
|
||||
|
||||
const eolFilter = [
|
||||
'**',
|
||||
'!ThirdPartyNotices.txt',
|
||||
'!LICENSE.txt',
|
||||
'!extensions/**/out/**',
|
||||
'!test/smoke/out/**',
|
||||
'!**/node_modules/**',
|
||||
'!**/fixtures/**',
|
||||
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot}',
|
||||
'!build/{lib,tslintRules}/**/*.js',
|
||||
'!build/monaco/**',
|
||||
'!build/win32/**',
|
||||
'!build/**/*.sh',
|
||||
'!build/tfs/**/*.js',
|
||||
'!**/Dockerfile'
|
||||
'test/**/*',
|
||||
'!**/node_modules/**'
|
||||
];
|
||||
|
||||
const indentationFilter = [
|
||||
'**',
|
||||
|
||||
// except specific files
|
||||
'!ThirdPartyNotices.txt',
|
||||
'!**/*.md',
|
||||
'!**/*.ps1',
|
||||
'!**/*.template',
|
||||
'!**/*.yaml',
|
||||
'!**/*.yml',
|
||||
'!**/yarn.lock',
|
||||
'!**/lib/**',
|
||||
'!extensions/**/*.d.ts',
|
||||
'!src/typings/**/*.d.ts',
|
||||
'!src/vs/*/**/*.d.ts',
|
||||
'!**/*.d.ts.recipe',
|
||||
'!LICENSE.txt',
|
||||
'!src/vs/nls.js',
|
||||
'!src/vs/css.js',
|
||||
'!src/vs/loader.js',
|
||||
'!src/vs/base/common/marked/marked.js',
|
||||
'!src/vs/base/common/winjs.base.js',
|
||||
'!src/vs/base/node/terminateProcess.sh',
|
||||
'!test/assert.js',
|
||||
|
||||
// except specific folders
|
||||
'!test/smoke/out/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace2/**',
|
||||
'!build/monaco/**',
|
||||
'!build/win32/**',
|
||||
|
||||
// except multiple specific files
|
||||
'!**/package.json',
|
||||
'!**/yarn.lock',
|
||||
'!**/yarn-error.log',
|
||||
|
||||
// except multiple specific folders
|
||||
'!**/octicons/**',
|
||||
'!**/vs/base/common/marked/raw.marked.js',
|
||||
'!**/vs/base/common/winjs.base.raw.js',
|
||||
'!**/vs/base/node/terminateProcess.sh',
|
||||
'!**/vs/base/node/ps-win.ps1',
|
||||
'!**/vs/nls.js',
|
||||
'!**/vs/css.js',
|
||||
'!**/vs/loader.js',
|
||||
'!**/fixtures/**',
|
||||
'!**/lib/**',
|
||||
'!extensions/**/out/**',
|
||||
'!extensions/**/snippets/**',
|
||||
'!extensions/**/syntaxes/**',
|
||||
'!extensions/**/themes/**',
|
||||
'!extensions/**/colorize-fixtures/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace/**'
|
||||
|
||||
// except specific file types
|
||||
'!src/vs/*/**/*.d.ts',
|
||||
'!src/typings/**/*.d.ts',
|
||||
'!extensions/**/*.d.ts',
|
||||
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,template,yaml,yml,d.ts.recipe}',
|
||||
'!build/{lib,tslintRules}/**/*.js',
|
||||
'!build/**/*.sh',
|
||||
'!build/tfs/**/*.js',
|
||||
'!**/Dockerfile',
|
||||
'!extensions/markdown/media/*.js'
|
||||
];
|
||||
|
||||
const copyrightFilter = [
|
||||
@@ -95,11 +100,13 @@ const copyrightFilter = [
|
||||
'!**/*.xpm',
|
||||
'!**/*.opts',
|
||||
'!**/*.disabled',
|
||||
'!**/*.code-workspace',
|
||||
'!build/**/*.init',
|
||||
'!resources/linux/snap/snapcraft.yaml',
|
||||
'!resources/win32/bin/code.js',
|
||||
'!extensions/markdown/media/tomorrow.css',
|
||||
'!extensions/html/server/src/modes/typescript/*'
|
||||
'!extensions/markdown-language-features/media/tomorrow.css',
|
||||
'!extensions/html-language-features/server/src/modes/typescript/*',
|
||||
'!extensions/*/server/bin/*'
|
||||
];
|
||||
|
||||
const eslintFilter = [
|
||||
@@ -110,8 +117,8 @@ const eslintFilter = [
|
||||
'!src/vs/nls.js',
|
||||
'!src/vs/css.build.js',
|
||||
'!src/vs/nls.build.js',
|
||||
'!src/**/winjs.base.raw.js',
|
||||
'!src/**/raw.marked.js',
|
||||
'!src/**/winjs.base.js',
|
||||
'!src/**/marked.js',
|
||||
'!**/test/**'
|
||||
];
|
||||
|
||||
@@ -124,16 +131,17 @@ const tslintFilter = [
|
||||
'!**/node_modules/**',
|
||||
'!extensions/typescript/test/colorize-fixtures/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace/**',
|
||||
'!extensions/vscode-api-tests/testWorkspace2/**',
|
||||
'!extensions/**/*.test.ts',
|
||||
'!extensions/html/server/lib/jquery.d.ts'
|
||||
'!extensions/html-language-features/server/lib/jquery.d.ts'
|
||||
];
|
||||
|
||||
const copyrightHeader = [
|
||||
const copyrightHeaderLines = [
|
||||
'/*---------------------------------------------------------------------------------------------',
|
||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||
' * Licensed under the Source EULA. See License.txt in the project root for license information.',
|
||||
' *--------------------------------------------------------------------------------------------*/'
|
||||
].join('\n');
|
||||
];
|
||||
|
||||
gulp.task('eslint', () => {
|
||||
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
||||
@@ -144,31 +152,23 @@ gulp.task('eslint', () => {
|
||||
});
|
||||
|
||||
gulp.task('tslint', () => {
|
||||
// {{SQL CARBON EDIT}}
|
||||
const options = { emitError: false };
|
||||
|
||||
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
||||
.pipe(filter(tslintFilter))
|
||||
.pipe(gulptslint({ rulesDirectory: 'build/lib/tslint' }))
|
||||
.pipe(gulptslint.report(options));
|
||||
.pipe(gulptslint.default({ rulesDirectory: 'build/lib/tslint' }))
|
||||
.pipe(gulptslint.default.report(options));
|
||||
});
|
||||
|
||||
const hygiene = exports.hygiene = (some, options) => {
|
||||
options = options || {};
|
||||
function hygiene(some) {
|
||||
let errorCount = 0;
|
||||
|
||||
const eol = es.through(function (file) {
|
||||
if (/\r\n?/g.test(file.contents.toString('utf8'))) {
|
||||
console.error(file.relative + ': Bad EOL found');
|
||||
errorCount++;
|
||||
}
|
||||
|
||||
this.emit('data', file);
|
||||
});
|
||||
|
||||
const indentation = es.through(function (file) {
|
||||
file.contents
|
||||
.toString('utf8')
|
||||
.split(/\r\n|\r|\n/)
|
||||
const lines = file.contents.toString('utf8').split(/\r\n|\r|\n/);
|
||||
file.__lines = lines;
|
||||
|
||||
lines
|
||||
.forEach((line, i) => {
|
||||
if (/^\s*$/.test(line)) {
|
||||
// empty or whitespace lines are OK
|
||||
@@ -186,9 +186,14 @@ const hygiene = exports.hygiene = (some, options) => {
|
||||
});
|
||||
|
||||
const copyrights = es.through(function (file) {
|
||||
if (file.contents.toString('utf8').indexOf(copyrightHeader) !== 0) {
|
||||
console.error(file.relative + ': Missing or bad copyright statement');
|
||||
errorCount++;
|
||||
const lines = file.__lines;
|
||||
|
||||
for (let i = 0; i < copyrightHeaderLines.length; i++) {
|
||||
if (lines[i] !== copyrightHeaderLines[i]) {
|
||||
console.error(file.relative + ': Missing or bad copyright statement');
|
||||
errorCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.emit('data', file);
|
||||
@@ -196,12 +201,25 @@ const hygiene = exports.hygiene = (some, options) => {
|
||||
|
||||
const formatting = es.map(function (file, cb) {
|
||||
tsfmt.processString(file.path, file.contents.toString('utf8'), {
|
||||
verify: true,
|
||||
verify: false,
|
||||
tsfmt: true,
|
||||
// verbose: true
|
||||
// verbose: true,
|
||||
// keep checkJS happy
|
||||
editorconfig: undefined,
|
||||
replace: undefined,
|
||||
tsconfig: undefined,
|
||||
tsconfigFile: undefined,
|
||||
tslint: undefined,
|
||||
tslintFile: undefined,
|
||||
tsfmtFile: undefined,
|
||||
vscode: undefined,
|
||||
vscodeFile: undefined
|
||||
}).then(result => {
|
||||
if (result.error) {
|
||||
console.error(result.message);
|
||||
let original = result.src.replace(/\r\n/gm, '\n');
|
||||
let formatted = result.dest.replace(/\r\n/gm, '\n');
|
||||
|
||||
if (original !== formatted) {
|
||||
console.error('File not formatted:', file.relative);
|
||||
errorCount++;
|
||||
}
|
||||
cb(null, file);
|
||||
@@ -211,43 +229,31 @@ const hygiene = exports.hygiene = (some, options) => {
|
||||
});
|
||||
});
|
||||
|
||||
function reportFailures(failures) {
|
||||
failures.forEach(failure => {
|
||||
const name = failure.name || failure.fileName;
|
||||
const position = failure.startPosition;
|
||||
const line = position.lineAndCharacter ? position.lineAndCharacter.line : position.line;
|
||||
const character = position.lineAndCharacter ? position.lineAndCharacter.character : position.character;
|
||||
|
||||
// console.error(`${name}:${line + 1}:${character + 1}:${failure.failure}`);
|
||||
});
|
||||
}
|
||||
const tslintConfiguration = tslint.Configuration.findConfiguration('tslint.json', '.');
|
||||
const tslintOptions = { fix: false, formatter: 'json' };
|
||||
const tsLinter = new tslint.Linter(tslintOptions);
|
||||
|
||||
const tsl = es.through(function (file) {
|
||||
const configuration = tslint.Configuration.findConfiguration(null, '.');
|
||||
const options = { formatter: 'json', rulesDirectory: 'build/lib/tslint' };
|
||||
const contents = file.contents.toString('utf8');
|
||||
const linter = new tslint.Linter(options);
|
||||
linter.lint(file.relative, contents, configuration.results);
|
||||
const result = linter.getResult();
|
||||
|
||||
if (result.failures.length > 0) {
|
||||
reportFailures(result.failures);
|
||||
errorCount += result.failures.length;
|
||||
}
|
||||
|
||||
tsLinter.lint(file.relative, contents, tslintConfiguration.results);
|
||||
this.emit('data', file);
|
||||
});
|
||||
|
||||
const result = vfs.src(some || all, { base: '.', follow: true, allowEmpty: true })
|
||||
let input;
|
||||
|
||||
if (Array.isArray(some) || typeof some === 'string' || !some) {
|
||||
input = vfs.src(some || all, { base: '.', follow: true, allowEmpty: true });
|
||||
} else {
|
||||
input = some;
|
||||
}
|
||||
|
||||
const result = input
|
||||
.pipe(filter(f => !f.stat.isDirectory()))
|
||||
.pipe(filter(eolFilter))
|
||||
// {{SQL CARBON EDIT}}
|
||||
//.pipe(options.skipEOL ? es.through() : eol)
|
||||
.pipe(filter(indentationFilter))
|
||||
.pipe(indentation)
|
||||
.pipe(filter(copyrightFilter))
|
||||
.pipe(filter(copyrightFilter));
|
||||
// {{SQL CARBON EDIT}}
|
||||
//.pipe(copyrights);
|
||||
// .pipe(copyrights);
|
||||
|
||||
const typescript = result
|
||||
.pipe(filter(tslintFilter))
|
||||
@@ -257,23 +263,52 @@ const hygiene = exports.hygiene = (some, options) => {
|
||||
const javascript = result
|
||||
.pipe(filter(eslintFilter))
|
||||
.pipe(gulpeslint('src/.eslintrc'))
|
||||
.pipe(gulpeslint.formatEach('compact'))
|
||||
// {{SQL CARBON EDIT}}
|
||||
.pipe(gulpeslint.formatEach('compact'));
|
||||
// {{SQL CARBON EDIT}}
|
||||
// .pipe(gulpeslint.failAfterError());
|
||||
|
||||
return es.merge(typescript, javascript)
|
||||
.pipe(es.through(null, function () {
|
||||
// {{SQL CARBON EDIT}}
|
||||
// if (errorCount > 0) {
|
||||
// this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
|
||||
// } else {
|
||||
// this.emit('end');
|
||||
// }
|
||||
this.emit('end');
|
||||
}));
|
||||
};
|
||||
let count = 0;
|
||||
return es.merge(typescript, javascript)
|
||||
.pipe(es.through(function (data) {
|
||||
// {{SQL CARBON EDIT}}
|
||||
this.emit('end');
|
||||
}));
|
||||
}
|
||||
|
||||
gulp.task('hygiene', () => hygiene(''));
|
||||
function createGitIndexVinyls(paths) {
|
||||
const cp = require('child_process');
|
||||
const repositoryPath = process.cwd();
|
||||
|
||||
const fns = paths.map(relativePath => () => new Promise((c, e) => {
|
||||
const fullPath = path.join(repositoryPath, relativePath);
|
||||
|
||||
fs.stat(fullPath, (err, stat) => {
|
||||
if (err && err.code === 'ENOENT') { // ignore deletions
|
||||
return c(null);
|
||||
} else if (err) {
|
||||
return e(err);
|
||||
}
|
||||
|
||||
cp.exec(`git show :${relativePath}`, { maxBuffer: 2000 * 1024, encoding: 'buffer' }, (err, out) => {
|
||||
if (err) {
|
||||
return e(err);
|
||||
}
|
||||
|
||||
c(new VinylFile({
|
||||
path: fullPath,
|
||||
base: repositoryPath,
|
||||
contents: out,
|
||||
stat
|
||||
}));
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
return pall(fns, { concurrency: 4 })
|
||||
.then(r => r.filter(p => !!p));
|
||||
}
|
||||
|
||||
gulp.task('hygiene', () => hygiene());
|
||||
|
||||
// this allows us to run hygiene as a git pre-commit hook
|
||||
if (require.main === module) {
|
||||
@@ -284,22 +319,19 @@ if (require.main === module) {
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
cp.exec('git config core.autocrlf', (err, out) => {
|
||||
const skipEOL = out.trim() === 'true';
|
||||
|
||||
if (process.argv.length > 2) {
|
||||
return hygiene(process.argv.slice(2), { skipEOL: skipEOL }).on('error', err => {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
if (process.argv.length > 2) {
|
||||
hygiene(process.argv.slice(2)).on('error', err => {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
} else {
|
||||
cp.exec('git diff --cached --name-only', { maxBuffer: 2000 * 1024 }, (err, out) => {
|
||||
if (err) {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
const some = out
|
||||
@@ -307,12 +339,18 @@ if (require.main === module) {
|
||||
.filter(l => !!l);
|
||||
|
||||
if (some.length > 0) {
|
||||
hygiene(some, { skipEOL: skipEOL }).on('error', err => {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
console.log('Reading git index versions...');
|
||||
|
||||
createGitIndexVinyls(some)
|
||||
.then(vinyls => new Promise((c, e) => hygiene(es.readArray(vinyls))
|
||||
.on('end', () => c())
|
||||
.on('error', e)))
|
||||
.catch(err => {
|
||||
console.error();
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,21 @@
|
||||
'use strict';
|
||||
|
||||
const gulp = require('gulp');
|
||||
const json = require('gulp-json-editor');
|
||||
const buffer = require('gulp-buffer');
|
||||
const filter = require('gulp-filter');
|
||||
const es = require('event-stream');
|
||||
const util = require('./lib/util');
|
||||
const remote = require('gulp-remote-src');
|
||||
const zip = require('gulp-vinyl-zip');
|
||||
const assign = require('object-assign');
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
const jeditor = require('gulp-json-editor');
|
||||
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const pkg = require('../package.json');
|
||||
|
||||
gulp.task('mixin', function () {
|
||||
// {{SQL CARBON EDIT}}
|
||||
const updateUrl = process.env['SQLOPS_UPDATEURL'];
|
||||
@@ -25,9 +37,9 @@ gulp.task('mixin', function () {
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
let serviceUrl = 'https://raw.githubusercontent.com/Microsoft/sqlopsstudio/release/extensions/extensionsGallery.json';
|
||||
let serviceUrl = 'https://sqlopsextensions.blob.core.windows.net/marketplace/v1/extensionsGallery.json';
|
||||
if (quality === 'insider') {
|
||||
serviceUrl = `https://raw.githubusercontent.com/Microsoft/sqlopsstudio/release/extensions/extensionsGallery-${quality}.json`;
|
||||
serviceUrl = `https://sqlopsextensions.blob.core.windows.net/marketplace/v1/extensionsGallery-${quality}.json`;
|
||||
}
|
||||
let newValues = {
|
||||
"updateUrl": updateUrl,
|
||||
|
||||
@@ -13,14 +13,6 @@ const filter = require('gulp-filter');
|
||||
|
||||
gulp.task('clean-mssql-extension', util.rimraf('extensions/mssql/node_modules'));
|
||||
gulp.task('clean-credentials-extension', util.rimraf('extensions/credentials/node_modules'));
|
||||
gulp.task('clean-extensions-modules', util.rimraf('extensions-modules/node_modules'));
|
||||
gulp.task('clean-protocol', ['clean-extensions-modules', 'clean-mssql-extension', 'clean-credentials-extension', 'clean-client', 'clean-jsonrpc', 'clean-server', 'clean-types']);
|
||||
|
||||
// Tasks to clean extensions modules
|
||||
gulp.task('clean-mssql-ext-mod', util.rimraf('extensions/mssql/node_modules/extensions-modules'));
|
||||
gulp.task('clean-credentials-ext-mod', util.rimraf('extensions/credentials/node_modules/extensions-modules'));
|
||||
gulp.task('clean-build-ext-mod', util.rimraf('build/node_modules/extensions-modules'));
|
||||
gulp.task('clean-ext-mod', ['clean-mssql-ext-mod', 'clean-credentials-ext-mod', 'clean-build-ext-mod', 'clean-extensions-modules']);
|
||||
|
||||
gulp.task('fmt', () => formatStagedFiles());
|
||||
const formatFiles = (some) => {
|
||||
|
||||
@@ -27,17 +27,22 @@ const common = require('./lib/optimize');
|
||||
const nlsDev = require('vscode-nls-dev');
|
||||
const root = path.dirname(__dirname);
|
||||
const commit = util.getVersion(root);
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const packageJson = require('../package.json');
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const product = require('../product.json');
|
||||
const crypto = require('crypto');
|
||||
const i18n = require('./lib/i18n');
|
||||
const serviceInstaller = require('../extensions-modules/lib/languageservice/serviceInstallerUtil');
|
||||
// {{SQL CARBON EDIT}}
|
||||
const serviceDownloader = require('service-downloader').ServiceDownloadProvider;
|
||||
const platformInfo = require('service-downloader/out/platform').PlatformInformation;
|
||||
const glob = require('glob');
|
||||
const deps = require('./dependencies');
|
||||
const getElectronVersion = require('./lib/electron').getElectronVersion;
|
||||
const createAsar = require('./lib/asar').createAsar;
|
||||
|
||||
const productionDependencies = deps.getProductionDependencies(path.dirname(__dirname));
|
||||
|
||||
// @ts-ignore
|
||||
// {{SQL CARBON EDIT}}
|
||||
var del = require('del');
|
||||
const extensionsRoot = path.join(root, 'extensions');
|
||||
@@ -55,16 +60,16 @@ const nodeModules = [
|
||||
.concat(_.uniq(productionDependencies.map(d => d.name)))
|
||||
.concat(baseModules);
|
||||
|
||||
// Build
|
||||
|
||||
const builtInExtensions = [
|
||||
{ name: 'ms-vscode.node-debug', version: '1.19.8' },
|
||||
{ name: 'ms-vscode.node-debug2', version: '1.19.4' }
|
||||
];
|
||||
// Build
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const builtInExtensions = require('./builtInExtensions.json');
|
||||
|
||||
const excludedExtensions = [
|
||||
'vscode-api-tests',
|
||||
'vscode-colorize-tests'
|
||||
'vscode-colorize-tests',
|
||||
'ms-vscode.node-debug',
|
||||
'ms-vscode.node-debug2',
|
||||
];
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
@@ -72,7 +77,8 @@ const vsce = require('vsce');
|
||||
const sqlBuiltInExtensions = [
|
||||
// Add SQL built-in extensions here.
|
||||
// the extension will be excluded from SQLOps package and will have separate vsix packages
|
||||
'agent'
|
||||
'agent',
|
||||
'profiler'
|
||||
];
|
||||
|
||||
const vscodeEntryPoints = _.flatten([
|
||||
@@ -85,25 +91,28 @@ const vscodeEntryPoints = _.flatten([
|
||||
const vscodeResources = [
|
||||
'out-build/main.js',
|
||||
'out-build/cli.js',
|
||||
'out-build/driver.js',
|
||||
'out-build/bootstrap.js',
|
||||
'out-build/bootstrap-amd.js',
|
||||
'out-build/paths.js',
|
||||
'out-build/vs/**/*.{svg,png,cur,html}',
|
||||
'out-build/vs/base/common/performance.js',
|
||||
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,ps-win.ps1}',
|
||||
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh}',
|
||||
'out-build/vs/base/browser/ui/octiconLabel/octicons/**',
|
||||
'out-build/vs/workbench/browser/media/*-theme.css',
|
||||
'out-build/vs/workbench/electron-browser/bootstrap/**',
|
||||
'out-build/vs/workbench/parts/debug/**/*.json',
|
||||
'out-build/vs/workbench/parts/execution/**/*.scpt',
|
||||
'out-build/vs/workbench/parts/html/browser/webview-pre.js',
|
||||
'out-build/vs/workbench/parts/webview/electron-browser/webview-pre.js',
|
||||
'out-build/vs/**/markdown.css',
|
||||
'out-build/vs/workbench/parts/tasks/**/*.json',
|
||||
'out-build/vs/workbench/parts/terminal/electron-browser/terminalProcess.js',
|
||||
'out-build/vs/workbench/parts/welcome/walkThrough/**/*.md',
|
||||
'out-build/vs/workbench/services/files/**/*.exe',
|
||||
'out-build/vs/workbench/services/files/**/*.md',
|
||||
'out-build/vs/code/electron-browser/sharedProcess.js',
|
||||
'out-build/vs/code/electron-browser/sharedProcess/sharedProcess.js',
|
||||
'out-build/vs/code/electron-browser/issue/issueReporter.js',
|
||||
'out-build/vs/code/electron-browser/processExplorer/processExplorer.js',
|
||||
// {{SQL CARBON EDIT}}
|
||||
'out-build/sql/workbench/electron-browser/splashscreen/*',
|
||||
'out-build/sql/**/*.{svg,png,cur,html}',
|
||||
@@ -133,10 +142,7 @@ const BUNDLED_FILE_HEADER = [
|
||||
' *--------------------------------------------------------*/'
|
||||
].join('\n');
|
||||
|
||||
var languages = ['chs', 'cht', 'jpn', 'kor', 'deu', 'fra', 'esn', 'rus', 'ita'];
|
||||
if (process.env.VSCODE_QUALITY !== 'stable') {
|
||||
languages = languages.concat(['ptb', 'hun', 'trk']); // Add languages requested by the community to non-stable builds
|
||||
}
|
||||
const languages = i18n.defaultLanguages.concat([]); // i18n.defaultLanguages.concat(process.env.VSCODE_QUALITY !== 'stable' ? i18n.extraLanguages : []);
|
||||
|
||||
gulp.task('clean-optimized-vscode', util.rimraf('out-vscode'));
|
||||
gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compile-extensions-build'], common.optimizeTask({
|
||||
@@ -146,7 +152,8 @@ gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compil
|
||||
loaderConfig: common.loaderConfig(nodeModules),
|
||||
header: BUNDLED_FILE_HEADER,
|
||||
out: 'out-vscode',
|
||||
languages: languages
|
||||
languages: languages,
|
||||
bundleInfo: undefined
|
||||
}));
|
||||
|
||||
|
||||
@@ -168,7 +175,7 @@ const config = {
|
||||
version: getElectronVersion(),
|
||||
productAppName: product.nameLong,
|
||||
companyName: 'Microsoft Corporation',
|
||||
copyright: 'Copyright (C) 2017 Microsoft. All rights reserved',
|
||||
copyright: 'Copyright (C) 2018 Microsoft. All rights reserved',
|
||||
darwinIcon: 'resources/darwin/code.icns',
|
||||
darwinBundleIdentifier: product.darwinBundleIdentifier,
|
||||
darwinApplicationCategoryType: 'public.app-category.developer-tools',
|
||||
@@ -187,7 +194,7 @@ const config = {
|
||||
name: product.nameLong,
|
||||
urlSchemes: [product.urlProtocol]
|
||||
}],
|
||||
darwinCredits: darwinCreditsTemplate ? new Buffer(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
|
||||
darwinCredits: darwinCreditsTemplate ? Buffer.from(darwinCreditsTemplate({ commit: commit, date: new Date().toISOString() })) : void 0,
|
||||
linuxExecutableName: product.applicationName,
|
||||
winIcon: 'resources/win32/code.ico',
|
||||
token: process.env['VSCODE_MIXIN_PASSWORD'] || process.env['GITHUB_TOKEN'] || void 0,
|
||||
@@ -325,16 +332,12 @@ function packageTask(platform, arch, opts) {
|
||||
const localExtensionDependencies = gulp.src(extensionDepsSrc, { base: '.', dot: true })
|
||||
.pipe(filter(['**', '!**/package-lock.json']))
|
||||
.pipe(util.cleanNodeModule('account-provider-azure', ['node_modules/date-utils/doc/**', 'node_modules/adal_node/node_modules/**'], undefined))
|
||||
.pipe(util.cleanNodeModule('dataprotocol-client', ['node_modules/**', 'src/*.js'], undefined))
|
||||
.pipe(util.cleanNodeModule('extensions-modules', ['node_modules/**', 'src/*.js'], undefined))
|
||||
.pipe(util.cleanNodeModule('typescript', ['**/**'], undefined));
|
||||
|
||||
|
||||
const sources = es.merge(src, localExtensions, localExtensionDependencies)
|
||||
.pipe(util.setExecutableBit(['**/*.sh']))
|
||||
.pipe(filter(['**',
|
||||
'!**/*.js.map',
|
||||
'!extensions/**/node_modules/**/{test, tests}/**',
|
||||
'!extensions/**/node_modules/**/test.js']));
|
||||
.pipe(filter(['**', '!**/*.js.map']));
|
||||
|
||||
let version = packageJson.version;
|
||||
const quality = product.quality;
|
||||
@@ -347,7 +350,7 @@ function packageTask(platform, arch, opts) {
|
||||
const packageJsonStream = gulp.src(['package.json'], { base: '.' })
|
||||
.pipe(json({ name, version }));
|
||||
|
||||
const settingsSearchBuildId = getBuildNumber();
|
||||
const settingsSearchBuildId = getSettingsSearchBuildId(packageJson);
|
||||
const date = new Date().toISOString();
|
||||
const productJsonStream = gulp.src(['product.json'], { base: '.' })
|
||||
.pipe(json({ commit, date, checksums, settingsSearchBuildId }));
|
||||
@@ -358,7 +361,7 @@ function packageTask(platform, arch, opts) {
|
||||
|
||||
// TODO the API should be copied to `out` during compile, not here
|
||||
const api = gulp.src('src/vs/vscode.d.ts').pipe(rename('out/vs/vscode.d.ts'));
|
||||
// {{SQL CARBON EDIT}}
|
||||
// {{SQL CARBON EDIT}}
|
||||
const dataApi = gulp.src('src/vs/data.d.ts').pipe(rename('out/sql/data.d.ts'));
|
||||
|
||||
const depsSrc = [
|
||||
@@ -372,6 +375,7 @@ function packageTask(platform, arch, opts) {
|
||||
.pipe(util.cleanNodeModule('oniguruma', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/*.js']))
|
||||
.pipe(util.cleanNodeModule('windows-mutex', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||
.pipe(util.cleanNodeModule('native-keymap', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node']))
|
||||
.pipe(util.cleanNodeModule('native-is-elevated', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node']))
|
||||
.pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||
.pipe(util.cleanNodeModule('spdlog', ['binding.gyp', 'build/**', 'deps/**', 'src/**', 'test/**'], ['**/*.node']))
|
||||
.pipe(util.cleanNodeModule('jschardet', ['dist/**']))
|
||||
@@ -379,18 +383,28 @@ function packageTask(platform, arch, opts) {
|
||||
.pipe(util.cleanNodeModule('windows-process-tree', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
|
||||
.pipe(util.cleanNodeModule('gc-signals', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js']))
|
||||
.pipe(util.cleanNodeModule('keytar', ['binding.gyp', 'build/**', 'src/**', 'script/**', 'node_modules/**'], ['**/*.node']))
|
||||
|
||||
.pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/*.exe', 'build/Release/*.dll', 'build/Release/*.node']))
|
||||
// {{SQL CARBON EDIT}}
|
||||
.pipe(util.cleanNodeModule('node-pty', ['binding.gyp', 'build/**', 'src/**', 'tools/**'], ['build/Release/*.node', 'build/Release/*.dll', 'build/Release/*.exe']))
|
||||
.pipe(util.cleanNodeModule('chart.js', ['node_modules/**'], undefined))
|
||||
.pipe(util.cleanNodeModule('emmet', ['node_modules/**'], undefined))
|
||||
.pipe(util.cleanNodeModule('pty.js', ['build/**'], ['build/Release/**']))
|
||||
.pipe(util.cleanNodeModule('jquery-ui', ['external/**', 'demos/**'], undefined))
|
||||
.pipe(util.cleanNodeModule('core-js', ['**/**'], undefined))
|
||||
.pipe(util.cleanNodeModule('slickgrid', ['node_modules/**', 'examples/**'], undefined))
|
||||
|
||||
.pipe(util.cleanNodeModule('nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
|
||||
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']));
|
||||
.pipe(util.cleanNodeModule('vscode-nsfw', ['binding.gyp', 'build/**', 'src/**', 'openpa/**', 'includes/**'], ['**/*.node', '**/*.a']))
|
||||
.pipe(util.cleanNodeModule('vsda', ['binding.gyp', 'README.md', 'build/**', '*.bat', '*.sh', '*.cpp', '*.h'], ['build/Release/vsda.node']))
|
||||
.pipe(createAsar(path.join(process.cwd(), 'node_modules'), ['**/*.node', '**/vscode-ripgrep/bin/*', '**/node-pty/build/Release/*'], 'app/node_modules.asar'));
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
let copiedModules = gulp.src([
|
||||
'node_modules/jquery/**/*.*',
|
||||
'node_modules/reflect-metadata/**/*.*',
|
||||
'node_modules/slickgrid/**/*.*',
|
||||
'node_modules/underscore/**/*.*',
|
||||
'node_modules/zone.js/**/*.*',
|
||||
'node_modules/chart.js/**/*.*'
|
||||
], { base: '.', dot: true });
|
||||
|
||||
let all = es.merge(
|
||||
packageJsonStream,
|
||||
@@ -398,7 +412,8 @@ function packageTask(platform, arch, opts) {
|
||||
license,
|
||||
watermark,
|
||||
api,
|
||||
// {{SQL CARBON EDIT}}
|
||||
// {{SQL CARBON EDIT}}
|
||||
copiedModules,
|
||||
dataApi,
|
||||
sources,
|
||||
deps
|
||||
@@ -469,25 +484,21 @@ gulp.task('vscode-linux-x64-min', ['minify-vscode', 'clean-vscode-linux-x64'], p
|
||||
gulp.task('vscode-linux-arm-min', ['minify-vscode', 'clean-vscode-linux-arm'], packageTask('linux', 'arm', { minified: true }));
|
||||
|
||||
// Transifex Localizations
|
||||
const vscodeLanguages = [
|
||||
'zh-hans',
|
||||
'zh-hant',
|
||||
'ja',
|
||||
'ko',
|
||||
'de',
|
||||
'fr',
|
||||
'es',
|
||||
'ru',
|
||||
'it',
|
||||
'pt-br',
|
||||
'hu',
|
||||
'tr'
|
||||
];
|
||||
const setupDefaultLanguages = [
|
||||
'zh-hans',
|
||||
'zh-hant',
|
||||
'ko'
|
||||
];
|
||||
|
||||
const innoSetupConfig = {
|
||||
'zh-cn': { codePage: 'CP936', defaultInfo: { name: 'Simplified Chinese', id: '$0804', } },
|
||||
'zh-tw': { codePage: 'CP950', defaultInfo: { name: 'Traditional Chinese', id: '$0404' } },
|
||||
'ko': { codePage: 'CP949', defaultInfo: { name: 'Korean', id: '$0412' } },
|
||||
'ja': { codePage: 'CP932' },
|
||||
'de': { codePage: 'CP1252' },
|
||||
'fr': { codePage: 'CP1252' },
|
||||
'es': { codePage: 'CP1252' },
|
||||
'ru': { codePage: 'CP1251' },
|
||||
'it': { codePage: 'CP1252' },
|
||||
'pt-br': { codePage: 'CP1252' },
|
||||
'hu': { codePage: 'CP1250' },
|
||||
'tr': { codePage: 'CP1254' }
|
||||
};
|
||||
|
||||
const apiHostname = process.env.TRANSIFEX_API_URL;
|
||||
const apiName = process.env.TRANSIFEX_API_NAME;
|
||||
@@ -495,27 +506,50 @@ const apiToken = process.env.TRANSIFEX_API_TOKEN;
|
||||
|
||||
gulp.task('vscode-translations-push', ['optimize-vscode'], function () {
|
||||
const pathToMetadata = './out-vscode/nls.metadata.json';
|
||||
const pathToExtensions = './extensions/**/*.nls.json';
|
||||
const pathToExtensions = './extensions/*';
|
||||
const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}';
|
||||
|
||||
return es.merge(
|
||||
gulp.src(pathToMetadata).pipe(i18n.prepareXlfFiles()),
|
||||
gulp.src(pathToSetup).pipe(i18n.prepareXlfFiles()),
|
||||
gulp.src(pathToExtensions).pipe(i18n.prepareXlfFiles('vscode-extensions'))
|
||||
gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),
|
||||
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
|
||||
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
|
||||
).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken)
|
||||
).pipe(i18n.pushXlfFiles(apiHostname, apiName, apiToken));
|
||||
});
|
||||
|
||||
gulp.task('vscode-translations-pull', function () {
|
||||
gulp.task('vscode-translations-push-test', ['optimize-vscode'], function () {
|
||||
const pathToMetadata = './out-vscode/nls.metadata.json';
|
||||
const pathToExtensions = './extensions/*';
|
||||
const pathToSetup = 'build/win32/**/{Default.isl,messages.en.isl}';
|
||||
|
||||
return es.merge(
|
||||
i18n.pullXlfFiles('vscode-editor', apiHostname, apiName, apiToken, vscodeLanguages),
|
||||
i18n.pullXlfFiles('vscode-workbench', apiHostname, apiName, apiToken, vscodeLanguages),
|
||||
i18n.pullXlfFiles('vscode-extensions', apiHostname, apiName, apiToken, vscodeLanguages),
|
||||
i18n.pullXlfFiles('vscode-setup', apiHostname, apiName, apiToken, setupDefaultLanguages)
|
||||
).pipe(vfs.dest('../vscode-localization'));
|
||||
gulp.src(pathToMetadata).pipe(i18n.createXlfFilesForCoreBundle()),
|
||||
gulp.src(pathToSetup).pipe(i18n.createXlfFilesForIsl()),
|
||||
gulp.src(pathToExtensions).pipe(i18n.createXlfFilesForExtensions())
|
||||
).pipe(i18n.findObsoleteResources(apiHostname, apiName, apiToken)
|
||||
).pipe(vfs.dest('../vscode-transifex-input'));
|
||||
});
|
||||
|
||||
gulp.task('vscode-translations-pull', function () {
|
||||
[...i18n.defaultLanguages, ...i18n.extraLanguages].forEach(language => {
|
||||
i18n.pullCoreAndExtensionsXlfFiles(apiHostname, apiName, apiToken, language).pipe(vfs.dest(`../vscode-localization/${language.id}/build`));
|
||||
|
||||
let includeDefault = !!innoSetupConfig[language.id].defaultInfo;
|
||||
i18n.pullSetupXlfFiles(apiHostname, apiName, apiToken, language, includeDefault).pipe(vfs.dest(`../vscode-localization/${language.id}/setup`));
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('vscode-translations-import', function () {
|
||||
return gulp.src('../vscode-localization/**/*.xlf').pipe(i18n.prepareJsonFiles()).pipe(vfs.dest('./i18n'));
|
||||
[...i18n.defaultLanguages, ...i18n.extraLanguages].forEach(language => {
|
||||
gulp.src(`../vscode-localization/${language.id}/build/*/*.xlf`)
|
||||
.pipe(i18n.prepareI18nFiles())
|
||||
.pipe(vfs.dest(`./i18n/${language.folderName}`));
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// gulp.src(`../vscode-localization/${language.id}/setup/*/*.xlf`)
|
||||
// .pipe(i18n.prepareIslFiles(language, innoSetupConfig[language.id]))
|
||||
// .pipe(vfs.dest(`./build/win32/i18n`));
|
||||
});
|
||||
});
|
||||
|
||||
// Sourcemaps
|
||||
@@ -541,20 +575,19 @@ gulp.task('upload-vscode-sourcemaps', ['minify-vscode'], () => {
|
||||
const allConfigDetailsPath = path.join(os.tmpdir(), 'configuration.json');
|
||||
gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () => {
|
||||
const branch = process.env.BUILD_SOURCEBRANCH;
|
||||
if (!branch.endsWith('/master') && branch.indexOf('/release/') < 0) {
|
||||
|
||||
if (!/\/master$/.test(branch) && branch.indexOf('/release/') < 0) {
|
||||
console.log(`Only runs on master and release branches, not ${branch}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(allConfigDetailsPath)) {
|
||||
console.error(`configuration file at ${allConfigDetailsPath} does not exist`);
|
||||
return;
|
||||
throw new Error(`configuration file at ${allConfigDetailsPath} does not exist`);
|
||||
}
|
||||
|
||||
const settingsSearchBuildId = getBuildNumber();
|
||||
const settingsSearchBuildId = getSettingsSearchBuildId(packageJson);
|
||||
if (!settingsSearchBuildId) {
|
||||
console.error('Failed to compute build number');
|
||||
return;
|
||||
throw new Error('Failed to compute build number');
|
||||
}
|
||||
|
||||
return gulp.src(allConfigDetailsPath)
|
||||
@@ -566,76 +599,19 @@ gulp.task('upload-vscode-configuration', ['generate-vscode-configuration'], () =
|
||||
}));
|
||||
});
|
||||
|
||||
function getBuildNumber() {
|
||||
const previous = getPreviousVersion(packageJson.version);
|
||||
if (!previous) {
|
||||
return 0;
|
||||
}
|
||||
function getSettingsSearchBuildId(packageJson) {
|
||||
const previous = util.getPreviousVersion(packageJson.version);
|
||||
|
||||
try {
|
||||
const out = cp.execSync(`git rev-list ${previous}..HEAD --count`);
|
||||
const count = parseInt(out.toString());
|
||||
return versionStringToNumber(packageJson.version) * 1e4 + count;
|
||||
return util.versionStringToNumber(packageJson.version) * 1e4 + count;
|
||||
} catch (e) {
|
||||
console.error('Could not determine build number: ' + e.toString());
|
||||
return 0;
|
||||
throw new Error('Could not determine build number: ' + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given 1.17.2, return 1.17.1
|
||||
* 1.18.0 => 1.17.2.
|
||||
* 2.0.0 => 1.18.0 (or the highest 1.x)
|
||||
*/
|
||||
function getPreviousVersion(versionStr) {
|
||||
function tagExists(tagName) {
|
||||
try {
|
||||
cp.execSync(`git rev-parse ${tagName}`, { stdio: 'ignore' });
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getLastTagFromBase(semverArr, componentToTest) {
|
||||
const baseVersion = semverArr.join('.');
|
||||
if (!tagExists(baseVersion)) {
|
||||
console.error('Failed to find tag for base version, ' + baseVersion);
|
||||
return null;
|
||||
}
|
||||
|
||||
let goodTag;
|
||||
do {
|
||||
goodTag = semverArr.join('.');
|
||||
semverArr[componentToTest]++;
|
||||
} while (tagExists(semverArr.join('.')));
|
||||
|
||||
return goodTag;
|
||||
}
|
||||
|
||||
const semverArr = versionStr.split('.');
|
||||
if (semverArr[2] > 0) {
|
||||
semverArr[2]--;
|
||||
return semverArr.join('.');
|
||||
} else if (semverArr[1] > 0) {
|
||||
semverArr[1]--;
|
||||
return getLastTagFromBase(semverArr, 2);
|
||||
} else {
|
||||
semverArr[0]--;
|
||||
return getLastTagFromBase(semverArr, 1);
|
||||
}
|
||||
}
|
||||
|
||||
function versionStringToNumber(versionStr) {
|
||||
const semverRegex = /(\d+)\.(\d+)\.(\d+)/;
|
||||
const match = versionStr.match(semverRegex);
|
||||
if (!match) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return parseInt(match[1], 10) * 1e4 + parseInt(match[2], 10) * 1e2 + parseInt(match[3], 10);
|
||||
}
|
||||
|
||||
// This task is only run for the MacOS build
|
||||
gulp.task('generate-vscode-configuration', () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const buildDir = process.env['AGENT_BUILDDIRECTORY'];
|
||||
@@ -645,7 +621,8 @@ gulp.task('generate-vscode-configuration', () => {
|
||||
|
||||
const userDataDir = path.join(os.tmpdir(), 'tmpuserdata');
|
||||
const extensionsDir = path.join(os.tmpdir(), 'tmpextdir');
|
||||
const appPath = path.join(buildDir, 'VSCode-darwin/Visual\\ Studio\\ Code\\ -\\ Insiders.app/Contents/Resources/app/bin/code');
|
||||
const appName = process.env.VSCODE_QUALITY === 'insider' ? 'Visual\\ Studio\\ Code\\ -\\ Insiders.app' : 'Visual\\ Studio\\ Code.app';
|
||||
const appPath = path.join(buildDir, `VSCode-darwin/${appName}/Contents/Resources/app/bin/code`);
|
||||
const codeProc = cp.exec(`${appPath} --export-default-configuration='${allConfigDetailsPath}' --wait --user-data-dir='${userDataDir}' --extensions-dir='${extensionsDir}'`);
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
@@ -665,36 +642,31 @@ gulp.task('generate-vscode-configuration', () => {
|
||||
clearTimeout(timer);
|
||||
reject(err);
|
||||
});
|
||||
}).catch(e => {
|
||||
// Don't fail the build
|
||||
console.error(e.toString());
|
||||
});
|
||||
});
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// Install service locally before building carbon
|
||||
|
||||
function installService(extObj, path) {
|
||||
var installer = new serviceInstaller.ServiceInstaller(extObj, path);
|
||||
installer.getServiceInstallDirectoryRoot().then(serviceInstallFolder => {
|
||||
console.log('Cleaning up the install folder: ' + serviceInstallFolder);
|
||||
del(serviceInstallFolder + '/*').then(() => {
|
||||
console.log('Installing the service. Install folder: ' + serviceInstallFolder);
|
||||
installer.installService();
|
||||
}, delError => {
|
||||
console.log('failed to delete the install folder error: ' + delError);
|
||||
});
|
||||
}, getFolderPathError => {
|
||||
console.log('failed to call getServiceInstallDirectoryRoot error: ' + getFolderPathError);
|
||||
function installService() {
|
||||
let config = require('../extensions/mssql/src/config.json');
|
||||
return platformInfo.getCurrent().then(p => {
|
||||
let runtime = p.runtimeId;
|
||||
// fix path since it won't be correct
|
||||
config.installDirectory = path.join(__dirname, '../extensions/mssql/src', config.installDirectory);
|
||||
var installer = new serviceDownloader(config);
|
||||
let serviceInstallFolder = installer.getInstallDirectory(runtime);
|
||||
console.log('Cleaning up the install folder: ' + serviceInstallFolder);
|
||||
return del(serviceInstallFolder + '/*').then(() => {
|
||||
console.log('Installing the service. Install folder: ' + serviceInstallFolder);
|
||||
return installer.installService(runtime);
|
||||
}, delError => {
|
||||
console.log('failed to delete the install folder error: ' + delError);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
gulp.task('install-sqltoolsservice', () => {
|
||||
var mssqlExt = require('../extensions/mssql/client/out/models/constants');
|
||||
var extObj = new mssqlExt.Constants();
|
||||
var path = '../extensions/mssql/client/out/config.json';
|
||||
return installService(extObj, path);
|
||||
return installService();
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -12,35 +12,15 @@ const shell = require('gulp-shell');
|
||||
const es = require('event-stream');
|
||||
const vfs = require('vinyl-fs');
|
||||
const util = require('./lib/util');
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const packageJson = require('../package.json');
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const product = require('../product.json');
|
||||
const rpmDependencies = require('../resources/linux/rpm/dependencies');
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const rpmDependencies = require('../resources/linux/rpm/dependencies.json');
|
||||
|
||||
const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
|
||||
|
||||
const flatpakManifest = {
|
||||
appId: product.darwinBundleIdentifier, // We need a reverse-url style identifier.
|
||||
sdk: 'org.freedesktop.Sdk',
|
||||
runtime: 'org.freedesktop.Sdk',
|
||||
runtimeVersion: '1.4',
|
||||
base: 'io.atom.electron.BaseApp',
|
||||
baseFlatpakref: 'https://s3-us-west-2.amazonaws.com/electron-flatpak.endlessm.com/electron-base-app-master.flatpakref',
|
||||
command: product.applicationName,
|
||||
symlinks: [
|
||||
['/share/' + product.applicationName + '/bin/' + product.applicationName, '/bin/' + product.applicationName],
|
||||
],
|
||||
finishArgs: [
|
||||
'--share=ipc', '--socket=x11', // Allow showing X11 windows.
|
||||
'--share=network', // Network access (e.g. for installing extension).
|
||||
'--filesystem=host', // Allow access to the whole file system.
|
||||
'--device=dri', // Allow OpenGL rendering.
|
||||
'--filesystem=/tmp', // Needed for Chromium's single instance check.
|
||||
'--socket=pulseaudio', // Some extensions may want to play sounds...
|
||||
'--talk-name=org.freedesktop.Notifications', // ...or pop up notifications.
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
function getDebPackageArch(arch) {
|
||||
return { x64: 'amd64', ia32: 'i386', arm: 'armhf' }[arch];
|
||||
}
|
||||
@@ -111,8 +91,7 @@ function buildDebPackage(arch) {
|
||||
return shell.task([
|
||||
'chmod 755 ' + product.applicationName + '-' + debArch + '/DEBIAN/postinst ' + product.applicationName + '-' + debArch + '/DEBIAN/prerm ' + product.applicationName + '-' + debArch + '/DEBIAN/postrm',
|
||||
'mkdir -p deb',
|
||||
'fakeroot dpkg-deb -b ' + product.applicationName + '-' + debArch + ' deb',
|
||||
'dpkg-scanpackages deb /dev/null > Packages'
|
||||
'fakeroot dpkg-deb -b ' + product.applicationName + '-' + debArch + ' deb'
|
||||
], { cwd: '.build/linux/deb/' + debArch });
|
||||
}
|
||||
|
||||
@@ -220,10 +199,10 @@ function prepareSnapPackage(arch) {
|
||||
|
||||
function buildSnapPackage(arch) {
|
||||
const snapBuildPath = getSnapBuildPath(arch);
|
||||
|
||||
const snapFilename = `${product.applicationName}-${packageJson.version}-${linuxPackageRevision}-${arch}.snap`;
|
||||
return shell.task([
|
||||
`chmod +x ${snapBuildPath}/electron-launch`,
|
||||
`cd ${snapBuildPath} && snapcraft snap`
|
||||
`cd ${snapBuildPath} && snapcraft snap --output ../${snapFilename}`
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -334,10 +313,3 @@ gulp.task('vscode-linux-arm-prepare-snap', ['clean-vscode-linux-arm-snap'], prep
|
||||
gulp.task('vscode-linux-ia32-build-snap', ['vscode-linux-ia32-prepare-snap'], buildSnapPackage('ia32'));
|
||||
gulp.task('vscode-linux-x64-build-snap', ['vscode-linux-x64-prepare-snap'], buildSnapPackage('x64'));
|
||||
gulp.task('vscode-linux-arm-build-snap', ['vscode-linux-arm-prepare-snap'], buildSnapPackage('arm'));
|
||||
|
||||
gulp.task('vscode-linux-ia32-prepare-flatpak', ['clean-vscode-linux-ia32-flatpak'], prepareFlatpak('ia32'));
|
||||
gulp.task('vscode-linux-x64-prepare-flatpak', ['clean-vscode-linux-x64-flatpak'], prepareFlatpak('x64'));
|
||||
gulp.task('vscode-linux-arm-prepare-flatpak', ['clean-vscode-linux-arm-flatpak'], prepareFlatpak('arm'));
|
||||
gulp.task('vscode-linux-ia32-flatpak', ['vscode-linux-ia32-prepare-flatpak'], buildFlatpak('ia32'));
|
||||
gulp.task('vscode-linux-x64-flatpak', ['vscode-linux-x64-prepare-flatpak'], buildFlatpak('x64'));
|
||||
gulp.task('vscode-linux-arm-flatpak', ['vscode-linux-arm-prepare-flatpak'], buildFlatpak('arm'));
|
||||
|
||||
@@ -11,8 +11,11 @@ const assert = require('assert');
|
||||
const cp = require('child_process');
|
||||
const _7z = require('7zip')['7z'];
|
||||
const util = require('./lib/util');
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const pkg = require('../package.json');
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const product = require('../product.json');
|
||||
const vfs = require('vinyl-fs');
|
||||
|
||||
const repoPath = path.dirname(__dirname);
|
||||
// {{SQL CARBON EDIT}}
|
||||
@@ -91,3 +94,13 @@ gulp.task('vscode-win32-ia32-archive', ['clean-vscode-win32-ia32-archive'], arch
|
||||
|
||||
gulp.task('clean-vscode-win32-x64-archive', util.rimraf(zipDir('x64')));
|
||||
gulp.task('vscode-win32-x64-archive', ['clean-vscode-win32-x64-archive'], archiveWin32Setup('x64'));
|
||||
|
||||
function copyInnoUpdater(arch) {
|
||||
return () => {
|
||||
return gulp.src('build/win32/{inno_updater.exe,vcruntime140.dll}', { base: 'build/win32' })
|
||||
.pipe(vfs.dest(path.join(buildPath(arch), 'tools')));
|
||||
};
|
||||
}
|
||||
|
||||
gulp.task('vscode-win32-ia32-copy-inno-updater', copyInnoUpdater('ia32'));
|
||||
gulp.task('vscode-win32-x64-copy-inno-updater', copyInnoUpdater('x64'));
|
||||
118
build/lib/asar.js
Normal file
118
build/lib/asar.js
Normal file
@@ -0,0 +1,118 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var path = require("path");
|
||||
var es = require("event-stream");
|
||||
var pickle = require("chromium-pickle-js");
|
||||
var Filesystem = require("asar/lib/filesystem");
|
||||
var VinylFile = require("vinyl");
|
||||
var minimatch = require("minimatch");
|
||||
function createAsar(folderPath, unpackGlobs, destFilename) {
|
||||
var shouldUnpackFile = function (file) {
|
||||
for (var i = 0; i < unpackGlobs.length; i++) {
|
||||
if (minimatch(file.relative, unpackGlobs[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var filesystem = new Filesystem(folderPath);
|
||||
var out = [];
|
||||
// Keep track of pending inserts
|
||||
var pendingInserts = 0;
|
||||
var onFileInserted = function () { pendingInserts--; };
|
||||
// Do not insert twice the same directory
|
||||
var seenDir = {};
|
||||
var insertDirectoryRecursive = function (dir) {
|
||||
if (seenDir[dir]) {
|
||||
return;
|
||||
}
|
||||
var lastSlash = dir.lastIndexOf('/');
|
||||
if (lastSlash === -1) {
|
||||
lastSlash = dir.lastIndexOf('\\');
|
||||
}
|
||||
if (lastSlash !== -1) {
|
||||
insertDirectoryRecursive(dir.substring(0, lastSlash));
|
||||
}
|
||||
seenDir[dir] = true;
|
||||
filesystem.insertDirectory(dir);
|
||||
};
|
||||
var insertDirectoryForFile = function (file) {
|
||||
var lastSlash = file.lastIndexOf('/');
|
||||
if (lastSlash === -1) {
|
||||
lastSlash = file.lastIndexOf('\\');
|
||||
}
|
||||
if (lastSlash !== -1) {
|
||||
insertDirectoryRecursive(file.substring(0, lastSlash));
|
||||
}
|
||||
};
|
||||
var insertFile = function (relativePath, stat, shouldUnpack) {
|
||||
insertDirectoryForFile(relativePath);
|
||||
pendingInserts++;
|
||||
filesystem.insertFile(relativePath, shouldUnpack, { stat: stat }, {}, onFileInserted);
|
||||
};
|
||||
return es.through(function (file) {
|
||||
if (file.stat.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
if (!file.stat.isFile()) {
|
||||
throw new Error("unknown item in stream!");
|
||||
}
|
||||
var shouldUnpack = shouldUnpackFile(file);
|
||||
insertFile(file.relative, { size: file.contents.length, mode: file.stat.mode }, shouldUnpack);
|
||||
if (shouldUnpack) {
|
||||
// The file goes outside of xx.asar, in a folder xx.asar.unpacked
|
||||
var relative = path.relative(folderPath, file.path);
|
||||
this.queue(new VinylFile({
|
||||
cwd: folderPath,
|
||||
base: folderPath,
|
||||
path: path.join(destFilename + '.unpacked', relative),
|
||||
stat: file.stat,
|
||||
contents: file.contents
|
||||
}));
|
||||
}
|
||||
else {
|
||||
// The file goes inside of xx.asar
|
||||
out.push(file.contents);
|
||||
}
|
||||
}, function () {
|
||||
var _this = this;
|
||||
var finish = function () {
|
||||
{
|
||||
var headerPickle = pickle.createEmpty();
|
||||
headerPickle.writeString(JSON.stringify(filesystem.header));
|
||||
var headerBuf = headerPickle.toBuffer();
|
||||
var sizePickle = pickle.createEmpty();
|
||||
sizePickle.writeUInt32(headerBuf.length);
|
||||
var sizeBuf = sizePickle.toBuffer();
|
||||
out.unshift(headerBuf);
|
||||
out.unshift(sizeBuf);
|
||||
}
|
||||
var contents = Buffer.concat(out);
|
||||
out.length = 0;
|
||||
_this.queue(new VinylFile({
|
||||
cwd: folderPath,
|
||||
base: folderPath,
|
||||
path: destFilename,
|
||||
contents: contents
|
||||
}));
|
||||
_this.queue(null);
|
||||
};
|
||||
// Call finish() only when all file inserts have finished...
|
||||
if (pendingInserts === 0) {
|
||||
finish();
|
||||
}
|
||||
else {
|
||||
onFileInserted = function () {
|
||||
pendingInserts--;
|
||||
if (pendingInserts === 0) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.createAsar = createAsar;
|
||||
131
build/lib/asar.ts
Normal file
131
build/lib/asar.ts
Normal file
@@ -0,0 +1,131 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as es from 'event-stream';
|
||||
import * as pickle from 'chromium-pickle-js';
|
||||
import * as Filesystem from 'asar/lib/filesystem';
|
||||
import * as VinylFile from 'vinyl';
|
||||
import * as minimatch from 'minimatch';
|
||||
|
||||
export function createAsar(folderPath: string, unpackGlobs: string[], destFilename: string): NodeJS.ReadWriteStream {
|
||||
|
||||
const shouldUnpackFile = (file: VinylFile): boolean => {
|
||||
for (let i = 0; i < unpackGlobs.length; i++) {
|
||||
if (minimatch(file.relative, unpackGlobs[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const filesystem = new Filesystem(folderPath);
|
||||
const out: Buffer[] = [];
|
||||
|
||||
// Keep track of pending inserts
|
||||
let pendingInserts = 0;
|
||||
let onFileInserted = () => { pendingInserts--; };
|
||||
|
||||
// Do not insert twice the same directory
|
||||
const seenDir: { [key: string]: boolean; } = {};
|
||||
const insertDirectoryRecursive = (dir: string) => {
|
||||
if (seenDir[dir]) {
|
||||
return;
|
||||
}
|
||||
|
||||
let lastSlash = dir.lastIndexOf('/');
|
||||
if (lastSlash === -1) {
|
||||
lastSlash = dir.lastIndexOf('\\');
|
||||
}
|
||||
if (lastSlash !== -1) {
|
||||
insertDirectoryRecursive(dir.substring(0, lastSlash));
|
||||
}
|
||||
seenDir[dir] = true;
|
||||
filesystem.insertDirectory(dir);
|
||||
};
|
||||
|
||||
const insertDirectoryForFile = (file: string) => {
|
||||
let lastSlash = file.lastIndexOf('/');
|
||||
if (lastSlash === -1) {
|
||||
lastSlash = file.lastIndexOf('\\');
|
||||
}
|
||||
if (lastSlash !== -1) {
|
||||
insertDirectoryRecursive(file.substring(0, lastSlash));
|
||||
}
|
||||
};
|
||||
|
||||
const insertFile = (relativePath: string, stat: { size: number; mode: number; }, shouldUnpack: boolean) => {
|
||||
insertDirectoryForFile(relativePath);
|
||||
pendingInserts++;
|
||||
filesystem.insertFile(relativePath, shouldUnpack, { stat: stat }, {}, onFileInserted);
|
||||
};
|
||||
|
||||
return es.through(function (file) {
|
||||
if (file.stat.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
if (!file.stat.isFile()) {
|
||||
throw new Error(`unknown item in stream!`);
|
||||
}
|
||||
const shouldUnpack = shouldUnpackFile(file);
|
||||
insertFile(file.relative, { size: file.contents.length, mode: file.stat.mode }, shouldUnpack);
|
||||
|
||||
if (shouldUnpack) {
|
||||
// The file goes outside of xx.asar, in a folder xx.asar.unpacked
|
||||
const relative = path.relative(folderPath, file.path);
|
||||
this.queue(new VinylFile({
|
||||
cwd: folderPath,
|
||||
base: folderPath,
|
||||
path: path.join(destFilename + '.unpacked', relative),
|
||||
stat: file.stat,
|
||||
contents: file.contents
|
||||
}));
|
||||
} else {
|
||||
// The file goes inside of xx.asar
|
||||
out.push(file.contents);
|
||||
}
|
||||
}, function () {
|
||||
|
||||
let finish = () => {
|
||||
{
|
||||
const headerPickle = pickle.createEmpty();
|
||||
headerPickle.writeString(JSON.stringify(filesystem.header));
|
||||
const headerBuf = headerPickle.toBuffer();
|
||||
|
||||
const sizePickle = pickle.createEmpty();
|
||||
sizePickle.writeUInt32(headerBuf.length);
|
||||
const sizeBuf = sizePickle.toBuffer();
|
||||
|
||||
out.unshift(headerBuf);
|
||||
out.unshift(sizeBuf);
|
||||
}
|
||||
|
||||
const contents = Buffer.concat(out);
|
||||
out.length = 0;
|
||||
|
||||
this.queue(new VinylFile({
|
||||
cwd: folderPath,
|
||||
base: folderPath,
|
||||
path: destFilename,
|
||||
contents: contents
|
||||
}));
|
||||
this.queue(null);
|
||||
};
|
||||
|
||||
// Call finish() only when all file inserts have finished...
|
||||
if (pendingInserts === 0) {
|
||||
finish();
|
||||
} else {
|
||||
onFileInserted = () => {
|
||||
pendingInserts--;
|
||||
if (pendingInserts === 0) {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
122
build/lib/builtInExtensions.js
Normal file
122
build/lib/builtInExtensions.js
Normal file
@@ -0,0 +1,122 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const os = require('os');
|
||||
const mkdirp = require('mkdirp');
|
||||
const rimraf = require('rimraf');
|
||||
const es = require('event-stream');
|
||||
const rename = require('gulp-rename');
|
||||
const vfs = require('vinyl-fs');
|
||||
const ext = require('./extensions');
|
||||
const util = require('gulp-util');
|
||||
|
||||
const root = path.dirname(path.dirname(__dirname));
|
||||
// @ts-ignore Microsoft/TypeScript#21262 complains about a require of a JSON file
|
||||
const builtInExtensions = require('../builtInExtensions.json');
|
||||
const controlFilePath = path.join(os.homedir(), '.vscode-oss-dev', 'extensions', 'control.json');
|
||||
|
||||
function getExtensionPath(extension) {
|
||||
return path.join(root, '.build', 'builtInExtensions', extension.name);
|
||||
}
|
||||
|
||||
function isUpToDate(extension) {
|
||||
const packagePath = path.join(getExtensionPath(extension), 'package.json');
|
||||
|
||||
if (!fs.existsSync(packagePath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const packageContents = fs.readFileSync(packagePath, { encoding: 'utf8' });
|
||||
|
||||
try {
|
||||
const diskVersion = JSON.parse(packageContents).version;
|
||||
return (diskVersion === extension.version);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function syncMarketplaceExtension(extension) {
|
||||
if (isUpToDate(extension)) {
|
||||
util.log(util.colors.blue('[marketplace]'), `${extension.name}@${extension.version}`, util.colors.green('✔︎'));
|
||||
return es.readArray([]);
|
||||
}
|
||||
|
||||
rimraf.sync(getExtensionPath(extension));
|
||||
|
||||
return ext.fromMarketplace(extension.name, extension.version)
|
||||
.pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`))
|
||||
.pipe(vfs.dest('.build/builtInExtensions'))
|
||||
.on('end', () => util.log(util.colors.blue('[marketplace]'), extension.name, util.colors.green('✔︎')));
|
||||
}
|
||||
|
||||
function syncExtension(extension, controlState) {
|
||||
switch (controlState) {
|
||||
case 'disabled':
|
||||
util.log(util.colors.blue('[disabled]'), util.colors.gray(extension.name));
|
||||
return es.readArray([]);
|
||||
|
||||
case 'marketplace':
|
||||
return syncMarketplaceExtension(extension);
|
||||
|
||||
default:
|
||||
if (!fs.existsSync(controlState)) {
|
||||
util.log(util.colors.red(`Error: Built-in extension '${extension.name}' is configured to run from '${controlState}' but that path does not exist.`));
|
||||
return es.readArray([]);
|
||||
|
||||
} else if (!fs.existsSync(path.join(controlState, 'package.json'))) {
|
||||
util.log(util.colors.red(`Error: Built-in extension '${extension.name}' is configured to run from '${controlState}' but there is no 'package.json' file in that directory.`));
|
||||
return es.readArray([]);
|
||||
}
|
||||
|
||||
util.log(util.colors.blue('[local]'), `${extension.name}: ${util.colors.cyan(controlState)}`, util.colors.green('✔︎'));
|
||||
return es.readArray([]);
|
||||
}
|
||||
}
|
||||
|
||||
function readControlFile() {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(controlFilePath, 'utf8'));
|
||||
} catch (err) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
function writeControlFile(control) {
|
||||
mkdirp.sync(path.dirname(controlFilePath));
|
||||
fs.writeFileSync(controlFilePath, JSON.stringify(control, null, 2));
|
||||
}
|
||||
|
||||
function main() {
|
||||
util.log('Syncronizing built-in extensions...');
|
||||
util.log(`You can manage built-in extensions with the ${util.colors.cyan('--builtin')} flag`);
|
||||
|
||||
const control = readControlFile();
|
||||
const streams = [];
|
||||
|
||||
for (const extension of builtInExtensions) {
|
||||
let controlState = control[extension.name] || 'marketplace';
|
||||
control[extension.name] = controlState;
|
||||
|
||||
streams.push(syncExtension(extension, controlState));
|
||||
}
|
||||
|
||||
writeControlFile(control);
|
||||
|
||||
es.merge(streams)
|
||||
.on('error', err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
})
|
||||
.on('end', () => {
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -217,6 +217,7 @@ function removeDuplicateTSBoilerplate(destFiles) {
|
||||
{ start: /^var __metadata/, end: /^};$/ },
|
||||
{ start: /^var __param/, end: /^};$/ },
|
||||
{ start: /^var __awaiter/, end: /^};$/ },
|
||||
{ start: /^var __generator/, end: /^};$/ },
|
||||
];
|
||||
destFiles.forEach(function (destFile) {
|
||||
var SEEN_BOILERPLATE = [];
|
||||
|
||||
@@ -44,11 +44,11 @@ interface ILoaderPluginReqFunc {
|
||||
|
||||
export interface IEntryPoint {
|
||||
name: string;
|
||||
include: string[];
|
||||
exclude: string[];
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
prepend: string[];
|
||||
append: string[];
|
||||
dest: string;
|
||||
append?: string[];
|
||||
dest?: string;
|
||||
}
|
||||
|
||||
interface IEntryPointMap {
|
||||
@@ -339,6 +339,7 @@ function removeDuplicateTSBoilerplate(destFiles: IConcatFile[]): IConcatFile[] {
|
||||
{ start: /^var __metadata/, end: /^};$/ },
|
||||
{ start: /^var __param/, end: /^};$/ },
|
||||
{ start: /^var __awaiter/, end: /^};$/ },
|
||||
{ start: /^var __generator/, end: /^};$/ },
|
||||
];
|
||||
|
||||
destFiles.forEach((destFile) => {
|
||||
|
||||
@@ -22,8 +22,12 @@ var rootDir = path.join(__dirname, '../../src');
|
||||
var options = require('../../src/tsconfig.json').compilerOptions;
|
||||
options.verbose = false;
|
||||
options.sourceMap = true;
|
||||
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
|
||||
options.sourceMap = false;
|
||||
}
|
||||
options.rootDir = rootDir;
|
||||
options.sourceRoot = util.toFileUri(rootDir);
|
||||
options.newLine = /\r\n/.test(fs.readFileSync(__filename, 'utf8')) ? 'CRLF' : 'LF';
|
||||
function createCompile(build, emitError) {
|
||||
var opts = _.clone(options);
|
||||
opts.inlineSources = !!build;
|
||||
@@ -58,9 +62,13 @@ function compileTask(out, build) {
|
||||
return function () {
|
||||
var compile = createCompile(build, true);
|
||||
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'));
|
||||
// Do not write .d.ts files to disk, as they are not needed there.
|
||||
var dtsFilter = util.filter(function (data) { return !/\.d\.ts$/.test(data.path); });
|
||||
return src
|
||||
.pipe(compile())
|
||||
.pipe(dtsFilter)
|
||||
.pipe(gulp.dest(out))
|
||||
.pipe(dtsFilter.restore)
|
||||
.pipe(monacodtsTask(out, false));
|
||||
};
|
||||
}
|
||||
@@ -70,54 +78,19 @@ function watchTask(out, build) {
|
||||
var compile = createCompile(build);
|
||||
var src = es.merge(gulp.src('src/**', { base: 'src' }), gulp.src('node_modules/typescript/lib/lib.d.ts'));
|
||||
var watchSrc = watch('src/**', { base: 'src' });
|
||||
// Do not write .d.ts files to disk, as they are not needed there.
|
||||
var dtsFilter = util.filter(function (data) { return !/\.d\.ts$/.test(data.path); });
|
||||
return watchSrc
|
||||
.pipe(util.incremental(compile, src, true))
|
||||
.pipe(dtsFilter)
|
||||
.pipe(gulp.dest(out))
|
||||
.pipe(dtsFilter.restore)
|
||||
.pipe(monacodtsTask(out, true));
|
||||
};
|
||||
}
|
||||
exports.watchTask = watchTask;
|
||||
function reloadTypeScriptNodeModule() {
|
||||
var util = require('gulp-util');
|
||||
function log(message) {
|
||||
var rest = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
rest[_i - 1] = arguments[_i];
|
||||
}
|
||||
util.log.apply(util, [util.colors.cyan('[memory watch dog]'), message].concat(rest));
|
||||
}
|
||||
function heapUsed() {
|
||||
return (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2) + ' MB';
|
||||
}
|
||||
return es.through(function (data) {
|
||||
this.emit('data', data);
|
||||
}, function () {
|
||||
log('memory usage after compilation finished: ' + heapUsed());
|
||||
// It appears we are running into some variant of
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=2073
|
||||
//
|
||||
// Even though all references are dropped, some
|
||||
// optimized methods in the TS compiler end up holding references
|
||||
// to the entire TypeScript language host (>600MB)
|
||||
//
|
||||
// The idea is to force v8 to drop references to these
|
||||
// optimized methods, by "reloading" the typescript node module
|
||||
log('Reloading typescript node module...');
|
||||
var resolvedName = require.resolve('typescript');
|
||||
var originalModule = require.cache[resolvedName];
|
||||
delete require.cache[resolvedName];
|
||||
var newExports = require('typescript');
|
||||
require.cache[resolvedName] = originalModule;
|
||||
for (var prop in newExports) {
|
||||
if (newExports.hasOwnProperty(prop)) {
|
||||
originalModule.exports[prop] = newExports[prop];
|
||||
}
|
||||
}
|
||||
log('typescript node module reloaded.');
|
||||
this.emit('end');
|
||||
});
|
||||
}
|
||||
function monacodtsTask(out, isWatch) {
|
||||
var basePath = path.resolve(process.cwd(), out);
|
||||
var neededFiles = {};
|
||||
monacodts.getFilesToWatch(out).forEach(function (filePath) {
|
||||
filePath = path.normalize(filePath);
|
||||
@@ -160,7 +133,7 @@ function monacodtsTask(out, isWatch) {
|
||||
}));
|
||||
}
|
||||
resultStream = es.through(function (data) {
|
||||
var filePath = path.normalize(data.path);
|
||||
var filePath = path.normalize(path.resolve(basePath, data.relative));
|
||||
if (neededFiles[filePath]) {
|
||||
setInputFile(filePath, data.contents.toString());
|
||||
}
|
||||
|
||||
@@ -25,8 +25,12 @@ const rootDir = path.join(__dirname, '../../src');
|
||||
const options = require('../../src/tsconfig.json').compilerOptions;
|
||||
options.verbose = false;
|
||||
options.sourceMap = true;
|
||||
if (process.env['VSCODE_NO_SOURCEMAP']) { // To be used by developers in a hurry
|
||||
options.sourceMap = false;
|
||||
}
|
||||
options.rootDir = rootDir;
|
||||
options.sourceRoot = util.toFileUri(rootDir);
|
||||
options.newLine = /\r\n/.test(fs.readFileSync(__filename, 'utf8')) ? 'CRLF' : 'LF';
|
||||
|
||||
function createCompile(build: boolean, emitError?: boolean): (token?: util.ICancellationToken) => NodeJS.ReadWriteStream {
|
||||
const opts = _.clone(options);
|
||||
@@ -49,7 +53,6 @@ function createCompile(build: boolean, emitError?: boolean): (token?: util.ICanc
|
||||
.pipe(tsFilter)
|
||||
.pipe(util.loadSourcemaps())
|
||||
.pipe(ts(token))
|
||||
// .pipe(build ? reloadTypeScriptNodeModule() : es.through())
|
||||
.pipe(noDeclarationsFilter)
|
||||
.pipe(build ? nls() : es.through())
|
||||
.pipe(noDeclarationsFilter.restore)
|
||||
@@ -75,9 +78,14 @@ export function compileTask(out: string, build: boolean): () => NodeJS.ReadWrite
|
||||
gulp.src('node_modules/typescript/lib/lib.d.ts'),
|
||||
);
|
||||
|
||||
// Do not write .d.ts files to disk, as they are not needed there.
|
||||
const dtsFilter = util.filter(data => !/\.d\.ts$/.test(data.path));
|
||||
|
||||
return src
|
||||
.pipe(compile())
|
||||
.pipe(dtsFilter)
|
||||
.pipe(gulp.dest(out))
|
||||
.pipe(dtsFilter.restore)
|
||||
.pipe(monacodtsTask(out, false));
|
||||
};
|
||||
}
|
||||
@@ -93,62 +101,22 @@ export function watchTask(out: string, build: boolean): () => NodeJS.ReadWriteSt
|
||||
);
|
||||
const watchSrc = watch('src/**', { base: 'src' });
|
||||
|
||||
// Do not write .d.ts files to disk, as they are not needed there.
|
||||
const dtsFilter = util.filter(data => !/\.d\.ts$/.test(data.path));
|
||||
|
||||
return watchSrc
|
||||
.pipe(util.incremental(compile, src, true))
|
||||
.pipe(dtsFilter)
|
||||
.pipe(gulp.dest(out))
|
||||
.pipe(dtsFilter.restore)
|
||||
.pipe(monacodtsTask(out, true));
|
||||
};
|
||||
}
|
||||
|
||||
function reloadTypeScriptNodeModule(): NodeJS.ReadWriteStream {
|
||||
var util = require('gulp-util');
|
||||
function log(message: any, ...rest: any[]): void {
|
||||
util.log(util.colors.cyan('[memory watch dog]'), message, ...rest);
|
||||
}
|
||||
|
||||
function heapUsed(): string {
|
||||
return (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2) + ' MB';
|
||||
}
|
||||
|
||||
return es.through(function (data) {
|
||||
this.emit('data', data);
|
||||
}, function () {
|
||||
|
||||
log('memory usage after compilation finished: ' + heapUsed());
|
||||
|
||||
// It appears we are running into some variant of
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=2073
|
||||
//
|
||||
// Even though all references are dropped, some
|
||||
// optimized methods in the TS compiler end up holding references
|
||||
// to the entire TypeScript language host (>600MB)
|
||||
//
|
||||
// The idea is to force v8 to drop references to these
|
||||
// optimized methods, by "reloading" the typescript node module
|
||||
|
||||
log('Reloading typescript node module...');
|
||||
|
||||
var resolvedName = require.resolve('typescript');
|
||||
|
||||
var originalModule = require.cache[resolvedName];
|
||||
delete require.cache[resolvedName];
|
||||
var newExports = require('typescript');
|
||||
require.cache[resolvedName] = originalModule;
|
||||
|
||||
for (var prop in newExports) {
|
||||
if (newExports.hasOwnProperty(prop)) {
|
||||
originalModule.exports[prop] = newExports[prop];
|
||||
}
|
||||
}
|
||||
|
||||
log('typescript node module reloaded.');
|
||||
|
||||
this.emit('end');
|
||||
});
|
||||
}
|
||||
|
||||
function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
|
||||
|
||||
const basePath = path.resolve(process.cwd(), out);
|
||||
|
||||
const neededFiles: { [file: string]: boolean; } = {};
|
||||
monacodts.getFilesToWatch(out).forEach(function (filePath) {
|
||||
filePath = path.normalize(filePath);
|
||||
@@ -196,7 +164,7 @@ function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
|
||||
}
|
||||
|
||||
resultStream = es.through(function (data) {
|
||||
const filePath = path.normalize(data.path);
|
||||
const filePath = path.normalize(path.resolve(basePath, data.relative));
|
||||
if (neededFiles[filePath]) {
|
||||
setInputFile(filePath, data.contents.toString());
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,10 +46,6 @@
|
||||
"name": "vs/workbench/parts/execution",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/explorers",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/extensions",
|
||||
"project": "vscode-workbench"
|
||||
@@ -71,7 +67,11 @@
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/nps",
|
||||
"name": "vs/workbench/parts/localizations",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/logs",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
@@ -130,22 +130,42 @@
|
||||
"name": "vs/workbench/parts/update",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/url",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/watermark",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/webview",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/parts/welcome",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/actions",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/configuration",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/configurationResolver",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/crashReporter",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/dialogs",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/editor",
|
||||
"project": "vscode-workbench"
|
||||
@@ -154,6 +174,10 @@
|
||||
"name": "vs/workbench/services/extensions",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/jsonschemas",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/files",
|
||||
"project": "vscode-workbench"
|
||||
@@ -162,10 +186,6 @@
|
||||
"name": "vs/workbench/services/keybinding",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/message",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/mode",
|
||||
"project": "vscode-workbench"
|
||||
@@ -195,8 +215,8 @@
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "setup_messages",
|
||||
"project": "vscode-workbench"
|
||||
"name": "vs/workbench/services/preferences",
|
||||
"project": "vscode-preferences"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
1033
build/lib/i18n.ts
1033
build/lib/i18n.ts
File diff suppressed because it is too large
Load Diff
@@ -79,7 +79,7 @@ function isImportNode(node) {
|
||||
function fileFrom(file, contents, path) {
|
||||
if (path === void 0) { path = file.path; }
|
||||
return new File({
|
||||
contents: new Buffer(contents),
|
||||
contents: Buffer.from(contents),
|
||||
base: file.base,
|
||||
cwd: file.cwd,
|
||||
path: path
|
||||
@@ -150,13 +150,16 @@ function isImportNode(node) {
|
||||
.filter(function (d) { return d.importClause.namedBindings.kind === ts.SyntaxKind.NamespaceImport; })
|
||||
.map(function (d) { return d.importClause.namedBindings.name; })
|
||||
.concat(importEqualsDeclarations.map(function (d) { return d.name; }))
|
||||
// find read-only references to `nls`
|
||||
.map(function (n) { return service.getReferencesAtPosition(filename, n.pos + 1); })
|
||||
.flatten()
|
||||
.filter(function (r) { return !r.isWriteAccess; })
|
||||
// find the deepest call expressions AST nodes that contain those references
|
||||
.map(function (r) { return collect(sourceFile, function (n) { return isCallExpressionWithinTextSpanCollectStep(r.textSpan, n); }); })
|
||||
.map(function (a) { return lazy(a).last(); })
|
||||
.filter(function (n) { return !!n; })
|
||||
.map(function (n) { return n; })
|
||||
// only `localize` calls
|
||||
.filter(function (n) { return n.expression.kind === ts.SyntaxKind.PropertyAccessExpression && n.expression.name.getText() === 'localize'; });
|
||||
// `localize` named imports
|
||||
var allLocalizeImportDeclarations = importDeclarations
|
||||
|
||||
@@ -131,7 +131,7 @@ module nls {
|
||||
|
||||
export function fileFrom(file: File, contents: string, path: string = file.path) {
|
||||
return new File({
|
||||
contents: new Buffer(contents),
|
||||
contents: Buffer.from(contents),
|
||||
base: file.base,
|
||||
cwd: file.cwd,
|
||||
path: path
|
||||
|
||||
@@ -59,7 +59,7 @@ function loader(bundledFileHeader, bundleLoader) {
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake',
|
||||
base: '',
|
||||
contents: new Buffer(bundledFileHeader)
|
||||
contents: Buffer.from(bundledFileHeader)
|
||||
}));
|
||||
this.emit('data', data);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ function toConcatStream(bundledFileHeader, sources, dest) {
|
||||
return new VinylFile({
|
||||
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
|
||||
base: base,
|
||||
contents: new Buffer(source.contents)
|
||||
contents: Buffer.from(source.contents)
|
||||
});
|
||||
});
|
||||
return es.readArray(treatedSources)
|
||||
@@ -141,7 +141,7 @@ function optimizeTask(opts) {
|
||||
bundleInfoArray.push(new VinylFile({
|
||||
path: 'bundleInfo.json',
|
||||
base: '.',
|
||||
contents: new Buffer(JSON.stringify(result.bundleData, null, '\t'))
|
||||
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
|
||||
}));
|
||||
}
|
||||
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
||||
@@ -174,7 +174,6 @@ function optimizeTask(opts) {
|
||||
};
|
||||
}
|
||||
exports.optimizeTask = optimizeTask;
|
||||
;
|
||||
/**
|
||||
* Wrap around uglify and allow the preserveComments function
|
||||
* to have a file "context" to include our copyright only once per file.
|
||||
@@ -237,4 +236,3 @@ function minifyTask(src, sourceMapBaseUrl) {
|
||||
};
|
||||
}
|
||||
exports.minifyTask = minifyTask;
|
||||
;
|
||||
|
||||
@@ -31,7 +31,7 @@ function log(prefix: string, message: string): void {
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
export function loaderConfig(emptyPaths: string[]) {
|
||||
export function loaderConfig(emptyPaths?: string[]) {
|
||||
const result = {
|
||||
paths: {
|
||||
'vs': 'out-build/vs',
|
||||
@@ -73,7 +73,7 @@ function loader(bundledFileHeader: string, bundleLoader: boolean): NodeJS.ReadWr
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake',
|
||||
base: '',
|
||||
contents: new Buffer(bundledFileHeader)
|
||||
contents: Buffer.from(bundledFileHeader)
|
||||
}));
|
||||
this.emit('data', data);
|
||||
} else {
|
||||
@@ -117,7 +117,7 @@ function toConcatStream(bundledFileHeader: string, sources: bundle.IFile[], dest
|
||||
return new VinylFile({
|
||||
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
|
||||
base: base,
|
||||
contents: new Buffer(source.contents)
|
||||
contents: Buffer.from(source.contents)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -165,7 +165,7 @@ export interface IOptimizeTaskOpts {
|
||||
/**
|
||||
* (languages to process)
|
||||
*/
|
||||
languages: string[];
|
||||
languages: i18n.Language[];
|
||||
}
|
||||
export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStream {
|
||||
const entryPoints = opts.entryPoints;
|
||||
@@ -201,7 +201,7 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
||||
bundleInfoArray.push(new VinylFile({
|
||||
path: 'bundleInfo.json',
|
||||
base: '.',
|
||||
contents: new Buffer(JSON.stringify(result.bundleData, null, '\t'))
|
||||
contents: Buffer.from(JSON.stringify(result.bundleData, null, '\t'))
|
||||
}));
|
||||
}
|
||||
es.readArray(bundleInfoArray).pipe(bundleInfoStream);
|
||||
@@ -241,7 +241,7 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
||||
}))
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
declare class FileWithCopyright extends VinylFile {
|
||||
public __hasOurCopyright: boolean;
|
||||
@@ -295,7 +295,7 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
|
||||
return es.duplex(input, output);
|
||||
}
|
||||
|
||||
export function minifyTask(src: string, sourceMapBaseUrl: string): (cb: any) => void {
|
||||
export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) => void {
|
||||
const sourceMappingURL = sourceMapBaseUrl && (f => `${sourceMapBaseUrl}/${f.relative}.map`);
|
||||
|
||||
return cb => {
|
||||
@@ -326,4 +326,4 @@ export function minifyTask(src: string, sourceMapBaseUrl: string): (cb: any) =>
|
||||
cb(err);
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -34,7 +34,13 @@ catch (err) {
|
||||
}
|
||||
function log() {
|
||||
var errors = _.flatten(allErrors);
|
||||
errors.map(function (err) { return util.log(util.colors.red('Error') + ": " + err); });
|
||||
var seen = new Set();
|
||||
errors.map(function (err) {
|
||||
if (!seen.has(err)) {
|
||||
seen.add(err);
|
||||
util.log(util.colors.red('Error') + ": " + err);
|
||||
}
|
||||
});
|
||||
var regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
|
||||
var messages = errors
|
||||
.map(function (err) { return regex.exec(err); })
|
||||
@@ -67,8 +73,13 @@ function createReporter() {
|
||||
return es.through(null, function () {
|
||||
onEnd();
|
||||
if (emitError && errors.length > 0) {
|
||||
log();
|
||||
this.emit('error');
|
||||
errors.__logged__ = true;
|
||||
if (!errors.__logged__) {
|
||||
log();
|
||||
}
|
||||
var err = new Error("Found " + errors.length + " errors");
|
||||
err.__reporter__ = true;
|
||||
this.emit('error', err);
|
||||
}
|
||||
else {
|
||||
this.emit('end');
|
||||
@@ -80,4 +91,3 @@ function createReporter() {
|
||||
return ReportFunc;
|
||||
}
|
||||
exports.createReporter = createReporter;
|
||||
;
|
||||
|
||||
@@ -11,7 +11,7 @@ import * as util from 'gulp-util';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
const allErrors: Error[][] = [];
|
||||
const allErrors: string[][] = [];
|
||||
let startTime: number = null;
|
||||
let count = 0;
|
||||
|
||||
@@ -42,7 +42,14 @@ try {
|
||||
|
||||
function log(): void {
|
||||
const errors = _.flatten(allErrors);
|
||||
errors.map(err => util.log(`${util.colors.red('Error')}: ${err}`));
|
||||
const seen = new Set<string>();
|
||||
|
||||
errors.map(err => {
|
||||
if (!seen.has(err)) {
|
||||
seen.add(err);
|
||||
util.log(`${util.colors.red('Error')}: ${err}`);
|
||||
}
|
||||
});
|
||||
|
||||
const regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
|
||||
const messages = errors
|
||||
@@ -61,17 +68,17 @@ function log(): void {
|
||||
}
|
||||
|
||||
export interface IReporter {
|
||||
(err: Error): void;
|
||||
(err: string): void;
|
||||
hasErrors(): boolean;
|
||||
end(emitError: boolean): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
export function createReporter(): IReporter {
|
||||
const errors: Error[] = [];
|
||||
const errors: string[] = [];
|
||||
allErrors.push(errors);
|
||||
|
||||
class ReportFunc {
|
||||
constructor(err: Error) {
|
||||
constructor(err: string) {
|
||||
errors.push(err);
|
||||
}
|
||||
|
||||
@@ -87,8 +94,15 @@ export function createReporter(): IReporter {
|
||||
onEnd();
|
||||
|
||||
if (emitError && errors.length > 0) {
|
||||
log();
|
||||
this.emit('error');
|
||||
(errors as any).__logged__ = true;
|
||||
|
||||
if (!(errors as any).__logged__) {
|
||||
log();
|
||||
}
|
||||
|
||||
const err = new Error(`Found ${errors.length} errors`);
|
||||
(err as any).__reporter__ = true;
|
||||
this.emit('error', err);
|
||||
} else {
|
||||
this.emit('end');
|
||||
}
|
||||
@@ -97,4 +111,4 @@ export function createReporter(): IReporter {
|
||||
}
|
||||
|
||||
return <IReporter><any>ReportFunc;
|
||||
};
|
||||
}
|
||||
|
||||
265
build/lib/standalone.js
Normal file
265
build/lib/standalone.js
Normal file
@@ -0,0 +1,265 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var ts = require("typescript");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var REPO_ROOT = path.join(__dirname, '../../');
|
||||
var SRC_DIR = path.join(REPO_ROOT, 'src');
|
||||
var OUT_EDITOR = path.join(REPO_ROOT, 'out-editor');
|
||||
function createESMSourcesAndResources(options) {
|
||||
var OUT_FOLDER = path.join(REPO_ROOT, options.outFolder);
|
||||
var OUT_RESOURCES_FOLDER = path.join(REPO_ROOT, options.outResourcesFolder);
|
||||
var in_queue = Object.create(null);
|
||||
var queue = [];
|
||||
var enqueue = function (module) {
|
||||
if (in_queue[module]) {
|
||||
return;
|
||||
}
|
||||
in_queue[module] = true;
|
||||
queue.push(module);
|
||||
};
|
||||
var seenDir = {};
|
||||
var createDirectoryRecursive = function (dir) {
|
||||
if (seenDir[dir]) {
|
||||
return;
|
||||
}
|
||||
var lastSlash = dir.lastIndexOf('/');
|
||||
if (lastSlash === -1) {
|
||||
lastSlash = dir.lastIndexOf('\\');
|
||||
}
|
||||
if (lastSlash !== -1) {
|
||||
createDirectoryRecursive(dir.substring(0, lastSlash));
|
||||
}
|
||||
seenDir[dir] = true;
|
||||
try {
|
||||
fs.mkdirSync(dir);
|
||||
}
|
||||
catch (err) { }
|
||||
};
|
||||
seenDir[REPO_ROOT] = true;
|
||||
var toggleComments = function (fileContents) {
|
||||
var lines = fileContents.split(/\r\n|\r|\n/);
|
||||
var mode = 0;
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var line = lines[i];
|
||||
if (mode === 0) {
|
||||
if (/\/\/ ESM-comment-begin/.test(line)) {
|
||||
mode = 1;
|
||||
continue;
|
||||
}
|
||||
if (/\/\/ ESM-uncomment-begin/.test(line)) {
|
||||
mode = 2;
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (mode === 1) {
|
||||
if (/\/\/ ESM-comment-end/.test(line)) {
|
||||
mode = 0;
|
||||
continue;
|
||||
}
|
||||
lines[i] = '// ' + line;
|
||||
continue;
|
||||
}
|
||||
if (mode === 2) {
|
||||
if (/\/\/ ESM-uncomment-end/.test(line)) {
|
||||
mode = 0;
|
||||
continue;
|
||||
}
|
||||
lines[i] = line.replace(/^(\s*)\/\/ ?/, function (_, indent) {
|
||||
return indent;
|
||||
});
|
||||
}
|
||||
}
|
||||
return lines.join('\n');
|
||||
};
|
||||
var write = function (filePath, contents) {
|
||||
var absoluteFilePath;
|
||||
if (/\.ts$/.test(filePath)) {
|
||||
absoluteFilePath = path.join(OUT_FOLDER, filePath);
|
||||
}
|
||||
else {
|
||||
absoluteFilePath = path.join(OUT_RESOURCES_FOLDER, filePath);
|
||||
}
|
||||
createDirectoryRecursive(path.dirname(absoluteFilePath));
|
||||
if (/(\.ts$)|(\.js$)/.test(filePath)) {
|
||||
contents = toggleComments(contents.toString());
|
||||
}
|
||||
fs.writeFileSync(absoluteFilePath, contents);
|
||||
};
|
||||
options.entryPoints.forEach(function (entryPoint) { return enqueue(entryPoint); });
|
||||
while (queue.length > 0) {
|
||||
var module_1 = queue.shift();
|
||||
if (transportCSS(options, module_1, enqueue, write)) {
|
||||
continue;
|
||||
}
|
||||
if (transportResource(options, module_1, enqueue, write)) {
|
||||
continue;
|
||||
}
|
||||
if (transportDTS(options, module_1, enqueue, write)) {
|
||||
continue;
|
||||
}
|
||||
var filename = void 0;
|
||||
if (options.redirects[module_1]) {
|
||||
filename = path.join(SRC_DIR, options.redirects[module_1] + '.ts');
|
||||
}
|
||||
else {
|
||||
filename = path.join(SRC_DIR, module_1 + '.ts');
|
||||
}
|
||||
var fileContents = fs.readFileSync(filename).toString();
|
||||
var info = ts.preProcessFile(fileContents);
|
||||
for (var i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||
var importedFilename = info.importedFiles[i].fileName;
|
||||
var pos = info.importedFiles[i].pos;
|
||||
var end = info.importedFiles[i].end;
|
||||
var importedFilepath = void 0;
|
||||
if (/^vs\/css!/.test(importedFilename)) {
|
||||
importedFilepath = importedFilename.substr('vs/css!'.length) + '.css';
|
||||
}
|
||||
else {
|
||||
importedFilepath = importedFilename;
|
||||
}
|
||||
if (/(^\.\/)|(^\.\.\/)/.test(importedFilepath)) {
|
||||
importedFilepath = path.join(path.dirname(module_1), importedFilepath);
|
||||
}
|
||||
enqueue(importedFilepath);
|
||||
var relativePath = void 0;
|
||||
if (importedFilepath === path.dirname(module_1)) {
|
||||
relativePath = '../' + path.basename(path.dirname(module_1));
|
||||
}
|
||||
else if (importedFilepath === path.dirname(path.dirname(module_1))) {
|
||||
relativePath = '../../' + path.basename(path.dirname(path.dirname(module_1)));
|
||||
}
|
||||
else {
|
||||
relativePath = path.relative(path.dirname(module_1), importedFilepath);
|
||||
}
|
||||
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
||||
relativePath = './' + relativePath;
|
||||
}
|
||||
fileContents = (fileContents.substring(0, pos + 1)
|
||||
+ relativePath
|
||||
+ fileContents.substring(end + 1));
|
||||
}
|
||||
fileContents = fileContents.replace(/import ([a-zA-z0-9]+) = require\(('[^']+')\);/g, function (_, m1, m2) {
|
||||
return "import * as " + m1 + " from " + m2 + ";";
|
||||
});
|
||||
fileContents = fileContents.replace(/Thenable/g, 'PromiseLike');
|
||||
write(module_1 + '.ts', fileContents);
|
||||
}
|
||||
var esm_opts = {
|
||||
"compilerOptions": {
|
||||
"outDir": path.relative(path.dirname(OUT_FOLDER), OUT_RESOURCES_FOLDER),
|
||||
"rootDir": "src",
|
||||
"module": "es6",
|
||||
"target": "es5",
|
||||
"experimentalDecorators": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es5",
|
||||
"es2015.collection",
|
||||
"es2015.promise"
|
||||
],
|
||||
"types": []
|
||||
}
|
||||
};
|
||||
fs.writeFileSync(path.join(path.dirname(OUT_FOLDER), 'tsconfig.json'), JSON.stringify(esm_opts, null, '\t'));
|
||||
var monacodts = fs.readFileSync(path.join(SRC_DIR, 'vs/monaco.d.ts')).toString();
|
||||
fs.writeFileSync(path.join(OUT_FOLDER, 'vs/monaco.d.ts'), monacodts);
|
||||
}
|
||||
exports.createESMSourcesAndResources = createESMSourcesAndResources;
|
||||
function transportCSS(options, module, enqueue, write) {
|
||||
if (!/\.css/.test(module)) {
|
||||
return false;
|
||||
}
|
||||
var filename = path.join(SRC_DIR, module);
|
||||
var fileContents = fs.readFileSync(filename).toString();
|
||||
var inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148
|
||||
var inlineResourcesLimit = 300000; //3000; // see https://github.com/Microsoft/monaco-editor/issues/336
|
||||
var newContents = _rewriteOrInlineUrls(filename, fileContents, inlineResources === 'base64', inlineResourcesLimit);
|
||||
write(module, newContents);
|
||||
return true;
|
||||
function _rewriteOrInlineUrls(originalFileFSPath, contents, forceBase64, inlineByteLimit) {
|
||||
return _replaceURL(contents, function (url) {
|
||||
var imagePath = path.join(path.dirname(module), url);
|
||||
var fileContents = fs.readFileSync(path.join(SRC_DIR, imagePath));
|
||||
if (fileContents.length < inlineByteLimit) {
|
||||
var MIME = /\.svg$/.test(url) ? 'image/svg+xml' : 'image/png';
|
||||
var DATA = ';base64,' + fileContents.toString('base64');
|
||||
if (!forceBase64 && /\.svg$/.test(url)) {
|
||||
// .svg => url encode as explained at https://codepen.io/tigt/post/optimizing-svgs-in-data-uris
|
||||
var newText = fileContents.toString()
|
||||
.replace(/"/g, '\'')
|
||||
.replace(/</g, '%3C')
|
||||
.replace(/>/g, '%3E')
|
||||
.replace(/&/g, '%26')
|
||||
.replace(/#/g, '%23')
|
||||
.replace(/\s+/g, ' ');
|
||||
var encodedData = ',' + newText;
|
||||
if (encodedData.length < DATA.length) {
|
||||
DATA = encodedData;
|
||||
}
|
||||
}
|
||||
return '"data:' + MIME + DATA + '"';
|
||||
}
|
||||
enqueue(imagePath);
|
||||
return url;
|
||||
});
|
||||
}
|
||||
function _replaceURL(contents, replacer) {
|
||||
// Use ")" as the terminator as quotes are oftentimes not used at all
|
||||
return contents.replace(/url\(\s*([^\)]+)\s*\)?/g, function (_) {
|
||||
var matches = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
matches[_i - 1] = arguments[_i];
|
||||
}
|
||||
var url = matches[0];
|
||||
// Eliminate starting quotes (the initial whitespace is not captured)
|
||||
if (url.charAt(0) === '"' || url.charAt(0) === '\'') {
|
||||
url = url.substring(1);
|
||||
}
|
||||
// The ending whitespace is captured
|
||||
while (url.length > 0 && (url.charAt(url.length - 1) === ' ' || url.charAt(url.length - 1) === '\t')) {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
// Eliminate ending quotes
|
||||
if (url.charAt(url.length - 1) === '"' || url.charAt(url.length - 1) === '\'') {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
if (!_startsWith(url, 'data:') && !_startsWith(url, 'http://') && !_startsWith(url, 'https://')) {
|
||||
url = replacer(url);
|
||||
}
|
||||
return 'url(' + url + ')';
|
||||
});
|
||||
}
|
||||
function _startsWith(haystack, needle) {
|
||||
return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle;
|
||||
}
|
||||
}
|
||||
function transportResource(options, module, enqueue, write) {
|
||||
if (!/\.svg/.test(module)) {
|
||||
return false;
|
||||
}
|
||||
write(module, fs.readFileSync(path.join(SRC_DIR, module)));
|
||||
return true;
|
||||
}
|
||||
function transportDTS(options, module, enqueue, write) {
|
||||
if (options.redirects[module] && fs.existsSync(path.join(SRC_DIR, options.redirects[module] + '.ts'))) {
|
||||
return false;
|
||||
}
|
||||
if (!fs.existsSync(path.join(SRC_DIR, module + '.d.ts'))) {
|
||||
return false;
|
||||
}
|
||||
write(module + '.d.ts', fs.readFileSync(path.join(SRC_DIR, module + '.d.ts')));
|
||||
var filename;
|
||||
if (options.redirects[module]) {
|
||||
write(module + '.js', fs.readFileSync(path.join(SRC_DIR, options.redirects[module] + '.js')));
|
||||
}
|
||||
else {
|
||||
write(module + '.js', fs.readFileSync(path.join(SRC_DIR, module + '.js')));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
305
build/lib/standalone.ts
Normal file
305
build/lib/standalone.ts
Normal file
@@ -0,0 +1,305 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as ts from 'typescript';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../');
|
||||
const SRC_DIR = path.join(REPO_ROOT, 'src');
|
||||
const OUT_EDITOR = path.join(REPO_ROOT, 'out-editor');
|
||||
|
||||
export interface IOptions {
|
||||
entryPoints: string[];
|
||||
outFolder: string;
|
||||
outResourcesFolder: string;
|
||||
redirects: { [module: string]: string; };
|
||||
}
|
||||
|
||||
export function createESMSourcesAndResources(options: IOptions): void {
|
||||
const OUT_FOLDER = path.join(REPO_ROOT, options.outFolder);
|
||||
const OUT_RESOURCES_FOLDER = path.join(REPO_ROOT, options.outResourcesFolder);
|
||||
|
||||
let in_queue: { [module: string]: boolean; } = Object.create(null);
|
||||
let queue: string[] = [];
|
||||
|
||||
const enqueue = (module: string) => {
|
||||
if (in_queue[module]) {
|
||||
return;
|
||||
}
|
||||
in_queue[module] = true;
|
||||
queue.push(module);
|
||||
};
|
||||
|
||||
const seenDir: { [key: string]: boolean; } = {};
|
||||
const createDirectoryRecursive = (dir: string) => {
|
||||
if (seenDir[dir]) {
|
||||
return;
|
||||
}
|
||||
|
||||
let lastSlash = dir.lastIndexOf('/');
|
||||
if (lastSlash === -1) {
|
||||
lastSlash = dir.lastIndexOf('\\');
|
||||
}
|
||||
if (lastSlash !== -1) {
|
||||
createDirectoryRecursive(dir.substring(0, lastSlash));
|
||||
}
|
||||
seenDir[dir] = true;
|
||||
try { fs.mkdirSync(dir); } catch (err) { }
|
||||
};
|
||||
|
||||
seenDir[REPO_ROOT] = true;
|
||||
|
||||
const toggleComments = (fileContents: string) => {
|
||||
let lines = fileContents.split(/\r\n|\r|\n/);
|
||||
let mode = 0;
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
|
||||
if (mode === 0) {
|
||||
if (/\/\/ ESM-comment-begin/.test(line)) {
|
||||
mode = 1;
|
||||
continue;
|
||||
}
|
||||
if (/\/\/ ESM-uncomment-begin/.test(line)) {
|
||||
mode = 2;
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mode === 1) {
|
||||
if (/\/\/ ESM-comment-end/.test(line)) {
|
||||
mode = 0;
|
||||
continue;
|
||||
}
|
||||
lines[i] = '// ' + line;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mode === 2) {
|
||||
if (/\/\/ ESM-uncomment-end/.test(line)) {
|
||||
mode = 0;
|
||||
continue;
|
||||
}
|
||||
lines[i] = line.replace(/^(\s*)\/\/ ?/, function (_, indent) {
|
||||
return indent;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
};
|
||||
|
||||
const write = (filePath: string, contents: string | Buffer) => {
|
||||
let absoluteFilePath: string;
|
||||
if (/\.ts$/.test(filePath)) {
|
||||
absoluteFilePath = path.join(OUT_FOLDER, filePath);
|
||||
} else {
|
||||
absoluteFilePath = path.join(OUT_RESOURCES_FOLDER, filePath);
|
||||
}
|
||||
createDirectoryRecursive(path.dirname(absoluteFilePath));
|
||||
if (/(\.ts$)|(\.js$)/.test(filePath)) {
|
||||
contents = toggleComments(contents.toString());
|
||||
}
|
||||
fs.writeFileSync(absoluteFilePath, contents);
|
||||
};
|
||||
|
||||
options.entryPoints.forEach((entryPoint) => enqueue(entryPoint));
|
||||
|
||||
while (queue.length > 0) {
|
||||
const module = queue.shift();
|
||||
if (transportCSS(options, module, enqueue, write)) {
|
||||
continue;
|
||||
}
|
||||
if (transportResource(options, module, enqueue, write)) {
|
||||
continue;
|
||||
}
|
||||
if (transportDTS(options, module, enqueue, write)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let filename: string;
|
||||
if (options.redirects[module]) {
|
||||
filename = path.join(SRC_DIR, options.redirects[module] + '.ts');
|
||||
} else {
|
||||
filename = path.join(SRC_DIR, module + '.ts');
|
||||
}
|
||||
let fileContents = fs.readFileSync(filename).toString();
|
||||
|
||||
const info = ts.preProcessFile(fileContents);
|
||||
|
||||
for (let i = info.importedFiles.length - 1; i >= 0; i--) {
|
||||
const importedFilename = info.importedFiles[i].fileName;
|
||||
const pos = info.importedFiles[i].pos;
|
||||
const end = info.importedFiles[i].end;
|
||||
|
||||
let importedFilepath: string;
|
||||
if (/^vs\/css!/.test(importedFilename)) {
|
||||
importedFilepath = importedFilename.substr('vs/css!'.length) + '.css';
|
||||
} else {
|
||||
importedFilepath = importedFilename;
|
||||
}
|
||||
if (/(^\.\/)|(^\.\.\/)/.test(importedFilepath)) {
|
||||
importedFilepath = path.join(path.dirname(module), importedFilepath);
|
||||
}
|
||||
|
||||
enqueue(importedFilepath);
|
||||
|
||||
let relativePath: string;
|
||||
if (importedFilepath === path.dirname(module)) {
|
||||
relativePath = '../' + path.basename(path.dirname(module));
|
||||
} else if (importedFilepath === path.dirname(path.dirname(module))) {
|
||||
relativePath = '../../' + path.basename(path.dirname(path.dirname(module)));
|
||||
} else {
|
||||
relativePath = path.relative(path.dirname(module), importedFilepath);
|
||||
}
|
||||
if (!/(^\.\/)|(^\.\.\/)/.test(relativePath)) {
|
||||
relativePath = './' + relativePath;
|
||||
}
|
||||
fileContents = (
|
||||
fileContents.substring(0, pos + 1)
|
||||
+ relativePath
|
||||
+ fileContents.substring(end + 1)
|
||||
);
|
||||
}
|
||||
|
||||
fileContents = fileContents.replace(/import ([a-zA-z0-9]+) = require\(('[^']+')\);/g, function (_, m1, m2) {
|
||||
return `import * as ${m1} from ${m2};`;
|
||||
});
|
||||
fileContents = fileContents.replace(/Thenable/g, 'PromiseLike');
|
||||
|
||||
write(module + '.ts', fileContents);
|
||||
}
|
||||
|
||||
const esm_opts = {
|
||||
"compilerOptions": {
|
||||
"outDir": path.relative(path.dirname(OUT_FOLDER), OUT_RESOURCES_FOLDER),
|
||||
"rootDir": "src",
|
||||
"module": "es6",
|
||||
"target": "es5",
|
||||
"experimentalDecorators": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es5",
|
||||
"es2015.collection",
|
||||
"es2015.promise"
|
||||
],
|
||||
"types": [
|
||||
]
|
||||
}
|
||||
};
|
||||
fs.writeFileSync(path.join(path.dirname(OUT_FOLDER), 'tsconfig.json'), JSON.stringify(esm_opts, null, '\t'));
|
||||
|
||||
const monacodts = fs.readFileSync(path.join(SRC_DIR, 'vs/monaco.d.ts')).toString();
|
||||
fs.writeFileSync(path.join(OUT_FOLDER, 'vs/monaco.d.ts'), monacodts);
|
||||
|
||||
}
|
||||
|
||||
function transportCSS(options: IOptions, module: string, enqueue: (module: string) => void, write: (path: string, contents: string | Buffer) => void): boolean {
|
||||
|
||||
if (!/\.css/.test(module)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const filename = path.join(SRC_DIR, module);
|
||||
const fileContents = fs.readFileSync(filename).toString();
|
||||
const inlineResources = 'base64'; // see https://github.com/Microsoft/monaco-editor/issues/148
|
||||
const inlineResourcesLimit = 300000;//3000; // see https://github.com/Microsoft/monaco-editor/issues/336
|
||||
|
||||
const newContents = _rewriteOrInlineUrls(filename, fileContents, inlineResources === 'base64', inlineResourcesLimit);
|
||||
write(module, newContents);
|
||||
return true;
|
||||
|
||||
function _rewriteOrInlineUrls(originalFileFSPath: string, contents: string, forceBase64: boolean, inlineByteLimit: number): string {
|
||||
return _replaceURL(contents, (url) => {
|
||||
let imagePath = path.join(path.dirname(module), url);
|
||||
let fileContents = fs.readFileSync(path.join(SRC_DIR, imagePath));
|
||||
|
||||
if (fileContents.length < inlineByteLimit) {
|
||||
const MIME = /\.svg$/.test(url) ? 'image/svg+xml' : 'image/png';
|
||||
let DATA = ';base64,' + fileContents.toString('base64');
|
||||
|
||||
if (!forceBase64 && /\.svg$/.test(url)) {
|
||||
// .svg => url encode as explained at https://codepen.io/tigt/post/optimizing-svgs-in-data-uris
|
||||
let newText = fileContents.toString()
|
||||
.replace(/"/g, '\'')
|
||||
.replace(/</g, '%3C')
|
||||
.replace(/>/g, '%3E')
|
||||
.replace(/&/g, '%26')
|
||||
.replace(/#/g, '%23')
|
||||
.replace(/\s+/g, ' ');
|
||||
let encodedData = ',' + newText;
|
||||
if (encodedData.length < DATA.length) {
|
||||
DATA = encodedData;
|
||||
}
|
||||
}
|
||||
return '"data:' + MIME + DATA + '"';
|
||||
}
|
||||
|
||||
enqueue(imagePath);
|
||||
return url;
|
||||
});
|
||||
}
|
||||
|
||||
function _replaceURL(contents: string, replacer: (url: string) => string): string {
|
||||
// Use ")" as the terminator as quotes are oftentimes not used at all
|
||||
return contents.replace(/url\(\s*([^\)]+)\s*\)?/g, (_: string, ...matches: string[]) => {
|
||||
var url = matches[0];
|
||||
// Eliminate starting quotes (the initial whitespace is not captured)
|
||||
if (url.charAt(0) === '"' || url.charAt(0) === '\'') {
|
||||
url = url.substring(1);
|
||||
}
|
||||
// The ending whitespace is captured
|
||||
while (url.length > 0 && (url.charAt(url.length - 1) === ' ' || url.charAt(url.length - 1) === '\t')) {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
// Eliminate ending quotes
|
||||
if (url.charAt(url.length - 1) === '"' || url.charAt(url.length - 1) === '\'') {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
|
||||
if (!_startsWith(url, 'data:') && !_startsWith(url, 'http://') && !_startsWith(url, 'https://')) {
|
||||
url = replacer(url);
|
||||
}
|
||||
|
||||
return 'url(' + url + ')';
|
||||
});
|
||||
}
|
||||
|
||||
function _startsWith(haystack: string, needle: string): boolean {
|
||||
return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle;
|
||||
}
|
||||
}
|
||||
|
||||
function transportResource(options: IOptions, module: string, enqueue: (module: string) => void, write: (path: string, contents: string | Buffer) => void): boolean {
|
||||
|
||||
if (!/\.svg/.test(module)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
write(module, fs.readFileSync(path.join(SRC_DIR, module)));
|
||||
return true;
|
||||
}
|
||||
|
||||
function transportDTS(options: IOptions, module: string, enqueue: (module: string) => void, write: (path: string, contents: string | Buffer) => void): boolean {
|
||||
|
||||
if (options.redirects[module] && fs.existsSync(path.join(SRC_DIR, options.redirects[module] + '.ts'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(path.join(SRC_DIR, module + '.d.ts'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
write(module + '.d.ts', fs.readFileSync(path.join(SRC_DIR, module + '.d.ts')));
|
||||
let filename: string;
|
||||
if (options.redirects[module]) {
|
||||
write(module + '.js', fs.readFileSync(path.join(SRC_DIR, options.redirects[module] + '.js')));
|
||||
} else {
|
||||
write(module + '.js', fs.readFileSync(path.join(SRC_DIR, module + '.js')));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
56
build/lib/test/util.test.js
Normal file
56
build/lib/test/util.test.js
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var assert = require("assert");
|
||||
var util = require("../util");
|
||||
function getMockTagExists(tags) {
|
||||
return function (tag) { return tags.indexOf(tag) >= 0; };
|
||||
}
|
||||
suite('util tests', function () {
|
||||
test('getPreviousVersion - patch', function () {
|
||||
assert.equal(util.getPreviousVersion('1.2.3', getMockTagExists(['1.2.2', '1.2.1', '1.2.0', '1.1.0'])), '1.2.2');
|
||||
});
|
||||
test('getPreviousVersion - patch invalid', function () {
|
||||
try {
|
||||
util.getPreviousVersion('1.2.2', getMockTagExists(['1.2.0', '1.1.0']));
|
||||
}
|
||||
catch (e) {
|
||||
// expected
|
||||
return;
|
||||
}
|
||||
throw new Error('Expected an exception');
|
||||
});
|
||||
test('getPreviousVersion - minor', function () {
|
||||
assert.equal(util.getPreviousVersion('1.2.0', getMockTagExists(['1.1.0', '1.1.1', '1.1.2', '1.1.3'])), '1.1.3');
|
||||
assert.equal(util.getPreviousVersion('1.2.0', getMockTagExists(['1.1.0', '1.0.0'])), '1.1.0');
|
||||
});
|
||||
test('getPreviousVersion - minor gap', function () {
|
||||
assert.equal(util.getPreviousVersion('1.2.0', getMockTagExists(['1.1.0', '1.1.1', '1.1.3'])), '1.1.1');
|
||||
});
|
||||
test('getPreviousVersion - minor invalid', function () {
|
||||
try {
|
||||
util.getPreviousVersion('1.2.0', getMockTagExists(['1.0.0']));
|
||||
}
|
||||
catch (e) {
|
||||
// expected
|
||||
return;
|
||||
}
|
||||
throw new Error('Expected an exception');
|
||||
});
|
||||
test('getPreviousVersion - major', function () {
|
||||
assert.equal(util.getPreviousVersion('2.0.0', getMockTagExists(['1.0.0', '1.1.0', '1.2.0', '1.2.1', '1.2.2'])), '1.2.2');
|
||||
});
|
||||
test('getPreviousVersion - major invalid', function () {
|
||||
try {
|
||||
util.getPreviousVersion('3.0.0', getMockTagExists(['1.0.0']));
|
||||
}
|
||||
catch (e) {
|
||||
// expected
|
||||
return;
|
||||
}
|
||||
throw new Error('Expected an exception');
|
||||
});
|
||||
});
|
||||
79
build/lib/test/util.test.ts
Normal file
79
build/lib/test/util.test.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import assert = require('assert');
|
||||
import util = require('../util');
|
||||
|
||||
function getMockTagExists(tags: string[]) {
|
||||
return (tag: string) => tags.indexOf(tag) >= 0;
|
||||
}
|
||||
|
||||
suite('util tests', () => {
|
||||
test('getPreviousVersion - patch', () => {
|
||||
assert.equal(
|
||||
util.getPreviousVersion('1.2.3', getMockTagExists(['1.2.2', '1.2.1', '1.2.0', '1.1.0'])),
|
||||
'1.2.2'
|
||||
);
|
||||
});
|
||||
|
||||
test('getPreviousVersion - patch invalid', () => {
|
||||
try {
|
||||
util.getPreviousVersion('1.2.2', getMockTagExists(['1.2.0', '1.1.0']));
|
||||
} catch (e) {
|
||||
// expected
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error('Expected an exception');
|
||||
});
|
||||
|
||||
test('getPreviousVersion - minor', () => {
|
||||
assert.equal(
|
||||
util.getPreviousVersion('1.2.0', getMockTagExists(['1.1.0', '1.1.1', '1.1.2', '1.1.3'])),
|
||||
'1.1.3'
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
util.getPreviousVersion('1.2.0', getMockTagExists(['1.1.0', '1.0.0'])),
|
||||
'1.1.0'
|
||||
);
|
||||
});
|
||||
|
||||
test('getPreviousVersion - minor gap', () => {
|
||||
assert.equal(
|
||||
util.getPreviousVersion('1.2.0', getMockTagExists(['1.1.0', '1.1.1', '1.1.3'])),
|
||||
'1.1.1'
|
||||
);
|
||||
});
|
||||
|
||||
test('getPreviousVersion - minor invalid', () => {
|
||||
try {
|
||||
util.getPreviousVersion('1.2.0', getMockTagExists(['1.0.0']));
|
||||
} catch (e) {
|
||||
// expected
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error('Expected an exception');
|
||||
});
|
||||
|
||||
test('getPreviousVersion - major', () => {
|
||||
assert.equal(
|
||||
util.getPreviousVersion('2.0.0', getMockTagExists(['1.0.0', '1.1.0', '1.2.0', '1.2.1', '1.2.2'])),
|
||||
'1.2.2'
|
||||
);
|
||||
});
|
||||
|
||||
test('getPreviousVersion - major invalid', () => {
|
||||
try {
|
||||
util.getPreviousVersion('3.0.0', getMockTagExists(['1.0.0']));
|
||||
} catch (e) {
|
||||
// expected
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error('Expected an exception');
|
||||
});
|
||||
});
|
||||
@@ -71,7 +71,7 @@ var TranslationRemindRuleWalker = /** @class */ (function (_super) {
|
||||
}
|
||||
});
|
||||
if (!resourceDefined) {
|
||||
this.addFailureAtNode(node, "Please add '" + resource + "' to ./builds/lib/i18n.resources.json file to use translations here.");
|
||||
this.addFailureAtNode(node, "Please add '" + resource + "' to ./build/lib/i18n.resources.json file to use translations here.");
|
||||
}
|
||||
};
|
||||
TranslationRemindRuleWalker.NLS_MODULE = 'vs/nls';
|
||||
|
||||
@@ -67,7 +67,7 @@ class TranslationRemindRuleWalker extends Lint.RuleWalker {
|
||||
});
|
||||
|
||||
if (!resourceDefined) {
|
||||
this.addFailureAtNode(node, `Please add '${resource}' to ./builds/lib/i18n.resources.json file to use translations here.`);
|
||||
this.addFailureAtNode(node, `Please add '${resource}' to ./build/lib/i18n.resources.json file to use translations here.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
9
build/lib/typings/event-stream.d.ts
vendored
9
build/lib/typings/event-stream.d.ts
vendored
@@ -1,7 +1,14 @@
|
||||
declare module "event-stream" {
|
||||
import { Stream } from 'stream';
|
||||
import { ThroughStream } from 'through';
|
||||
import { ThroughStream as _ThroughStream} from 'through';
|
||||
import { MapStream } from 'map-stream';
|
||||
import * as File from 'vinyl';
|
||||
|
||||
export interface ThroughStream extends _ThroughStream {
|
||||
queue(data: File | null);
|
||||
push(data: File | null);
|
||||
paused: boolean;
|
||||
}
|
||||
|
||||
function merge(streams: Stream[]): ThroughStream;
|
||||
function merge(...streams: Stream[]): ThroughStream;
|
||||
|
||||
@@ -14,6 +14,7 @@ var fs = require("fs");
|
||||
var _rimraf = require("rimraf");
|
||||
var git = require("./git");
|
||||
var VinylFile = require("vinyl");
|
||||
var cp = require("child_process");
|
||||
var NoCancellationToken = { isCancellationRequested: function () { return false; } };
|
||||
function incremental(streamProvider, initial, supportsCancellation) {
|
||||
var input = es.through();
|
||||
@@ -143,7 +144,7 @@ function loadSourcemaps() {
|
||||
cb(null, f);
|
||||
return;
|
||||
}
|
||||
f.contents = new Buffer(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
|
||||
f.contents = Buffer.from(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
|
||||
fs.readFile(path.join(path.dirname(f.path), lastMatch[1]), 'utf8', function (err, contents) {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
@@ -160,7 +161,7 @@ function stripSourceMappingURL() {
|
||||
var output = input
|
||||
.pipe(es.mapSync(function (f) {
|
||||
var contents = f.contents.toString('utf8');
|
||||
f.contents = new Buffer(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
|
||||
f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
|
||||
return f;
|
||||
}));
|
||||
return es.duplex(input, output);
|
||||
@@ -173,7 +174,6 @@ function rimraf(dir) {
|
||||
if (!err) {
|
||||
return cb();
|
||||
}
|
||||
;
|
||||
if (err.code === 'ENOTEMPTY' && ++retries < 5) {
|
||||
return setTimeout(function () { return retry(cb); }, 10);
|
||||
}
|
||||
@@ -211,3 +211,68 @@ function filter(fn) {
|
||||
return result;
|
||||
}
|
||||
exports.filter = filter;
|
||||
function tagExists(tagName) {
|
||||
try {
|
||||
cp.execSync("git rev-parse " + tagName, { stdio: 'ignore' });
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the version previous to the given version. Throws if a git tag for that version doesn't exist.
|
||||
* Given 1.17.2, return 1.17.1
|
||||
* 1.18.0 => 1.17.2. (or the highest 1.17.x)
|
||||
* 2.0.0 => 1.18.0 (or the highest 1.x)
|
||||
*/
|
||||
function getPreviousVersion(versionStr, _tagExists) {
|
||||
if (_tagExists === void 0) { _tagExists = tagExists; }
|
||||
function getLatestTagFromBase(semverArr, componentToTest) {
|
||||
var baseVersion = semverArr.join('.');
|
||||
if (!_tagExists(baseVersion)) {
|
||||
throw new Error('Failed to find git tag for base version, ' + baseVersion);
|
||||
}
|
||||
var goodTag;
|
||||
do {
|
||||
goodTag = semverArr.join('.');
|
||||
semverArr[componentToTest]++;
|
||||
} while (_tagExists(semverArr.join('.')));
|
||||
return goodTag;
|
||||
}
|
||||
var semverArr = versionStringToNumberArray(versionStr);
|
||||
if (semverArr[2] > 0) {
|
||||
semverArr[2]--;
|
||||
var previous = semverArr.join('.');
|
||||
if (!_tagExists(previous)) {
|
||||
throw new Error('Failed to find git tag for previous version, ' + previous);
|
||||
}
|
||||
return previous;
|
||||
}
|
||||
else if (semverArr[1] > 0) {
|
||||
semverArr[1]--;
|
||||
return getLatestTagFromBase(semverArr, 2);
|
||||
}
|
||||
else {
|
||||
semverArr[0]--;
|
||||
// Find 1.x.0 for latest x
|
||||
var latestMinorVersion = getLatestTagFromBase(semverArr, 1);
|
||||
// Find 1.x.y for latest y
|
||||
return getLatestTagFromBase(versionStringToNumberArray(latestMinorVersion), 2);
|
||||
}
|
||||
}
|
||||
exports.getPreviousVersion = getPreviousVersion;
|
||||
function versionStringToNumberArray(versionStr) {
|
||||
return versionStr
|
||||
.split('.')
|
||||
.map(function (s) { return parseInt(s); });
|
||||
}
|
||||
function versionStringToNumber(versionStr) {
|
||||
var semverRegex = /(\d+)\.(\d+)\.(\d+)/;
|
||||
var match = versionStr.match(semverRegex);
|
||||
if (!match) {
|
||||
throw new Error('Version string is not properly formatted: ' + versionStr);
|
||||
}
|
||||
return parseInt(match[1], 10) * 1e4 + parseInt(match[2], 10) * 1e2 + parseInt(match[3], 10);
|
||||
}
|
||||
exports.versionStringToNumber = versionStringToNumber;
|
||||
|
||||
@@ -17,6 +17,7 @@ import * as git from './git';
|
||||
import * as VinylFile from 'vinyl';
|
||||
import { ThroughStream } from 'through';
|
||||
import * as sm from 'source-map';
|
||||
import * as cp from 'child_process';
|
||||
|
||||
export interface ICancellationToken {
|
||||
isCancellationRequested(): boolean;
|
||||
@@ -28,7 +29,7 @@ export interface IStreamProvider {
|
||||
(cancellationToken?: ICancellationToken): NodeJS.ReadWriteStream;
|
||||
}
|
||||
|
||||
export function incremental(streamProvider: IStreamProvider, initial: NodeJS.ReadWriteStream, supportsCancellation: boolean): NodeJS.ReadWriteStream {
|
||||
export function incremental(streamProvider: IStreamProvider, initial: NodeJS.ReadWriteStream, supportsCancellation?: boolean): NodeJS.ReadWriteStream {
|
||||
const input = es.through();
|
||||
const output = es.through();
|
||||
let state = 'idle';
|
||||
@@ -129,7 +130,7 @@ export function skipDirectories(): NodeJS.ReadWriteStream {
|
||||
});
|
||||
}
|
||||
|
||||
export function cleanNodeModule(name: string, excludes: string[], includes: string[]): NodeJS.ReadWriteStream {
|
||||
export function cleanNodeModule(name: string, excludes: string[], includes?: string[]): NodeJS.ReadWriteStream {
|
||||
const toGlob = (path: string) => '**/node_modules/' + name + (path ? '/' + path : '');
|
||||
const negate = (str: string) => '!' + str;
|
||||
|
||||
@@ -190,7 +191,7 @@ export function loadSourcemaps(): NodeJS.ReadWriteStream {
|
||||
return;
|
||||
}
|
||||
|
||||
f.contents = new Buffer(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
|
||||
f.contents = Buffer.from(contents.replace(/\/\/# sourceMappingURL=(.*)$/g, ''), 'utf8');
|
||||
|
||||
fs.readFile(path.join(path.dirname(f.path), lastMatch[1]), 'utf8', (err, contents) => {
|
||||
if (err) { return cb(err); }
|
||||
@@ -209,7 +210,7 @@ export function stripSourceMappingURL(): NodeJS.ReadWriteStream {
|
||||
const output = input
|
||||
.pipe(es.mapSync<VinylFile, VinylFile>(f => {
|
||||
const contents = (<Buffer>f.contents).toString('utf8');
|
||||
f.contents = new Buffer(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
|
||||
f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, ''), 'utf8');
|
||||
return f;
|
||||
}));
|
||||
|
||||
@@ -223,7 +224,7 @@ export function rimraf(dir: string): (cb: any) => void {
|
||||
_rimraf(dir, { maxBusyTries: 1 }, (err: any) => {
|
||||
if (!err) {
|
||||
return cb();
|
||||
};
|
||||
}
|
||||
|
||||
if (err.code === 'ENOTEMPTY' && ++retries < 5) {
|
||||
return setTimeout(() => retry(cb), 10);
|
||||
@@ -268,4 +269,74 @@ export function filter(fn: (data: any) => boolean): FilterStream {
|
||||
|
||||
result.restore = es.through();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
function tagExists(tagName: string): boolean {
|
||||
try {
|
||||
cp.execSync(`git rev-parse ${tagName}`, { stdio: 'ignore' });
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version previous to the given version. Throws if a git tag for that version doesn't exist.
|
||||
* Given 1.17.2, return 1.17.1
|
||||
* 1.18.0 => 1.17.2. (or the highest 1.17.x)
|
||||
* 2.0.0 => 1.18.0 (or the highest 1.x)
|
||||
*/
|
||||
export function getPreviousVersion(versionStr: string, _tagExists = tagExists) {
|
||||
function getLatestTagFromBase(semverArr: number[], componentToTest: number): string {
|
||||
const baseVersion = semverArr.join('.');
|
||||
if (!_tagExists(baseVersion)) {
|
||||
throw new Error('Failed to find git tag for base version, ' + baseVersion);
|
||||
}
|
||||
|
||||
let goodTag;
|
||||
do {
|
||||
goodTag = semverArr.join('.');
|
||||
semverArr[componentToTest]++;
|
||||
} while (_tagExists(semverArr.join('.')));
|
||||
|
||||
return goodTag;
|
||||
}
|
||||
|
||||
const semverArr = versionStringToNumberArray(versionStr);
|
||||
if (semverArr[2] > 0) {
|
||||
semverArr[2]--;
|
||||
const previous = semverArr.join('.');
|
||||
if (!_tagExists(previous)) {
|
||||
throw new Error('Failed to find git tag for previous version, ' + previous);
|
||||
}
|
||||
|
||||
return previous;
|
||||
} else if (semverArr[1] > 0) {
|
||||
semverArr[1]--;
|
||||
return getLatestTagFromBase(semverArr, 2);
|
||||
} else {
|
||||
semverArr[0]--;
|
||||
|
||||
// Find 1.x.0 for latest x
|
||||
const latestMinorVersion = getLatestTagFromBase(semverArr, 1);
|
||||
|
||||
// Find 1.x.y for latest y
|
||||
return getLatestTagFromBase(versionStringToNumberArray(latestMinorVersion), 2);
|
||||
}
|
||||
}
|
||||
|
||||
function versionStringToNumberArray(versionStr: string): number[] {
|
||||
return versionStr
|
||||
.split('.')
|
||||
.map(s => parseInt(s));
|
||||
}
|
||||
|
||||
export function versionStringToNumber(versionStr: string) {
|
||||
const semverRegex = /(\d+)\.(\d+)\.(\d+)/;
|
||||
const match = versionStr.match(semverRegex);
|
||||
if (!match) {
|
||||
throw new Error('Version string is not properly formatted: ' + versionStr);
|
||||
}
|
||||
|
||||
return parseInt(match[1], 10) * 1e4 + parseInt(match[2], 10) * 1e2 + parseInt(match[3], 10);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ const es = require('event-stream');
|
||||
function handleDeletions() {
|
||||
return es.mapSync(f => {
|
||||
if (/\.ts$/.test(f.relative) && !f.contents) {
|
||||
f.contents = new Buffer('');
|
||||
f.contents = Buffer.from('');
|
||||
f.stat = { mtime: new Date() };
|
||||
}
|
||||
|
||||
|
||||
@@ -30,12 +30,12 @@ function watch(root) {
|
||||
path: path,
|
||||
base: root
|
||||
});
|
||||
|
||||
//@ts-ignore
|
||||
file.event = type;
|
||||
result.emit('data', file);
|
||||
}
|
||||
|
||||
nsfw(root, function(events) {
|
||||
nsfw(root, function (events) {
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
var e = events[i];
|
||||
var changeType = e.action;
|
||||
@@ -47,16 +47,16 @@ function watch(root) {
|
||||
handleEvent(path.join(e.directory, e.file), toChangeType(changeType));
|
||||
}
|
||||
}
|
||||
}).then(function(watcher) {
|
||||
}).then(function (watcher) {
|
||||
watcher.start();
|
||||
});
|
||||
});
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
var cache = Object.create(null);
|
||||
|
||||
module.exports = function(pattern, options) {
|
||||
module.exports = function (pattern, options) {
|
||||
options = options || {};
|
||||
|
||||
var cwd = path.normalize(options.cwd || process.cwd());
|
||||
@@ -66,7 +66,7 @@ module.exports = function(pattern, options) {
|
||||
watcher = cache[cwd] = watch(cwd);
|
||||
}
|
||||
|
||||
var rebase = !options.base ? es.through() : es.mapSync(function(f) {
|
||||
var rebase = !options.base ? es.through() : es.mapSync(function (f) {
|
||||
f.base = options.base;
|
||||
return f;
|
||||
});
|
||||
@@ -74,13 +74,13 @@ module.exports = function(pattern, options) {
|
||||
return watcher
|
||||
.pipe(filter(['**', '!.git{,/**}'])) // ignore all things git
|
||||
.pipe(filter(pattern))
|
||||
.pipe(es.map(function(file, cb) {
|
||||
fs.stat(file.path, function(err, stat) {
|
||||
.pipe(es.map(function (file, cb) {
|
||||
fs.stat(file.path, function (err, stat) {
|
||||
if (err && err.code === 'ENOENT') { return cb(null, file); }
|
||||
if (err) { return cb(); }
|
||||
if (!stat.isFile()) { return cb(); }
|
||||
|
||||
fs.readFile(file.path, function(err, contents) {
|
||||
fs.readFile(file.path, function (err, contents) {
|
||||
if (err && err.code === 'ENOENT') { return cb(null, file); }
|
||||
if (err) { return cb(); }
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@ function watch(root) {
|
||||
var result = es.through();
|
||||
var child = cp.spawn(watcherPath, [root]);
|
||||
|
||||
child.stdout.on('data', function(data) {
|
||||
child.stdout.on('data', function (data) {
|
||||
// @ts-ignore
|
||||
var lines = data.toString('utf8').split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var line = lines[i].trim();
|
||||
@@ -46,17 +47,17 @@ function watch(root) {
|
||||
path: changePathFull,
|
||||
base: root
|
||||
});
|
||||
|
||||
//@ts-ignore
|
||||
file.event = toChangeType(changeType);
|
||||
result.emit('data', file);
|
||||
}
|
||||
});
|
||||
|
||||
child.stderr.on('data', function(data) {
|
||||
child.stderr.on('data', function (data) {
|
||||
result.emit('error', data);
|
||||
});
|
||||
|
||||
child.on('exit', function(code) {
|
||||
child.on('exit', function (code) {
|
||||
result.emit('error', 'Watcher died with code ' + code);
|
||||
child = null;
|
||||
});
|
||||
@@ -70,7 +71,7 @@ function watch(root) {
|
||||
|
||||
var cache = Object.create(null);
|
||||
|
||||
module.exports = function(pattern, options) {
|
||||
module.exports = function (pattern, options) {
|
||||
options = options || {};
|
||||
|
||||
var cwd = path.normalize(options.cwd || process.cwd());
|
||||
|
||||
@@ -1 +1,21 @@
|
||||
See project root directory
|
||||
The Source EULA
|
||||
|
||||
Copyright (c) 2016 - present Microsoft Corporation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
@@ -171,9 +171,7 @@ function format(text) {
|
||||
function getRuleProvider(options) {
|
||||
// Share this between multiple formatters using the same options.
|
||||
// This represents the bulk of the space the formatter uses.
|
||||
var ruleProvider = new ts.formatting.RulesProvider();
|
||||
ruleProvider.ensureUpToDate(options);
|
||||
return ruleProvider;
|
||||
return ts.formatting.getFormatContext(options);
|
||||
}
|
||||
function applyEdits(text, edits) {
|
||||
// Apply edits in reverse on the existing text
|
||||
@@ -210,7 +208,8 @@ function createReplacer(data) {
|
||||
};
|
||||
}
|
||||
function generateDeclarationFile(out, inputFiles, recipe) {
|
||||
var lines = recipe.split(/\r\n|\n|\r/);
|
||||
var endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
||||
var lines = recipe.split(endl);
|
||||
var result = [];
|
||||
lines.forEach(function (line) {
|
||||
var m1 = line.match(/^\s*#include\(([^;)]*)(;[^)]*)?\)\:(.*)$/);
|
||||
@@ -278,12 +277,11 @@ function generateDeclarationFile(out, inputFiles, recipe) {
|
||||
}
|
||||
result.push(line);
|
||||
});
|
||||
var resultTxt = result.join('\n');
|
||||
var resultTxt = result.join(endl);
|
||||
resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri');
|
||||
resultTxt = resultTxt.replace(/\bEvent</g, 'IEvent<');
|
||||
resultTxt = resultTxt.replace(/\bTPromise</g, 'Promise<');
|
||||
resultTxt = format(resultTxt);
|
||||
resultTxt = resultTxt.replace(/\r\n/g, '\n');
|
||||
return resultTxt;
|
||||
}
|
||||
function getFilesToWatch(out) {
|
||||
@@ -314,10 +312,13 @@ function run(out, inputFiles) {
|
||||
var result = generateDeclarationFile(out, inputFiles, recipe);
|
||||
var currentContent = fs.readFileSync(DECLARATION_PATH).toString();
|
||||
log('Finished monaco.d.ts generation');
|
||||
var one = currentContent.replace(/\r\n/gm, '\n');
|
||||
var other = result.replace(/\r\n/gm, '\n');
|
||||
var isTheSame = one === other;
|
||||
return {
|
||||
content: result,
|
||||
filePath: DECLARATION_PATH,
|
||||
isTheSame: currentContent === result
|
||||
isTheSame: isTheSame
|
||||
};
|
||||
}
|
||||
exports.run = run;
|
||||
|
||||
@@ -24,15 +24,15 @@ function logErr(message: any, ...rest: any[]): void {
|
||||
util.log(util.colors.red('[monaco.d.ts]'), message, ...rest);
|
||||
}
|
||||
|
||||
function moduleIdToPath(out:string, moduleId:string): string {
|
||||
function moduleIdToPath(out: string, moduleId: string): string {
|
||||
if (/\.d\.ts/.test(moduleId)) {
|
||||
return path.join(SRC, moduleId);
|
||||
}
|
||||
return path.join(OUT_ROOT, out, moduleId) + '.d.ts';
|
||||
}
|
||||
|
||||
let SOURCE_FILE_MAP: {[moduleId:string]:ts.SourceFile;} = {};
|
||||
function getSourceFile(out:string, inputFiles: { [file: string]: string; }, moduleId:string): ts.SourceFile {
|
||||
let SOURCE_FILE_MAP: { [moduleId: string]: ts.SourceFile; } = {};
|
||||
function getSourceFile(out: string, inputFiles: { [file: string]: string; }, moduleId: string): ts.SourceFile {
|
||||
if (!SOURCE_FILE_MAP[moduleId]) {
|
||||
let filePath = path.normalize(moduleIdToPath(out, moduleId));
|
||||
|
||||
@@ -53,7 +53,7 @@ function getSourceFile(out:string, inputFiles: { [file: string]: string; }, modu
|
||||
type TSTopLevelDeclaration = ts.InterfaceDeclaration | ts.EnumDeclaration | ts.ClassDeclaration | ts.TypeAliasDeclaration | ts.FunctionDeclaration | ts.ModuleDeclaration;
|
||||
type TSTopLevelDeclare = TSTopLevelDeclaration | ts.VariableStatement;
|
||||
|
||||
function isDeclaration(a:TSTopLevelDeclare): a is TSTopLevelDeclaration {
|
||||
function isDeclaration(a: TSTopLevelDeclare): a is TSTopLevelDeclaration {
|
||||
return (
|
||||
a.kind === ts.SyntaxKind.InterfaceDeclaration
|
||||
|| a.kind === ts.SyntaxKind.EnumDeclaration
|
||||
@@ -64,7 +64,7 @@ function isDeclaration(a:TSTopLevelDeclare): a is TSTopLevelDeclaration {
|
||||
);
|
||||
}
|
||||
|
||||
function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTopLevelDeclare)=>boolean): void {
|
||||
function visitTopLevelDeclarations(sourceFile: ts.SourceFile, visitor: (node: TSTopLevelDeclare) => boolean): void {
|
||||
let stop = false;
|
||||
|
||||
let visit = (node: ts.Node): void => {
|
||||
@@ -100,8 +100,8 @@ function visitTopLevelDeclarations(sourceFile:ts.SourceFile, visitor:(node:TSTop
|
||||
}
|
||||
|
||||
|
||||
function getAllTopLevelDeclarations(sourceFile:ts.SourceFile): TSTopLevelDeclare[] {
|
||||
let all:TSTopLevelDeclare[] = [];
|
||||
function getAllTopLevelDeclarations(sourceFile: ts.SourceFile): TSTopLevelDeclare[] {
|
||||
let all: TSTopLevelDeclare[] = [];
|
||||
visitTopLevelDeclarations(sourceFile, (node) => {
|
||||
if (node.kind === ts.SyntaxKind.InterfaceDeclaration || node.kind === ts.SyntaxKind.ClassDeclaration || node.kind === ts.SyntaxKind.ModuleDeclaration) {
|
||||
let interfaceDeclaration = <ts.InterfaceDeclaration>node;
|
||||
@@ -128,8 +128,8 @@ function getAllTopLevelDeclarations(sourceFile:ts.SourceFile): TSTopLevelDeclare
|
||||
}
|
||||
|
||||
|
||||
function getTopLevelDeclaration(sourceFile:ts.SourceFile, typeName:string): TSTopLevelDeclare {
|
||||
let result:TSTopLevelDeclare = null;
|
||||
function getTopLevelDeclaration(sourceFile: ts.SourceFile, typeName: string): TSTopLevelDeclare {
|
||||
let result: TSTopLevelDeclare = null;
|
||||
visitTopLevelDeclarations(sourceFile, (node) => {
|
||||
if (isDeclaration(node)) {
|
||||
if (node.name.text === typeName) {
|
||||
@@ -149,12 +149,12 @@ function getTopLevelDeclaration(sourceFile:ts.SourceFile, typeName:string): TSTo
|
||||
}
|
||||
|
||||
|
||||
function getNodeText(sourceFile:ts.SourceFile, node:{pos:number; end:number;}): string {
|
||||
function getNodeText(sourceFile: ts.SourceFile, node: { pos: number; end: number; }): string {
|
||||
return sourceFile.getFullText().substring(node.pos, node.end);
|
||||
}
|
||||
|
||||
|
||||
function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaration: TSTopLevelDeclare): string {
|
||||
function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare): string {
|
||||
let result = getNodeText(sourceFile, declaration);
|
||||
// if (result.indexOf('MonacoWorker') >= 0) {
|
||||
// console.log('here!');
|
||||
@@ -163,7 +163,7 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
|
||||
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
||||
let interfaceDeclaration = <ts.InterfaceDeclaration | ts.ClassDeclaration>declaration;
|
||||
|
||||
let members:ts.NodeArray<ts.Node> = interfaceDeclaration.members;
|
||||
let members: ts.NodeArray<ts.Node> = interfaceDeclaration.members;
|
||||
members.forEach((member) => {
|
||||
try {
|
||||
let memberText = getNodeText(sourceFile, member);
|
||||
@@ -182,7 +182,7 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
|
||||
return result;
|
||||
}
|
||||
|
||||
function format(text:string): string {
|
||||
function format(text: string): string {
|
||||
|
||||
// Parse the source text
|
||||
let sourceFile = ts.createSourceFile('file.ts', text, ts.ScriptTarget.Latest, /*setParentPointers*/ true);
|
||||
@@ -196,9 +196,7 @@ function format(text:string): string {
|
||||
function getRuleProvider(options: ts.FormatCodeSettings) {
|
||||
// Share this between multiple formatters using the same options.
|
||||
// This represents the bulk of the space the formatter uses.
|
||||
let ruleProvider = new (<any>ts).formatting.RulesProvider();
|
||||
ruleProvider.ensureUpToDate(options);
|
||||
return ruleProvider;
|
||||
return (ts as any).formatting.getFormatContext(options);
|
||||
}
|
||||
|
||||
function applyEdits(text: string, edits: ts.TextChange[]): string {
|
||||
@@ -214,10 +212,10 @@ function format(text:string): string {
|
||||
}
|
||||
}
|
||||
|
||||
function createReplacer(data:string): (str:string)=>string {
|
||||
function createReplacer(data: string): (str: string) => string {
|
||||
data = data || '';
|
||||
let rawDirectives = data.split(';');
|
||||
let directives: [RegExp,string][] = [];
|
||||
let directives: [RegExp, string][] = [];
|
||||
rawDirectives.forEach((rawDirective) => {
|
||||
if (rawDirective.length === 0) {
|
||||
return;
|
||||
@@ -231,7 +229,7 @@ function createReplacer(data:string): (str:string)=>string {
|
||||
directives.push([new RegExp(findStr, 'g'), replaceStr]);
|
||||
});
|
||||
|
||||
return (str:string)=> {
|
||||
return (str: string) => {
|
||||
for (let i = 0; i < directives.length; i++) {
|
||||
str = str.replace(directives[i][0], directives[i][1]);
|
||||
}
|
||||
@@ -239,10 +237,11 @@ function createReplacer(data:string): (str:string)=>string {
|
||||
};
|
||||
}
|
||||
|
||||
function generateDeclarationFile(out: string, inputFiles: { [file: string]: string; }, recipe:string): string {
|
||||
let lines = recipe.split(/\r\n|\n|\r/);
|
||||
let result = [];
|
||||
function generateDeclarationFile(out: string, inputFiles: { [file: string]: string; }, recipe: string): string {
|
||||
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
||||
|
||||
let lines = recipe.split(endl);
|
||||
let result = [];
|
||||
|
||||
lines.forEach(line => {
|
||||
|
||||
@@ -285,7 +284,7 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
|
||||
let replacer = createReplacer(m2[2]);
|
||||
|
||||
let typeNames = m2[3].split(/,/);
|
||||
let typesToExcludeMap: {[typeName:string]:boolean;} = {};
|
||||
let typesToExcludeMap: { [typeName: string]: boolean; } = {};
|
||||
let typesToExcludeArr: string[] = [];
|
||||
typeNames.forEach((typeName) => {
|
||||
typeName = typeName.trim();
|
||||
@@ -318,18 +317,17 @@ function generateDeclarationFile(out: string, inputFiles: { [file: string]: stri
|
||||
result.push(line);
|
||||
});
|
||||
|
||||
let resultTxt = result.join('\n');
|
||||
let resultTxt = result.join(endl);
|
||||
resultTxt = resultTxt.replace(/\bURI\b/g, 'Uri');
|
||||
resultTxt = resultTxt.replace(/\bEvent</g, 'IEvent<');
|
||||
resultTxt = resultTxt.replace(/\bTPromise</g, 'Promise<');
|
||||
|
||||
resultTxt = format(resultTxt);
|
||||
|
||||
resultTxt = resultTxt.replace(/\r\n/g, '\n');
|
||||
return resultTxt;
|
||||
}
|
||||
|
||||
export function getFilesToWatch(out:string): string[] {
|
||||
export function getFilesToWatch(out: string): string[] {
|
||||
let recipe = fs.readFileSync(RECIPE_PATH).toString();
|
||||
let lines = recipe.split(/\r\n|\n|\r/);
|
||||
let result = [];
|
||||
@@ -370,10 +368,14 @@ export function run(out: string, inputFiles: { [file: string]: string; }): IMona
|
||||
let currentContent = fs.readFileSync(DECLARATION_PATH).toString();
|
||||
log('Finished monaco.d.ts generation');
|
||||
|
||||
const one = currentContent.replace(/\r\n/gm, '\n');
|
||||
const other = result.replace(/\r\n/gm, '\n');
|
||||
const isTheSame = one === other;
|
||||
|
||||
return {
|
||||
content: result,
|
||||
filePath: DECLARATION_PATH,
|
||||
isTheSame: currentContent === result
|
||||
isTheSame
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module monaco {
|
||||
declare namespace monaco {
|
||||
|
||||
type Thenable<T> = PromiseLike<T>;
|
||||
export type Thenable<T> = PromiseLike<T>;
|
||||
|
||||
export interface IDisposable {
|
||||
dispose(): void;
|
||||
@@ -32,6 +32,14 @@ declare module monaco {
|
||||
Error = 3,
|
||||
}
|
||||
|
||||
export enum MarkerSeverity {
|
||||
Hint = 1,
|
||||
Info = 2,
|
||||
Warning = 4,
|
||||
Error = 8,
|
||||
}
|
||||
|
||||
|
||||
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, Promise
|
||||
#include(vs/base/common/cancellation): CancellationTokenSource, CancellationToken
|
||||
#include(vs/base/common/uri): URI, UriComponents
|
||||
@@ -46,7 +54,7 @@ declare module monaco {
|
||||
#include(vs/editor/common/core/token): Token
|
||||
}
|
||||
|
||||
declare module monaco.editor {
|
||||
declare namespace monaco.editor {
|
||||
|
||||
#includeAll(vs/editor/standalone/browser/standaloneEditor;modes.=>languages.;editorCommon.=>):
|
||||
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
||||
@@ -58,29 +66,34 @@ export interface ICommandHandler {
|
||||
}
|
||||
#include(vs/platform/contextkey/common/contextkey): IContextKey
|
||||
#include(vs/editor/standalone/browser/standaloneServices): IEditorOverrideServices
|
||||
#include(vs/platform/markers/common/markers): IMarker, IMarkerData
|
||||
#include(vs/platform/markers/common/markers): IMarker, IMarkerData, IRelatedInformation
|
||||
#include(vs/editor/standalone/browser/colorizer): IColorizerOptions, IColorizerElementOptions
|
||||
#include(vs/base/common/scrollable): ScrollbarVisibility
|
||||
#include(vs/platform/theme/common/themeService): ThemeColor
|
||||
#includeAll(vs/editor/common/editorCommon;IMode=>languages.IMode;LanguageIdentifier=>languages.LanguageIdentifier;editorOptions.=>): ISelection, IScrollEvent
|
||||
#includeAll(vs/editor/common/model;LanguageIdentifier=>languages.LanguageIdentifier): IScrollEvent
|
||||
#includeAll(vs/editor/common/editorCommon;editorOptions.=>): IScrollEvent
|
||||
#includeAll(vs/editor/common/model/textModelEvents):
|
||||
#includeAll(vs/editor/common/controller/cursorEvents):
|
||||
#includeAll(vs/editor/common/config/editorOptions):
|
||||
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
|
||||
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo
|
||||
|
||||
//compatibility:
|
||||
export type IReadOnlyModel = ITextModel;
|
||||
export type IModel = ITextModel;
|
||||
}
|
||||
|
||||
declare module monaco.languages {
|
||||
declare namespace monaco.languages {
|
||||
|
||||
#includeAll(vs/editor/standalone/browser/standaloneLanguages;modes.=>;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData):
|
||||
#includeAll(vs/editor/standalone/browser/standaloneLanguages;modes.=>;editorCommon.=>editor.;model.=>editor.;IMarkerData=>editor.IMarkerData):
|
||||
#includeAll(vs/editor/common/modes/languageConfiguration):
|
||||
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData):
|
||||
#includeAll(vs/editor/common/modes;editorCommon.IRange=>IRange;editorCommon.IPosition=>IPosition;editorCommon.=>editor.;IMarkerData=>editor.IMarkerData;model.=>editor.):
|
||||
#include(vs/editor/common/services/modeService): ILanguageExtensionPoint
|
||||
#includeAll(vs/editor/standalone/common/monarch/monarchTypes):
|
||||
|
||||
}
|
||||
|
||||
declare module monaco.worker {
|
||||
declare namespace monaco.worker {
|
||||
|
||||
#includeAll(vs/editor/common/services/editorSimpleWorker;):
|
||||
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
{
|
||||
"name": "monaco-editor-core",
|
||||
"private": true,
|
||||
"version": "0.9.0",
|
||||
"version": "0.12.0",
|
||||
"description": "A browser based code editor",
|
||||
"author": "Microsoft Corporation",
|
||||
"license": "MIT",
|
||||
"typings": "./esm/vs/editor/editor.api.d.ts",
|
||||
"module": "./esm/vs/editor/editor.main.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/vscode"
|
||||
},
|
||||
"bugs": {
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/vscode/issues"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,28 +21,24 @@ function yarnInstall(location, opts) {
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
yarnInstall('extensions-modules');
|
||||
yarnInstall('extensions'); // node modules shared by all extensions
|
||||
|
||||
const extensions = [
|
||||
'vscode-colorize-tests',
|
||||
'json',
|
||||
'mssql',
|
||||
'configuration-editing',
|
||||
'extension-editing',
|
||||
'markdown',
|
||||
'git',
|
||||
'merge-conflict',
|
||||
'insights-default',
|
||||
'account-provider-azure',
|
||||
'agent'
|
||||
];
|
||||
const allExtensionFolders = fs.readdirSync('extensions');
|
||||
const extensions = allExtensionFolders.filter(e => {
|
||||
try {
|
||||
let packageJSON = JSON.parse(fs.readFileSync(path.join('extensions', e, 'package.json')).toString());
|
||||
return packageJSON && (packageJSON.dependencies || packageJSON.devDependencies);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
extensions.forEach(extension => yarnInstall(`extensions/${extension}`));
|
||||
|
||||
function yarnInstallBuildDependencies() {
|
||||
// make sure we install the deps of build/lib/watch for the system installed
|
||||
// node, since that is the driver of gulp
|
||||
//@ts-ignore
|
||||
const env = Object.assign({}, process.env);
|
||||
const watchPath = path.join(path.dirname(__dirname), 'lib', 'watch');
|
||||
const yarnrcPath = path.join(watchPath, '.yarnrc');
|
||||
@@ -60,4 +56,5 @@ runtime "${runtime}"`;
|
||||
}
|
||||
|
||||
yarnInstall(`build`); // node modules required for build
|
||||
yarnInstall('test/smoke'); // node modules required for smoketest
|
||||
yarnInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron
|
||||
@@ -4,9 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const cp = require('child_process');
|
||||
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function updateGrammar(location) {
|
||||
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
const result = cp.spawnSync(npm, ['run', 'update-grammar'], {
|
||||
cwd: location,
|
||||
stdio: 'inherit'
|
||||
@@ -17,50 +19,17 @@ function updateGrammar(location) {
|
||||
}
|
||||
}
|
||||
|
||||
const extensions = [
|
||||
'bat',
|
||||
'clojure',
|
||||
'coffeescript',
|
||||
'cpp',
|
||||
'csharp',
|
||||
'css',
|
||||
'diff',
|
||||
'docker',
|
||||
'fsharp',
|
||||
'gitsyntax',
|
||||
'go',
|
||||
'groovy',
|
||||
'handlebars',
|
||||
'hlsl',
|
||||
'html',
|
||||
'ini',
|
||||
'java',
|
||||
// 'javascript', updated through JavaScript
|
||||
'json',
|
||||
'less',
|
||||
'lua',
|
||||
'make',
|
||||
'markdown',
|
||||
'objective-c',
|
||||
'perl',
|
||||
'php',
|
||||
// 'powershell', grammar not ready yet, @daviwil will ping when ready
|
||||
'pug',
|
||||
'python',
|
||||
'r',
|
||||
'razor',
|
||||
'ruby',
|
||||
'rust',
|
||||
'scss',
|
||||
'shaderlab',
|
||||
'shellscript',
|
||||
'sql',
|
||||
'swift',
|
||||
'typescript',
|
||||
'vb',
|
||||
'xml',
|
||||
'yaml'
|
||||
];
|
||||
const allExtensionFolders = fs.readdirSync('extensions');
|
||||
const extensions = allExtensionFolders.filter(e => {
|
||||
try {
|
||||
let packageJSON = JSON.parse(fs.readFileSync(path.join('extensions', e, 'package.json')).toString());
|
||||
return packageJSON && packageJSON.scripts && packageJSON.scripts['update-grammar'];
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Updating ${extensions.length} grammars...`);
|
||||
|
||||
extensions.forEach(extension => updateGrammar(`extensions/${extension}`));
|
||||
|
||||
@@ -70,4 +39,5 @@ if (process.platform === 'win32') {
|
||||
cp.spawn('.\scripts\test-integration.bat', [], { env: process.env, stdio: 'inherit' });
|
||||
} else {
|
||||
cp.spawn('/bin/bash', ['./scripts/test-integration.sh'], { env: process.env, stdio: 'inherit' });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,19 @@ var url = require('url');
|
||||
|
||||
function getOptions(urlString) {
|
||||
var _url = url.parse(urlString);
|
||||
var headers = {
|
||||
'User-Agent': 'VSCode'
|
||||
};
|
||||
var token = process.env['GITHUB_TOKEN'];
|
||||
if (token) {
|
||||
headers['Authorization'] = 'token ' + token
|
||||
}
|
||||
return {
|
||||
protocol: _url.protocol,
|
||||
host: _url.host,
|
||||
port: _url.port,
|
||||
path: _url.path,
|
||||
headers: {
|
||||
'User-Agent': 'NodeJS'
|
||||
}
|
||||
headers: headers
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,12 +37,16 @@ function download(url, redirectCount) {
|
||||
response.on('data', function (data) {
|
||||
content += data.toString();
|
||||
}).on('end', function () {
|
||||
if (response.statusCode === 403 && response.headers['x-ratelimit-remaining'] === '0') {
|
||||
e('GitHub API rate exceeded. Set GITHUB_TOKEN environment variable to increase rate limit.');
|
||||
return;
|
||||
}
|
||||
let count = redirectCount || 0;
|
||||
if (count < 5 && response.statusCode >= 300 && response.statusCode <= 303 || response.statusCode === 307) {
|
||||
let location = response.headers['location'];
|
||||
if (location) {
|
||||
console.log("Redirected " + url + " to " + location);
|
||||
download(location, count+1).then(c, e);
|
||||
download(location, count + 1).then(c, e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -59,17 +68,13 @@ function getCommitSha(repoId, repoPath) {
|
||||
commitDate: lastCommit.commit.author.date
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Failed extracting the SHA: " + content);
|
||||
return Promise.resolve(null);
|
||||
return Promise.reject(new Error("Failed extracting the SHA: " + content));
|
||||
}
|
||||
}, function () {
|
||||
console.error('Failed loading ' + commitInfo);
|
||||
return Promise.resolve(null);
|
||||
});
|
||||
}
|
||||
|
||||
exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
||||
var contentPath = 'https://raw.githubusercontent.com/' + repoId + '/master/' + repoPath;
|
||||
exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'master') {
|
||||
var contentPath = 'https://raw.githubusercontent.com/' + repoId + `/${version}/` + repoPath;
|
||||
console.log('Reading from ' + contentPath);
|
||||
return download(contentPath).then(function (content) {
|
||||
var ext = path.extname(repoPath);
|
||||
@@ -81,8 +86,7 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
||||
} else if (ext === '.json') {
|
||||
grammar = JSON.parse(content);
|
||||
} else {
|
||||
console.error('Unknown file extension: ' + ext);
|
||||
return;
|
||||
return Promise.reject(new Error('Unknown file extension: ' + ext));
|
||||
}
|
||||
if (modifyGrammar) {
|
||||
modifyGrammar(grammar);
|
||||
@@ -99,8 +103,10 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
||||
if (info) {
|
||||
result.version = 'https://github.com/' + repoId + '/commit/' + info.commitSha;
|
||||
}
|
||||
for (let key in grammar) {
|
||||
if (!result.hasOwnProperty(key)) {
|
||||
|
||||
let keys = ['name', 'scopeName', 'comment', 'injections', 'patterns', 'repository'];
|
||||
for (let key of keys) {
|
||||
if (grammar.hasOwnProperty(key)) {
|
||||
result[key] = grammar[key];
|
||||
}
|
||||
}
|
||||
@@ -113,11 +119,14 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar) {
|
||||
console.log('Updated ' + path.basename(dest));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return Promise.reject(e);
|
||||
}
|
||||
});
|
||||
|
||||
}, console.error);
|
||||
}, console.error).catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
};
|
||||
|
||||
if (path.basename(process.argv[1]) === 'update-grammar.js') {
|
||||
|
||||
69
build/npm/update-localization-extension.js
Normal file
69
build/npm/update-localization-extension.js
Normal file
@@ -0,0 +1,69 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
let i18n = require("../lib/i18n");
|
||||
|
||||
let fs = require("fs");
|
||||
let path = require("path");
|
||||
let vfs = require("vinyl-fs");
|
||||
let rimraf = require('rimraf');
|
||||
|
||||
function update(idOrPath) {
|
||||
if (!idOrPath) {
|
||||
throw new Error('Argument must be the location of the localization extension.');
|
||||
}
|
||||
let locExtFolder = idOrPath;
|
||||
if (/^\w{2}(-\w+)?$/.test(idOrPath)) {
|
||||
locExtFolder = '../vscode-language-pack-' + idOrPath;
|
||||
}
|
||||
let locExtStat = fs.statSync(locExtFolder);
|
||||
if (!locExtStat || !locExtStat.isDirectory) {
|
||||
throw new Error('No directory found at ' + idOrPath);
|
||||
}
|
||||
let packageJSON = JSON.parse(fs.readFileSync(path.join(locExtFolder, 'package.json')).toString());
|
||||
let contributes = packageJSON['contributes'];
|
||||
if (!contributes) {
|
||||
throw new Error('The extension must define a "localizations" contribution in the "package.json"');
|
||||
}
|
||||
let localizations = contributes['localizations'];
|
||||
if (!localizations) {
|
||||
throw new Error('The extension must define a "localizations" contribution of type array in the "package.json"');
|
||||
}
|
||||
|
||||
localizations.forEach(function (localization) {
|
||||
if (!localization.languageId || !localization.languageName || !localization.localizedLanguageName) {
|
||||
throw new Error('Each localization contribution must define "languageId", "languageName" and "localizedLanguageName" properties.');
|
||||
}
|
||||
let server = localization.server || 'www.transifex.com';
|
||||
let userName = localization.userName || 'api';
|
||||
let apiToken = process.env.TRANSIFEX_API_TOKEN;
|
||||
let languageId = localization.transifexId || localization.languageId;
|
||||
let translationDataFolder = path.join(locExtFolder, 'translations');
|
||||
|
||||
if (fs.existsSync(translationDataFolder) && fs.existsSync(path.join(translationDataFolder, 'main.i18n.json'))) {
|
||||
console.log('Clearing \'' + translationDataFolder + '\'...');
|
||||
rimraf.sync(translationDataFolder);
|
||||
}
|
||||
|
||||
console.log('Downloading translations for \'' + languageId + '\' to \'' + translationDataFolder + '\'...');
|
||||
const translationPaths = [];
|
||||
i18n.pullI18nPackFiles(server, userName, apiToken, { id: languageId }, translationPaths)
|
||||
.pipe(vfs.dest(translationDataFolder)).on('end', function () {
|
||||
localization.translations = [];
|
||||
for (let tp of translationPaths) {
|
||||
localization.translations.push({ id: tp.id, path: `./translations/${tp.resourceName}`});
|
||||
}
|
||||
fs.writeFileSync(path.join(locExtFolder, 'package.json'), JSON.stringify(packageJSON, null, '\t'));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
if (path.basename(process.argv[1]) === 'update-localization-extension.js') {
|
||||
update(process.argv[2]);
|
||||
}
|
||||
@@ -9,20 +9,24 @@
|
||||
"@types/mime": "0.0.29",
|
||||
"@types/node": "8.0.33",
|
||||
"@types/xml2js": "0.0.33",
|
||||
"@types/request": "^2.47.0",
|
||||
"azure-storage": "^2.1.0",
|
||||
"decompress": "^4.2.0",
|
||||
"documentdb": "1.13.0",
|
||||
"extensions-modules": "file:../extensions-modules",
|
||||
"service-downloader": "github:anthonydresser/service-downloader#0.1.2",
|
||||
"fs-extra-promise": "^1.0.1",
|
||||
"mime": "^1.3.4",
|
||||
"minimist": "^1.2.0",
|
||||
"typescript": "2.6.1",
|
||||
"vscode": "^1.0.1",
|
||||
"xml2js": "^0.4.17"
|
||||
"typescript": "2.8.1",
|
||||
"vscode": "^1.0.1",
|
||||
"xml2js": "^0.4.17",
|
||||
"github-releases": "^0.4.1",
|
||||
"request": "^2.85.0"
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "tsc",
|
||||
"watch": "tsc --watch",
|
||||
"postinstall": "npm run compile"
|
||||
"compile": "tsc -p tsconfig.build.json",
|
||||
"watch": "tsc -p tsconfig.build.json --watch",
|
||||
"postinstall": "npm run compile",
|
||||
"npmCheckJs": "tsc --noEmit"
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,9 @@ set -e
|
||||
# setup nvm
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
export NVM_DIR=~/.nvm
|
||||
source $(brew --prefix nvm)/nvm.sh
|
||||
source $(brew --prefix nvm)/nvm.sh --no-use
|
||||
else
|
||||
source $NVM_DIR/nvm.sh
|
||||
source $NVM_DIR/nvm.sh --no-use
|
||||
fi
|
||||
|
||||
# install node
|
||||
|
||||
@@ -70,6 +70,7 @@ interface Asset {
|
||||
hash: string;
|
||||
sha256hash: string;
|
||||
size: number;
|
||||
supportsFastUpdate?: boolean;
|
||||
}
|
||||
|
||||
function createOrUpdate(commit: string, quality: string, platform: string, type: string, release: NewDocument, asset: Asset, isUpdate: boolean): Promise<void> {
|
||||
@@ -203,17 +204,30 @@ async function publish(commit: string, quality: string, platform: string, type:
|
||||
// mooncake is fussy and far away, this is needed!
|
||||
mooncakeBlobService.defaultClientRequestTimeoutInMs = 10 * 60 * 1000;
|
||||
|
||||
await assertContainer(mooncakeBlobService, quality);
|
||||
await Promise.all([
|
||||
assertContainer(blobService, quality),
|
||||
assertContainer(mooncakeBlobService, quality)
|
||||
]);
|
||||
|
||||
const mooncakeBlobExists = await doesAssetExist(mooncakeBlobService, quality, blobName);
|
||||
const [blobExists, moooncakeBlobExists] = await Promise.all([
|
||||
doesAssetExist(blobService, quality, blobName),
|
||||
doesAssetExist(mooncakeBlobService, quality, blobName)
|
||||
]);
|
||||
|
||||
if (!mooncakeBlobExists) {
|
||||
const promises = [];
|
||||
|
||||
if (!blobExists) {
|
||||
promises.push(uploadBlob(blobService, quality, blobName, file));
|
||||
}
|
||||
|
||||
if (!moooncakeBlobExists) {
|
||||
promises.push(uploadBlob(mooncakeBlobService, quality, blobName, file));
|
||||
}
|
||||
} else {
|
||||
console.log('Skipping Mooncake publishing.');
|
||||
}
|
||||
|
||||
|
||||
if (promises.length === 0) {
|
||||
console.log(`Blob ${quality}, ${blobName} already exists, not publishing again.`);
|
||||
return;
|
||||
@@ -240,6 +254,13 @@ async function publish(commit: string, quality: string, platform: string, type:
|
||||
size
|
||||
};
|
||||
|
||||
// Remove this if we ever need to rollback fast updates for windows
|
||||
if (/win32/.test(platform)) {
|
||||
asset.supportsFastUpdate = true;
|
||||
}
|
||||
|
||||
console.log('Asset:', JSON.stringify(asset, null, ' '));
|
||||
|
||||
const release = {
|
||||
id: commit,
|
||||
timestamp: (new Date()).getTime(),
|
||||
|
||||
219
build/tfs/common/symbols.ts
Normal file
219
build/tfs/common/symbols.ts
Normal file
@@ -0,0 +1,219 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as request from 'request';
|
||||
import { createReadStream, createWriteStream, unlink, mkdir } from 'fs';
|
||||
import * as github from 'github-releases';
|
||||
import { join } from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import { promisify } from 'util';
|
||||
|
||||
const BASE_URL = 'https://rink.hockeyapp.net/api/2/';
|
||||
const HOCKEY_APP_TOKEN_HEADER = 'X-HockeyAppToken';
|
||||
|
||||
export interface IVersions {
|
||||
app_versions: IVersion[];
|
||||
}
|
||||
|
||||
export interface IVersion {
|
||||
id: number;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export interface IApplicationAccessor {
|
||||
accessToken: string;
|
||||
appId: string;
|
||||
}
|
||||
|
||||
export interface IVersionAccessor extends IApplicationAccessor {
|
||||
id: string;
|
||||
}
|
||||
|
||||
enum Platform {
|
||||
WIN_32 = 'win32-ia32',
|
||||
WIN_64 = 'win32-x64',
|
||||
LINUX_32 = 'linux-ia32',
|
||||
LINUX_64 = 'linux-x64',
|
||||
MAC_OS = 'darwin-x64'
|
||||
}
|
||||
|
||||
function symbolsZipName(platform: Platform, electronVersion: string, insiders: boolean): string {
|
||||
return `${insiders ? 'insiders' : 'stable'}-symbols-v${electronVersion}-${platform}.zip`;
|
||||
}
|
||||
|
||||
const SEED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
async function tmpFile(name: string): Promise<string> {
|
||||
let res = '';
|
||||
for (let i = 0; i < 8; i++) {
|
||||
res += SEED.charAt(Math.floor(Math.random() * SEED.length));
|
||||
}
|
||||
|
||||
const tmpParent = join(tmpdir(), res);
|
||||
|
||||
await promisify(mkdir)(tmpParent);
|
||||
|
||||
return join(tmpParent, name);
|
||||
}
|
||||
|
||||
function getVersions(accessor: IApplicationAccessor): Promise<IVersions> {
|
||||
return asyncRequest<IVersions>({
|
||||
url: `${BASE_URL}/apps/${accessor.appId}/app_versions`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
[HOCKEY_APP_TOKEN_HEADER]: accessor.accessToken
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createVersion(accessor: IApplicationAccessor, version: string): Promise<IVersion> {
|
||||
return asyncRequest<IVersion>({
|
||||
url: `${BASE_URL}/apps/${accessor.appId}/app_versions/new`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
[HOCKEY_APP_TOKEN_HEADER]: accessor.accessToken
|
||||
},
|
||||
formData: {
|
||||
bundle_version: version
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateVersion(accessor: IVersionAccessor, symbolsPath: string) {
|
||||
return asyncRequest<IVersions>({
|
||||
url: `${BASE_URL}/apps/${accessor.appId}/app_versions/${accessor.id}`,
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
[HOCKEY_APP_TOKEN_HEADER]: accessor.accessToken
|
||||
},
|
||||
formData: {
|
||||
dsym: createReadStream(symbolsPath)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function asyncRequest<T>(options: request.UrlOptions & request.CoreOptions): Promise<T> {
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
request(options, (error, response, body) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(JSON.parse(body));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function downloadAsset(repository, assetName: string, targetPath: string, electronVersion: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
repository.getReleases({ tag_name: `v${electronVersion}` }, (err, releases) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
const asset = releases[0].assets.filter(asset => asset.name === assetName)[0];
|
||||
if (!asset) {
|
||||
reject(new Error(`Asset with name ${assetName} not found`));
|
||||
} else {
|
||||
repository.downloadAsset(asset, (err, reader) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
const writer = createWriteStream(targetPath);
|
||||
writer.on('error', reject);
|
||||
writer.on('close', resolve);
|
||||
reader.on('error', reject);
|
||||
|
||||
reader.pipe(writer);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
interface IOptions {
|
||||
repository: string;
|
||||
platform: Platform;
|
||||
versions: { code: string; insiders: boolean; electron: string; };
|
||||
access: { hockeyAppToken: string; hockeyAppId: string; githubToken: string };
|
||||
}
|
||||
|
||||
async function ensureVersionAndSymbols(options: IOptions) {
|
||||
|
||||
// Check version does not exist
|
||||
console.log(`HockeyApp: checking for existing version ${options.versions.code} (${options.platform})`);
|
||||
const versions = await getVersions({ accessToken: options.access.hockeyAppToken, appId: options.access.hockeyAppId });
|
||||
if (versions.app_versions.some(v => v.version === options.versions.code)) {
|
||||
console.log(`HockeyApp: Returning without uploading symbols because version ${options.versions.code} (${options.platform}) was already found`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Download symbols for platform and electron version
|
||||
const symbolsName = symbolsZipName(options.platform, options.versions.electron, options.versions.insiders);
|
||||
const symbolsPath = await tmpFile('symbols.zip');
|
||||
console.log(`HockeyApp: downloading symbols ${symbolsName} for electron ${options.versions.electron} (${options.platform}) into ${symbolsPath}`);
|
||||
await downloadAsset(new github({ repo: options.repository, token: options.access.githubToken }), symbolsName, symbolsPath, options.versions.electron);
|
||||
|
||||
// Create version
|
||||
console.log(`HockeyApp: creating new version ${options.versions.code} (${options.platform})`);
|
||||
const version = await createVersion({ accessToken: options.access.hockeyAppToken, appId: options.access.hockeyAppId }, options.versions.code);
|
||||
|
||||
// Upload symbols
|
||||
console.log(`HockeyApp: uploading symbols for version ${options.versions.code} (${options.platform})`);
|
||||
await updateVersion({ id: String(version.id), accessToken: options.access.hockeyAppToken, appId: options.access.hockeyAppId }, symbolsPath);
|
||||
|
||||
// Cleanup
|
||||
await promisify(unlink)(symbolsPath);
|
||||
}
|
||||
|
||||
// Environment
|
||||
const pakage = require('../../../package.json');
|
||||
const product = require('../../../product.json');
|
||||
const repository = product.electronRepository;
|
||||
const electronVersion = require('../../lib/electron').getElectronVersion();
|
||||
const insiders = product.quality !== 'stable';
|
||||
let codeVersion = pakage.version;
|
||||
if (insiders) {
|
||||
codeVersion = `${codeVersion}-insider`;
|
||||
}
|
||||
const githubToken = process.argv[2];
|
||||
const hockeyAppToken = process.argv[3];
|
||||
const is64 = process.argv[4] === 'x64';
|
||||
const hockeyAppId = process.argv[5];
|
||||
|
||||
let platform: Platform;
|
||||
if (process.platform === 'darwin') {
|
||||
platform = Platform.MAC_OS;
|
||||
} else if (process.platform === 'win32') {
|
||||
platform = is64 ? Platform.WIN_64 : Platform.WIN_32;
|
||||
} else {
|
||||
platform = is64 ? Platform.LINUX_64 : Platform.LINUX_32;
|
||||
}
|
||||
|
||||
// Create version and upload symbols in HockeyApp
|
||||
if (repository && codeVersion && electronVersion && (product.quality === 'stable' || product.quality === 'insider')) {
|
||||
ensureVersionAndSymbols({
|
||||
repository,
|
||||
platform,
|
||||
versions: {
|
||||
code: codeVersion,
|
||||
insiders,
|
||||
electron: electronVersion
|
||||
},
|
||||
access: {
|
||||
githubToken,
|
||||
hockeyAppToken,
|
||||
hockeyAppId
|
||||
}
|
||||
}).then(() => {
|
||||
console.log('HockeyApp: done');
|
||||
}).catch(error => {
|
||||
console.error(`HockeyApp: error (${error})`);
|
||||
});
|
||||
} else {
|
||||
console.log(`HockeyApp: skipping due to unexpected context (repository: ${repository}, codeVersion: ${codeVersion}, electronVersion: ${electronVersion}, quality: ${product.quality})`);
|
||||
}
|
||||
100
build/tfs/continuous-build.yml
Normal file
100
build/tfs/continuous-build.yml
Normal file
@@ -0,0 +1,100 @@
|
||||
phases:
|
||||
- phase: Windows
|
||||
queue: Hosted VS2017
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
- powershell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
yarn
|
||||
.\node_modules\.bin\gulp electron
|
||||
npm run gulp -- hygiene
|
||||
.\node_modules\.bin\tsc -p .\src\tsconfig.monaco.json --noEmit
|
||||
npm run compile
|
||||
node build/lib/builtInExtensions.js
|
||||
name: build
|
||||
- powershell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
.\scripts\test.bat --tfs
|
||||
.\scripts\test-integration.bat
|
||||
yarn smoketest --screenshots "$(Build.ArtifactStagingDirectory)\artifacts" --log "$(Build.ArtifactStagingDirectory)\artifacts\smoketest.log"
|
||||
name: test
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts'
|
||||
ArtifactName: build-artifacts-win32
|
||||
publishLocation: Container
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- phase: Linux
|
||||
queue: Hosted Linux Preview
|
||||
steps:
|
||||
- script: |
|
||||
set -e
|
||||
apt-get update
|
||||
apt-get install -y libxkbfile-dev pkg-config libsecret-1-dev libxss1 libgconf-2-4 dbus xvfb libgtk-3-0
|
||||
cp build/tfs/linux/x64/xvfb.init /etc/init.d/xvfb
|
||||
chmod +x /etc/init.d/xvfb
|
||||
update-rc.d xvfb defaults
|
||||
ln -sf /bin/dbus-daemon /usr/bin/dbus-daemon
|
||||
service xvfb start
|
||||
service dbus start
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
- script: |
|
||||
set -e
|
||||
yarn
|
||||
npm run gulp -- electron-x64
|
||||
- script: |
|
||||
set -e
|
||||
npm run gulp -- hygiene
|
||||
./node_modules/.bin/tsc -p ./src/tsconfig.monaco.json --noEmit
|
||||
npm run compile
|
||||
node build/lib/builtInExtensions.js
|
||||
name: build
|
||||
- script: |
|
||||
set -e
|
||||
DISPLAY=:10 ./scripts/test.sh --tfs
|
||||
# DISPLAY=:10 ./scripts/test-integration.sh
|
||||
name: test
|
||||
|
||||
- phase: macOS
|
||||
queue: Hosted macOS Preview
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
- script: |
|
||||
set -e
|
||||
yarn
|
||||
npm run gulp -- electron-x64
|
||||
- script: |
|
||||
set -e
|
||||
npm run gulp -- hygiene
|
||||
./node_modules/.bin/tsc -p ./src/tsconfig.monaco.json --noEmit
|
||||
npm run compile
|
||||
node build/lib/builtInExtensions.js
|
||||
name: build
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test.sh --tfs
|
||||
./scripts/test-integration.sh
|
||||
yarn smoketest --screenshots "$(Build.ArtifactStagingDirectory)/artifacts" --log "$(Build.ArtifactStagingDirectory)/artifacts/smoketest.log"
|
||||
name: test
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts'
|
||||
ArtifactName: build-artifacts-darwin
|
||||
publishLocation: Container
|
||||
condition: succeededOrFailed()
|
||||
@@ -19,6 +19,9 @@ step "Install dependencies" \
|
||||
step "Hygiene" \
|
||||
npm run gulp -- hygiene
|
||||
|
||||
step "Monaco Editor Check" \
|
||||
./node_modules/.bin/tsc -p ./src/tsconfig.monaco.json --noEmit
|
||||
|
||||
step "Mix in repository from vscode-distro" \
|
||||
npm run gulp -- mixin
|
||||
|
||||
|
||||
51
build/tfs/darwin/build.yml
Normal file
51
build/tfs/darwin/build.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
steps:
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
|
||||
- script: |
|
||||
echo "machine monacotools.visualstudio.com password $(VSO_PAT)" > ~/.netrc
|
||||
yarn
|
||||
npm run gulp -- hygiene
|
||||
npm run monaco-compile-check
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin electron
|
||||
node build/tfs/common/installDistro.js
|
||||
|
||||
- script: |
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- vscode-darwin-min
|
||||
name: build
|
||||
|
||||
- script: |
|
||||
./scripts/test.sh --build --tfs
|
||||
name: test
|
||||
|
||||
- script: |
|
||||
# archive the unsigned build
|
||||
pushd ../VSCode-darwin && zip -r -X -y ../VSCode-darwin-unsigned.zip * && popd
|
||||
|
||||
# publish the unsigned build
|
||||
PACKAGEJSON=`ls ../VSCode-darwin/*.app/Contents/Resources/app/package.json`
|
||||
VERSION=`node -p "require(\"$PACKAGEJSON\").version"`
|
||||
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||
MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
|
||||
node build/tfs/common/publish.js \
|
||||
"$(VSCODE_QUALITY)" \
|
||||
darwin \
|
||||
archive-unsigned \
|
||||
"VSCode-darwin-$(VSCODE_QUALITY)-unsigned.zip" \
|
||||
$VERSION \
|
||||
false \
|
||||
../VSCode-darwin-unsigned.zip
|
||||
|
||||
# enqueue the unsigned build
|
||||
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||
node build/tfs/common/enqueue.js "$(VSCODE_QUALITY)"
|
||||
|
||||
npm run gulp -- upload-vscode-configuration
|
||||
@@ -22,6 +22,9 @@ step "Install dependencies" \
|
||||
step "Hygiene" \
|
||||
npm run gulp -- hygiene
|
||||
|
||||
step "Monaco Editor Check" \
|
||||
./node_modules/.bin/tsc -p ./src/tsconfig.monaco.json --noEmit
|
||||
|
||||
step "Mix in repository from vscode-distro" \
|
||||
npm run gulp -- mixin
|
||||
|
||||
|
||||
103
build/tfs/linux/build.yml
Normal file
103
build/tfs/linux/build.yml
Normal file
@@ -0,0 +1,103 @@
|
||||
steps:
|
||||
|
||||
- script: |
|
||||
# dependencies
|
||||
dpkg --add-architecture i386
|
||||
apt-get update
|
||||
|
||||
DEPS=" \
|
||||
gcc-multilib g++-multilib \
|
||||
pkg-config \
|
||||
dbus \
|
||||
xvfb \
|
||||
fakeroot \
|
||||
bc \
|
||||
bsdmainutils \
|
||||
rpm \
|
||||
"
|
||||
|
||||
if [[ "$(VSCODE_ARCH)" == "x64" ]]; then
|
||||
DEPS="$DEPS \
|
||||
dpkg-dev \
|
||||
libgconf-2-4 \
|
||||
libnss3 \
|
||||
libasound2 \
|
||||
libxtst6 \
|
||||
libx11-dev \
|
||||
libxkbfile-dev \
|
||||
libxss1 \
|
||||
libx11-xcb-dev \
|
||||
libsecret-1-dev \
|
||||
"
|
||||
else
|
||||
DEPS="$DEPS \
|
||||
dpkg-dev:i386 \
|
||||
libgconf-2-4:i386 \
|
||||
libnss3:i386 \
|
||||
libasound2:i386 \
|
||||
libxtst6:i386 \
|
||||
libnotify4:i386 \
|
||||
libx11-dev:i386 \
|
||||
libxkbfile-dev:i386 \
|
||||
libxss1:i386 \
|
||||
libx11-xcb-dev:i386 \
|
||||
libgl1-mesa-glx:i386 libgl1-mesa-dri:i386 \
|
||||
libgirepository-1.0-1:i386 \
|
||||
gir1.2-glib-2.0:i386 \
|
||||
gir1.2-secret-1:i386 \
|
||||
libsecret-1-dev:i386 \
|
||||
libgtk2.0-0:i386 \
|
||||
"
|
||||
fi
|
||||
|
||||
apt-get install -y $DEPS
|
||||
|
||||
# setup xvfb
|
||||
cp build/tfs/linux/$(VSCODE_ARCH)/xvfb.init /etc/init.d/xvfb
|
||||
chmod +x /etc/init.d/xvfb
|
||||
update-rc.d xvfb defaults
|
||||
service xvfb start
|
||||
|
||||
# setup dbus
|
||||
ln -sf /bin/dbus-daemon /usr/bin/dbus-daemon
|
||||
service dbus start
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
|
||||
- script: |
|
||||
export npm_config_arch="$(VSCODE_ARCH)"
|
||||
if [[ "$(VSCODE_ARCH)" == "ia32" ]]; then
|
||||
export PKG_CONFIG_PATH="/usr/lib/i386-linux-gnu/pkgconfig"
|
||||
fi
|
||||
|
||||
echo "machine monacotools.visualstudio.com password $(VSO_PAT)" > ~/.netrc
|
||||
yarn
|
||||
npm run gulp -- hygiene
|
||||
npm run monaco-compile-check
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
|
||||
node build/tfs/common/installDistro.js
|
||||
|
||||
- script: |
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- vscode-linux-$(VSCODE_ARCH)-min
|
||||
name: build
|
||||
|
||||
- script: |
|
||||
npm run gulp -- "electron-$(VSCODE_ARCH)"
|
||||
DISPLAY=:10 ./scripts/test.sh --build --tfs
|
||||
name: test
|
||||
|
||||
- script: |
|
||||
npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-deb"
|
||||
npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-rpm"
|
||||
#npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-snap"
|
||||
|
||||
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||
MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
|
||||
./build/tfs/linux/release2.sh "$(VSCODE_ARCH)" "$(LINUX_REPO_PASSWORD)"
|
||||
67
build/tfs/linux/release2.sh
Executable file
67
build/tfs/linux/release2.sh
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Arguments
|
||||
ARCH="$1"
|
||||
LINUX_REPO_PASSWORD="$2"
|
||||
|
||||
# Variables
|
||||
PLATFORM_LINUX="linux-$ARCH"
|
||||
PLATFORM_DEB="linux-deb-$ARCH"
|
||||
PLATFORM_RPM="linux-rpm-$ARCH"
|
||||
[[ "$ARCH" == "ia32" ]] && DEB_ARCH="i386" || DEB_ARCH="amd64"
|
||||
[[ "$ARCH" == "ia32" ]] && RPM_ARCH="i386" || RPM_ARCH="x86_64"
|
||||
REPO="`pwd`"
|
||||
ROOT="$REPO/.."
|
||||
BUILDNAME="VSCode-$PLATFORM_LINUX"
|
||||
BUILD="$ROOT/$BUILDNAME"
|
||||
BUILD_VERSION="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/ | sed -e 's/code-[a-z]*_//g' -e 's/\.deb$//g')"
|
||||
[ -z "$VSCODE_QUALITY" ] && TARBALL_FILENAME="code-$BUILD_VERSION.tar.gz" || TARBALL_FILENAME="code-$VSCODE_QUALITY-$BUILD_VERSION.tar.gz"
|
||||
TARBALL_PATH="$ROOT/$TARBALL_FILENAME"
|
||||
PACKAGEJSON="$BUILD/resources/app/package.json"
|
||||
VERSION=$(node -p "require(\"$PACKAGEJSON\").version")
|
||||
|
||||
rm -rf $ROOT/code-*.tar.*
|
||||
(cd $ROOT && tar -czf $TARBALL_PATH $BUILDNAME)
|
||||
|
||||
node build/tfs/common/publish.js $VSCODE_QUALITY $PLATFORM_LINUX archive-unsigned $TARBALL_FILENAME $VERSION true $TARBALL_PATH
|
||||
|
||||
DEB_FILENAME="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/)"
|
||||
DEB_PATH="$REPO/.build/linux/deb/$DEB_ARCH/deb/$DEB_FILENAME"
|
||||
|
||||
node build/tfs/common/publish.js $VSCODE_QUALITY $PLATFORM_DEB package $DEB_FILENAME $VERSION true $DEB_PATH
|
||||
|
||||
RPM_FILENAME="$(ls $REPO/.build/linux/rpm/$RPM_ARCH/ | grep .rpm)"
|
||||
RPM_PATH="$REPO/.build/linux/rpm/$RPM_ARCH/$RPM_FILENAME"
|
||||
|
||||
node build/tfs/common/publish.js $VSCODE_QUALITY $PLATFORM_RPM package $RPM_FILENAME $VERSION true $RPM_PATH
|
||||
|
||||
# SNAP_FILENAME="$(ls $REPO/.build/linux/snap/$ARCH/ | grep .snap)"
|
||||
# SNAP_PATH="$REPO/.build/linux/snap/$ARCH/$SNAP_FILENAME"
|
||||
|
||||
IS_FROZEN="$(node build/tfs/linux/frozen-check.js $VSCODE_QUALITY)"
|
||||
|
||||
if [ -z "$VSCODE_QUALITY" ]; then
|
||||
echo "VSCODE_QUALITY is not set, skipping repo package publish"
|
||||
elif [ "$IS_FROZEN" = "true" ]; then
|
||||
echo "$VSCODE_QUALITY is frozen, skipping repo package publish"
|
||||
else
|
||||
if [ "$BUILD_SOURCEBRANCH" = "master" ] || [ "$BUILD_SOURCEBRANCH" = "refs/heads/master" ]; then
|
||||
if [[ $BUILD_QUEUEDBY = *"Project Collection Service Accounts"* || $BUILD_QUEUEDBY = *"Microsoft.VisualStudio.Services.TFS"* ]]; then
|
||||
# Write config files needed by API, use eval to force environment variable expansion
|
||||
pushd build/tfs/linux
|
||||
# Submit to apt repo
|
||||
if [ "$DEB_ARCH" = "amd64" ]; then
|
||||
eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4adf642421134a1a48d1a\", \"username\": \"vscode\", \"password\": \"$LINUX_REPO_PASSWORD\" }' > apt-config.json
|
||||
|
||||
./repoapi_client.sh -config apt-config.json -addfile $DEB_PATH
|
||||
fi
|
||||
# Submit to yum repo (disabled as it's manual until signing is automated)
|
||||
# eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4ae3542421134a1a48d1b\", \"username\": \"vscode\", \"password\": \"$LINUX_REPO_PASSWORD\" }' > yum-config.json
|
||||
|
||||
# ./repoapi_client.sh -config yum-config.json -addfile $RPM_PATH
|
||||
popd
|
||||
echo "To check repo publish status run ./repoapi_client.sh -config config.json -check <id>"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
413
build/tfs/product-build.yml
Normal file
413
build/tfs/product-build.yml
Normal file
@@ -0,0 +1,413 @@
|
||||
phases:
|
||||
- phase: Windows
|
||||
condition: eq(variables['VSCODE_BUILD_WIN32'], 'true')
|
||||
queue:
|
||||
name: Hosted VS2017
|
||||
parallel: 2
|
||||
matrix:
|
||||
x64:
|
||||
VSCODE_ARCH: x64
|
||||
ia32:
|
||||
VSCODE_ARCH: ia32
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
|
||||
- powershell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
"machine monacotools.visualstudio.com password $(VSO_PAT)" | Out-File "$env:USERPROFILE\_netrc" -Encoding ASCII
|
||||
$env:npm_config_arch="$(VSCODE_ARCH)"
|
||||
$env:CHILD_CONCURRENCY="1"
|
||||
yarn
|
||||
npm run gulp -- hygiene
|
||||
npm run monaco-compile-check
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)"
|
||||
npm run gulp -- mixin
|
||||
node build/tfs/common/installDistro.js
|
||||
node build/lib/builtInExtensions.js
|
||||
|
||||
- powershell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)"
|
||||
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-min"
|
||||
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-copy-inno-updater"
|
||||
name: build
|
||||
|
||||
- powershell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
npm run gulp -- "electron-$(VSCODE_ARCH)"
|
||||
.\scripts\test.bat --build --tfs
|
||||
# yarn smoketest -- --build "$(agent.builddirectory)\VSCode-win32-$(VSCODE_ARCH)"
|
||||
name: test
|
||||
|
||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
||||
inputs:
|
||||
ConnectedServiceName: 'ESRP CodeSign'
|
||||
FolderPath: '$(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)'
|
||||
Pattern: '*.dll,*.exe,*.node'
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: |
|
||||
[
|
||||
{
|
||||
"keyCode": "CP-229803",
|
||||
"operationSetCode": "SigntoolSign",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "VS Code"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "https://code.visualstudio.com/"
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/t \"http://ts4096.gtm.microsoft.com/TSS/AuthenticodeTS\""
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"keyCode": "CP-230012",
|
||||
"operationSetCode": "SigntoolSign",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "VS Code"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "https://code.visualstudio.com/"
|
||||
},
|
||||
{
|
||||
"parameterName": "Append",
|
||||
"parameterValue": "/as"
|
||||
},
|
||||
{
|
||||
"parameterName": "FileDigest",
|
||||
"parameterValue": "/fd \"SHA256\""
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"keyCode": "CP-230012",
|
||||
"operationSetCode": "SigntoolVerify",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "VerifyAll",
|
||||
"parameterValue": "/all"
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
}
|
||||
]
|
||||
SessionTimeout: 120
|
||||
|
||||
- powershell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-archive" "vscode-win32-$(VSCODE_ARCH)-setup"
|
||||
|
||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
||||
inputs:
|
||||
ConnectedServiceName: 'ESRP CodeSign'
|
||||
FolderPath: '$(agent.builddirectory)'
|
||||
Pattern: VSCodeSetup.exe
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: |
|
||||
[
|
||||
{
|
||||
"keyCode": "CP-229803",
|
||||
"operationSetCode": "SigntoolSign",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "VS Code"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "https://code.visualstudio.com/"
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/t \"http://ts4096.gtm.microsoft.com/TSS/AuthenticodeTS\""
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"keyCode": "CP-230012",
|
||||
"operationSetCode": "SigntoolSign",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "VS Code"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "https://code.visualstudio.com/"
|
||||
},
|
||||
{
|
||||
"parameterName": "Append",
|
||||
"parameterValue": "/as"
|
||||
},
|
||||
{
|
||||
"parameterName": "FileDigest",
|
||||
"parameterValue": "/fd \"SHA256\""
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"keyCode": "CP-230012",
|
||||
"operationSetCode": "SigntoolVerify",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "VerifyAll",
|
||||
"parameterValue": "/all"
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
}
|
||||
]
|
||||
SessionTimeout: 120
|
||||
|
||||
- powershell: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Repo = "$(pwd)"
|
||||
$Root = "$Repo\.."
|
||||
$Exe = "$Repo\.build\win32-$(VSCODE_ARCH)\setup\VSCodeSetup.exe"
|
||||
$Zip = "$Repo\.build\win32-$(VSCODE_ARCH)\archive\VSCode-win32-$(VSCODE_ARCH).zip"
|
||||
$Build = "$Root\VSCode-win32-$(VSCODE_ARCH)"
|
||||
|
||||
# get version
|
||||
$PackageJson = Get-Content -Raw -Path "$Build\resources\app\package.json" | ConvertFrom-Json
|
||||
$Version = $PackageJson.version
|
||||
$Quality = "$env:VSCODE_QUALITY"
|
||||
$env:AZURE_STORAGE_ACCESS_KEY_2 = "$(AZURE_STORAGE_ACCESS_KEY_2)"
|
||||
$env:MOONCAKE_STORAGE_ACCESS_KEY = "$(MOONCAKE_STORAGE_ACCESS_KEY)"
|
||||
$env:AZURE_DOCUMENTDB_MASTERKEY = "$(AZURE_DOCUMENTDB_MASTERKEY)"
|
||||
|
||||
$assetPlatform = if ("$(VSCODE_ARCH)" -eq "ia32") { "win32" } else { "win32-x64" }
|
||||
|
||||
node build/tfs/common/publish.js $Quality "$global:assetPlatform-archive" archive "VSCode-win32-$(VSCODE_ARCH)-$Version.zip" $Version true $Zip
|
||||
node build/tfs/common/publish.js $Quality "$global:assetPlatform" setup "VSCodeSetup-$(VSCODE_ARCH)-$Version.exe" $Version true $Exe
|
||||
|
||||
# publish hockeyapp symbols
|
||||
$hockeyAppId = if ("$(VSCODE_ARCH)" -eq "ia32") { "$(VSCODE_HOCKEYAPP_ID_WIN32)" } else { "$(VSCODE_HOCKEYAPP_ID_WIN64)" }
|
||||
node build/tfs/common/symbols.js "$(VSCODE_MIXIN_PASSWORD)" "$(VSCODE_HOCKEYAPP_TOKEN)" "$(VSCODE_ARCH)" $hockeyAppId
|
||||
|
||||
- phase: Linux
|
||||
condition: eq(variables['VSCODE_BUILD_LINUX'], 'true')
|
||||
queue: linux-x64
|
||||
variables:
|
||||
VSCODE_ARCH: x64
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
export npm_config_arch="$(VSCODE_ARCH)"
|
||||
if [[ "$(VSCODE_ARCH)" == "ia32" ]]; then
|
||||
export PKG_CONFIG_PATH="/usr/lib/i386-linux-gnu/pkgconfig"
|
||||
fi
|
||||
|
||||
echo "machine monacotools.visualstudio.com password $(VSO_PAT)" > ~/.netrc
|
||||
yarn
|
||||
npm run gulp -- hygiene
|
||||
npm run monaco-compile-check
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
|
||||
node build/tfs/common/installDistro.js
|
||||
node build/lib/builtInExtensions.js
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- vscode-linux-$(VSCODE_ARCH)-min
|
||||
name: build
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm run gulp -- "electron-$(VSCODE_ARCH)"
|
||||
DISPLAY=:10 ./scripts/test.sh --build --tfs
|
||||
# yarn smoketest -- --build "$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)"
|
||||
name: test
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-deb"
|
||||
npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-rpm"
|
||||
#npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-snap"
|
||||
|
||||
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||
MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
|
||||
./build/tfs/linux/release2.sh "$(VSCODE_ARCH)" "$(LINUX_REPO_PASSWORD)"
|
||||
|
||||
# publish hockeyapp symbols
|
||||
node build/tfs/common/symbols.js "$(VSCODE_MIXIN_PASSWORD)" "$(VSCODE_HOCKEYAPP_TOKEN)" "$(VSCODE_ARCH)" "$(VSCODE_HOCKEYAPP_ID_LINUX64)"
|
||||
|
||||
- phase: Linux32
|
||||
condition: eq(variables['VSCODE_BUILD_LINUX'], 'true')
|
||||
queue: linux-ia32
|
||||
variables:
|
||||
VSCODE_ARCH: ia32
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
export npm_config_arch="$(VSCODE_ARCH)"
|
||||
if [[ "$(VSCODE_ARCH)" == "ia32" ]]; then
|
||||
export PKG_CONFIG_PATH="/usr/lib/i386-linux-gnu/pkgconfig"
|
||||
fi
|
||||
|
||||
echo "machine monacotools.visualstudio.com password $(VSO_PAT)" > ~/.netrc
|
||||
yarn
|
||||
npm run gulp -- hygiene
|
||||
npm run monaco-compile-check
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
|
||||
node build/tfs/common/installDistro.js
|
||||
node build/lib/builtInExtensions.js
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- vscode-linux-$(VSCODE_ARCH)-min
|
||||
name: build
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm run gulp -- "electron-$(VSCODE_ARCH)"
|
||||
DISPLAY=:10 ./scripts/test.sh --build --tfs
|
||||
# yarn smoketest -- --build "$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)"
|
||||
name: test
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-deb"
|
||||
npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-rpm"
|
||||
#npm run gulp -- "vscode-linux-$(VSCODE_ARCH)-build-snap"
|
||||
|
||||
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||
MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
|
||||
./build/tfs/linux/release2.sh "$(VSCODE_ARCH)" "$(LINUX_REPO_PASSWORD)"
|
||||
|
||||
# publish hockeyapp symbols
|
||||
node build/tfs/common/symbols.js "$(VSCODE_MIXIN_PASSWORD)" "$(VSCODE_HOCKEYAPP_TOKEN)" "$(VSCODE_ARCH)" "$(VSCODE_HOCKEYAPP_ID_LINUX32)"
|
||||
|
||||
- phase: macOS
|
||||
condition: eq(variables['VSCODE_BUILD_MACOS'], 'true')
|
||||
queue: Hosted macOS Preview
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
echo "machine monacotools.visualstudio.com password $(VSO_PAT)" > ~/.netrc
|
||||
yarn
|
||||
npm run gulp -- hygiene
|
||||
npm run monaco-compile-check
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" npm run gulp -- mixin
|
||||
node build/tfs/common/installDistro.js
|
||||
node build/lib/builtInExtensions.js
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)" \
|
||||
AZURE_STORAGE_ACCESS_KEY="$(AZURE_STORAGE_ACCESS_KEY)" \
|
||||
npm run gulp -- vscode-darwin-min upload-vscode-sourcemaps
|
||||
name: build
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
./scripts/test.sh --build --tfs
|
||||
APP_NAME="`ls $(agent.builddirectory)/VSCode-darwin | head -n 1`"
|
||||
# yarn smoketest -- --build "$(agent.builddirectory)/VSCode-darwin/$APP_NAME"
|
||||
name: test
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
# archive the unsigned build
|
||||
pushd ../VSCode-darwin && zip -r -X -y ../VSCode-darwin-unsigned.zip * && popd
|
||||
|
||||
# publish the unsigned build
|
||||
PACKAGEJSON=`ls ../VSCode-darwin/*.app/Contents/Resources/app/package.json`
|
||||
VERSION=`node -p "require(\"$PACKAGEJSON\").version"`
|
||||
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||
MOONCAKE_STORAGE_ACCESS_KEY="$(MOONCAKE_STORAGE_ACCESS_KEY)" \
|
||||
node build/tfs/common/publish.js \
|
||||
"$(VSCODE_QUALITY)" \
|
||||
darwin \
|
||||
archive-unsigned \
|
||||
"VSCode-darwin-$(VSCODE_QUALITY)-unsigned.zip" \
|
||||
$VERSION \
|
||||
false \
|
||||
../VSCode-darwin-unsigned.zip
|
||||
|
||||
# publish hockeyapp symbols
|
||||
node build/tfs/common/symbols.js "$(VSCODE_MIXIN_PASSWORD)" "$(VSCODE_HOCKEYAPP_TOKEN)" "$(VSCODE_ARCH)" "$(VSCODE_HOCKEYAPP_ID_MACOS)"
|
||||
|
||||
# enqueue the unsigned build
|
||||
AZURE_DOCUMENTDB_MASTERKEY="$(AZURE_DOCUMENTDB_MASTERKEY)" \
|
||||
AZURE_STORAGE_ACCESS_KEY_2="$(AZURE_STORAGE_ACCESS_KEY_2)" \
|
||||
node build/tfs/common/enqueue.js "$(VSCODE_QUALITY)"
|
||||
|
||||
AZURE_STORAGE_ACCESS_KEY="$(AZURE_STORAGE_ACCESS_KEY)" \
|
||||
npm run gulp -- upload-vscode-configuration
|
||||
@@ -24,6 +24,10 @@ step "Hygiene" {
|
||||
exec { & npm run gulp -- hygiene }
|
||||
}
|
||||
|
||||
step "Monaco Editor Check" {
|
||||
exec { & .\node_modules\.bin\tsc -p .\src\tsconfig.monaco.json --noEmit }
|
||||
}
|
||||
|
||||
$env:VSCODE_MIXIN_PASSWORD = $mixinPassword
|
||||
step "Mix in repository from vscode-distro" {
|
||||
exec { & npm run gulp -- mixin }
|
||||
@@ -41,6 +45,10 @@ step "Build minified" {
|
||||
exec { & npm run gulp -- "vscode-win32-$global:arch-min" }
|
||||
}
|
||||
|
||||
step "Copy Inno updater" {
|
||||
exec { & npm run gulp -- "vscode-win32-$global:arch-copy-inno-updater" }
|
||||
}
|
||||
|
||||
# step "Create loader snapshot" {
|
||||
# exec { & node build\lib\snapshotLoader.js --arch=$global:arch }
|
||||
# }
|
||||
|
||||
212
build/tfs/win32/build.yml
Normal file
212
build/tfs/win32/build.yml
Normal file
@@ -0,0 +1,212 @@
|
||||
steps:
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "8.9.1"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
versionSpec: "1.3.2"
|
||||
|
||||
- powershell: |
|
||||
"machine monacotools.visualstudio.com password $(VSO_PAT)" | Out-File "$env:USERPROFILE\_netrc" -Encoding ASCII
|
||||
$env:npm_config_arch="$(VSCODE_ARCH)"
|
||||
$env:CHILD_CONCURRENCY="1"
|
||||
yarn
|
||||
npm run gulp -- hygiene
|
||||
npm run monaco-compile-check
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)"
|
||||
npm run gulp -- mixin
|
||||
node build/tfs/common/installDistro.js
|
||||
|
||||
- powershell: |
|
||||
$env:VSCODE_MIXIN_PASSWORD="$(VSCODE_MIXIN_PASSWORD)"
|
||||
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-min"
|
||||
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-copy-inno-updater"
|
||||
name: build
|
||||
|
||||
- powershell: |
|
||||
npm run gulp -- "electron-$(VSCODE_ARCH)"
|
||||
.\scripts\test.bat --build --tfs
|
||||
name: test
|
||||
|
||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
||||
inputs:
|
||||
ConnectedServiceName: 'ESRP CodeSign'
|
||||
FolderPath: '$(agent.builddirectory)/VSCode-win32-$(VSCODE_ARCH)'
|
||||
Pattern: '*.dll,*.exe,*.node'
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: |
|
||||
[
|
||||
{
|
||||
"keyCode": "CP-229803",
|
||||
"operationSetCode": "SigntoolSign",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "Microsoft"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "http://www.microsoft.com"
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/t \"http://ts4096.gtm.microsoft.com/TSS/AuthenticodeTS\""
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"keyCode": "CP-230012",
|
||||
"operationSetCode": "SigntoolSign",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "Microsoft"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "http://www.microsoft.com"
|
||||
},
|
||||
{
|
||||
"parameterName": "Append",
|
||||
"parameterValue": "/as"
|
||||
},
|
||||
{
|
||||
"parameterName": "FileDigest",
|
||||
"parameterValue": "/fd \"SHA256\""
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"keyCode": "CP-230012",
|
||||
"operationSetCode": "SigntoolVerify",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "VerifyAll",
|
||||
"parameterValue": "/all"
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
}
|
||||
]
|
||||
SessionTimeout: 120
|
||||
|
||||
- powershell: |
|
||||
npm run gulp -- "vscode-win32-$(VSCODE_ARCH)-archive" "vscode-win32-$(VSCODE_ARCH)-setup"
|
||||
|
||||
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
||||
inputs:
|
||||
ConnectedServiceName: 'ESRP CodeSign'
|
||||
FolderPath: '$(agent.builddirectory)'
|
||||
Pattern: VSCodeSetup.exe
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: |
|
||||
[
|
||||
{
|
||||
"keyCode": "CP-229803",
|
||||
"operationSetCode": "SigntoolSign",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "Microsoft"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "http://www.microsoft.com"
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/t \"http://ts4096.gtm.microsoft.com/TSS/AuthenticodeTS\""
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"keyCode": "CP-230012",
|
||||
"operationSetCode": "SigntoolSign",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "OpusName",
|
||||
"parameterValue": "Microsoft"
|
||||
},
|
||||
{
|
||||
"parameterName": "OpusInfo",
|
||||
"parameterValue": "http://www.microsoft.com"
|
||||
},
|
||||
{
|
||||
"parameterName": "Append",
|
||||
"parameterValue": "/as"
|
||||
},
|
||||
{
|
||||
"parameterName": "FileDigest",
|
||||
"parameterValue": "/fd \"SHA256\""
|
||||
},
|
||||
{
|
||||
"parameterName": "PageHash",
|
||||
"parameterValue": "/NPH"
|
||||
},
|
||||
{
|
||||
"parameterName": "TimeStamp",
|
||||
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
},
|
||||
{
|
||||
"keyCode": "CP-230012",
|
||||
"operationSetCode": "SigntoolVerify",
|
||||
"parameters": [
|
||||
{
|
||||
"parameterName": "VerifyAll",
|
||||
"parameterValue": "/all"
|
||||
}
|
||||
],
|
||||
"toolName": "sign",
|
||||
"toolVersion": "1.0"
|
||||
}
|
||||
]
|
||||
SessionTimeout: 120
|
||||
|
||||
- powershell: |
|
||||
$Repo = "$(pwd)"
|
||||
$Root = "$Repo\.."
|
||||
$Exe = "$Repo\.build\win32-$(VSCODE_ARCH)\setup\VSCodeSetup.exe"
|
||||
$Zip = "$Repo\.build\win32-$(VSCODE_ARCH)\archive\VSCode-win32-$(VSCODE_ARCH).zip"
|
||||
$Build = "$Root\VSCode-win32-$(VSCODE_ARCH)"
|
||||
|
||||
# get version
|
||||
$PackageJson = Get-Content -Raw -Path "$Build\resources\app\package.json" | ConvertFrom-Json
|
||||
$Version = $PackageJson.version
|
||||
$Quality = "$env:VSCODE_QUALITY"
|
||||
$env:AZURE_STORAGE_ACCESS_KEY_2 = "$(AZURE_STORAGE_ACCESS_KEY_2)"
|
||||
$env:MOONCAKE_STORAGE_ACCESS_KEY = "$(MOONCAKE_STORAGE_ACCESS_KEY)"
|
||||
$env:AZURE_DOCUMENTDB_MASTERKEY = "$(AZURE_DOCUMENTDB_MASTERKEY)"
|
||||
|
||||
$assetPlatform = if ("$(VSCODE_ARCH)" -eq "ia32") { "win32" } else { "win32-x64" }
|
||||
|
||||
node build/tfs/common/publish.js $Quality "$global:assetPlatform-archive" archive "VSCode-win32-$(VSCODE_ARCH)-$Version.zip" $Version true $Zip
|
||||
node build/tfs/common/publish.js $Quality "$global:assetPlatform" setup "VSCodeSetup-$(VSCODE_ARCH)-$Version.exe" $Version true $Exe
|
||||
@@ -1,7 +1,7 @@
|
||||
# install node
|
||||
$env:Path = $env:NVM_HOME + ";" + $env:NVM_SYMLINK + ";" + $env:Path
|
||||
$NodeVersion = "8.9.1"
|
||||
nvm install $NodeVersion
|
||||
nvm use $NodeVersion
|
||||
npm install -g yarn
|
||||
# nvm install $NodeVersion
|
||||
# nvm use $NodeVersion
|
||||
# npm install -g yarn
|
||||
$env:Path = $env:NVM_HOME + "\v" + $NodeVersion + ";" + $env:Path
|
||||
7
build/tsconfig.build.json
Normal file
7
build/tsconfig.build.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": false,
|
||||
"checkJs": false
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,11 @@
|
||||
"preserveConstEnums": true,
|
||||
"sourceMap": false,
|
||||
"experimentalDecorators": true,
|
||||
"newLine": "LF"
|
||||
// enable JavaScript type checking for the language service
|
||||
// use the tsconfig.build.json for compiling wich disable JavaScript
|
||||
// type checking so that JavaScript file are not transpiled
|
||||
"allowJs": true,
|
||||
"checkJs": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules/**"
|
||||
|
||||
@@ -9,5 +9,6 @@
|
||||
"always"
|
||||
],
|
||||
"triple-equals": true
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
||||
1794
build/win32/OSSREADME.json
Executable file
1794
build/win32/OSSREADME.json
Executable file
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@ OutputDir={#OutputDir}
|
||||
OutputBaseFilename=SqlOpsStudioSetup
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
AppMutex={#AppMutex}
|
||||
AppMutex={code:GetAppMutex}
|
||||
SetupMutex={#AppMutex}setup
|
||||
WizardImageFile={#RepoDir}\resources\win32\inno-big.bmp
|
||||
WizardSmallImageFile={#RepoDir}\resources\win32\inno-small.bmp
|
||||
@@ -52,10 +52,16 @@ Type: filesandordirs; Name: "{app}\resources\app\out"; Check: IsNotUpdate
|
||||
Type: filesandordirs; Name: "{app}\resources\app\plugins"; Check: IsNotUpdate
|
||||
Type: filesandordirs; Name: "{app}\resources\app\extensions"; Check: IsNotUpdate
|
||||
Type: filesandordirs; Name: "{app}\resources\app\node_modules"; Check: IsNotUpdate
|
||||
Type: filesandordirs; Name: "{app}\resources\app\node_modules.asar.unpacked"; Check: IsNotUpdate
|
||||
Type: files; Name: "{app}\resources\app\node_modules.asar"; Check: IsNotUpdate
|
||||
Type: files; Name: "{app}\resources\app\Credits_45.0.2454.85.html"; Check: IsNotUpdate
|
||||
|
||||
[UninstallDelete]
|
||||
Type: filesandordirs; Name: "{app}\_"
|
||||
|
||||
[Tasks]
|
||||
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
|
||||
Name: "associatewithfiles"; Description: "{cm:AssociateWithFiles,{#NameShort}}"; GroupDescription: "{cm:Other}"; Flags: unchecked
|
||||
Name: "addtopath"; Description: "{cm:AddToPath}"; GroupDescription: "{cm:Other}"
|
||||
Name: "runcode"; Description: "{cm:RunAfter,{#NameShort}}"; GroupDescription: "{cm:Other}"; Check: WizardSilent
|
||||
|
||||
@@ -77,6 +83,13 @@ Root: HKCR; Subkey: "{#RegValueName}SourceFile\DefaultIcon"; ValueType: string;
|
||||
Root: HKCR; Subkey: "{#RegValueName}SourceFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""
|
||||
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\bin"; Tasks: addtopath; Check: NeedsAddPath(ExpandConstant('{app}\bin'))
|
||||
|
||||
Root: HKCU; Subkey: "Software\Classes\.sql\OpenWithProgids"; ValueType: none; ValueName: "{#RegValueName}"; Flags: deletevalue uninsdeletevalue; Tasks: associatewithfiles
|
||||
Root: HKCU; Subkey: "Software\Classes\.sql\OpenWithProgids"; ValueType: string; ValueName: "{#RegValueName}.sql"; ValueData: ""; Flags: uninsdeletevalue; Tasks: associatewithfiles
|
||||
Root: HKCU; Subkey: "Software\Classes\{#RegValueName}.sql"; ValueType: string; ValueName: ""; ValueData: "{cm:SourceFile,SQL}"; Flags: uninsdeletekey; Tasks: associatewithfiles
|
||||
Root: HKCU; Subkey: "Software\Classes\{#RegValueName}.sql"; ValueType: string; ValueName: "AppUserModelID"; ValueData: "{#AppUserId}"; Flags: uninsdeletekey; Tasks: associatewithfiles
|
||||
Root: HKCU; Subkey: "Software\Classes\{#RegValueName}.sql\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\resources\app\resources\win32\code_file.ico"; Tasks: associatewithfiles
|
||||
Root: HKCU; Subkey: "Software\Classes\{#RegValueName}.sql\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#ExeBasename}.exe"" ""%1"""; Tasks: associatewithfiles
|
||||
|
||||
[Code]
|
||||
// Don't allow installing conflicting architectures
|
||||
function InitializeSetup(): Boolean;
|
||||
@@ -138,6 +151,48 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function GetAppMutex(Value: string): string;
|
||||
begin
|
||||
if IsBackgroundUpdate() then
|
||||
Result := ''
|
||||
else
|
||||
Result := '{#AppMutex}';
|
||||
end;
|
||||
|
||||
function GetDestDir(Value: string): string;
|
||||
begin
|
||||
if IsBackgroundUpdate() then
|
||||
Result := ExpandConstant('{app}\_')
|
||||
else
|
||||
Result := ExpandConstant('{app}');
|
||||
end;
|
||||
|
||||
function BoolToStr(Value: Boolean): String;
|
||||
begin
|
||||
if Value then
|
||||
Result := 'true'
|
||||
else
|
||||
Result := 'false';
|
||||
end;
|
||||
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
var
|
||||
UpdateResultCode: Integer;
|
||||
begin
|
||||
if IsBackgroundUpdate() and (CurStep = ssPostInstall) then
|
||||
begin
|
||||
CreateMutex('{#AppMutex}-ready');
|
||||
|
||||
while (CheckForMutexes('{#AppMutex}')) do
|
||||
begin
|
||||
Log('Application is still running, waiting');
|
||||
Sleep(1000);
|
||||
end;
|
||||
|
||||
Exec(ExpandConstant('{app}\tools\inno_updater.exe'), ExpandConstant('"{app}\{#ExeBasename}.exe" ' + BoolToStr(LockFileExists())), '', SW_SHOW, ewWaitUntilTerminated, UpdateResultCode);
|
||||
end;
|
||||
end;
|
||||
|
||||
// http://stackoverflow.com/a/23838239/261019
|
||||
procedure Explode(var Dest: TArrayOfString; Text: String; Separator: String);
|
||||
var
|
||||
|
||||
BIN
build/win32/inno_updater.exe
Normal file
BIN
build/win32/inno_updater.exe
Normal file
Binary file not shown.
BIN
build/win32/vcruntime140.dll
Normal file
BIN
build/win32/vcruntime140.dll
Normal file
Binary file not shown.
4422
build/yarn.lock
4422
build/yarn.lock
File diff suppressed because it is too large
Load Diff
3
extensions-modules/.gitignore
vendored
3
extensions-modules/.gitignore
vendored
@@ -1,3 +0,0 @@
|
||||
node_modules
|
||||
lib
|
||||
*.log
|
||||
@@ -1,9 +0,0 @@
|
||||
.vscode/
|
||||
lib/test/
|
||||
lib/**/*.map
|
||||
src/
|
||||
test/
|
||||
.eslintrc
|
||||
.gitignore
|
||||
gulpfile.js
|
||||
tsd.json
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "extensions-modules",
|
||||
"version": "0.1.0",
|
||||
"description": "Shared modules for SQL Operations Studio extensions",
|
||||
"dependencies": {
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#0.1.5",
|
||||
"decompress": "^4.2.0",
|
||||
"fs-extra-promise": "^1.0.1",
|
||||
"http-proxy-agent": "^2.0.0",
|
||||
"https-proxy-agent": "^2.1.0",
|
||||
"opener": "^1.4.3",
|
||||
"tmp": "0.0.33",
|
||||
"vscode-extension-telemetry": "0.0.8",
|
||||
"vscode-languageclient": "3.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.61",
|
||||
"vscode": "^1.1.10",
|
||||
"sqlops": "github:anthonydresser/vscode-extension-vscode"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "node ./node_modules/vscode/bin/install && node ./node_modules/sqlops/bin/install && tsc -p ./src",
|
||||
"compile": "tsc -p ./src",
|
||||
"watch": "tsc -w -p ./src"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "*",
|
||||
"sqlops": "*"
|
||||
},
|
||||
"main": "./lib/main.js",
|
||||
"typings": "./lib/main"
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
import * as path from 'path';
|
||||
import { IConfig } from '../languageservice/interfaces';
|
||||
import { Constants } from '../models/constants';
|
||||
|
||||
/*
|
||||
* Config class handles getting values from config.json.
|
||||
*/
|
||||
export default class Config implements IConfig {
|
||||
private _configJsonContent: any = undefined;
|
||||
|
||||
private _extensionConfigSectionName: string = undefined;
|
||||
private _fromBuild: boolean = undefined;
|
||||
|
||||
constructor(extensionConfigSectionName: string, private path: string, fromBuild?: boolean) {
|
||||
this._extensionConfigSectionName = extensionConfigSectionName;
|
||||
this._fromBuild = fromBuild;
|
||||
}
|
||||
|
||||
public get configJsonContent(): any {
|
||||
if (this._configJsonContent === undefined) {
|
||||
this._configJsonContent = this.loadConfig();
|
||||
}
|
||||
return this._configJsonContent;
|
||||
}
|
||||
|
||||
public getDownloadUrl(): string {
|
||||
return this.getConfigValue(Constants.downloadUrlConfigKey);
|
||||
}
|
||||
|
||||
public getInstallDirectory(): string {
|
||||
return this.getConfigValue(Constants.installDirConfigKey);
|
||||
}
|
||||
|
||||
public getExecutableFiles(): string[] {
|
||||
return this.getConfigValue(Constants.executableFilesConfigKey);
|
||||
}
|
||||
|
||||
public getPackageVersion(): string {
|
||||
return this.getConfigValue(Constants.versionConfigKey);
|
||||
}
|
||||
|
||||
public getConfigValue(configKey: string): any {
|
||||
let json = this.configJsonContent;
|
||||
let toolsConfig = json[Constants.serviceConfigKey];
|
||||
let configValue: string = undefined;
|
||||
if (toolsConfig !== undefined) {
|
||||
configValue = toolsConfig[configKey];
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public getExtensionConfig(key: string, defaultValue?: any): any {
|
||||
let json = this.configJsonContent;
|
||||
let extensionConfig = json[this._extensionConfigSectionName];
|
||||
let configValue = extensionConfig[key];
|
||||
if (!configValue) {
|
||||
configValue = defaultValue;
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public getWorkspaceConfig(key: string, defaultValue?: any): any {
|
||||
let json = this.configJsonContent;
|
||||
let configValue = json[key];
|
||||
if (!configValue) {
|
||||
configValue = defaultValue;
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public loadConfig(): any {
|
||||
let configContent = undefined;
|
||||
if (this._fromBuild) {
|
||||
let remainingPath = '../../../extensions/' + this._extensionConfigSectionName + '/client/out/config.json';
|
||||
configContent = fs.readFileSync(path.join(__dirname, remainingPath));
|
||||
}
|
||||
else {
|
||||
configContent = fs.readFileSync(this.path);
|
||||
}
|
||||
return JSON.parse(configContent);
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import Config from './config';
|
||||
import { workspace, WorkspaceConfiguration } from 'vscode';
|
||||
import { IConfig } from '../languageservice/interfaces';
|
||||
import { Constants } from '../models/constants';
|
||||
|
||||
/*
|
||||
* ExtConfig class handles getting values from workspace config or config.json.
|
||||
*/
|
||||
export default class ExtConfig implements IConfig {
|
||||
|
||||
constructor(private _extensionConfigSectionName: string, private _config?: IConfig,
|
||||
path?: string,
|
||||
private _extensionConfig?: WorkspaceConfiguration,
|
||||
private _workspaceConfig?: WorkspaceConfiguration) {
|
||||
if (this._config === undefined) {
|
||||
this._config = new Config(_extensionConfigSectionName, path);
|
||||
}
|
||||
if (this._extensionConfig === undefined) {
|
||||
this._extensionConfig = workspace.getConfiguration(_extensionConfigSectionName);
|
||||
}
|
||||
if (this._workspaceConfig === undefined) {
|
||||
this._workspaceConfig = workspace.getConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
public getDownloadUrl(): string {
|
||||
return this.getConfigValue(Constants.downloadUrlConfigKey);
|
||||
}
|
||||
|
||||
public getInstallDirectory(): string {
|
||||
return this.getConfigValue(Constants.installDirConfigKey);
|
||||
}
|
||||
|
||||
public getExecutableFiles(): string[] {
|
||||
return this.getConfigValue(Constants.executableFilesConfigKey);
|
||||
}
|
||||
|
||||
public getPackageVersion(): string {
|
||||
return this.getConfigValue(Constants.versionConfigKey);
|
||||
}
|
||||
|
||||
public getConfigValue(configKey: string): any {
|
||||
let configValue: string = <string>this.getExtensionConfig(`${Constants.serviceConfigKey}.${configKey}`);
|
||||
if (!configValue) {
|
||||
configValue = this._config.getConfigValue(configKey);
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public getExtensionConfig(key: string, defaultValue?: any): any {
|
||||
let configValue = this._extensionConfig.get(key);
|
||||
if (configValue === undefined) {
|
||||
configValue = defaultValue;
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public getWorkspaceConfig(key: string, defaultValue?: any): any {
|
||||
let configValue = this._workspaceConfig.get(key);
|
||||
if (configValue === undefined) {
|
||||
configValue = defaultValue;
|
||||
}
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public updateWorkspaceConfig(configKey: string, configValue: any) {
|
||||
this._workspaceConfig.update(configKey, configValue, true);
|
||||
}
|
||||
}
|
||||
@@ -1,278 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import vscode = require('vscode');
|
||||
import { IExtensionConstants } from '../models/contracts/contracts';
|
||||
|
||||
export class VscodeWrapper {
|
||||
private _extensionConstants: IExtensionConstants;
|
||||
/**
|
||||
* Output channel for logging. Shared among all instances.
|
||||
*/
|
||||
private static _outputChannel: vscode.OutputChannel;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public constructor(constants: IExtensionConstants) {
|
||||
this._extensionConstants = constants;
|
||||
if (typeof VscodeWrapper._outputChannel === 'undefined') {
|
||||
VscodeWrapper._outputChannel = this.createOutputChannel(this._extensionConstants.outputChannelName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current active text editor
|
||||
*/
|
||||
public get activeTextEditor(): vscode.TextEditor {
|
||||
return vscode.window.activeTextEditor;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the current textDocument; any that are open?
|
||||
*/
|
||||
public get textDocuments(): vscode.TextDocument[] {
|
||||
return vscode.workspace.textDocuments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse uri
|
||||
*/
|
||||
public parseUri(uri: string): vscode.Uri {
|
||||
return vscode.Uri.parse(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI string for the current active text editor
|
||||
*/
|
||||
public get activeTextEditorUri(): string {
|
||||
if (typeof vscode.window.activeTextEditor !== 'undefined' &&
|
||||
typeof vscode.window.activeTextEditor.document !== 'undefined') {
|
||||
return vscode.window.activeTextEditor.document.uri.toString();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public get constants(): IExtensionConstants {
|
||||
return this._extensionConstants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an output channel in vscode.
|
||||
*/
|
||||
public createOutputChannel(channelName: string): vscode.OutputChannel {
|
||||
return vscode.window.createOutputChannel(channelName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the command denoted by the given command identifier.
|
||||
*
|
||||
* When executing an editor command not all types are allowed to
|
||||
* be passed as arguments. Allowed are the primitive types `string`, `boolean`,
|
||||
* `number`, `undefined`, and `null`, as well as classes defined in this API.
|
||||
* There are no restrictions when executing commands that have been contributed
|
||||
* by extensions.
|
||||
*
|
||||
* @param command Identifier of the command to execute.
|
||||
* @param rest Parameters passed to the command function.
|
||||
* @return A thenable that resolves to the returned value of the given command. `undefined` when
|
||||
* the command handler function doesn't return anything.
|
||||
* @see vscode.commands.executeCommand
|
||||
*/
|
||||
public executeCommand<T>(command: string, ...rest: any[]): Thenable<T> {
|
||||
return vscode.commands.executeCommand<T>(command, ...rest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration for a extensionName; NOT YET IMPLEMENTED
|
||||
* @param extensionName The string name of the extension to get the configuration for
|
||||
*/
|
||||
public getConfiguration(extensionName: string): vscode.WorkspaceConfiguration {
|
||||
return vscode.workspace.getConfiguration(extensionName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 'true' if the active editor window has a .sql file, false otherwise
|
||||
*/
|
||||
public get isEditingSqlFile(): boolean {
|
||||
let sqlFile = false;
|
||||
let editor = this.activeTextEditor;
|
||||
if (editor) {
|
||||
if (editor.document.languageId === this._extensionConstants.languageId) {
|
||||
sqlFile = true;
|
||||
}
|
||||
}
|
||||
return sqlFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that is emitted when a [text document](#TextDocument) is disposed.
|
||||
*/
|
||||
public get onDidCloseTextDocument(): vscode.Event<vscode.TextDocument> {
|
||||
return vscode.workspace.onDidCloseTextDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that is emitted when a [text document](#TextDocument) is opened.
|
||||
*/
|
||||
public get onDidOpenTextDocument(): vscode.Event<vscode.TextDocument> {
|
||||
return vscode.workspace.onDidOpenTextDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that is emitted when a [text document](#TextDocument) is saved to disk.
|
||||
*/
|
||||
public get onDidSaveTextDocument(): vscode.Event<vscode.TextDocument> {
|
||||
return vscode.workspace.onDidSaveTextDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the denoted document from disk. Will return early if the
|
||||
* document is already open, otherwise the document is loaded and the
|
||||
* [open document](#workspace.onDidOpenTextDocument)-event fires.
|
||||
* The document to open is denoted by the [uri](#Uri). Two schemes are supported:
|
||||
*
|
||||
* file: A file on disk, will be rejected if the file does not exist or cannot be loaded, e.g. `file:///Users/frodo/r.ini`.
|
||||
* untitled: A new file that should be saved on disk, e.g. `untitled:c:\frodo\new.js`. The language will be derived from the file name.
|
||||
*
|
||||
* Uris with other schemes will make this method return a rejected promise.
|
||||
*
|
||||
* @param uri Identifies the resource to open.
|
||||
* @return A promise that resolves to a [document](#TextDocument).
|
||||
* @see vscode.workspace.openTextDocument
|
||||
*/
|
||||
public openTextDocument(uri: vscode.Uri): Thenable<vscode.TextDocument> {
|
||||
return vscode.workspace.openTextDocument(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to log messages to output channel.
|
||||
*/
|
||||
public logToOutputChannel(msg: any): void {
|
||||
let date: Date = new Date();
|
||||
if (msg instanceof Array) {
|
||||
msg.forEach(element => {
|
||||
VscodeWrapper._outputChannel.appendLine('[' + date.toLocaleTimeString() + '] ' + element.toString());
|
||||
});
|
||||
} else {
|
||||
VscodeWrapper._outputChannel.appendLine('[' + date.toLocaleTimeString() + '] ' + msg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a vscode.Range object
|
||||
* @param start The start position for the range
|
||||
* @param end The end position for the range
|
||||
*/
|
||||
public range(start: vscode.Position, end: vscode.Position): vscode.Range {
|
||||
return new vscode.Range(start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a vscode.Position object
|
||||
* @param line The line for the position
|
||||
* @param column The column for the position
|
||||
*/
|
||||
public position(line: number, column: number): vscode.Position {
|
||||
return new vscode.Position(line, column);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a vscode.Selection object
|
||||
* @param start The start postion of the selection
|
||||
* @param end The end position of the selection
|
||||
*/
|
||||
public selection(start: vscode.Position, end: vscode.Position): vscode.Selection {
|
||||
return new vscode.Selection(start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats and shows a vscode error message
|
||||
*/
|
||||
public showErrorMessage(msg: string, ...items: string[]): Thenable<string> {
|
||||
return vscode.window.showErrorMessage(this._extensionConstants.extensionName + ': ' + msg, ...items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats and shows a vscode information message
|
||||
*/
|
||||
public showInformationMessage(msg: string, ...items: string[]): Thenable<string> {
|
||||
return vscode.window.showInformationMessage(this._extensionConstants.extensionName + ': ' + msg, ...items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a selection list.
|
||||
*
|
||||
* @param items An array of items, or a promise that resolves to an array of items.
|
||||
* @param options Configures the behavior of the selection list.
|
||||
* @return A promise that resolves to the selected item or undefined.
|
||||
*/
|
||||
public showQuickPick<T extends vscode.QuickPickItem>(items: T[] | Thenable<T[]>, options?: vscode.QuickPickOptions): Thenable<T> {
|
||||
return vscode.window.showQuickPick<T>(items, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the given document in a text editor. A [column](#ViewColumn) can be provided
|
||||
* to control where the editor is being shown. Might change the [active editor](#window.activeTextEditor).
|
||||
*
|
||||
* @param document A text document to be shown.
|
||||
* @param column A view column in which the editor should be shown. The default is the [one](#ViewColumn.One), other values
|
||||
* are adjusted to be __Min(column, columnCount + 1)__.
|
||||
* @param preserveFocus When `true` the editor will not take focus.
|
||||
* @return A promise that resolves to an [editor](#TextEditor).
|
||||
*/
|
||||
public showTextDocument(document: vscode.TextDocument, column?: vscode.ViewColumn, preserveFocus?: boolean): Thenable<vscode.TextEditor> {
|
||||
return vscode.window.showTextDocument(document, column, preserveFocus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats and shows a vscode warning message
|
||||
*/
|
||||
public showWarningMessage(msg: string): Thenable<string> {
|
||||
return vscode.window.showWarningMessage(this._extensionConstants.extensionName + ': ' + msg );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a array of the text editors currently visible in the window
|
||||
*/
|
||||
public get visibleEditors(): vscode.TextEditor[] {
|
||||
return vscode.window.visibleTextEditors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an URI from a file system path. The [scheme](#Uri.scheme)
|
||||
* will be `file`.
|
||||
*
|
||||
* @param path A file system or UNC path.
|
||||
* @return A new Uri instance.
|
||||
* @see vscode.Uri.file
|
||||
*/
|
||||
public uriFile(path: string): vscode.Uri {
|
||||
return vscode.Uri.file(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an URI from a string. Will throw if the given value is not
|
||||
* valid.
|
||||
*
|
||||
* @param value The string value of an Uri.
|
||||
* @return A new Uri instance.
|
||||
* @see vscode.Uri.parse
|
||||
*/
|
||||
public uriParse(value: string): vscode.Uri {
|
||||
return vscode.Uri.parse(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The folder that is open in VS Code. `undefined` when no folder
|
||||
* has been opened.
|
||||
*
|
||||
* @readonly
|
||||
* @see vscode.workspace.rootPath
|
||||
*/
|
||||
public get workspaceRootPath(): string {
|
||||
return vscode.workspace.rootPath;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IDecompressProvider, IPackage } from './interfaces';
|
||||
import { ILogger } from '../models/interfaces';
|
||||
const decompress = require('decompress');
|
||||
|
||||
export default class DecompressProvider implements IDecompressProvider {
|
||||
public decompress(pkg: IPackage, logger: ILogger): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
decompress(pkg.tmpFile.name, pkg.installPath).then(files => {
|
||||
logger.appendLine(`Done! ${files.length} files unpacked.\n`);
|
||||
resolve();
|
||||
}).catch(decompressErr => {
|
||||
logger.appendLine(`[ERROR] ${decompressErr}`);
|
||||
reject(decompressErr);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { IPackage, IStatusView, PackageError, IHttpClient } from './interfaces';
|
||||
import { ILogger } from '../models/interfaces';
|
||||
import { parse as parseUrl, Url } from 'url';
|
||||
import * as https from 'https';
|
||||
import * as http from 'http';
|
||||
import { getProxyAgent } from './proxy';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
/*
|
||||
* Http client class to handle downloading files using http or https urls
|
||||
*/
|
||||
export default class HttpClient implements IHttpClient {
|
||||
|
||||
/*
|
||||
* Downloads a file and stores the result in the temp file inside the package object
|
||||
*/
|
||||
public downloadFile(urlString: string, pkg: IPackage, logger: ILogger, statusView: IStatusView, proxy?: string, strictSSL?: boolean): Promise<void> {
|
||||
const url = parseUrl(urlString);
|
||||
let options = this.getHttpClientOptions(url, proxy, strictSSL);
|
||||
let clientRequest = url.protocol === 'http:' ? http.request : https.request;
|
||||
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!pkg.tmpFile || pkg.tmpFile.fd === 0) {
|
||||
return reject(new PackageError('Temporary package file unavailable', pkg));
|
||||
}
|
||||
|
||||
let request = clientRequest(options, response => {
|
||||
if (response.statusCode === 301 || response.statusCode === 302) {
|
||||
// Redirect - download from new location
|
||||
return resolve(this.downloadFile(response.headers.location, pkg, logger, statusView, proxy, strictSSL));
|
||||
}
|
||||
|
||||
if (response.statusCode !== 200) {
|
||||
// Download failed - print error message
|
||||
logger.appendLine(`failed (error code '${response.statusCode}')`);
|
||||
return reject(new PackageError(response.statusCode.toString(), pkg));
|
||||
}
|
||||
|
||||
// If status code is 200
|
||||
this.handleSuccessfulResponse(pkg, response, logger, statusView).then(_ => {
|
||||
resolve();
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
|
||||
request.on('error', error => {
|
||||
// reject(new PackageError(`Request error: ${error.code || 'NONE'}`, pkg, error));
|
||||
reject(new PackageError(`Request error: ${error.name || 'NONE'}`, pkg, error));
|
||||
});
|
||||
|
||||
// Execute the request
|
||||
request.end();
|
||||
});
|
||||
}
|
||||
|
||||
private getHttpClientOptions(url: Url, proxy?: string, strictSSL?: boolean): any {
|
||||
const agent = getProxyAgent(url, proxy, strictSSL);
|
||||
|
||||
let options: http.RequestOptions = {
|
||||
host: url.hostname,
|
||||
path: url.path,
|
||||
agent: agent,
|
||||
port: +url.port
|
||||
};
|
||||
|
||||
if (url.protocol === 'https:') {
|
||||
let httpsOptions: https.RequestOptions = {
|
||||
host: url.hostname,
|
||||
path: url.path,
|
||||
agent: agent,
|
||||
port: +url.port
|
||||
};
|
||||
options = httpsOptions;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the download percentage and stores in the progress object
|
||||
*/
|
||||
public handleDataReceivedEvent(progress: IDownloadProgress, data: any, logger: ILogger, statusView: IStatusView): void {
|
||||
progress.downloadedBytes += data.length;
|
||||
|
||||
// Update status bar item with percentage
|
||||
if (progress.packageSize > 0) {
|
||||
let newPercentage = Math.ceil(100 * (progress.downloadedBytes / progress.packageSize));
|
||||
if (newPercentage !== progress.downloadPercentage) {
|
||||
statusView.updateServiceDownloadingProgress(progress.downloadPercentage);
|
||||
progress.downloadPercentage = newPercentage;
|
||||
}
|
||||
|
||||
// Update dots after package name in output console
|
||||
let newDots = Math.ceil(progress.downloadPercentage / 5);
|
||||
if (newDots > progress.dots) {
|
||||
logger.append('.'.repeat(newDots - progress.dots));
|
||||
progress.dots = newDots;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private handleSuccessfulResponse(pkg: IPackage, response: http.IncomingMessage, logger: ILogger, statusView: IStatusView): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let progress: IDownloadProgress = {
|
||||
packageSize: parseInt(response.headers['content-length'], 10),
|
||||
dots: 0,
|
||||
downloadedBytes: 0,
|
||||
downloadPercentage: 0
|
||||
};
|
||||
logger.append(`(${Math.ceil(progress.packageSize / 1024)} KB) `);
|
||||
response.on('data', data => {
|
||||
this.handleDataReceivedEvent(progress, data, logger, statusView);
|
||||
});
|
||||
let tmpFile = fs.createWriteStream(undefined, { fd: pkg.tmpFile.fd });
|
||||
response.on('end', () => {
|
||||
resolve();
|
||||
});
|
||||
|
||||
response.on('error', err => {
|
||||
reject(new PackageError(`Response error: ${err.name || 'NONE'}`, pkg, err));
|
||||
});
|
||||
|
||||
// Begin piping data from the response to the package file
|
||||
response.pipe(tmpFile, { end: false });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Interface to store the values needed to calculate download percentage
|
||||
*/
|
||||
export interface IDownloadProgress {
|
||||
packageSize: number;
|
||||
downloadedBytes: number;
|
||||
downloadPercentage: number;
|
||||
dots: number;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as tmp from 'tmp';
|
||||
import { ILogger } from '../models/interfaces';
|
||||
|
||||
export interface IStatusView {
|
||||
installingService(): void;
|
||||
serviceInstalled(): void;
|
||||
serviceInstallationFailed(): void;
|
||||
updateServiceDownloadingProgress(downloadPercentage: number): void;
|
||||
}
|
||||
|
||||
export interface IConfig {
|
||||
getDownloadUrl(): string;
|
||||
getInstallDirectory(): string;
|
||||
getExecutableFiles(): string[];
|
||||
getPackageVersion(): string;
|
||||
getExtensionConfig(key: string, defaultValue?: any): any;
|
||||
getWorkspaceConfig(key: string, defaultValue?: any): any;
|
||||
getConfigValue(configKey: string): any;
|
||||
}
|
||||
|
||||
export interface IPackage {
|
||||
url: string;
|
||||
installPath?: string;
|
||||
tmpFile: tmp.SynchronousResult;
|
||||
}
|
||||
|
||||
export class PackageError extends Error {
|
||||
// Do not put PII (personally identifiable information) in the 'message' field as it will be logged to telemetry
|
||||
constructor(public message: string,
|
||||
public pkg: IPackage = undefined,
|
||||
public innerError: any = undefined) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
export interface IHttpClient {
|
||||
downloadFile(urlString: string, pkg: IPackage, logger: ILogger, statusView: IStatusView, proxy: string, strictSSL: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IDecompressProvider {
|
||||
decompress(pkg: IPackage, logger: ILogger): Promise<void>;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { Url, parse as parseUrl } from 'url';
|
||||
const HttpProxyAgent = require('http-proxy-agent');
|
||||
const HttpsProxyAgent = require('https-proxy-agent');
|
||||
|
||||
function getSystemProxyURL(requestURL: Url): string {
|
||||
if (requestURL.protocol === 'http:') {
|
||||
return process.env.HTTP_PROXY || process.env.http_proxy || undefined;
|
||||
} else if (requestURL.protocol === 'https:') {
|
||||
return process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy || undefined;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the proxy agent using the proxy url in the parameters or the system proxy. Returns null if no proxy found
|
||||
*/
|
||||
export function getProxyAgent(requestURL: Url, proxy?: string, strictSSL?: boolean): any {
|
||||
const proxyURL = proxy || getSystemProxyURL(requestURL);
|
||||
|
||||
if (!proxyURL) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const proxyEndpoint = parseUrl(proxyURL);
|
||||
|
||||
if (!/^https?:$/.test(proxyEndpoint.protocol)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
strictSSL = strictSSL || true;
|
||||
|
||||
const opts = {
|
||||
host: proxyEndpoint.hostname,
|
||||
port: Number(proxyEndpoint.port),
|
||||
auth: proxyEndpoint.auth,
|
||||
rejectUnauthorized: strictSSL
|
||||
};
|
||||
|
||||
return requestURL.protocol === 'http:' ? new HttpProxyAgent(opts) : new HttpsProxyAgent(opts);
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import { Runtime } from '../models/platform';
|
||||
import ServiceDownloadProvider from './serviceDownloadProvider';
|
||||
import { IConfig, IStatusView } from './interfaces';
|
||||
const fs = require('fs-extra-promise');
|
||||
|
||||
|
||||
/*
|
||||
* Service Provider class finds the SQL tools service executable file or downloads it if doesn't exist.
|
||||
*/
|
||||
export default class ServerProvider {
|
||||
|
||||
constructor(private _downloadProvider: ServiceDownloadProvider,
|
||||
private _config: IConfig,
|
||||
private _statusView: IStatusView,
|
||||
private _extensionConfigSectionName: string) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Public get method for downloadProvider
|
||||
*/
|
||||
public get downloadProvider(): ServiceDownloadProvider {
|
||||
return this._downloadProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a file path, returns the path to the SQL Tools service file.
|
||||
*/
|
||||
public findServerPath(filePath: string, executableFiles: string[] = undefined): Promise<string> {
|
||||
return fs.lstatAsync(filePath).then(stats => {
|
||||
// If a file path was passed, assume its the launch file.
|
||||
if (stats.isFile()) {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
// Otherwise, search the specified folder.
|
||||
let candidate: string;
|
||||
|
||||
if (executableFiles === undefined && this._config !== undefined) {
|
||||
executableFiles = this._config.getExecutableFiles();
|
||||
}
|
||||
if (executableFiles !== undefined) {
|
||||
executableFiles.forEach(element => {
|
||||
let executableFile = path.join(filePath, element);
|
||||
if (candidate === undefined && fs.existsSync(executableFile)) {
|
||||
candidate = executableFile;
|
||||
return candidate;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return candidate;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the service if doesn't exist and returns the file path.
|
||||
*/
|
||||
public getOrDownloadServer(runtime: Runtime): Promise<string> {
|
||||
// Attempt to find launch file path first from options, and then from the default install location.
|
||||
// If SQL tools service can't be found, download it.
|
||||
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
return this.getServerPath(runtime).then(result => {
|
||||
if (result === undefined) {
|
||||
return this.downloadServerFiles(runtime).then ( downloadResult => {
|
||||
resolve(downloadResult);
|
||||
});
|
||||
} else {
|
||||
return resolve(result);
|
||||
}
|
||||
}).catch(err => {
|
||||
return reject(err);
|
||||
});
|
||||
}).catch(err => {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path of the installed service
|
||||
*/
|
||||
public getServerPath(runtime: Runtime): Promise<string> {
|
||||
const installDirectory = this._downloadProvider.getInstallDirectory(runtime, this._extensionConfigSectionName);
|
||||
return this.findServerPath(installDirectory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the service and returns the path of the installed service
|
||||
*/
|
||||
public downloadServerFiles(runtime: Runtime): Promise<string> {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const installDirectory = this._downloadProvider.getInstallDirectory(runtime, this._extensionConfigSectionName);
|
||||
return this._downloadProvider.installService(runtime).then( _ => {
|
||||
return this.findServerPath(installDirectory).then ( result => {
|
||||
return resolve(result);
|
||||
});
|
||||
}).catch(err => {
|
||||
this._statusView.serviceInstallationFailed();
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { IStatusView } from './interfaces';
|
||||
import vscode = require('vscode');
|
||||
import { IExtensionConstants } from '../models/contracts/contracts';
|
||||
import { Constants } from '../models/constants';
|
||||
|
||||
/*
|
||||
* The status class which includes the service initialization result.
|
||||
*/
|
||||
export class ServerInitializationResult {
|
||||
|
||||
public constructor(
|
||||
public installedBeforeInitializing: Boolean = false,
|
||||
public isRunning: Boolean = false,
|
||||
public serverPath: string = undefined
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
public Clone(): ServerInitializationResult {
|
||||
return new ServerInitializationResult(this.installedBeforeInitializing, this.isRunning, this.serverPath);
|
||||
}
|
||||
|
||||
public WithRunning(isRunning: Boolean): ServerInitializationResult {
|
||||
return new ServerInitializationResult(this.installedBeforeInitializing, isRunning, this.serverPath);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The status class shows service installing progress in UI
|
||||
*/
|
||||
export class ServerStatusView implements IStatusView, vscode.Disposable {
|
||||
private _numberOfSecondsBeforeHidingMessage = 5000;
|
||||
private _statusBarItem: vscode.StatusBarItem = undefined;
|
||||
private _progressTimerId: NodeJS.Timer;
|
||||
private _constants: IExtensionConstants;
|
||||
|
||||
constructor(constants: IExtensionConstants) {
|
||||
this._statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
|
||||
vscode.window.onDidChangeActiveTextEditor((params) => this.onDidChangeActiveTextEditor(params));
|
||||
vscode.workspace.onDidCloseTextDocument((params) => this.onDidCloseTextDocument(params));
|
||||
this._constants = constants;
|
||||
}
|
||||
|
||||
public installingService(): void {
|
||||
this._statusBarItem.command = undefined;
|
||||
this._statusBarItem.show();
|
||||
|
||||
this.showProgress('$(desktop-download) ' + Constants.serviceInstalling);
|
||||
}
|
||||
|
||||
public updateServiceDownloadingProgress(downloadPercentage: number): void {
|
||||
this._statusBarItem.text = '$(cloud-download) ' + `${Constants.serviceDownloading} ... ${downloadPercentage}%`;
|
||||
this._statusBarItem.show();
|
||||
}
|
||||
|
||||
public serviceInstalled(): void {
|
||||
|
||||
this._statusBarItem.command = undefined;
|
||||
this._statusBarItem.text = this._constants.serviceInstalled;
|
||||
this._statusBarItem.show();
|
||||
// Cleat the status bar after 2 seconds
|
||||
setTimeout(() => {
|
||||
this._statusBarItem.hide();
|
||||
}, this._numberOfSecondsBeforeHidingMessage);
|
||||
}
|
||||
|
||||
public serviceInstallationFailed(): void {
|
||||
this._statusBarItem.command = undefined;
|
||||
this._statusBarItem.text = this._constants.serviceInstallationFailed;
|
||||
this._statusBarItem.show();
|
||||
}
|
||||
|
||||
private showProgress(statusText: string): void {
|
||||
let index = 0;
|
||||
let progressTicks = [ '|', '/', '-', '\\'];
|
||||
|
||||
|
||||
this._progressTimerId = setInterval(() => {
|
||||
index++;
|
||||
if (index > 3) {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
let progressTick = progressTicks[index];
|
||||
if (this._statusBarItem.text !== this._constants.serviceInstalled) {
|
||||
this._statusBarItem.text = statusText + ' ' + progressTick;
|
||||
this._statusBarItem.show();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.destroyStatusBar();
|
||||
}
|
||||
|
||||
private hideLastShownStatusBar(): void {
|
||||
if (typeof this._statusBarItem !== 'undefined') {
|
||||
this._statusBarItem.hide();
|
||||
}
|
||||
}
|
||||
|
||||
private onDidChangeActiveTextEditor(editor: vscode.TextEditor): void {
|
||||
// Hide the most recently shown status bar
|
||||
this.hideLastShownStatusBar();
|
||||
}
|
||||
|
||||
private onDidCloseTextDocument(doc: vscode.TextDocument): void {
|
||||
// Remove the status bar associated with the document
|
||||
this.destroyStatusBar();
|
||||
}
|
||||
|
||||
private destroyStatusBar(): void {
|
||||
if (typeof this._statusBarItem !== 'undefined') {
|
||||
this._statusBarItem.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,535 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { ExtensionContext, workspace, window, OutputChannel, languages } from 'vscode';
|
||||
import * as SqlopsClient from 'dataprotocol-client';
|
||||
import { CloseAction, ErrorAction, ServerOptions, NotificationHandler, NotificationType, RequestType, TransportKind } from 'vscode-languageclient';
|
||||
|
||||
import { VscodeWrapper } from '../controllers/vscodeWrapper';
|
||||
import { Telemetry } from '../models/telemetry';
|
||||
import { Utils } from '../models/utils';
|
||||
import { VersionRequest, IExtensionConstants } from '../models/contracts/contracts';
|
||||
import { Logger } from '../models/logger';
|
||||
import ServerProvider from './server';
|
||||
import ServiceDownloadProvider from './serviceDownloadProvider';
|
||||
import DecompressProvider from './decompressProvider';
|
||||
import HttpClient from './httpClient';
|
||||
import ExtConfig from '../configurations/extConfig';
|
||||
import { PlatformInformation, Runtime } from '../models/platform';
|
||||
import { ServerInitializationResult, ServerStatusView } from './serverStatus';
|
||||
import StatusView from '../views/statusView';
|
||||
import * as LanguageServiceContracts from '../models/contracts/languageService';
|
||||
import { Constants } from '../models/constants';
|
||||
import ServiceStatus from './serviceStatus';
|
||||
|
||||
const opener = require('opener');
|
||||
const path = require('path');
|
||||
let _channel: OutputChannel = undefined;
|
||||
|
||||
/**
|
||||
* @interface IMessage
|
||||
*/
|
||||
interface IMessage {
|
||||
jsonrpc: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Language Service client errors
|
||||
* @class LanguageClientErrorHandler
|
||||
*/
|
||||
class LanguageClientErrorHandler {
|
||||
|
||||
private vscodeWrapper: VscodeWrapper;
|
||||
|
||||
/**
|
||||
* Creates an instance of LanguageClientErrorHandler.
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
constructor(constants: IExtensionConstants) {
|
||||
if (!this.vscodeWrapper) {
|
||||
this.vscodeWrapper = new VscodeWrapper(constants);
|
||||
}
|
||||
Telemetry.getRuntimeId = this.vscodeWrapper.constants.getRuntimeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an error message prompt with a link to known issues wiki page
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
showOnErrorPrompt(): void {
|
||||
let extensionConstants = this.vscodeWrapper.constants;
|
||||
Telemetry.sendTelemetryEvent(extensionConstants.serviceName + 'Crash');
|
||||
this.vscodeWrapper.showErrorMessage(
|
||||
extensionConstants.serviceCrashMessage,
|
||||
Constants.serviceCrashButton).then(action => {
|
||||
if (action && action === Constants.serviceCrashButton) {
|
||||
opener(extensionConstants.serviceCrashLink);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for language service client error
|
||||
*
|
||||
* @param {Error} error
|
||||
* @param {Message} message
|
||||
* @param {number} count
|
||||
* @returns {ErrorAction}
|
||||
*
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
error(error: Error, message: IMessage, count: number): ErrorAction {
|
||||
this.showOnErrorPrompt();
|
||||
|
||||
// we don't retry running the service since crashes leave the extension
|
||||
// in a bad, unrecovered state
|
||||
return ErrorAction.Shutdown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for language service client closed
|
||||
*
|
||||
* @returns {CloseAction}
|
||||
*
|
||||
* @memberOf LanguageClientErrorHandler
|
||||
*/
|
||||
closed(): CloseAction {
|
||||
this.showOnErrorPrompt();
|
||||
|
||||
// we don't retry running the service since crashes leave the extension
|
||||
// in a bad, unrecovered state
|
||||
return CloseAction.DoNotRestart;
|
||||
}
|
||||
}
|
||||
|
||||
// The Service Client class handles communication with the VS Code LanguageClient
|
||||
export class SqlToolsServiceClient {
|
||||
// singleton instance
|
||||
private static _instance: SqlToolsServiceClient = undefined;
|
||||
|
||||
private static _constants: IExtensionConstants = undefined;
|
||||
|
||||
public static get constants(): IExtensionConstants {
|
||||
return this._constants;
|
||||
}
|
||||
|
||||
public static set constants(constantsObject: IExtensionConstants) {
|
||||
this._constants = constantsObject;
|
||||
Telemetry.getRuntimeId = this._constants.getRuntimeId;
|
||||
}
|
||||
|
||||
private static _helper: LanguageServiceContracts.ILanguageClientHelper = undefined;
|
||||
|
||||
public static get helper(): LanguageServiceContracts.ILanguageClientHelper {
|
||||
return this._helper;
|
||||
}
|
||||
|
||||
public static set helper(helperObject: LanguageServiceContracts.ILanguageClientHelper) {
|
||||
this._helper = helperObject;
|
||||
}
|
||||
|
||||
// VS Code Language Client
|
||||
private _client: SqlopsClient.SqlOpsDataClient = undefined;
|
||||
|
||||
// getter method for the Language Client
|
||||
private get client(): SqlopsClient.SqlOpsDataClient {
|
||||
return this._client;
|
||||
}
|
||||
|
||||
private set client(client: SqlopsClient.SqlOpsDataClient) {
|
||||
this._client = client;
|
||||
}
|
||||
|
||||
public installDirectory: string;
|
||||
private _downloadProvider: ServiceDownloadProvider;
|
||||
private _vscodeWrapper: VscodeWrapper;
|
||||
|
||||
private _serviceStatus: ServiceStatus;
|
||||
|
||||
private _languageClientStartTime: number = undefined;
|
||||
private _installationTime: number = undefined;
|
||||
|
||||
constructor(
|
||||
private _server: ServerProvider,
|
||||
private _logger: Logger,
|
||||
private _statusView: StatusView,
|
||||
private _config: ExtConfig) {
|
||||
this._downloadProvider = _server.downloadProvider;
|
||||
if (!this._vscodeWrapper) {
|
||||
this._vscodeWrapper = new VscodeWrapper(SqlToolsServiceClient.constants);
|
||||
}
|
||||
this._serviceStatus = new ServiceStatus(SqlToolsServiceClient._constants.serviceName);
|
||||
}
|
||||
|
||||
// gets or creates the singleton service client instance
|
||||
public static getInstance(path: string): SqlToolsServiceClient {
|
||||
if (this._instance === undefined) {
|
||||
let constants = this._constants;
|
||||
let config = new ExtConfig(constants.extensionConfigSectionName, undefined, path);
|
||||
_channel = window.createOutputChannel(constants.serviceInitializingOutputChannelName);
|
||||
let logger = new Logger(text => _channel.append(text), constants);
|
||||
let serverStatusView = new ServerStatusView(constants);
|
||||
let httpClient = new HttpClient();
|
||||
let decompressProvider = new DecompressProvider();
|
||||
let downloadProvider = new ServiceDownloadProvider(config, logger, serverStatusView, httpClient,
|
||||
decompressProvider, constants, false);
|
||||
let serviceProvider = new ServerProvider(downloadProvider, config, serverStatusView, constants.extensionConfigSectionName);
|
||||
let statusView = new StatusView();
|
||||
this._instance = new SqlToolsServiceClient(serviceProvider, logger, statusView, config);
|
||||
}
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
// initialize the Service Client instance by launching
|
||||
// out-of-proc server through the LanguageClient
|
||||
public initialize(context: ExtensionContext): Promise<any> {
|
||||
this._logger.appendLine(SqlToolsServiceClient._constants.serviceInitializing);
|
||||
this._languageClientStartTime = Date.now();
|
||||
return PlatformInformation.getCurrent(SqlToolsServiceClient._constants.getRuntimeId, SqlToolsServiceClient._constants.extensionName).then(platformInfo => {
|
||||
return this.initializeForPlatform(platformInfo, context);
|
||||
}).catch(err => {
|
||||
this._vscodeWrapper.showErrorMessage(err);
|
||||
});
|
||||
}
|
||||
|
||||
public initializeForPlatform(platformInfo: PlatformInformation, context: ExtensionContext): Promise<ServerInitializationResult> {
|
||||
return new Promise<ServerInitializationResult>((resolve, reject) => {
|
||||
this._logger.appendLine(SqlToolsServiceClient._constants.commandsNotAvailableWhileInstallingTheService);
|
||||
this._logger.appendLine();
|
||||
this._logger.append(`Platform: ${platformInfo.toString()}`);
|
||||
|
||||
if (!platformInfo.isValidRuntime()) {
|
||||
// if it's an unknown Linux distro then try generic Linux x64 and give a warning to the user
|
||||
if (platformInfo.isLinux()) {
|
||||
this._logger.appendLine(Constants.usingDefaultPlatformMessage);
|
||||
platformInfo.runtimeId = Runtime.Linux_64;
|
||||
}
|
||||
|
||||
let ignoreWarning: boolean = this._config.getWorkspaceConfig(Constants.ignorePlatformWarning, false);
|
||||
if (!ignoreWarning) {
|
||||
this._vscodeWrapper.showErrorMessage(
|
||||
Constants.unsupportedPlatformErrorMessage,
|
||||
Constants.neverShowAgain)
|
||||
.then(action => {
|
||||
if (action === Constants.neverShowAgain) {
|
||||
this._config.updateWorkspaceConfig(Constants.ignorePlatformWarning, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Telemetry.sendTelemetryEvent('UnsupportedPlatform', { platform: platformInfo.toString() });
|
||||
}
|
||||
|
||||
if (platformInfo.runtimeId) {
|
||||
this._logger.appendLine(` (${platformInfo.getRuntimeDisplayName()})`);
|
||||
} else {
|
||||
this._logger.appendLine();
|
||||
}
|
||||
|
||||
this._logger.appendLine();
|
||||
|
||||
this._server.getServerPath(platformInfo.runtimeId).then(serverPath => {
|
||||
if (serverPath === undefined) {
|
||||
// Check if the service already installed and if not open the output channel to show the logs
|
||||
if (_channel !== undefined) {
|
||||
_channel.show();
|
||||
}
|
||||
let installationStartTime = Date.now();
|
||||
this._server.downloadServerFiles(platformInfo.runtimeId).then(installedServerPath => {
|
||||
this._installationTime = Date.now() - installationStartTime;
|
||||
this.initializeLanguageClient(installedServerPath, context, platformInfo.runtimeId);
|
||||
resolve(new ServerInitializationResult(true, true, installedServerPath));
|
||||
}).catch(downloadErr => {
|
||||
reject(downloadErr);
|
||||
});
|
||||
} else {
|
||||
this.initializeLanguageClient(serverPath, context, platformInfo.runtimeId);
|
||||
resolve(new ServerInitializationResult(false, true, serverPath));
|
||||
}
|
||||
}).catch(err => {
|
||||
Utils.logDebug(SqlToolsServiceClient._constants.serviceLoadingFailed + ' ' + err, SqlToolsServiceClient._constants.extensionConfigSectionName);
|
||||
Utils.showErrorMsg(SqlToolsServiceClient._constants.serviceLoadingFailed, SqlToolsServiceClient._constants.extensionName);
|
||||
Telemetry.sendTelemetryEvent('ServiceInitializingFailed');
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the SQL language configuration
|
||||
*
|
||||
* @memberOf SqlToolsServiceClient
|
||||
*/
|
||||
private initializeLanguageConfiguration(): void {
|
||||
languages.setLanguageConfiguration('sql', {
|
||||
comments: {
|
||||
lineComment: '--',
|
||||
blockComment: ['/*', '*/']
|
||||
},
|
||||
|
||||
brackets: [
|
||||
['{', '}'],
|
||||
['[', ']'],
|
||||
['(', ')']
|
||||
],
|
||||
|
||||
__characterPairSupport: {
|
||||
autoClosingPairs: [
|
||||
{ open: '{', close: '}' },
|
||||
{ open: '[', close: ']' },
|
||||
{ open: '(', close: ')' },
|
||||
{ open: '"', close: '"', notIn: ['string'] },
|
||||
{ open: '\'', close: '\'', notIn: ['string', 'comment'] }
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private initializeLanguageClient(serverPath: string, context: ExtensionContext, runtimeId: Runtime): void {
|
||||
if (serverPath === undefined) {
|
||||
Utils.logDebug(SqlToolsServiceClient._constants.invalidServiceFilePath, SqlToolsServiceClient._constants.extensionConfigSectionName);
|
||||
throw new Error(SqlToolsServiceClient._constants.invalidServiceFilePath);
|
||||
} else {
|
||||
let self = this;
|
||||
|
||||
if (SqlToolsServiceClient._constants.languageId === 'sql') {
|
||||
self.initializeLanguageConfiguration();
|
||||
}
|
||||
|
||||
// Use default createServerOptions if one isn't specified
|
||||
let serverOptions: ServerOptions = SqlToolsServiceClient._helper ?
|
||||
SqlToolsServiceClient._helper.createServerOptions(serverPath, runtimeId) : self.createServerOptions(serverPath);
|
||||
this.client = this.createLanguageClient(serverOptions);
|
||||
this.installDirectory = this._downloadProvider.getInstallDirectory(runtimeId, SqlToolsServiceClient._constants.extensionConfigSectionName);
|
||||
|
||||
if (context !== undefined) {
|
||||
// Create the language client and start the client.
|
||||
let disposable = this.client.start();
|
||||
|
||||
// Push the disposable to the context's subscriptions so that the
|
||||
// client can be deactivated on extension deactivation
|
||||
|
||||
context.subscriptions.push(disposable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public createClient(context: ExtensionContext, runtimeId: Runtime, languageClientHelper: LanguageServiceContracts.ILanguageClientHelper, executableFiles: string[]): Promise<SqlopsClient.SqlOpsDataClient> {
|
||||
return new Promise<SqlopsClient.SqlOpsDataClient>((resolve, reject) => {
|
||||
let client: SqlopsClient.SqlOpsDataClient;
|
||||
this._server.findServerPath(this.installDirectory, executableFiles).then(serverPath => {
|
||||
if (serverPath === undefined) {
|
||||
reject(new Error(SqlToolsServiceClient._constants.invalidServiceFilePath));
|
||||
} else {
|
||||
|
||||
let serverOptions: ServerOptions = languageClientHelper ?
|
||||
languageClientHelper.createServerOptions(serverPath, runtimeId) : this.createServerOptions(serverPath);
|
||||
|
||||
// Options to control the language client
|
||||
let clientOptions: SqlopsClient.ClientOptions = {
|
||||
documentSelector: [SqlToolsServiceClient._constants.languageId],
|
||||
providerId: '',
|
||||
synchronize: {
|
||||
configurationSection: SqlToolsServiceClient._constants.extensionConfigSectionName
|
||||
},
|
||||
errorHandler: new LanguageClientErrorHandler(SqlToolsServiceClient._constants),
|
||||
outputChannel: {
|
||||
append: () => {
|
||||
},
|
||||
appendLine: () => {
|
||||
},
|
||||
dispose: () => {
|
||||
},
|
||||
clear: () => {
|
||||
},
|
||||
hide: () => {
|
||||
},
|
||||
name: '',
|
||||
show: () => {
|
||||
}
|
||||
},
|
||||
// pass in no features so we don't register features we don't want
|
||||
features: []
|
||||
};
|
||||
|
||||
this._serviceStatus.showServiceLoading();
|
||||
// cache the client instance for later use
|
||||
client = new SqlopsClient.SqlOpsDataClient(SqlToolsServiceClient._constants.serviceName, serverOptions, clientOptions);
|
||||
|
||||
if (context !== undefined) {
|
||||
// Create the language client and start the client.
|
||||
let disposable = client.start();
|
||||
|
||||
// Push the disposable to the context's subscriptions so that the
|
||||
// client can be deactivated on extension deactivation
|
||||
|
||||
context.subscriptions.push(disposable);
|
||||
}
|
||||
client.onReady().then(this._serviceStatus.showServiceLoaded);
|
||||
|
||||
resolve(client);
|
||||
}
|
||||
}, error => {
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private createServerOptions(servicePath): ServerOptions {
|
||||
let serverArgs = [];
|
||||
let serverCommand: string = servicePath;
|
||||
if (servicePath.endsWith('.dll')) {
|
||||
serverArgs = [servicePath];
|
||||
serverCommand = 'dotnet';
|
||||
}
|
||||
|
||||
// Enable diagnostic logging in the service if it is configured
|
||||
let config = workspace.getConfiguration(SqlToolsServiceClient._constants.extensionConfigSectionName);
|
||||
if (config) {
|
||||
let logDebugInfo = config[Constants.configLogDebugInfo];
|
||||
if (logDebugInfo) {
|
||||
serverArgs.push('--enable-logging');
|
||||
}
|
||||
}
|
||||
serverArgs.push('--log-dir');
|
||||
let logFileLocation = path.join(Utils.getDefaultLogLocation(), SqlToolsServiceClient.constants.extensionName);
|
||||
serverArgs.push(logFileLocation);
|
||||
|
||||
// run the service host using dotnet.exe from the path
|
||||
let serverOptions: ServerOptions = { command: serverCommand, args: serverArgs, transport: TransportKind.stdio };
|
||||
return serverOptions;
|
||||
}
|
||||
|
||||
private createLanguageClient(serverOptions: ServerOptions): SqlopsClient.SqlOpsDataClient {
|
||||
// Options to control the language client
|
||||
let clientOptions: SqlopsClient.ClientOptions = {
|
||||
documentSelector: [SqlToolsServiceClient._constants.languageId],
|
||||
providerId: SqlToolsServiceClient._constants.providerId,
|
||||
synchronize: {
|
||||
configurationSection: SqlToolsServiceClient._constants.extensionConfigSectionName
|
||||
},
|
||||
errorHandler: new LanguageClientErrorHandler(SqlToolsServiceClient._constants),
|
||||
outputChannel: {
|
||||
append: () => {
|
||||
},
|
||||
appendLine: () => {
|
||||
},
|
||||
dispose: () => {
|
||||
},
|
||||
clear: () => {
|
||||
},
|
||||
hide: () => {
|
||||
},
|
||||
name: '',
|
||||
show: () => {
|
||||
}
|
||||
},
|
||||
features: [
|
||||
SqlopsClient.AdminServicesFeature,
|
||||
SqlopsClient.BackupFeature,
|
||||
SqlopsClient.CapabilitiesFeature,
|
||||
SqlopsClient.ConnectionFeature,
|
||||
SqlopsClient.FileBrowserFeature,
|
||||
SqlopsClient.MetadataFeature,
|
||||
SqlopsClient.ObjectExplorerFeature,
|
||||
SqlopsClient.ProfilerFeature,
|
||||
SqlopsClient.QueryFeature,
|
||||
SqlopsClient.RestoreFeature,
|
||||
SqlopsClient.ScriptingFeature,
|
||||
SqlopsClient.TaskServicesFeature,
|
||||
// heres the important bit
|
||||
LanguageServiceContracts.AgentServicesFeature
|
||||
]
|
||||
};
|
||||
|
||||
this._serviceStatus.showServiceLoading();
|
||||
// cache the client instance for later use
|
||||
let client = new SqlopsClient.SqlOpsDataClient(SqlToolsServiceClient._constants.serviceName, serverOptions, clientOptions);
|
||||
client.onReady().then(() => {
|
||||
this.checkServiceCompatibility();
|
||||
this._serviceStatus.showServiceLoaded();
|
||||
client.onNotification(LanguageServiceContracts.TelemetryNotification.type, this.handleLanguageServiceTelemetryNotification());
|
||||
client.onNotification(LanguageServiceContracts.StatusChangedNotification.type, this.handleLanguageServiceStatusNotification());
|
||||
|
||||
// Report the language client startup time
|
||||
let endTime = Date.now();
|
||||
let installationTime = this._installationTime || 0;
|
||||
let totalTime = endTime - this._languageClientStartTime;
|
||||
let processStartupTime = totalTime - installationTime;
|
||||
Telemetry.sendTelemetryEvent('startup/LanguageClientStarted', {
|
||||
installationTime: String(installationTime),
|
||||
processStartupTime: String(processStartupTime),
|
||||
totalTime: String(totalTime),
|
||||
beginningTimestamp: String(this._languageClientStartTime)
|
||||
});
|
||||
this._languageClientStartTime = undefined;
|
||||
this._installationTime = undefined;
|
||||
});
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
private handleLanguageServiceTelemetryNotification(): NotificationHandler<LanguageServiceContracts.TelemetryParams> {
|
||||
return (event: LanguageServiceContracts.TelemetryParams): void => {
|
||||
Telemetry.sendTelemetryEvent(event.params.eventName, event.params.properties, event.params.measures);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Public for testing purposes only.
|
||||
*/
|
||||
public handleLanguageServiceStatusNotification(): NotificationHandler<LanguageServiceContracts.StatusChangeParams> {
|
||||
return (event: LanguageServiceContracts.StatusChangeParams): void => {
|
||||
this._statusView.languageServiceStatusChanged(event.ownerUri, event.status);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a request to the service client
|
||||
* @param type The of the request to make
|
||||
* @param params The params to pass with the request
|
||||
* @returns A thenable object for when the request receives a response
|
||||
*/
|
||||
public sendRequest<P, R, E, RO>(type: RequestType<P, R, E, RO>, params?: P, client: SqlopsClient.SqlOpsDataClient = undefined): Thenable<R> {
|
||||
if (client === undefined) {
|
||||
client = this._client;
|
||||
}
|
||||
if (client !== undefined) {
|
||||
return client.sendRequest(type, params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a handler for a notification type
|
||||
* @param type The notification type to register the handler for
|
||||
* @param handler The handler to register
|
||||
*/
|
||||
public onNotification<P, RO>(type: NotificationType<P, RO>, handler: NotificationHandler<P>, client: SqlopsClient.SqlOpsDataClient = undefined): void {
|
||||
if (client === undefined) {
|
||||
client = this._client;
|
||||
}
|
||||
if (client !== undefined) {
|
||||
return client.onNotification(type, handler);
|
||||
}
|
||||
}
|
||||
|
||||
public checkServiceCompatibility(): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
this._client.sendRequest(VersionRequest.type, undefined).then((result) => {
|
||||
Utils.logDebug(SqlToolsServiceClient._constants.extensionName + ' service client version: ' + result, SqlToolsServiceClient._constants.extensionConfigSectionName);
|
||||
|
||||
if (result === undefined || !result.startsWith(SqlToolsServiceClient._constants.serviceCompatibleVersion)) {
|
||||
Utils.showErrorMsg(Constants.serviceNotCompatibleError, SqlToolsServiceClient._constants.extensionName);
|
||||
Utils.logDebug(Constants.serviceNotCompatibleError, SqlToolsServiceClient._constants.extensionConfigSectionName);
|
||||
resolve(false);
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { Runtime, getRuntimeDisplayName } from '../models/platform';
|
||||
import * as path from 'path';
|
||||
import { IConfig, IStatusView, IPackage, PackageError, IHttpClient, IDecompressProvider } from './interfaces';
|
||||
import { ILogger } from '../models/interfaces';
|
||||
import { Constants } from '../models/constants';
|
||||
import * as tmp from 'tmp';
|
||||
import { IExtensionConstants } from '../models/contracts/contracts';
|
||||
|
||||
const fse = require('fs-extra');
|
||||
|
||||
/*
|
||||
* Service Download Provider class which handles downloading the SQL Tools service.
|
||||
*/
|
||||
export default class ServiceDownloadProvider {
|
||||
|
||||
constructor(private _config: IConfig,
|
||||
private _logger: ILogger,
|
||||
private _statusView: IStatusView,
|
||||
private _httpClient: IHttpClient,
|
||||
private _decompressProvider: IDecompressProvider,
|
||||
private _extensionConstants: IExtensionConstants,
|
||||
private _fromBuild: boolean) {
|
||||
// Ensure our temp files get cleaned up in case of error.
|
||||
tmp.setGracefulCleanup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the download url for given platform
|
||||
*/
|
||||
public getDownloadFileName(platform: Runtime): string {
|
||||
let fileNamesJson = this._config.getConfigValue('downloadFileNames');
|
||||
console.info('Platform: ', platform.toString());
|
||||
|
||||
let fileName = fileNamesJson[platform.toString()];
|
||||
console.info('Filename: ', fileName);
|
||||
|
||||
if (fileName === undefined) {
|
||||
if (process.platform === 'linux') {
|
||||
throw new Error('Unsupported linux distribution');
|
||||
} else {
|
||||
throw new Error(`Unsupported platform: ${process.platform}`);
|
||||
}
|
||||
}
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns SQL tools service installed folder.
|
||||
*/
|
||||
public getInstallDirectory(platform: Runtime, extensionConfigSectionName: string): string {
|
||||
let basePath = this.getInstallDirectoryRoot(platform, extensionConfigSectionName);
|
||||
let versionFromConfig = this._config.getPackageVersion();
|
||||
basePath = basePath.replace('{#version#}', versionFromConfig);
|
||||
basePath = basePath.replace('{#platform#}', getRuntimeDisplayName(platform));
|
||||
if (!fse.existsSync(basePath)) {
|
||||
fse.mkdirsSync(basePath);
|
||||
}
|
||||
|
||||
return basePath;
|
||||
}
|
||||
|
||||
private getLocalUserFolderPath(platform: Runtime): string {
|
||||
if (platform) {
|
||||
switch (platform) {
|
||||
case Runtime.Windows_64:
|
||||
case Runtime.Windows_86:
|
||||
return process.env.APPDATA;
|
||||
case Runtime.OSX:
|
||||
return process.env.HOME + '/Library/Preferences';
|
||||
default:
|
||||
return process.env.HOME;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns SQL tools service installed folder root.
|
||||
*/
|
||||
public getInstallDirectoryRoot(platform: Runtime, extensionConfigSectionName: string): string {
|
||||
let installDirFromConfig : string;
|
||||
installDirFromConfig = this._config.getInstallDirectory();
|
||||
if (!installDirFromConfig || installDirFromConfig === '') {
|
||||
let rootFolderName: string = '.sqlops';
|
||||
if (platform === Runtime.Windows_64 || platform === Runtime.Windows_86) {
|
||||
rootFolderName = 'sqlops';
|
||||
}
|
||||
installDirFromConfig = path.join(this.getLocalUserFolderPath(platform), `/${rootFolderName}/${this._extensionConstants.installFolderName}/{#version#}/{#platform#}`);
|
||||
}
|
||||
let basePath: string;
|
||||
if (path.isAbsolute(installDirFromConfig)) {
|
||||
basePath = installDirFromConfig;
|
||||
} else if (this._fromBuild) {
|
||||
basePath = path.join(__dirname, '../../../extensions/' + extensionConfigSectionName + '/' + installDirFromConfig);
|
||||
} else {
|
||||
// The path from config is relative to the out folder
|
||||
basePath = path.join(__dirname, '../../../../' + installDirFromConfig);
|
||||
}
|
||||
return basePath;
|
||||
}
|
||||
|
||||
private getGetDownloadUrl(fileName: string): string {
|
||||
let baseDownloadUrl = this._config.getDownloadUrl();
|
||||
let version = this._config.getPackageVersion();
|
||||
baseDownloadUrl = baseDownloadUrl.replace('{#version#}', version);
|
||||
baseDownloadUrl = baseDownloadUrl.replace('{#fileName#}', fileName);
|
||||
return baseDownloadUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads the service and decompress it in the install folder.
|
||||
*/
|
||||
public installService(platform: Runtime): Promise<boolean> {
|
||||
const proxy = <string>this._config.getWorkspaceConfig('http.proxy');
|
||||
const strictSSL = this._config.getWorkspaceConfig('http.proxyStrictSSL', true);
|
||||
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
const fileName = this.getDownloadFileName(platform);
|
||||
const installDirectory = this.getInstallDirectory(platform, this._extensionConstants.extensionConfigSectionName);
|
||||
|
||||
this._logger.appendLine(`${this._extensionConstants.serviceInstallingTo} ${installDirectory}.`);
|
||||
const urlString = this.getGetDownloadUrl(fileName);
|
||||
|
||||
this._logger.appendLine(`${Constants.serviceDownloading} ${urlString}`);
|
||||
let pkg: IPackage = {
|
||||
installPath: installDirectory,
|
||||
url: urlString,
|
||||
tmpFile: undefined
|
||||
};
|
||||
this.createTempFile(pkg).then(tmpResult => {
|
||||
pkg.tmpFile = tmpResult;
|
||||
|
||||
this._httpClient.downloadFile(pkg.url, pkg, this._logger, this._statusView, proxy, strictSSL).then(_ => {
|
||||
|
||||
this._logger.logDebug(`Downloaded to ${pkg.tmpFile.name}...`);
|
||||
this._logger.appendLine(' Done!');
|
||||
this.install(pkg).then(result => {
|
||||
resolve(true);
|
||||
}).catch(installError => {
|
||||
reject(installError);
|
||||
});
|
||||
}).catch(downloadError => {
|
||||
this._logger.appendLine(`[ERROR] ${downloadError}`);
|
||||
reject(downloadError);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private createTempFile(pkg: IPackage): Promise<tmp.SynchronousResult> {
|
||||
return new Promise<tmp.SynchronousResult>((resolve, reject) => {
|
||||
tmp.file({ prefix: 'package-' }, (err, path, fd, cleanupCallback) => {
|
||||
if (err) {
|
||||
return reject(new PackageError('Error from tmp.file', pkg, err));
|
||||
}
|
||||
|
||||
resolve(<tmp.SynchronousResult>{ name: path, fd: fd, removeCallback: cleanupCallback });
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private install(pkg: IPackage): Promise<void> {
|
||||
this._logger.appendLine('Installing ...');
|
||||
this._statusView.installingService();
|
||||
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this._decompressProvider.decompress(pkg, this._logger).then(_ => {
|
||||
this._statusView.serviceInstalled();
|
||||
resolve();
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Runtime, PlatformInformation } from '../models/platform';
|
||||
import Config from '../configurations/config';
|
||||
import ServiceDownloadProvider from './serviceDownloadProvider';
|
||||
import DecompressProvider from './decompressProvider';
|
||||
import HttpClient from './httpClient';
|
||||
import ServerProvider from './server';
|
||||
import { IStatusView } from './interfaces';
|
||||
import { ILogger } from '../models/interfaces';
|
||||
import { IExtensionConstants } from '../models/contracts/contracts';
|
||||
|
||||
class StubStatusView implements IStatusView {
|
||||
installingService(): void {
|
||||
console.log('...');
|
||||
}
|
||||
serviceInstalled(): void {
|
||||
console.log('Service installed');
|
||||
}
|
||||
serviceInstallationFailed(): void {
|
||||
console.log('Service installation failed');
|
||||
}
|
||||
updateServiceDownloadingProgress(downloadPercentage: number): void {
|
||||
if (downloadPercentage === 100) {
|
||||
process.stdout.write('100%');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class StubLogger implements ILogger {
|
||||
logDebug(message: string): void {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
increaseIndent(): void {
|
||||
console.log('increaseIndent');
|
||||
}
|
||||
|
||||
decreaseIndent(): void {
|
||||
console.log('decreaseIndent');
|
||||
}
|
||||
|
||||
append(message?: string): void {
|
||||
process.stdout.write(message);
|
||||
}
|
||||
appendLine(message?: string): void {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
export class ServiceInstaller {
|
||||
private _config = undefined;
|
||||
private _logger = new StubLogger();
|
||||
private _statusView = new StubStatusView();
|
||||
private _httpClient = new HttpClient();
|
||||
private _decompressProvider = new DecompressProvider();
|
||||
private _downloadProvider = undefined;
|
||||
private _serverProvider = undefined;
|
||||
private _extensionConstants = undefined;
|
||||
|
||||
constructor(extensionConstants: IExtensionConstants, path?: string) {
|
||||
this._extensionConstants = extensionConstants;
|
||||
this._config = new Config(extensionConstants.extensionConfigSectionName, path, true);
|
||||
this._downloadProvider = new ServiceDownloadProvider(this._config, this._logger, this._statusView, this._httpClient, this._decompressProvider, extensionConstants, true);
|
||||
this._serverProvider = new ServerProvider(this._downloadProvider, this._config, this._statusView, extensionConstants.extensionConfigSectionName);
|
||||
}
|
||||
/*
|
||||
* Installs the service for the given platform if it's not already installed.
|
||||
*/
|
||||
public installService(): Promise<String> {
|
||||
return PlatformInformation.getCurrent(this._extensionConstants.getRuntimeId, this._extensionConstants.extensionName).then(platformInfo => {
|
||||
if (platformInfo.isValidRuntime()) {
|
||||
return this._serverProvider.getOrDownloadServer(platformInfo.runtimeId);
|
||||
} else {
|
||||
throw new Error('unsupported runtime');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the install folder path for given platform.
|
||||
*/
|
||||
public getServiceInstallDirectory(runtime: Runtime): Promise<string> {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
if (runtime === undefined) {
|
||||
PlatformInformation.getCurrent(this._extensionConstants.getRuntimeId, this._extensionConstants.extensionName).then(platformInfo => {
|
||||
if (platformInfo.isValidRuntime()) {
|
||||
resolve(this._downloadProvider.getInstallDirectory(platformInfo.runtimeId));
|
||||
} else {
|
||||
reject('unsupported runtime');
|
||||
}
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
resolve(this._downloadProvider.getInstallDirectory(runtime));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the path to the root folder of service install location.
|
||||
*/
|
||||
public getServiceInstallDirectoryRoot(runtime: Runtime): Promise<string> {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
if (runtime === undefined) {
|
||||
PlatformInformation.getCurrent(this._extensionConstants.getRuntimeId, this._extensionConstants.extensionName).then(platformInfo => {
|
||||
if (platformInfo.isValidRuntime()) {
|
||||
let directoryPath: string = this._downloadProvider.getInstallDirectoryRoot(platformInfo, this._extensionConstants.extensionName);
|
||||
directoryPath = directoryPath.replace('\\{#version#}', '');
|
||||
directoryPath = directoryPath.replace('\\{#platform#}', '');
|
||||
directoryPath = directoryPath.replace('/{#platform#}', '');
|
||||
directoryPath = directoryPath.replace('/{#version#}', '');
|
||||
resolve(directoryPath);
|
||||
} else {
|
||||
reject('unsupported runtime');
|
||||
}
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
} else {
|
||||
resolve(this._downloadProvider.getInstallDirectory(runtime));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import vscode = require('vscode');
|
||||
|
||||
export default class ServiceStatus implements vscode.Disposable {
|
||||
|
||||
private _progressTimerId: NodeJS.Timer;
|
||||
|
||||
private _statusBarItem: vscode.StatusBarItem = undefined;
|
||||
|
||||
private durationStatusInMs: number = 1500;
|
||||
|
||||
// These need localization
|
||||
private _serviceStartingMessage: string = `Starting ${this._serviceName}`;
|
||||
private _serviceStartedMessage: string = `${this._serviceName} started`;
|
||||
|
||||
constructor(private _serviceName: string) {
|
||||
this._statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||
}
|
||||
|
||||
public showServiceLoading(): Promise<void> {
|
||||
return this === undefined ?
|
||||
Promise.resolve() :
|
||||
Promise.resolve(this.updateStatusView(this._serviceStartingMessage, true));
|
||||
}
|
||||
|
||||
public showServiceLoaded(): Promise<void> {
|
||||
return this === undefined ?
|
||||
Promise.resolve() :
|
||||
Promise.resolve(this.updateStatusView(this._serviceStartedMessage, false, this.durationStatusInMs));
|
||||
}
|
||||
|
||||
//TODO: This can be merged with the serverStatus code
|
||||
private showProgress(statusText: string): void {
|
||||
let index: number = 0;
|
||||
let progressTicks: string[] = ['.', '..', '...', '....'];
|
||||
|
||||
this._progressTimerId = setInterval(() => {
|
||||
index = (index + 1) % progressTicks.length;
|
||||
let progressTick = progressTicks[index];
|
||||
if (this._statusBarItem.text !== this._serviceStartedMessage) {
|
||||
this._statusBarItem.text = statusText + ' ' + progressTick;
|
||||
this._statusBarItem.show();
|
||||
}
|
||||
}, 400);
|
||||
}
|
||||
|
||||
private updateStatusView(message: string, showAsProgress: boolean = false, disposeAfter: number = -1): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (showAsProgress) {
|
||||
this.showProgress(message);
|
||||
}
|
||||
else {
|
||||
this._statusBarItem.text = message;
|
||||
this._statusBarItem.show();
|
||||
if (this._progressTimerId !== undefined) {
|
||||
clearInterval(this._progressTimerId);
|
||||
}
|
||||
}
|
||||
if (disposeAfter !== -1) {
|
||||
setInterval(() => {
|
||||
this._statusBarItem.hide();
|
||||
}, disposeAfter);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
if (this._progressTimerId !== undefined) {
|
||||
clearInterval(this._progressTimerId);
|
||||
}
|
||||
this._statusBarItem.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user