More grunt work. Nearly there.

This commit is contained in:
photonstorm 2015-02-19 06:03:42 +00:00
parent 9c46027340
commit f34088458d
14 changed files with 212 additions and 194 deletions

View file

@ -24,36 +24,28 @@ module.exports = function (grunt) {
'keyboard': 'Keyboard Input',
'gamepad': 'Gamepad Input',
'graphics': 'Graphics Game Object',
'text': 'Text and BitmapText Game Objects',
'retrofont': 'RetroFont Game Object',
'bitmapdata': 'BitmapData',
'graphics': 'Graphics',
'rendertexture': 'RenderTextures',
'text': 'Text Game Object',
'tweens': 'Tween Manager',
'sound': 'Sound Manager',
'tweens': 'Tween System',
'sound': 'Sound System',
'particles': 'Particle System',
'debug': 'Debug System',
'tilemap': 'Tilemaps',
'tilemap': 'Tilemap Support',
'arcade': 'Arcade Physics',
'p2': 'P2 Physics',
'nophysics': 'Exclude all physics systems, tilemaps and particles'
'ninja': 'Ninja Physics',
'p2': 'P2 Physics'
};
var autoExclude = {
'retrofont': 'RetroFont Game Object',
'ninja': 'Ninja Physics'
}
grunt.log.writeln("----------------------------");
grunt.log.writeln("Building Phaser " + grunt.config.get('package.version') + '-custom');
grunt.log.writeln("----------------------------");
if (!grunt.option('exclude'))
{
grunt.log.errorlns("No custom build options were specified.");
grunt.log.writeln("\nUse --exclude to select which of the following modules to exclude:\n");
for (var key in modules)
@ -61,16 +53,11 @@ module.exports = function (grunt) {
grunt.log.writeln(key + ' - ' + modules[key]);
}
grunt.log.writeln("\nThe following are excluded automatically. Use --include to include them:\n");
grunt.log.writeln("\nFor example: --exclude p2,tilemap,retrofont\n");
for (var key in autoExclude)
{
grunt.log.writeln(key + ' - ' + autoExclude[key]);
}
grunt.log.writeln("Note that some modules have dependencies on others.\n");
grunt.log.writeln("\nFor example: --exclude p2,tilemap --include retrofont\n");
grunt.log.writeln("Note that some modules have dependencies on others.");
grunt.fail.fatal("No build options were specified.");
}
else
{
@ -78,11 +65,18 @@ module.exports = function (grunt) {
var excludes = grunt.option('exclude').split(',');
for (var key in modules)
{
grunt.config.set(['custom', key], true);
}
for (var i = 0; i < excludes.length; i++)
{
if (modules[excludes[i]])
{
// It's a valid module
grunt.log.writeln("* " + excludes[i] + ' - ' + modules[excludes[i]]);
grunt.config.set(['custom', excludes[i]], false);
}
else
{
@ -90,13 +84,139 @@ module.exports = function (grunt) {
}
}
grunt.log.writeln("Building blah blah:\n");
grunt.log.writeln("\nBuilding ...:\n");
// Clean the dist folder
var tasks = [ 'clean:dist' ];
// Concat the module files
for (var key in modules)
{
if (grunt.config.get(['custom', key]))
{
tasks.push('concat:' + key);
}
}
// Concat all the modules together into a single custom build
var filelist = [];
filelist.push('<%= concat.intro.dest %>');
filelist.push('<%= concat.geom.dest %>');
filelist.push('<%= concat.core.dest %>');
filelist.push('<%= concat.input.dest %>');
if (grunt.config.get('custom.keyboard'))
{
filelist.push('<%= concat.keyboard.dest %>');
}
if (grunt.config.get('custom.gamepad'))
{
filelist.push('<%= concat.gamepad.dest %>');
}
filelist.push('<%= concat.components.dest %>');
filelist.push('<%= concat.gameobjects.dest %>');
if (grunt.config.get('custom.bitmapdata'))
{
filelist.push('<%= concat.bitmapdata.dest %>');
}
if (grunt.config.get('custom.graphics'))
{
filelist.push('<%= concat.graphics.dest %>');
}
if (grunt.config.get('custom.rendertexture'))
{
filelist.push('<%= concat.rendertexture.dest %>');
}
if (grunt.config.get('custom.text'))
{
filelist.push('<%= concat.text.dest %>');
}
if (grunt.config.get('custom.bitmaptext'))
{
filelist.push('<%= concat.bitmaptext.dest %>');
}
if (grunt.config.get('custom.retrofont'))
{
filelist.push('<%= concat.retrofont.dest %>');
}
filelist.push('<%= concat.system.dest %>');
filelist.push('<%= concat.math.dest %>');
filelist.push('<%= concat.net.dest %>');
if (grunt.config.get('custom.tweens'))
{
filelist.push('<%= concat.tweens.dest %>');
}
else
{
// TweenManager stub
}
filelist.push('<%= concat.time.dest %>');
filelist.push('<%= concat.animation.dest %>');
filelist.push('<%= concat.loader.dest %>');
if (grunt.config.get('custom.sound'))
{
filelist.push('<%= concat.sound.dest %>');
}
else
{
// SoundManager stub
}
if (grunt.config.get('custom.debug'))
{
filelist.push('<%= concat.debug.dest %>');
}
filelist.push('<%= concat.utils.dest %>');
filelist.push('<%= concat.physics.dest %>');
if (grunt.config.get('custom.particles'))
{
filelist.push('<%= concat.particles.dest %>');
}
if (grunt.config.get('custom.tilemap'))
{
filelist.push('<%= concat.tilemap.dest %>');
}
if (grunt.config.get('custom.arcade'))
{
filelist.push('<%= concat.arcade.dest %>');
}
// + arcade tmap col
if (grunt.config.get('custom.p2'))
{
filelist.push('<%= concat.p2.dest %>');
}
if (grunt.config.get('custom.ninja'))
{
filelist.push('<%= concat.ninja.dest %>');
}
tasks.push('concat:custom');
tasks.push('uglify:custom');
grunt.task.run(tasks);
}
});
grunt.registerTask('test', ['clean:dist', 'concat', 'uglify']);

