Skip to content

Commit 68222f0

Browse files
author
Lanny McNie
committed
Updated the build process to use NodeJS & Grunt.js.
Please refer to the readme in the build folder. Signed-off-by: Lanny McNie <lanny@gskinner.com>
1 parent 827e8e7 commit 68222f0

16 files changed

+322
-341
lines changed

VERSIONS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ CRITICAL (may break existing content):
2323
WebAudioPlugin.
2424
- fixed a bug with WebAudioPlugin that stopped SoundInstances from being reusable.
2525
- fixed an issue with EventDispatcher when adding the same listener to an event twice
26+
- Updated the build process to use NodeJS & Grunt.js. Please refer to the readme in the build folder.
2627

2728
Version 0.4.1 [May 10, 2013]
2829
************************************************************************************************************************

build/Build_FlashPlugin_OSX.command

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

build/Build_FlashPlugin_Win.bat

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

build/Build_OSX.command

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

build/Build_Win.bat

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

build/Gruntfile.js

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
var path = require('path');
2+
var _ = require('lodash');
3+
4+
module.exports = function (grunt) {
5+
grunt.initConfig(
6+
{
7+
pkg: grunt.file.readJSON('package.json'),
8+
9+
// Default values
10+
version: 'NEXT',
11+
name: 'soundjs',
12+
docsZip: "<%= pkg.name %>_docs-<%= version %>.zip",
13+
14+
// Setup doc names / paths.
15+
docsName: '<%= pkg.name %>_docs-<%= version %>',
16+
docsZip: "<%= docsName %>.zip",
17+
docsFolder: "./output/<%= docsName %>/",
18+
19+
// Setup Uglify for JS minification.
20+
uglify: {
21+
options: {
22+
banner: grunt.file.read('LICENSE'),
23+
preserveComments: "some",
24+
compress: {
25+
global_defs: {
26+
"DEBUG": false
27+
}
28+
},
29+
},
30+
build: {
31+
files: {
32+
'output/<%= pkg.name.toLowerCase() %>-<%= version %>.min.js': getConfigValue('source'),
33+
'output/flashplugin-<%= version %>.min.js': getConfigValue('flashplugin_source'),
34+
}
35+
}
36+
},
37+
38+
// Build docs using yuidoc
39+
yuidoc: {
40+
compile: {
41+
name: '<%= pkg.name %>',
42+
version: '<%= version %>',
43+
description: '<%= pkg.description %>',
44+
url: '<%= pkg.url %>',
45+
logo: '<%= pkg.logo %>',
46+
options: {
47+
paths: ['../src/'],
48+
outdir: '<%= docsFolder %>',
49+
linkNatives: true,
50+
attributesEmit: true,
51+
selleck: true,
52+
helpers: ["./path.js"],
53+
themedir: "createjsTheme/"
54+
}
55+
}
56+
},
57+
58+
compress: {
59+
build: {
60+
options: {
61+
mode:'zip',
62+
archive:'output/<%= docsZip %>'
63+
},
64+
files: [
65+
{expand:true, src:'**', cwd:'<%= docsFolder %>'}
66+
]
67+
}
68+
},
69+
70+
copy: {
71+
docsZip: {
72+
files: [
73+
{expand:true, cwd:'output/', src:'<%= docsZip %>', dest:'../docs/'}
74+
]
75+
},
76+
docsSite: {
77+
files: [
78+
{expand:true, cwd:'<%= docsFolder %>', src:'**', dest:getConfigValue('docs_out_path')}
79+
]
80+
},
81+
src: {
82+
files: [
83+
{expand: true, cwd:'output/', src: '*.js', dest: '../lib/'}
84+
]
85+
}
86+
},
87+
88+
updateversion: {
89+
build: {
90+
file: '../src/soundjs/version.js',
91+
version: '<%= version %>'
92+
},
93+
}
94+
}
95+
);
96+
97+
function getBuildConfig() {
98+
// Read the global settings file first.
99+
var config = grunt.file.readJSON('config.json');
100+
101+
// If we have a config.local.json .. prefer its values.
102+
if (grunt.file.exists('config.local.json')) {
103+
var config2 = grunt.file.readJSON('config.local.json');
104+
_.extend(config, config2);
105+
}
106+
107+
return config;
108+
}
109+
110+
function getConfigValue(name) {
111+
var config = grunt.config.get('buildConfig');
112+
113+
if (config == null) {
114+
config = getBuildConfig();
115+
grunt.config.set('buildConfig', config);
116+
}
117+
118+
return config[name];
119+
}
120+
121+
// Load all the tasks we need
122+
grunt.loadNpmTasks('grunt-contrib-uglify');
123+
grunt.loadNpmTasks('grunt-contrib-yuidoc');
124+
grunt.loadNpmTasks('grunt-contrib-compress');
125+
grunt.loadNpmTasks('grunt-contrib-copy');
126+
grunt.loadTasks('tasks/');
127+
128+
/**
129+
* Build the docs using YUIdocs.
130+
*/
131+
grunt.registerTask('docs', [
132+
"yuidoc", "compress", "copy:docsZip"
133+
]);
134+
135+
/**
136+
* Sets out version to the version in package.json (defaults to NEXT)
137+
*/
138+
grunt.registerTask('setVersion', function () {
139+
grunt.config.set('version', grunt.config.get('pkg').version);
140+
});
141+
142+
/**
143+
* Task for exporting a next build.
144+
*
145+
*/
146+
grunt.registerTask('next', [
147+
"coreBuild"
148+
]);
149+
150+
/**
151+
* Task for exporting a release build (version based on package.json)
152+
*
153+
*/
154+
grunt.registerTask('build', [
155+
"setVersion", "coreBuild", "copy:docsSite"
156+
]);
157+
158+
/**
159+
* Main build task, always runs after next or build.
160+
*
161+
*/
162+
grunt.registerTask('coreBuild', [
163+
"updateversion", "uglify", "docs", "copy:src"
164+
]);
165+
};
Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
/**
2-
* SoundJS
3-
* Visit http://createjs.com/ for documentation, updates and examples.
4-
*
5-
* Copyright (c) 2011 gskinner.com, inc.
6-
*
7-
* Distributed under the terms of the MIT license.
8-
* http://www.opensource.org/licenses/mit-license.html
9-
*
10-
* This notice shall be included in all copies or substantial portions of the Software.
11-
**/
1+
/*!
2+
* @license <%= pkg.name %>
3+
* Visit http://createjs.com/ for documentation, updates and examples.
4+
*
5+
* Copyright (c) 2011-2013 gskinner.com, inc.
6+
*
7+
* Distributed under the terms of the MIT license.
8+
* http://www.opensource.org/licenses/mit-license.html
9+
*
10+
* This notice shall be included in all copies or substantial portions of the Software.
11+
*/
12+
13+
/**!
14+
* SoundJS FlashPlugin also includes swfobject (http://code.google.com/p/swfobject/)
15+
*/
16+

0 commit comments

Comments
 (0)