protected override bool doInitialization() { var parts = Name.Split(_separator); SourcePath = PathHelper.GetTestAppFolder(parts[0]); if (SourcePath == null) { return(false); } var dotnet = DotnetHelper.GetDefaultInstance(); if (!dotnet.Restore(SourcePath, quiet: true)) { return(false); } var target = Path.Combine(PathHelper.GetNewTempFolder(), parts[0]); Directory.CreateDirectory(target); if (!dotnet.Publish(SourcePath, target, parts[1])) { Directory.Delete(target, recursive: true); return(false); } SamplePath = target; return(true); }
protected override bool doInitialization() { SourcePath = PathHelper.GetTestAppFolder(Name); if (SourcePath == null) { return(false); } var tempFolder = PathHelper.GetNewTempFolder(); Directory.CreateDirectory(tempFolder); // workaround for Linux var target = Path.Combine(tempFolder, "app", Name); Directory.CreateDirectory(target); var buildTarget = Path.Combine(tempFolder, "build"); string copyCommand, copyBuildParameters, copyNugetConfigParameters, copyPropsParameters, copySampleParameters; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { copyCommand = "robocopy"; copyBuildParameters = $"\"{_buildFolder}\" \"{buildTarget}\" /NP /S"; copyNugetConfigParameters = $"\"{_pathToNugetConfig}\" \"{target}\" NuGet.config /NP"; copyPropsParameters = $"\"{_rootFolder}\" \"{tempFolder}\" *.props *.targets /NP"; copySampleParameters = $"\"{SourcePath}\" \"{target}\" /NP /S /XD bin node_modules obj /XF project.lock.json"; } else { copyCommand = "rsync"; copyBuildParameters = $"\"{_buildFolder}/\"*.* \"{buildTarget}\""; copyNugetConfigParameters = $"\"{_pathToNugetConfig}/NuGet.config\" \"{target}/NuGet.config\""; copyPropsParameters = "--include=*.props --include=*.targets --exclude=*.* " + $"\"{_rootFolder}/\"*.* \"{tempFolder}\""; copySampleParameters = "--recursive --exclude=bin/ --exclude=node_modules/ --exclude=obj/ " + $"--exclude=project.lock.json \"{SourcePath}/\" \"{target}/\""; } var runner = new CommandLineRunner(copyCommand); if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { // Let the shell expand the wildcards for the content of the build folder as well as the props and // targets in the root folder. runner.UseShellExecute = true; } runner.Execute(copyBuildParameters); runner.Execute(copyNugetConfigParameters); runner.Execute(copyPropsParameters); runner.Execute(copySampleParameters); if (!DotnetHelper.GetDefaultInstance().Restore(target, quiet: true)) { Directory.Delete(target, recursive: true); return(false); } SamplePath = target; return(true); }
protected override bool doInitialization() { SourcePath = PathHelper.GetTestAppFolder(Name); if (SourcePath == null) { return(false); } var tempFolder = PathHelper.GetNewTempFolder(); Directory.CreateDirectory(tempFolder); // workaround for Linux var target = Path.Combine(tempFolder, Name); Directory.CreateDirectory(target); string copyCommand, copySampleParameters, copyNugetConfigParameters; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { copyCommand = "robocopy"; copySampleParameters = $"\"{SourcePath}\" \"{target}\" /E /S /XD node_modules /XF project.lock.json"; copyNugetConfigParameters = $"\"{_pathToNugetConfig}\" \"{target}\" NuGet.config"; } else { copyCommand = "rsync"; copySampleParameters = $"--recursive --exclude=node_modules --exclude=project.lock.json \"{SourcePath}/\" \"{target}/\""; copyNugetConfigParameters = $"\"{_pathToNugetConfig}/NuGet.config\" \"{target}/NuGet.config\""; } var runner = new CommandLineRunner(copyCommand); runner.Execute(copySampleParameters); runner.Execute(copyNugetConfigParameters); if (!DotnetHelper.GetDefaultInstance().Restore(target, quiet: true)) { Directory.Delete(target, recursive: true); return(false); } SamplePath = target; return(true); }