This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
192 lines (184 loc) · 6.44 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
var gulp = require("gulp");
var ts = require("gulp-typescript");
var jasmine = require("gulp-jasmine");
var del = require("del");
var minimist = require("minimist");
var child_process = require("child_process");
var rimraf = require("rimraf");
var fs = require("fs");
var path = require("path");
gulp.task("clean-tests", function()
{
return del(
[
"spec/bin"
]);
});
gulp.task("clean", function()
{
return del(
[
"bin/*.js"
]);
});
gulp.task("build-tests", ["build", "clean-tests"], function()
{
var tsProject = ts.createProject("spec/tsconfig.json");
return gulp.src(
[
"source/*.ts",
"spec/as3/*.ts",
"spec/parser/*.ts",
])
.pipe(tsProject())
.pipe(gulp.dest("spec/bin"));
});
gulp.task("build", ["clean"], function()
{
var tsProject = ts.createProject("tsconfig.json");
return gulp.src("source/*.ts")
.pipe(tsProject())
.pipe(gulp.dest("bin"));
});
gulp.task("test", ["build-tests"], function()
{
return gulp.src("spec/bin/*-spec.js")
.pipe(jasmine(
{
//includeStackTrace: true
}));
});
//tests dts2as with a selection of libraries from DefinitelyTyped.
//https://github.com/DefinitelyTyped/DefinitelyTyped
//successful execution of this task is no guarantee that the generated output
//is correct. it simply ensures that the generated output will compile.
//usage: gulp test-definitely-typed --flexHome <Path to Apache FlexJS SDK>
gulp.task("test-definitely-typed", ["build"], function(callback)
{
var libraries =
[
[ "node_modules/typescript/lib/lib.d.ts" ],
[ "node_modules/typescript/lib/lib.es2015.d.ts" ],
[ "node_modules/typescript/lib/lib.es2016.d.ts" ],
[ "node_modules/typescript/lib/lib.es2017.d.ts" ],
//[ "node_modules/typescript/lib/typescript.d.ts" ],
//[ "node_modules/typescript/lib/typescriptServices.d.ts" ],
["../../DefinitelyTyped/types/amcharts/index.d.ts"],
["../../DefinitelyTyped/types/angular/index.d.ts"],
["../../DefinitelyTyped/types/backbone/index.d.ts"],
["../../DefinitelyTyped/types/bluebird/index.d.ts"],
["../../DefinitelyTyped/types/bootstrap/index.d.ts"],
["../../DefinitelyTyped/types/box2d/index.d.ts"],
["../../DefinitelyTyped/types/chalk/index.d.ts"],
["../../DefinitelyTyped/types/chartjs/index.d.ts"],
["../../DefinitelyTyped/types/chrome/index.d.ts"],
["../../DefinitelyTyped/types/colors/index.d.ts"],
[
"../../DefinitelyTyped/types/createjs-lib/index.d.ts",
"../../DefinitelyTyped/types/tweenjs/index.d.ts",
"../../DefinitelyTyped/types/soundjs/index.d.ts",
"../../DefinitelyTyped/types/easeljs/index.d.ts",
"../../DefinitelyTyped/types/preloadjs/index.d.ts",
],
["../../DefinitelyTyped/types/d3/index.d.ts"],
["../../DefinitelyTyped/types/dropboxjs/index.d.ts"],
["../../DefinitelyTyped/types/emscripten/index.d.ts"],
["../../DefinitelyTyped/types/facebook-js-sdk/index.d.ts"],
["../../DefinitelyTyped/types/fb/index.d.ts"],
["../../DefinitelyTyped/types/firebase/index.d.ts"],
["../../DefinitelyTyped/types/foundation/index.d.ts"],
["../../DefinitelyTyped/types/gapi/index.d.ts"],
["../../DefinitelyTyped/types/google.analytics/index.d.ts"],
["../../DefinitelyTyped/types/googlemaps/index.d.ts"],
["../../DefinitelyTyped/types/gsap/index.d.ts"],
["../../DefinitelyTyped/types/gulp/index.d.ts"],
["../../DefinitelyTyped/types/handlebars/index.d.ts"],
["../../DefinitelyTyped/types/history/index.d.ts"],
["../../DefinitelyTyped/types/humane/index.d.ts"],
["../../DefinitelyTyped/types/ionic/index.d.ts"],
["../../DefinitelyTyped/types/jade/index.d.ts"],
[
//jquery mobile modifies jquery types, so they must be
//compiled together
"../../DefinitelyTyped/types/jquery/index.d.ts",
"../../DefinitelyTyped/types/jquerymobile/index.d.ts",
],
["../../DefinitelyTyped/types/jquery/index.d.ts"],
[
//jquery ui modifies jquery types, so they must be
//compiled together
"../../DefinitelyTyped/types/jquery/index.d.ts",
"../../DefinitelyTyped/types/jqueryui/index.d.ts"
],
["../../DefinitelyTyped/types/jsen/index.d.ts"],
["../../DefinitelyTyped/types/json5/index.d.ts"],
["../../DefinitelyTyped/types/knockout/index.d.ts"],
["../../DefinitelyTyped/types/less/index.d.ts"],
["../../DefinitelyTyped/types/marked/index.d.ts"],
["../../DefinitelyTyped/types/material-design-lite/index.d.ts"],
["../../DefinitelyTyped/types/mithril/index.d.ts"],
["../../DefinitelyTyped/types/mkdirp/index.d.ts"],
["../../DefinitelyTyped/types/mocha/index.d.ts"],
["../../DefinitelyTyped/types/minimist/index.d.ts"],
["../../DefinitelyTyped/types/mustache/index.d.ts"],
//["../../DefinitelyTyped/types/node/index.d.ts"],
["../../DefinitelyTyped/types/nunjucks/index.d.ts"],
["../../DefinitelyTyped/types/optimist/index.d.ts"],
["../../DefinitelyTyped/types/page/index.d.ts"],
["../../DefinitelyTyped/types/pdfjs-dist/index.d.ts"],
["../../DefinitelyTyped/types/pixi.js/index.d.ts"],
["../../DefinitelyTyped/types/polymer/index.d.ts"],
["../../DefinitelyTyped/types/pug/index.d.ts"],
["../../DefinitelyTyped/types/qunit/index.d.ts"],
["../../DefinitelyTyped/types/rimraf/index.d.ts"],
["../../DefinitelyTyped/types/sizzle/index.d.ts"],
["../../DefinitelyTyped/types/source-map/index.d.ts"],
["../../DefinitelyTyped/types/swfobject/index.d.ts"],
["../../DefinitelyTyped/types/twitter/index.d.ts"],
["../../DefinitelyTyped/types/underscore/index.d.ts"],
["../../DefinitelyTyped/types/yargs/index.d.ts"],
["../../DefinitelyTyped/types/yosay/index.d.ts"],
["../../DefinitelyTyped/types/youtube/index.d.ts"],
["../../DefinitelyTyped/types/yui/index.d.ts"],
["../../DefinitelyTyped/types/zynga-scroller/index.d.ts"],
];
(function next()
{
var files = libraries.pop();
run_dts2as(files, function(error)
{
if(error)
{
return callback(error);
}
if(libraries.length === 0)
{
return callback();
}
setImmediate(next);
});
})();
});
function run_dts2as(files, callback)
{
var params = minimist(process.argv.slice(2));
var flexHome = params["flexHome"];
if(!fs.existsSync(flexHome))
{
console.error("Apache FlexJS SDK not found: " + flexHome);
process.exit(1);
}
console.info(files.join(" "));
child_process.exec("node " + path.join("bin", "cli.js") + " --flexHome " + flexHome + " --target Latest --debug 1 --outDir dts2astests_temp --outSWC " + path.join("dts2astests_temp", "test.swc") + " " + files.join(" "),
{},
function(error, stdout, stderr)
{
rimraf.sync("dts2astests_temp");
if (error !== null)
{
return callback(error);
}
callback();
});
}
gulp.task("default", ["build"]);