public IEnumerable <TargetRelativePath> GetAllResultsIn(TargetRelativePath targetDir) { Contract.Requires(targetDir != null); Contract.Ensures(Contract.Result <IEnumerable <TargetRelativePath> >() != null); return(null); // dummy }
/// <summary> /// Constructs the builder /// </summary> /// <param name="slnBuilder">Sub task building the solution file, used as a dependency</param> /// <param name="slnPath">Path of the generated solution file</param> /// <param name="version">MSBuild version to use</param> /// <param name="targetRoot">Target directory</param> /// <param name="msbuildFactory">Factory to get the MSBuild implementation to use</param> public MSBuildRunner(SlnBuilder slnBuilder, TargetRelativePath slnPath, MSBuildVersion version, [TargetRoot] IFileSystemDirectory targetRoot, IMSBuildFactory msbuildFactory) { this.slnBuilder = slnBuilder; this.slnPath = slnPath; this.targetRoot = targetRoot; msbuild = msbuildFactory.CreateMSBuild(version); }
/// <summary> /// Constructs the builder /// </summary> /// <param name="slnBuilder">Sub task building the solution file, used as a dependency</param> /// <param name="slnPath">Path of the generated solution file</param> /// <param name="targetRoot">Target directory</param> /// <param name="msbuild">The MSBuild implementation to use</param> public MSBuildRunner(SlnBuilder slnBuilder, TargetRelativePath slnPath, [TargetRoot] IFileSystemDirectory targetRoot, IMSBuild msbuild) { this.slnBuilder = slnBuilder; this.slnPath = slnPath; this.targetRoot = targetRoot; this.msbuild = msbuild; }
public void Compile(SuiteRelativePath scriptPath, TargetRelativePath targetPath, string version, Goal targetGoal) { var platform = targetGoal.Has("x64") ? "x64" : "x86"; Run(suiteRoot, "/dVERSION=" + version, "/dPLATFORM=" + platform, "/dGOAL=" + targetGoal.Name, "/o" + Path.GetDirectoryName(Path.Combine(suiteRoot.GetRelativePath(targetRoot), targetPath)), scriptPath); }
public void Compile(SuiteRelativePath scriptPath, TargetRelativePath targetPath, string version, Goal targetGoal) { var platform = targetGoal.Has("x64") ? "x64" : "x86"; Run(suiteRoot, "/dVERSION="+version, "/dPLATFORM="+platform, "/dGOAL="+targetGoal.Name, "/o"+Path.GetDirectoryName(Path.Combine(suiteRoot.GetRelativePath(targetRoot), targetPath)), scriptPath); }
/// <summary> /// Gets all the result files under the given subdirectory of target root /// </summary> /// <param name="targetDir">Subdirectory of target</param> /// <returns>An enumeration of target relative paths all pointing to files /// generated under the current build context to the given subdirectory or one of /// its children.</returns> public IEnumerable <TargetRelativePath> GetAllResultsIn(TargetRelativePath targetDir) { var prefix = (string)targetDir; if (prefix[prefix.Length - 1] != Path.DirectorySeparatorChar) { prefix += Path.DirectorySeparatorChar; } return(partialResults.Values.SelectMany(ps => ps.Where(p => ((string)p).StartsWith(prefix)))); }
private bool IsValidReference(TargetRelativePath reference) { if (IsGACReference(reference) || IsSolutionReference(reference)) { return(true); } else { var extension = Path.GetExtension(reference); if (extension != null) { return(allowedExtensions.Contains(extension.ToLowerInvariant())); } else { return(false); } } }
private TargetRelativePath GenerateAddonSupportFile(string solutionName) { string contents = AddonSupportData(); var path = new TargetRelativePath("", solutionName + ".yaml"); bool writeFile = true; if (targetRoot.Exists(path.RelativePath)) { using (var reader = targetRoot.ReadTextFile(path.RelativePath)) { string existingContents = reader.ReadToEnd(); writeFile = existingContents != contents; } } if (writeFile) { using (var writer = targetRoot.CreateTextFile(path.RelativePath)) writer.WriteLine(contents); } return path; }
private TargetRelativePath GenerateAddonSupportFile(string solutionName) { string contents = AddonSupportData(); var path = new TargetRelativePath("", solutionName + ".yaml"); bool writeFile = true; if (targetRoot.Exists(path.RelativePath)) { using (var reader = targetRoot.ReadTextFile(path.RelativePath)) { string existingContents = reader.ReadToEnd(); writeFile = existingContents != contents; } } if (writeFile) { using (var writer = targetRoot.CreateTextFile(path.RelativePath)) writer.WriteLine(contents); } return(path); }
private static bool IsSolutionReference(TargetRelativePath refPath) { return(((string)refPath).StartsWith("SLN!")); }
public IEnumerable<TargetRelativePath> GetAllResultsIn(TargetRelativePath targetDir) { Contract.Requires(targetDir != null); Contract.Ensures(Contract.Result<IEnumerable<TargetRelativePath>>() != null); return null; // dummy }
private void Copy(TargetRelativePath sourcePath, string relativePath) { using (var source = targetRoot.ReadBinaryFile(sourcePath)) using (var target = targetDirectory.CreateBinaryFileWithDirectories(relativePath)) StreamOperations.Copy(source, target); }
private static bool IsGACReference(TargetRelativePath refPath) { return ((string) refPath).StartsWith("GAC!"); }
private static bool IsSolutionReference(TargetRelativePath refPath) { return ((string)refPath).StartsWith("SLN!"); }
private bool IsValidReference(TargetRelativePath reference) { if (IsGACReference(reference) || IsSolutionReference(reference)) return true; else { var extension = Path.GetExtension(reference); if (extension != null) { return allowedExtensions.Contains(extension.ToLowerInvariant()); } else { return false; } } }
/// <summary> /// Runs this builder /// </summary> /// <param name="context"> </param> /// <returns>Returns a set of generated files, in target relative paths</returns> public override ISet <TargetRelativePath> Run(IBuildContext context) { // Collecting all the files already existing in 'targetdir/modulename' directories var targetDirs = new HashSet <string>(slnBuilder.Projects.Select(GetTargetDir)); var existingFiles = new Dictionary <TargetRelativePath, DateTime>(); var expectedOutputs = new HashSet <TargetRelativePath>(slnBuilder.Projects.SelectMany(GetExpectedProjectOutputs).Union(GetDependencyResults(context))); foreach (var targetDir in targetDirs) { var moduleTargetDir = targetRoot.GetChildDirectory(targetDir); if (moduleTargetDir != null) { foreach (var fileName in moduleTargetDir.Files) { existingFiles.Add(new TargetRelativePath(targetDir, fileName), moduleTargetDir.GetLastModifiedDate(fileName)); } } } msbuild.Run(targetRoot, slnPath); // Collecting all the files in 'targetdir/modulename' directories as results var outputs = new HashSet <TargetRelativePath>(); foreach (var targetDir in targetDirs) { var moduleTargetDir = targetRoot.GetChildDirectory(targetDir); if (moduleTargetDir != null) { moduleTargetDir.InvalidateCacheFileData(); foreach (var fileName in moduleTargetDir.Files) { var relativePath = new TargetRelativePath(targetDir, fileName); var lastModified = moduleTargetDir.GetLastModifiedDate(fileName); bool isNew = false; if (expectedOutputs.Contains(relativePath)) { isNew = true; } else { DateTime previousLastModified; if (existingFiles.TryGetValue(relativePath, out previousLastModified)) { if (lastModified != previousLastModified) { isNew = true; } } else { isNew = true; } } if (isNew) { outputs.Add(relativePath); } } } } foreach (var targetDir in targetDirs) { outputs.ExceptWith(context.GetAllResultsIn(new TargetRelativePath(targetDir, String.Empty))); } return(outputs); }
public MSBuildRunner CreateMSBuildRunner(SlnBuilder slnBuilder, TargetRelativePath slnPath, MSBuildVersion version) { return(store.Add(baseImpl.CreateMSBuildRunner(slnBuilder, slnPath, version))); }
/// <summary> /// Gets all the result files under the given subdirectory of target root /// </summary> /// <param name="targetDir">Subdirectory of target</param> /// <returns>An enumeration of target relative paths all pointing to files /// generated under the current build context to the given subdirectory or one of /// its children.</returns> public IEnumerable<TargetRelativePath> GetAllResultsIn(TargetRelativePath targetDir) { var prefix = (string)targetDir; if (prefix[prefix.Length - 1] != Path.DirectorySeparatorChar) prefix += Path.DirectorySeparatorChar; return partialResults.Values.SelectMany(ps => ps.Where(p => ((string)p).StartsWith(prefix))); }
private static bool IsGACReference(TargetRelativePath refPath) { return(((string)refPath).StartsWith("GAC!")); }
public MSBuildRunner CreateMSBuildRunner(SlnBuilder slnBuilder, TargetRelativePath slnPath, MSBuildVersion version) { return store.Add(baseImpl.CreateMSBuildRunner(slnBuilder, slnPath, version)); }