Skip to content

Commit 9c46027

Browse files
committed
Working through the new build scripts.
1 parent cbac770 commit 9c46027

7 files changed

Lines changed: 610 additions & 113 deletions

File tree

Gruntfile.js

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = function (grunt) {
88
config: {
99
release_dir: 'build',
1010
compile_dir: 'dist',
11+
modules_dir: 'dist/modules',
1112
docs_dir: 'docs',
1213
banner: require('fs').readFileSync(__dirname + '/tasks/banner.txt', 'utf8')
1314
}
@@ -17,11 +18,94 @@ module.exports = function (grunt) {
1718

1819
grunt.registerTask('default', ['build']);
1920

21+
grunt.registerTask('custom', 'Build a custom version of Phaser', function(arg) {
22+
23+
var modules = {
24+
25+
'keyboard': 'Keyboard Input',
26+
'gamepad': 'Gamepad Input',
27+
'bitmapdata': 'BitmapData',
28+
'graphics': 'Graphics',
29+
'rendertexture': 'RenderTextures',
30+
'text': 'Text Game Object',
31+
'tweens': 'Tween Manager',
32+
'sound': 'Sound Manager',
33+
'particles': 'Particle System',
34+
'debug': 'Debug System',
35+
'tilemap': 'Tilemaps',
36+
'arcade': 'Arcade Physics',
37+
'p2': 'P2 Physics',
38+
'nophysics': 'Exclude all physics systems, tilemaps and particles'
39+
40+
};
41+
42+
var autoExclude = {
43+
44+
'retrofont': 'RetroFont Game Object',
45+
'ninja': 'Ninja Physics'
46+
47+
}
48+
49+
grunt.log.writeln("----------------------------");
50+
grunt.log.writeln("Building Phaser " + grunt.config.get('package.version') + '-custom');
51+
grunt.log.writeln("----------------------------");
52+
53+
if (!grunt.option('exclude'))
54+
{
55+
grunt.log.errorlns("No custom build options were specified.");
56+
57+
grunt.log.writeln("\nUse --exclude to select which of the following modules to exclude:\n");
58+
59+
for (var key in modules)
60+
{
61+
grunt.log.writeln(key + ' - ' + modules[key]);
62+
}
63+
64+
grunt.log.writeln("\nThe following are excluded automatically. Use --include to include them:\n");
65+
66+
for (var key in autoExclude)
67+
{
68+
grunt.log.writeln(key + ' - ' + autoExclude[key]);
69+
}
70+
71+
grunt.log.writeln("\nFor example: --exclude p2,tilemap --include retrofont\n");
72+
73+
grunt.log.writeln("Note that some modules have dependencies on others.");
74+
}
75+
else
76+
{
77+
grunt.log.writeln("Excluding modules:\n");
78+
79+
var excludes = grunt.option('exclude').split(',');
80+
81+
for (var i = 0; i < excludes.length; i++)
82+
{
83+
if (modules[excludes[i]])
84+
{
85+
grunt.log.writeln("* " + excludes[i] + ' - ' + modules[excludes[i]]);
86+
}
87+
else
88+
{
89+
grunt.fail.fatal("Unknown module '" + excludes[i] + "'");
90+
}
91+
}
92+
93+
grunt.log.writeln("Building blah blah:\n");
94+
95+
}
96+
97+
98+
99+
100+
});
101+
102+
grunt.registerTask('test', ['clean:dist', 'concat', 'uglify']);
103+
20104
grunt.registerTask('build', ['clean:dist', 'jshint', 'concat', 'uglify']);
21105

22106
grunt.registerTask('dist', ['replace:pixi', 'replace:p2', 'build', 'copy']);
23107

24-
grunt.registerTask('docs', [ 'clean:docs', 'pixidoc', 'jsdoc:html', 'replace:docs', 'clean:out']);
108+
grunt.registerTask('docs', ['clean:docs', 'pixidoc', 'jsdoc:html', 'replace:docs', 'clean:out']);
25109

26110
grunt.registerTask('tsdocs', ['clean:out', 'pixidoc', 'gitclone:plugins', 'jsdoc:json', 'buildtsdoc:pixi', 'buildtsdoc:phaser', 'replace:phasertsdefheader', 'clean:out']);
27111
};

0 commit comments

Comments
 (0)