Update build file.
This commit is contained in:
parent
c1c25f0e28
commit
6f5446f218
2 changed files with 14 additions and 21 deletions
32
mkrfile.js
32
mkrfile.js
|
@ -12,17 +12,14 @@ var src = path.join(root, 'src');
|
|||
var build = path.join(root, 'build');
|
||||
|
||||
|
||||
function getBuildSuffix(callback) {
|
||||
function getBuildSuffixSync() {
|
||||
|
||||
require('child_process').exec('git rev-list v' + pkg.version + '..HEAD', {cwd: root}, function (err, out) {
|
||||
|
||||
try {
|
||||
var lines = out.trim().split(/\r?\n/);
|
||||
callback('+' + ('000' + lines.length).substr(-3) + '~' + lines[0].substring(0, 7));
|
||||
} catch (e) {
|
||||
callback('+X');
|
||||
}
|
||||
});
|
||||
try {
|
||||
var out = require('child_process').execSync('git rev-list v' + pkg.version + '..HEAD', {cwd: root, encoding: 'utf8'});
|
||||
var lines = out.trim().split(/\r?\n/);
|
||||
return '+' + ('000' + lines.length).substr(-3) + '~' + lines[0].substring(0, 7);
|
||||
} catch (e) {}
|
||||
return '+X';
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,19 +40,12 @@ module.exports = function (suite) {
|
|||
suite.defaults('release');
|
||||
|
||||
|
||||
suite.target('check-version', [], 'add git info to dev builds').task(function (done) {
|
||||
suite.target('check-version', [], 'add git info to dev builds').task(function () {
|
||||
|
||||
if (!pkg.develop) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
getBuildSuffix(function (result) {
|
||||
|
||||
pkg.version += result;
|
||||
if (pkg.develop) {
|
||||
pkg.version += getBuildSuffixSync();
|
||||
$.report({type: 'info', method: 'check-version', message: 'version set to ' + pkg.version});
|
||||
done();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -27,5 +27,8 @@
|
|||
"fquery-less": "~0.3.0",
|
||||
"fquery-uglifyjs": "~0.3.0",
|
||||
"mkr": "~0.8.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.12.x"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue