Skip to content

Commit 6136448

Browse files
committed
Merge branch 'snow-dev'
2 parents fb71877 + 93cf5bd commit 6136448

File tree

34 files changed

+146
-576
lines changed

34 files changed

+146
-576
lines changed

src/flow/cmd/build/build.cpp.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ exports.ios_combine_archs = function(flow, done) {
4444
'-create'];
4545

4646
var input_list = archs.map(function(a){
47-
return flow.project.get_path_binary_dest_full(flow, flow.project.prepared, a);
47+
var binary_source = flow.project.get_path_binary_name_source(flow, flow.project.prepared, a);
48+
var source_path = util.normalize(path.join(flow.project.paths.build, 'cpp/' + binary_source));
49+
return source_path;
4850
});
4951

5052
args = args.concat(input_list);
@@ -82,12 +84,14 @@ internal.post_build_mobile = function(flow, done) {
8284

8385
//runs ant, and such
8486
internal.build_android = function(flow, done) {
87+
done();
88+
}
8589

86-
87-
flow.log(2, 'android specifics', flow.project.prepared.source.project.app.mobile.android);
90+
internal.build_androidold = function(flow, done) {
8891

8992
//handle ability to compile store build, vs debug test build
90-
var build_type = flow.project.prepared.source.project.app.mobile.android.build_type;
93+
// var build_type = flow.project.prepared.source.project.app.mobile.android.build_type;
94+
var build_type = flow.flags['android-build-type'] || 'debug';
9195

9296
//where to build from
9397
var project_root = path.join(flow.project.paths.build, flow.config.build.android.project);
@@ -192,11 +196,13 @@ internal.post_build_desktop = function(flow, done) {
192196

193197
internal.move_binary = function(flow, target_arch) {
194198

199+
if(flow.target == 'ios') return;
200+
195201
target_arch = target_arch || flow.target_arch;
196202

197203
var binary_source = flow.project.get_path_binary_name_source(flow, flow.project.prepared, target_arch);
198-
var binary_dest_full = flow.project.get_path_binary_dest_full(flow, flow.project.prepared, target_arch);
199204
var source_path = util.normalize(path.join(flow.project.paths.build, 'cpp/' + binary_source));
205+
var binary_dest_full = flow.project.get_path_binary_dest_full(flow, flow.project.prepared, target_arch);
200206

201207
flow.log(3,'build - moving binary for %s from %s to %s', target_arch, source_path, binary_dest_full);
202208

@@ -377,6 +383,7 @@ exports.build_hxcpp = function(flow, target_arch, run_path, hxcpp_file, done) {
377383
}
378384

379385
args.push('-D' + flow.target);
386+
args.push('-DHAXE_OUTPUT_PART=' + flow.project.prepared.source.project.app.name);
380387

381388
switch(target_arch) {
382389
case '32':
@@ -419,10 +426,6 @@ exports.build_hxcpp = function(flow, target_arch, run_path, hxcpp_file, done) {
419426
args.push('-DHXCPP_CLANG');
420427
}
421428

422-
if(flow.target == 'android') {
423-
args.push('-Dandroid-' + flow.project.parsed.project.app.mobile.android.sdk_target);
424-
}
425-
426429
//append command line + project based flags
427430
args = util.array_union(args, flow.project.prepared.hxcpp.flags);
428431

src/flow/cmd/files/files.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,18 @@ internal.copy_files = function(flow, files, output, no_copy) {
211211

212212
} //copy_project_files
213213

214+
exports.template_path = function(flow, template, source, dest) {
215+
216+
if(fs.statSync(source).isDirectory()) {
217+
var _node = {source:source, template:template, source_name:'ext'};
218+
return internal.template_folder_recursively(flow, _node, dest);
219+
} else {
220+
internal.template_file(flow, template, source, dest);
221+
return [ dest ];
222+
}
223+
224+
} //template_path
225+
214226
internal.template_path = function(flow, node, dest) {
215227

216228
if(fs.statSync(node.source).isDirectory()) {
@@ -251,6 +263,9 @@ internal.template_folder_recursively = function(flow, node, _dest, _overwrite) {
251263
if(allow) {
252264
_source_file_list.push(_source_list[i]);
253265
}
266+
} else {
267+
var _dest_dir = path.join( _dest, _source_list[i] );
268+
wrench.mkdirSyncRecursive(_dest_dir, 0755);
254269
}
255270
}
256271

@@ -310,10 +325,19 @@ internal.template_file = function(flow, _template, _source, _dest) {
310325
flow.log(6, 'context for file node : ', _source, file_context);
311326

312327
var template = bars.compile(raw_file);
313-
var templated = template( file_context );
328+
var templated = false;
314329

315-
fse.ensureFileSync(_dest);
316-
fs.writeFileSync(_dest, templated, 'utf8');
330+
try {
331+
templated = template( file_context );
332+
} catch(err) {
333+
flow.log(3, ' - NOTE cannot template file (binary?), copying as is', _source);
334+
util.copy_path(flow, _source, _dest);
335+
}
336+
337+
if(templated !== false) {
338+
fse.ensureFileSync(_dest);
339+
fs.writeFileSync(_dest, templated, 'utf8');
340+
}
317341

318342
} //template_file
319343

src/flow/cmd/hooks/hooks.js

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
var cmd = require('../../util/process')
1616
, util = require('../../util/util')
17+
, files = require('../files/files')
1718

1819
var internal = {};
1920

@@ -127,8 +128,18 @@ internal.get_hook_flow = function(flow, stage, _name, hook) {
127128
target_js : Boolean(flow.target_js),
128129
target_desktop : Boolean(flow.target_desktop),
129130
target_mobile : Boolean(flow.target_mobile),
130-
project : util.deep_copy(flow.project.prepared.source),
131131
log_level : Number(flow.log_level),
132+
util : util,
133+
files : {
134+
template_path: function(template, source, dest){
135+
files.template_path(flow, template, source, dest)
136+
}
137+
},
138+
project : {
139+
source: util.deep_copy(flow.project.prepared.source),
140+
paths: util.deep_copy(flow.project.paths),
141+
root: String(flow.project.root)
142+
},
132143
log : function(){
133144
var args = Array.prototype.slice.call(arguments,0);
134145
flow.log.apply(flow,args);
@@ -141,11 +152,12 @@ internal.run_hook = function(flow, stage, _name, hook, done) {
141152

142153
var hook_file = path.join(hook.__path, hook.script);
143154

144-
flow.log(2, 'hooks - running hook from %s in %s', _name, hook.__path);
145-
flow.log(2, 'hooks - running %s hook named `%s` from %s', stage, hook.name, hook.script);
155+
flow.log(3, 'hooks - running hook from %s in %s', _name, hook.__path);
156+
flow.log(3, 'hooks - running %s hook `%s` from %s', stage, hook.name, hook.script);
146157
flow.log(3, 'hooks - desc : %s', hook.desc || 'no description');
147158

148159
var fail = function(e) {
160+
149161
if(hook.require_success) {
150162
flow.project.failed = true;
151163
}
@@ -155,6 +167,7 @@ internal.run_hook = function(flow, stage, _name, hook, done) {
155167
if(done) {
156168
done(e);
157169
}
170+
158171
} //fail
159172

160173
var hook_script;
@@ -170,18 +183,28 @@ internal.run_hook = function(flow, stage, _name, hook, done) {
170183
var hook_flow = internal.get_hook_flow(flow, stage, _name, hook);
171184

172185
var s = hook_script.hook.toString();
173-
if(s.indexOf('done()') == -1) {
186+
if(s.indexOf('done(') == -1) {
174187
return fail('hook script is missing a done(); call. This will stall! fix this before trying again.');
175188
}
176189

177190
try {
178191

179-
hook_script.hook(hook_flow, function(err){
192+
hook_script.hook(hook_flow, function(err,skip_build) {
193+
if(err) return fail(err);
194+
if(skip_build) {
195+
flow.log(3, 'hooks - build skip requested');
196+
flow.project.skip_build = true;
197+
}
180198
done(err);
181199
});
182200

183201
} catch(e) {
184-
return fail(e);
202+
203+
var _stack = e.stack.split('\n');
204+
_stack.splice(_stack.length-9,_stack.length);
205+
206+
return fail('hook exception:\n\n' + _stack.join('\n'));
207+
185208
} //try
186209

187210
} else { //hook_script
-18.6 KB
Binary file not shown.
-18.3 KB
Binary file not shown.
-19.5 KB
Binary file not shown.
-20.5 KB
Binary file not shown.
-21.3 KB
Binary file not shown.
-19.7 KB
Binary file not shown.
-18.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)