var generateHash = function()

in src/vsts/buildAndReleaseTask/hash-and-cache.js [83:111]


var generateHash = function (sourcePath, sourceFiles, sourceIgnore, hashSuffix, execCommand) {
  console.log("Generating Hash...");
  console.log("sourcePath: " + sourcePath);
  console.log("sourceFiles: " + sourceFiles);
  console.log("sourceIgnore: " + sourceIgnore);
  console.log("hashSuffix: " + hashSuffix);
  console.log("execCommand: " + execCommand);

  var files = getFileList(sourcePath, sourceFiles, sourceIgnore);

  console.log("Hashing " + files.length + " files...");

  var hashAlgorithm = crypto.createHash('sha256');

  files.forEach(function (file) {
    var filePath = path.join(sourcePath, file);
    hashAlgorithm.update(fs.readFileSync(filePath));
    hashAlgorithm.update(path.relative(sourcePath, filePath));
  });

  hashAlgorithm.update(hashSuffix);
  hashAlgorithm.update(execCommand);

  var hash = hashAlgorithm.digest('hex');

  console.log("Hash = " + hash);

  return hash;
}