Merge pull request #195 from sclements/master

Add configuration and a script to auto-build with travis-ci
This commit is contained in:
Shane M. Clements 2014-05-15 10:11:29 -06:00
commit b337bd20f8
3 changed files with 89 additions and 0 deletions

8
.travis.yml Normal file
View file

@ -0,0 +1,8 @@
language: node_js
node_js:
- "0.10"
cache:
directories:
- node_modules
before_script:
- npm install flex-sdk

23
package.json Normal file
View file

@ -0,0 +1,23 @@
{
"name": "Scratch",
"description": "Open source version of the Scratch 2.0 project editor.",
"version": "1.0.0",
"homepage": "http://scratch.mit.edu/",
"main": "scratch-flash",
"license": "GPL-2.0",
"repository": {
"type": "git",
"url": "git://github.com/LLK/scratch-flash.git"
},
"scripts": {
"test": "node tests/build.js"
},
"engines": {
"node": ">= 0.10"
},
"dependencies": {},
"devDependencies": {
"flex-sdk": "4.6.0-0"
}
}

58
tests/build.js Normal file
View file

@ -0,0 +1,58 @@
var childProcess = require('child_process');
var path = require('path');
var flexSdk = require('flex-sdk');
var binPath = flexSdk.bin.mxmlc;
// Source locations for Scratch and the 3D rendering library
var proj_dir = path.normalize(path.join(__dirname, '..'))
var src_dir = path.join(proj_dir, 'src');
var src_dir_3d = path.join(proj_dir, '3d_render_src');
// Where to find libraries to link into Scratch
var libs_dir = path.join(proj_dir, 'libs');
// Where to put the built SWF
var deploy_dir = path.join(proj_dir, 'bin');
// Build the 3D code
compile(path.join(src_dir_3d, 'DisplayObjectContainerIn3D.as'),
path.join(libs_dir, 'RenderIn3D.swf'),
function(err, stdout, stderr) {
if (err) {
console.log(err);
process.exit(1);
} else {
// Build Scratch
compile(path.join(src_dir, 'Scratch.as'),
path.join(deploy_dir, 'Scratch.swf'),
function(err, stdout, stderr) {
if (err) {
console.log(err);
process.exit(1);
} else {
process.exit(0);
}
},
[path.join(libs_dir, 'blooddy_crypto.swc')]
);
}
}
);
function compile(src, dest, callback, lib_paths) {
var args = [
'-output', dest,
'-target-player=11.4',
'-swf-version=17',
'-debug=false'
];
if(lib_paths) {
lib_paths.forEach(function(lib_path){
args.push('-library-path+='+lib_path);
});
}
args.push(src);
childProcess.execFile(binPath, args, callback);
}