Skip to content

Commit db36521

Browse files
committed
Merge pull request microsoft#4 from Microsoft/addBaseline
Add baselines and CI integration
2 parents 4389931 + dab5b14 commit db36521

17 files changed

+13945
-193
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,7 @@ FakesAssemblies/
189189
# LightSwitch generated files
190190
GeneratedArtifacts/
191191
_Pvt_Extensions/
192-
ModelManifest.xml
192+
ModelManifest.xml
193+
194+
.paket/
195+
.fake/

App.config

Lines changed: 0 additions & 14 deletions
This file was deleted.

AssemblyInfo.fs

Lines changed: 0 additions & 41 deletions
This file was deleted.

Generator.fsproj

Lines changed: 0 additions & 88 deletions
This file was deleted.

Generator.sln

Lines changed: 0 additions & 22 deletions
This file was deleted.

JS.fs renamed to JS.fsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module JS
1+
#load "Shared.fsx"
22

33
open System
44
open System.IO
@@ -691,6 +691,7 @@ let EmitTheWholeThing flavor (target: TextWriter) =
691691

692692
fprintf target "%s" content
693693
target.Flush()
694+
target.Close()
694695

695696
let EmitDomWeb () =
696697
EmitTheWholeThing Flavor.Web GlobalVars.jsWebOutput

Program.fs

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
This tool is used to generate `dom.generated.d.ts` and `webworker.generated.d.ts` for TypeScript, and `domWeb.js` and `domWindows.js` for Visual Studio JavaScript language service. The input file is the XML spec file generated by the Microsoft Edge browser.
33

44
## Build Instruction
5-
**Required Software**: Visual Studio 2015 Community Version (with Visual F# installed)
6-
7-
To build the tool, simply open the `Generator.sln` in Visual Studio and build the solution. A nuget restore should be done automatically before the build.
8-
9-
Press `F5` in Visual Studio to run the tool. If it runs successfully, the output files will be generated under the `generated` folder.
5+
To build the tool, simply clone the repo, and run `build.cmd` in command line or powershell. If it runs successfully, the output files will be generated under the `generated` folder.
106

117
## Code Structure
128
- `Shared.fs`: handles the parsing from XML spec file, and stores the common data structures for later use;
139
- `TS.fs`: handles the emitting of the `lib.d.ts` file;
1410
- `JS.fs`: handles the emitting of the `domWeb.js` and `domWindows.js`
15-
files used for Visual Studio JavaScript language service;
16-
- `Program.fs`: entry point of the tool;
11+
12+
## Contribution Guide
13+
The `dom.generated.d.ts` and `webworker.generated.d.ts` files that are used in TypeScript repo `master` branch are used as baselines. For each pull request, we will try run the script and compare the generated files with the baseline files. So to make the tests passed, please update the baseline and the code at the same pull request.
1714

1815
## Input Files:
1916
- `browser.webidl.xml`: the XML spec file generated by Microsoft Edge (due to the different updating schedules between Edge and TypeScript, this may **not** be the most up-to-date version of the spec.);

Shared.fs renamed to Shared.fsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
module Shared
1+
#r @"packages\FSharp.Data\lib\net40\FSharp.Data.dll"
2+
#r "System.Xml.Linq.dll"
23

34
open FSharp.Data
45
open System.IO
@@ -16,9 +17,9 @@ module GlobalVars =
1617

1718
let inputFolder = __SOURCE_DIRECTORY__ + @"\inputfiles"
1819
let makeTextWriter fileName = File.CreateText(__SOURCE_DIRECTORY__ + @"\generated\" + fileName) :> TextWriter
19-
let jsWebOutput = makeTextWriter "domWeb.js"
20-
let jsWinOutput = makeTextWriter "domWindows.js"
21-
let jsWorkerOutput = makeTextWriter "dedicatedworker.js"
20+
// let jsWebOutput = makeTextWriter "domWeb.js"
21+
// let jsWinOutput = makeTextWriter "domWindows.js"
22+
// let jsWorkerOutput = makeTextWriter "dedicatedworker.js"
2223
let tsWebOutput = makeTextWriter "dom.generated.d.ts"
2324
let tsWorkerOutput = makeTextWriter "webworker.generated.d.ts"
2425
let defaultEventType = "Event"

TS.fs renamed to TS.fsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module TS
1+
#load "Shared.fsx"
22

33
open System
44
open System.Text.RegularExpressions
@@ -578,6 +578,7 @@ let EmitTheWholeThing flavor (target:TextWriter) =
578578

579579
fprintf target "%s" (Pt.getResult())
580580
target.Flush()
581+
target.Close()
581582

582583
let EmitDomWeb () =
583584
EmitTheWholeThing Flavor.All GlobalVars.tsWebOutput

0 commit comments

Comments
 (0)