VisualStudioCode をビルド (Windows)

## 概要
- VisualStudioCode を Windows上で、ビルド.


## 環境
- Windows 7 64bit
- Visual Studio 2015 Update 3 (`Visual C++`と`Microsoft Web Developer Tools`を[入れた](http://qiita.com/mt08/items/daccb1b82cc1c671796e))
- nodejs v4.4.7
- git for Windows 2.9.0


## 手順
1. [Visual Studio 2015](https://www.visualstudio.com/) Update 3のインストール<br>Proを使用(評価版)。Communityでもいけるかと。
2. gitのイントール - https://git-for-windows.github.io/

    ```
C:\>git --version
git version 2.9.0.windows.1
```
3. nodejsインストール　- https://nodejs.org/<br>=> v4.4.7を使用
\#インストールの最後に、PATHに設定するか、ときかれるのをYesにしといたほうがいいかと。

    ```
C:\>node --version
v4.4.7
```
4. `git clone https://github.com/Microsoft/vscode.git`<br>ソース取得 : [GitHub - Microsoft/vscode: Visual Studio Code](https://github.com/Microsoft/vscode)

    ```
C:\>C:

    C:\>mkdir C:\github

    C:\>cd \github

    C:\github>git clone https://github.com/Microsoft/vscode.git
Cloning into 'vscode'...
remote: Counting objects: 102939, done.
remote: Compressing objects: 100% (446/446), done.
remote: Total 102939 (delta 218), reused 0 (delta 0), pack-reused 102461
Receiving objects: 100% (102939/102939), 31.42 MiB | 1.95 MiB/s, done.
Resolving deltas: 100% (68130/68130), done.
Checking connectivity... done.
Checking out files: 100% (4792/4792), done.

    C:\github>cd vscode

    C:\github\vscode>
```
5. `.\scripts\npm.bat install`<br>パッケージインストール
    1. ワーニング? VS2015Update3から、__pfnDliNotifyHook2に`const`がついてしまう模様

        ```
  win_delay_load_hook.c
C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers [C:\github\vscode\node_modules\pty.js\build\deps\winpty\winpty.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134): note: see declaration of '__pfnDliNotifyHook2'
```

        ```c:win_delay_load_hook.c
...
#include <windows.h>

        #ifndef DELAYIMP_INSECURE_WRITABLE_HOOKS
#define DELAYIMP_INSECURE_WRITABLE_HOOKS
#endif

        #include <delayimp.h>
#include <string.h>
...
```
`delayimp.h`をインクルードする前に　`#define DELAYIMP_INSECURE_WRITABLE_HOOKS`

    2. `fsevents`でエラー

        ```
C:\github\vscode>.\scripts\npm.bat install

        > code-oss-dev@1.3.0 preinstall C:\github\vscode
> node build/npm/preinstall.js

        npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code EBADPLATFORM

        npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: fsevents@0.3.8
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

        npm ERR! Please include the following file with any support request:
npm ERR!     C:\github\vscode\npm-debug.log
```
Windowsでは使えないらしいので、インストールしない.

        ```json:npm-shrinkwrap.jsonから以下を取り除く
...
            "fsevents": {
              "version": "0.3.8",
              "from": "fsevents@>=0.3.1 <0.4.0",
              "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-0.3.8.tgz"
            },
...
```
6. `.\scripts\npm.bat install`<br>上を直してまたパッケージインストール。

7. `.build`と`out`フォルダを削除(きれいに)
8. `.\script\code.bat`<br>ビルド開始、終了後,VSCodeが起動

9. `.\scripts\test-integration.bat`<br>テスト??

## その他
1. `grep gulp.task gulpfile.js`

    ```bat
C:\github\vscode>grep gulp.task gulpfile.js
gulp.task('clean-client', util.rimraf('out'));
gulp.task('compile-client', ['clean-client'], compileTask('out', false));
gulp.task('watch-client', ['clean-client'], watchTask('out', false));
gulp.task('clean-client-build', util.rimraf('out-build'));
gulp.task('compile-client-build', ['clean-client-build'], compileTask('out-build', true));
gulp.task('watch-client-build', ['clean-client-build'], watchTask('out-build', true));
gulp.task('default', ['compile']);
gulp.task('clean', ['clean-client', 'clean-extensions']);
gulp.task('compile', ['compile-client', 'compile-extensions']);
gulp.task('watch', ['watch-client', 'watch-extensions']);
gulp.task('clean-build', ['clean-client-build', 'clean-extensions-build']);
gulp.task('compile-build', ['compile-client-build', 'compile-extensions-build']);
gulp.task('watch-build', ['watch-client-build', 'watch-extensions-build']);
gulp.task('test', function () {
gulp.task('mixin', function () {

    C:\github\vscode>.\node_modules\.bin\gulp.cmd clean-build
[11:57:09] Using gulpfile C:\github\vscode\gulpfile.js
[11:57:09] Starting 'clean-client-build'...
[11:57:09] Starting 'clean-extension-build:configuration-editing'...
[11:57:09] Starting 'clean-extension-build:css-client'...
[11:57:09] Starting 'clean-extension-build:css-server'...
[11:57:09] Starting 'clean-extension-build:javascript'...
[11:57:09] Starting 'clean-extension-build:json-client'...
[11:57:09] Starting 'clean-extension-build:json-server'...
[11:57:09] Starting 'clean-extension-build:markdown'...
[11:57:09] Starting 'clean-extension-build:php'...
[11:57:09] Starting 'clean-extension-build:typescript-test-colorize-fixtures'...
[11:57:09] Starting 'clean-extension-build:typescript'...
[11:57:09] Starting 'clean-extension-build:vscode-api-tests'...
[11:57:09] Starting 'clean-extension-build:vscode-colorize-tests'...
[11:57:09] Finished 'clean-client-build' after 10 ms
[11:57:09] Finished 'clean-extension-build:configuration-editing' after 8.36 ms
[11:57:09] Finished 'clean-extension-build:css-client' after 7.88 ms
[11:57:09] Finished 'clean-extension-build:css-server' after 7.54 ms
[11:57:09] Finished 'clean-extension-build:javascript' after 7.6 ms
[11:57:09] Finished 'clean-extension-build:json-client' after 7.69 ms
[11:57:09] Finished 'clean-extension-build:json-server' after 8.41 ms
[11:57:09] Finished 'clean-extension-build:markdown' after 8.7 ms
[11:57:09] Finished 'clean-extension-build:php' after 8.87 ms
[11:57:09] Finished 'clean-extension-build:typescript-test-colorize-fixtures' af
ter 8.69 ms
[11:57:09] Finished 'clean-extension-build:typescript' after 8.6 ms
[11:57:09] Finished 'clean-extension-build:vscode-api-tests' after 8.64 ms
[11:57:09] Finished 'clean-extension-build:vscode-colorize-tests' after 8.72 ms
[11:57:09] Starting 'clean-extensions-build'...
[11:57:09] Finished 'clean-extensions-build' after 6.84 μs
[11:57:09] Starting 'clean-build'...
[11:57:09] Finished 'clean-build' after 9.88 μs

    C:\github\vscode>.\node_modules\.bin\gulp.cmd build
...

    C:\github\vscode>
```