Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow build configuration to run on Windows machines #9951

Merged
merged 1 commit into from Jan 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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