Comparing version 0.8.0 to 0.8.1
"use strict"; | ||
var CMake = require("./cMake"); | ||
var dist = require("./dist"); | ||
var log = require("npmlog"); | ||
var IntLog = require("./intLog"); | ||
@@ -9,2 +9,3 @@ function BuildSystem(options) { | ||
this.cmake = new CMake(options); | ||
this.log = new IntLog(options); | ||
} | ||
@@ -17,7 +18,5 @@ | ||
BuildSystem.prototype._showError = function(e) { | ||
if (!this.options.noLog) { | ||
log.error("OMG", e.message); | ||
if (log.level === "verbose" || log.level === "silly") { | ||
log.error("OMG", e.stack); | ||
} | ||
this.log.error("OMG", e.message); | ||
if (this.log.level === "verbose" || this.log.level === "silly") { | ||
this.log.error("OMG", e.stack); | ||
} | ||
@@ -24,0 +23,0 @@ }; |
@@ -7,13 +7,10 @@ "use strict"; | ||
var path = require("path"); | ||
var log = require('npmlog'); | ||
var _ = require("lodash"); | ||
var environment = require("./environment"); | ||
var dist = require("./dist"); | ||
var IntLog = require("./intLog"); | ||
var binaryDirRex = /^(.*)_BINARY_DIR:STATIC=(.*)/; | ||
var projectNameRex = /^\s*project\s*\((.*)\)/i; | ||
var libraryNameRex = /^\s*add_library\s*\((.*)\)\s+SHARED/i; | ||
function CMake(options) { | ||
this.options = options || {}; | ||
this.log = new IntLog(options); | ||
this.projectRoot = this.options.directory || process.cwd(); | ||
@@ -55,2 +52,3 @@ this.workDir = path.join(this.projectRoot, "build"); | ||
catch (e) { | ||
_.noop(e); | ||
} | ||
@@ -127,3 +125,3 @@ return false; | ||
return init.then(function () { | ||
var useNinja = environment.isLinux && !self.options.preferMake && environment.isNinjaAvailable; | ||
var useNinja = !environment.isWin && !self.options.preferMake && environment.isNinjaAvailable; | ||
var command = self.path; | ||
@@ -178,5 +176,3 @@ command += " " + self.projectRoot; | ||
if (!this.options.noLog) { | ||
log.info("CMD", "CONFIGURE"); | ||
} | ||
this.log.info("CMD", "CONFIGURE"); | ||
var self = this; | ||
@@ -228,5 +224,3 @@ var listPath = path.join(self.projectRoot, "CMakeLists.txt"); | ||
.then(function (buildCommand) { | ||
if (!self.options.noLog) { | ||
log.info("CMD", "BUILD"); | ||
} | ||
self.log.info("CMD", "BUILD"); | ||
return self._run(buildCommand); | ||
@@ -241,5 +235,3 @@ }); | ||
CMake.prototype.clean = function () { | ||
if (!this.options.noLog) { | ||
log.info("CMD", "CLEAN"); | ||
} | ||
this.log.info("CMD", "CLEAN"); | ||
return this._run(this.getCleanCommand()); | ||
@@ -265,5 +257,4 @@ }; | ||
CMake.prototype._run = function (command) { | ||
if (!this.options.noLog) { | ||
log.info("RUN", command); | ||
} | ||
var self = this; | ||
self.log.info("RUN", command); | ||
function showOutput(output, level) { | ||
@@ -275,3 +266,3 @@ output.forEach(function (line, i) { | ||
} | ||
log[level]("OUT", line); | ||
self.log[level]("OUT", line); | ||
}); | ||
@@ -293,5 +284,3 @@ } | ||
showOutput(output, "warn"); | ||
if (!self.options.noLog) { | ||
log.warn("OUT", err); | ||
} | ||
self.log.warn("OUT", err); | ||
resolve(); | ||
@@ -298,0 +287,0 @@ } |
@@ -7,3 +7,2 @@ "use strict"; | ||
var fs = Bluebird.promisifyAll(require("fs-extra")); | ||
var log = require('npmlog'); | ||
var MemoryStream = require("memory-stream"); | ||
@@ -15,4 +14,5 @@ var request = require("request"); | ||
var _ = require("lodash"); | ||
var IntLog = require("./intLog"); | ||
function downloadTo (url, result, calculateSum) { | ||
function downloadTo(url, result, calculateSum) { | ||
var shasum = calculateSum ? crypto.createHash('sha256') : null; | ||
@@ -34,3 +34,3 @@ return new Bluebird(function (resolve, reject) { | ||
function testSum (sums, sum, fPath) { | ||
function testSum(sums, sum, fPath) { | ||
var serverSum = _.first(sums.filter(function (s) { return s.getPath === fPath; })); | ||
@@ -49,3 +49,4 @@ if (serverSum && serverSum.sum === sum) { | ||
"v" + environment.runtimeVersion), | ||
_externalPath: null, | ||
_downloaded: null, | ||
ensureDownloaded: function (options) { | ||
@@ -57,8 +58,6 @@ if (!dist.downloaded) { | ||
}, | ||
download: function (options) { | ||
options = options || {}; | ||
if (!options.noLog) { | ||
log.info("DIST", "Downloading distribution files."); | ||
} | ||
var log = new IntLog(options); | ||
log.info("DIST", "Downloading distribution files."); | ||
return fs.mkdirpAsync(dist.internalPath) | ||
@@ -75,5 +74,4 @@ .then(function () { | ||
var sumUrl = urljoin(dist.externalPath, "SHASUMS256.txt"); | ||
if (!options.noLog) { | ||
log.http("DIST", "\t- " + sumUrl); | ||
} | ||
var log = new IntLog(options); | ||
log.http("DIST", "\t- " + sumUrl); | ||
return downloadTo(sumUrl, result, false) | ||
@@ -90,6 +88,7 @@ .then(function () { | ||
}) | ||
.filter(function (i) { return i.getPath && i.getPath; }); | ||
.filter(function (i) { return i.getPath && i.sum; }); | ||
}); | ||
}, | ||
_downloadTar: function (options, sums) { | ||
var log = new IntLog(options); | ||
var gunzip = zlib.createGunzip(); | ||
@@ -109,5 +108,3 @@ var extracter = new tar.Extract({ | ||
var tarUrl = urljoin(dist.externalPath, fn); | ||
if (!options.noLog) { | ||
log.http("DIST", "\t- " + tarUrl); | ||
} | ||
log.http("DIST", "\t- " + tarUrl); | ||
@@ -135,2 +132,3 @@ return new Bluebird(function (resolve, reject) { | ||
_downloadLib: function (options, sums) { | ||
var log = new IntLog(options); | ||
if (!environment.isWin) { | ||
@@ -144,5 +142,3 @@ return Bluebird.resolve(); | ||
var libUrl = urljoin(dist.externalPath, fPath); | ||
if (!options.noLog) { | ||
log.http("DIST", "\t- " + libUrl); | ||
} | ||
log.http("DIST", "\t- " + libUrl); | ||
@@ -161,6 +157,2 @@ return fs.mkdirpAsync(path.join(dist.internalPath, subDir)) | ||
Object.defineProperties(dist, { | ||
_externalPath: { | ||
value: null, | ||
writable: true | ||
}, | ||
externalPath: { | ||
@@ -179,7 +171,2 @@ get: function () { | ||
}, | ||
_downloaded: { | ||
value: null, | ||
writable: true | ||
}, | ||
downloaded: { | ||
@@ -198,2 +185,3 @@ get: function () { | ||
catch (e) { | ||
_.noop(e); | ||
} | ||
@@ -203,3 +191,2 @@ return false; | ||
}, | ||
winLibDir: { | ||
@@ -215,2 +202,2 @@ get: function () { | ||
} | ||
}); | ||
}); |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"author": "Gábor Mező aka unbornchikken", | ||
@@ -31,2 +31,3 @@ "repository": { | ||
"cli": "^0.6.5", | ||
"debug": "^2.1.3", | ||
"fs-extra": "^0.16.5", | ||
@@ -33,0 +34,0 @@ "is-iojs": "^1.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 7 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192434
47
632
13
7
+ Addeddebug@^2.1.3
+ Addeddebug@2.6.9(transitive)
+ Addedms@2.0.0(transitive)