Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7cc0c60

Browse files
committed
validate BUILD_SOURCEVERSION
1 parent 34143ca commit 7cc0c60

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

build/lib/util.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var _ = require('underscore');
1010
var path = require('path');
1111
var fs = require('fs');
1212
var rimraf = require('rimraf');
13+
var git = require('./git');
1314

1415
var NoCancellationToken = {
1516
isCancellationRequested: function () {
@@ -275,4 +276,14 @@ exports.downloadExtensions = function(extensions) {
275276
});
276277

277278
return es.merge(streams);
279+
};
280+
281+
exports.getVersion = function (root) {
282+
var version = process.env['BUILD_SOURCEVERSION'];
283+
284+
if (!version || !/^[0-9a-f]{40}$/i.test(version)) {
285+
version = git.getVersion(root);
286+
}
287+
288+
return version;
278289
};

0 commit comments

Comments
 (0)