<commit_before>
    var   cmds = require('../')
        , fs = require('graceful-fs')
        , path = require('path')
        , cmd = require('../../util/process')
        , util = require('../../util/util')
        , bars = require('handlebars')
        , fse = require('fs-extra')

var internal = {};

exports.post_build = function(flow, done) {

    flow.log(3,'build - running cpp post process');

        //run upx against the newly built binary first
    flow.execute(flow, cmds['upx'], function(){

        //the post build is so that we can move the binary file
        //from the output path if needed etc, run extra scripts and so on
        var source_path = util.normalize(path.join(flow.project.paths.build, 'cpp/' + flow.project.paths.binary.source));

        flow.log(3,'build - moving binary from %s to %s', source_path, flow.project.paths.binary.full);

            if(flow.timing) console.time('build - binary copy');
        util.copy_path(flow, source_path, flow.project.paths.binary.full);
            if(flow.timing) console.timeEnd('build - binary copy');

        if(flow.target_desktop) {
            internal.post_build_desktop(flow, source_path, done);
        } else {
            internal.post_build_mobile(flow, source_path, done);
        }

    }); //upx

} //post_build

internal.post_build_mobile = function(flow, source_path, done) {

        //run platform specific build chains
    if(flow.target == 'android') {
        internal.build_android(flow, done);
        return;
    }

        //other platforms end here
    if(done) {
        done();
    }

} //post_build_mobile

    //runs ant, and such
internal.build_android = function(flow, done) {


    flow.log(2, 'android specifics', flow.project.prepared.source.project.app.mobile.android);

    //handle ability to compile store build, vs debug test build
    var build_type = flow.project.prepared.source.project.app.mobile.android.build_type;

        //where to build from
    var project_root = path.join(flow.project.paths.build, flow.config.build.android.project);
        //a build file to remove
    var build_meta_file = path.join(project_root,'bin/build.prop');

        //remove build meta data to ensure build happens
    if(fs.existsSync(build_meta_file)) {
        fs.unlinkSync(build_meta_file);
    }

    var args = [build_type];
    var opt = {
        cwd: project_root,
        quiet:false
    }

            if(flow.timing) console.time('build - android - ant');

    flow.log(2, 'build - android - using ant at %s', flow.config.build.android.ant_path);
    if(!fs.existsSync(flow.config.build.android.ant_path)) {
        flow.log(1, 'build - android - cannot find ant at specified path %s', flow.config.build.android.ant_path );
        return flow.project.failed = true;
    }

    try {

        cmd.exec(flow, flow.config.build.android.ant_path, args, opt, function(code,out,err){

                if(flow.timing) console.timeEnd('build - android - ant');

            if(code != 0) {
                flow.log(1,'build - android - stopping because ant failed to build, exit code %d', code);
                return flow.project.failed = true;
            }

                //now move the apk out into the user bin folder
            var apk_name = flow.project.prepared.source.project.app.name + '-' + build_type + '.apk';
            var apk_path = path.join(project_root, 'bin/' + apk_name);
            var apk_dest = path.join(flow.project.paths.output, apk_name);

                if(flow.timing) console.time('build - apk copy');
            util.copy_path(flow, apk_path, apk_dest);
                if(flow.timing) console.timeEnd('build - apk copy');


            if(done) {
                done(code,out,err);
            }

        });

    } catch(e) {
        flow.log(1, 'build - android - cannot execute ant', e );
        return done('cannot execute ant...', null);
    }

} //build_android
<commit_msg>cpp; making sure ant path is nicely formatted again<commit_after>
    var   cmds = require('../')
        , fs = require('graceful-fs')
        , path = require('path')
        , cmd = require('../../util/process')
        , util = require('../../util/util')
        , bars = require('handlebars')
        , fse = require('fs-extra')

var internal = {};

exports.post_build = function(flow, done) {

    flow.log(3,'build - running cpp post process');

        //run upx against the newly built binary first
    flow.execute(flow, cmds['upx'], function(){

        //the post build is so that we can move the binary file
        //from the output path if needed etc, run extra scripts and so on
        var source_path = util.normalize(path.join(flow.project.paths.build, 'cpp/' + flow.project.paths.binary.source));

        flow.log(3,'build - moving binary from %s to %s', source_path, flow.project.paths.binary.full);

            if(flow.timing) console.time('build - binary copy');
        util.copy_path(flow, source_path, flow.project.paths.binary.full);
            if(flow.timing) console.timeEnd('build - binary copy');

        if(flow.target_desktop) {
            internal.post_build_desktop(flow, source_path, done);
        } else {
            internal.post_build_mobile(flow, source_path, done);
        }

    }); //upx

} //post_build

internal.post_build_mobile = function(flow, source_path, done) {

        //run platform specific build chains
    if(flow.target == 'android') {
        internal.build_android(flow, done);
        return;
    }

        //other platforms end here
    if(done) {
        done();
    }

} //post_build_mobile

    //runs ant, and such
internal.build_android = function(flow, done) {


    flow.log(2, 'android specifics', flow.project.prepared.source.project.app.mobile.android);

    //handle ability to compile store build, vs debug test build
    var build_type = flow.project.prepared.source.project.app.mobile.android.build_type;

        //where to build from
    var project_root = path.join(flow.project.paths.build, flow.config.build.android.project);
        //a build file to remove
    var build_meta_file = path.join(project_root,'bin/build.prop');

        //remove build meta data to ensure build happens
    if(fs.existsSync(build_meta_file)) {
        fs.unlinkSync(build_meta_file);
    }

    var args = [build_type];
    var opt = {
        cwd: project_root,
        quiet:false
    }

            if(flow.timing) console.time('build - android - ant');

    var ant_path = util.normalize(flow.config.build.android.ant_path);

    flow.log(2, 'build - android - using ant at %s', ant_path);

    if(!fs.existsSync(ant_path)) {
        flow.log(1, 'build - android - cannot find ant at specified path %s', ant_path );
        return flow.project.failed = true;
    }

    try {

        cmd.exec(flow, ant_path, args, opt, function(code,out,err){

                if(flow.timing) console.timeEnd('build - android - ant');

            if(code != 0) {
                flow.log(1,'build - android - stopping because ant failed to build, exit code %d', code);
                return flow.project.failed = true;
            }

                //now move the apk out into the user bin folder
            var apk_name = flow.project.prepared.source.project.app.name + '-' + build_type + '.apk';
            var apk_path = path.join(project_root, 'bin/' + apk_name);
            var apk_dest = path.join(flow.project.paths.output, apk_name);

                if(flow.timing) console.time('build - apk copy');
            util.copy_path(flow, apk_path, apk_dest);
                if(flow.timing) console.timeEnd('build - apk copy');


            if(done) {
                done(code,out,err);
            }

        });

    } catch(e) {
        flow.log(1, 'build - android - cannot execute ant', e );
        return done('cannot execute ant...', null);
    }

} //build_android

{'fraction_non_alphanumeric': 0.1321161404843413, 'fraction_numerical': 0.0020286547483200205, 'mean_word_length': 2.2487644151565074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6415560', 'n_tokens_mistral': 2419, 'n_tokens_neox': 2327, 'n_words': 577}