View file

@ -215,6 +215,14 @@ EOL;
{
echo <<<EOL
<script src="$path/src/gameobjects/Text.js"></script>
EOL;
}
if ($bitmaptext)
{
echo <<<EOL
<script src="$path/src/gameobjects/BitmapText.js"></script>

View file

@ -0,0 +1,3 @@
[
"src/gameobjects/BitmapData.js"
]

View file

@ -1,4 +1,3 @@
[
"src/gameobjects/Text.js",
"src/gameobjects/BitmapText.js"
]

View file

@ -1,5 +0,0 @@
[
"src/gameobjects/BitmapData.js",
"src/gameobjects/Graphics.js",
"src/gameobjects/RenderTexture.js"
]

View file

@ -0,0 +1,3 @@
[
"src/gameobjects/Graphics.js"
]

View file

@ -0,0 +1,3 @@
[
"src/gameobjects/RenderTexture.js"
]

View file

@ -0,0 +1,3 @@
[
"src/gameobjects/Text.js"
]

View file

@ -17,24 +17,39 @@ module.exports = {
// Game Objects
display: {
src: require('../manifests/gameobjects.display'),
dest: '<%= modules_dir %>/gameobjects.display.js'
gameobjects: {
src: require('../manifests/gameobjects'),
dest: '<%= modules_dir %>/gameobjects.js'
},
retrofont: {
src: require('../manifests/gameobjects.retrofont'),
dest: '<%= modules_dir %>/gameobjects.retrofont.js'
bitmapdata: {
src: require('../manifests/bitmapdata'),
dest: '<%= modules_dir %>/bitmapdata.js'
},
graphics: {
src: require('../manifests/graphics'),
dest: '<%= modules_dir %>/graphics.js'
},
rendertexture: {
src: require('../manifests/rendertexture'),
dest: '<%= modules_dir %>/rendertexture.js'
},
bitmaptext: {
src: require('../manifests/bitmaptext'),
dest: '<%= modules_dir %>/bitmaptext.js'
},
text: {
src: require('../manifests/gameobjects.text'),
dest: '<%= modules_dir %>/gameobjects.text.js'
src: require('../manifests/text'),
dest: '<%= modules_dir %>/text.js'
},
textures: {
src: require('../manifests/gameobjects.textures'),
dest: '<%= modules_dir %>/gameobjects.textures.js'
retrofont: {
src: require('../manifests/retrofont'),
dest: '<%= modules_dir %>/retrofont.js'
},
geom: {
@ -50,13 +65,13 @@ module.exports = {
},
gamepad: {
src: require('../manifests/input.gamepad'),
dest: '<%= modules_dir %>/input.gamepad.js'
src: require('../manifests/gamepad'),
dest: '<%= modules_dir %>/gamepad.js'
},
keyboard: {
src: require('../manifests/input.keyboard'),
dest: '<%= modules_dir %>/input.keyboard.js'
src: require('../manifests/keyboard'),
dest: '<%= modules_dir %>/keyboard.js'
},
intro: {
@ -151,6 +166,14 @@ module.exports = {
dest: '<%= modules_dir %>/utils.js'
},
custom: {
options: {
banner: '<%= banner %>'
},
src: grunt.config.get('custom.filelist'),
dest: '<%= compile_dir %>/phaser-custom.js'
},
/*
// Phaser without Pixi, P2 or Ninja Physics (does include Arcade Physics)

View file

@ -1,154 +1,15 @@
module.exports = {
custom: {
options: {
banner: '/* Phaser (custom) v<%= package.version %> - http://phaser.io - @photonstorm - (c) 2014 Photon Storm Ltd. */\n'
},
/*
animation: {
src: ['<%= concat.animation.dest %>'],
dest: '<%= compile_dir %>/animation.min.js'
},
src: ['<%= concat.custom.dest %>'],
dest: '<%= compile_dir %>/phaser-custom.min.js'
components: {
src: ['<%= concat.components.dest %>'],
dest: '<%= compile_dir %>/components.min.js'
},
core: {
src: ['<%= concat.core.dest %>'],
dest: '<%= compile_dir %>/core.min.js'
},
display: {
src: ['<%= concat.display.dest %>'],
dest: '<%= compile_dir %>/gameobjects.display.min.js'
},
retrofont: {
src: ['<%= concat.retrofont.dest %>'],
dest: '<%= compile_dir %>/gameobjects.retrofont.min.js'
},
text: {
src: ['<%= concat.text.dest %>'],
dest: '<%= compile_dir %>/gameobjects.text.min.js'
},
textures: {
src: ['<%= concat.textures.dest %>'],
dest: '<%= compile_dir %>/gameobjects.textures.min.js'
},
geom: {
src: ['<%= concat.geom.dest %>'],
dest: '<%= compile_dir %>/geom.min.js'
},
input: {
src: ['<%= concat.input.dest %>'],
dest: '<%= compile_dir %>/input.min.js'
},
gamepad: {
src: ['<%= concat.gamepad.dest %>'],
dest: '<%= compile_dir %>/input.gamepad.min.js'
},
keyboard: {
src: ['<%= concat.keyboard.dest %>'],
dest: '<%= compile_dir %>/input.keyboard.min.js'
},
intro: {
src: ['<%= concat.intro.dest %>'],
dest: '<%= compile_dir %>/intro.min.js'
},
loader: {
src: ['<%= concat.loader.dest %>'],
dest: '<%= compile_dir %>/loader.min.js'
},
math: {
src: ['<%= concat.math.dest %>'],
dest: '<%= compile_dir %>/math.min.js'
},
net: {
src: ['<%= concat.net.dest %>'],
dest: '<%= compile_dir %>/net.min.js'
},
outro: {
src: ['<%= concat.outro.dest %>'],
dest: '<%= compile_dir %>/outro.min.js'
},
particles: {
src: ['<%= concat.particles.dest %>'],
dest: '<%= compile_dir %>/particles.min.js'
},
physics: {
src: ['<%= concat.physics.dest %>'],
dest: '<%= compile_dir %>/physics.min.js'
},
arcadeNoTilemap: {
src: ['<%= concat.arcadeNoTilemap.dest %>'],
dest: '<%= compile_dir %>/physics.arcade.no-tilemap.min.js'
},
arcade: {
src: ['<%= concat.arcade.dest %>'],
dest: '<%= compile_dir %>/physics.arcade.tilemap.min.js'
},
ninja: {
src: ['<%= concat.ninja.dest %>'],
dest: '<%= compile_dir %>/physics.ninja.min.js'
},
p2: {
src: ['<%= concat.p2.dest %>'],
dest: '<%= compile_dir %>/physics.p2.min.js'
},
pixi: {
src: ['<%= concat.pixi.dest %>'],
dest: '<%= compile_dir %>/pixi.min.js'
},
sound: {
src: ['<%= concat.sound.dest %>'],
dest: '<%= compile_dir %>/sound.min.js'
},
system: {
src: ['<%= concat.system.dest %>'],
dest: '<%= compile_dir %>/system.min.js'
},
tilemaps: {
src: ['<%= concat.tilemaps.dest %>'],
dest: '<%= compile_dir %>/tilemaps.min.js'
},
time: {
src: ['<%= concat.time.dest %>'],
dest: '<%= compile_dir %>/time.min.js'
},
tweens: {
src: ['<%= concat.tweens.dest %>'],
dest: '<%= compile_dir %>/tweens.min.js'
},
utils: {
src: ['<%= concat.utils.dest %>'],
dest: '<%= compile_dir %>/utils.min.js'
}
*/
};