Skip to content

Commit 98b5386

Browse files
committed
Added travis build config and js
1 parent f889a7f commit 98b5386

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: node_js
2+
node_js:
3+
- "0.10"
4+
before_script:
5+
- npm install -g flex-sdk
6+

package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "Scratch",
3+
"description": "Open source version of the Scratch 2.0 project editor.",
4+
"version": "1.0.0",
5+
"homepage": "http://scratch.mit.edu/",
6+
"main": "./lib/serious-calculations",
7+
"license": "GPL-2.0",
8+
"repository": {
9+
"type": "git",
10+
"url": "git://github.com/LLK/scratch-flash.git"
11+
},
12+
"scripts": {
13+
"test": "node tests/build.js"
14+
},
15+
"engines": {
16+
"node": ">= 0.10"
17+
},
18+
"dependencies": {},
19+
"devDependencies": {
20+
"flex-sdk": "4.6.0-0"
21+
}
22+
}
23+

tests/build.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
var childProcess = require('child_process');
2+
var path = require('path');
3+
var flexSdk = require('flex-sdk');
4+
var binPath = flexSdk.bin.mxmlc;
5+
6+
// Source locations for Scratch and the 3D rendering library
7+
var proj_dir = path.normalize(path.join(__dirname, '..'))
8+
var src_dir = path.join(proj_dir, 'src');
9+
var src_dir_3d = path.join(proj_dir, '3d_render_src');
10+
11+
// Where to find libraries to link into Scratch
12+
var libs_dir = path.join(proj_dir, 'libs');
13+
14+
// Where to put the built SWF
15+
var deploy_dir = path.join(proj_dir, 'bin');
16+
17+
// Build the 3D code
18+
compile(path.join(src_dir_3d, 'DisplayObjectContainerIn3D.as'),
19+
path.join(libs_dir, 'RenderIn3D.swf'),
20+
function(err, stdout, stderr) {
21+
if (err) {
22+
console.log(err);
23+
process.exit(1);
24+
} else {
25+
// Build Scratch
26+
compile(path.join(src_dir, 'Scratch.as'),
27+
path.join(deploy_dir, 'Scratch.swf'),
28+
function(err, stdout, stderr) {
29+
if (err) {
30+
console.log(err);
31+
process.exit(1);
32+
} else {
33+
process.exit(0);
34+
}
35+
},
36+
[path.join(libs_dir, 'blooddy_crypto.swc')]
37+
);
38+
}
39+
}
40+
);
41+
42+
function compile(src, dest, callback, lib_paths) {
43+
var args = [
44+
'-output', dest,
45+
'-target-player=11.4',
46+
'-swf-version=17',
47+
'-debug=false'
48+
];
49+
50+
if(lib_paths) {
51+
lib_paths.forEach(function(lib_path){
52+
args.push('-library-path+='+lib_path);
53+
});
54+
}
55+
56+
args.push(src);
57+
childProcess.execFile(binPath, args, callback);
58+
}

0 commit comments

Comments
 (0)