Skip to content

Commit

Permalink
Allow build configuration to run on Windows machines (#9951)
Browse files Browse the repository at this point in the history
  • Loading branch information
pickypg committed Jan 19, 2017
1 parent 72c38cf commit 10f4277
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tasks/config/build.js
@@ -1,11 +1,19 @@
import { execSync as exec } from 'child_process';
const platform = require('os').platform();

export default (grunt) => {
const pkgVersion = grunt.config.get('pkg.version');

const sha = String(exec('git rev-parse HEAD')).trim();
const number = parseFloat(String(exec('git log --format="%h" | wc -l')).trim());
const version = buildVersion(grunt.option('release'), pkgVersion);
let number;

if (/^win/.test(platform)) {
// Windows does not have the wc process and `find /C /V ""` does not consistently work
number = String(exec('git log --format="%h"')).split('\n').length;
} else {
number = parseFloat(String(exec('git log --format="%h" | wc -l')).trim());
}

return { sha, number, version };
};
Expand Down

0 comments on commit 10f4277

Please sign in to comment.