Updated the grunt target to delete node_modules directory afterward
- It shelss out to "robocopy" tool as that is safe for long paths - Doing this to work around the issue with KRE compile failing when long paths are present in the project folder
This commit is contained in:
parent
fc99ba1426
commit
9c279164c4
|
|
@ -106,7 +106,13 @@ default Configuration='${E("Configuration")}'
|
|||
-// Find all dirs that contain a gruntfile.js file
|
||||
var gruntDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "gruntfile.js")}'
|
||||
grunt each='var gruntDir in gruntDirs'
|
||||
|
||||
-CallTarget("clean-npm-modules");
|
||||
|
||||
#clean-npm-modules if='!IsMono'
|
||||
-// Find all dirs that contain a package.json file
|
||||
var npmDirs = '${GetDirectoriesContaining(Directory.GetCurrentDirectory(), "package.json").Select(d => Path.Combine(d, "node_modules"))}'
|
||||
robocopy-delete dir='${npmDir}' each='var npmDir in npmDirs'
|
||||
|
||||
#stylecop
|
||||
stylecop-setup
|
||||
stylecop-run each='var projectFile in Files.Include("src/**/project.json")'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
-// Deletes a directory using robocopy such that long paths aren't an issue
|
||||
default parentDir = '${Directory.GetParent(dir).FullName}'
|
||||
default tempDir = '${Path.Combine(parentDir, "__emp_dir")}'
|
||||
default logFile = '${Path.Combine(parentDir, "robocopy-log.txt")}'
|
||||
|
||||
exec program='cmd' commandline='/C mkdir ${tempDir}'
|
||||
|
||||
@{
|
||||
var robocopyProcessStartInfo = new ProcessStartInfo {
|
||||
UseShellExecute = false,
|
||||
WorkingDirectory = dir,
|
||||
FileName = "cmd",
|
||||
Arguments = "/C robocopy " + tempDir + " " + dir + " /PURGE /NS /NC /NP /NFL /NDL /NJH /NJS /LOG:" + logFile,
|
||||
};
|
||||
|
||||
var robocopyProcess = Process.Start(robocopyProcessStartInfo);
|
||||
robocopyProcess.WaitForExit();
|
||||
|
||||
// Robocopy encodes results as a bitmap in the return code, see http://ss64.com/nt/robocopy-exit.html
|
||||
if (robocopyProcess.ExitCode >= 16)
|
||||
{
|
||||
throw new Exception(string.Format("Error {0} attempting to delete {1}, see {2} for more details", robocopyProcess.ExitCode, dir, logFile));
|
||||
}
|
||||
}
|
||||
-//exec program='cmd' commandline='/C robocopy ${tempDir} ${dir} /PURGE /NS /NC /NP /NFL /NDL /NJH /NJS /LOG:${logFile}'
|
||||
|
||||
exec program='cmd' commandline='/C rmdir ${tempDir}'
|
||||
exec program='cmd' commandline='/C rmdir ${dir}'
|
||||
exec program='cmd' commandline='/C del ${logFile}'
|
||||
Loading…
Reference in New Issue