/// <summary> /// Adds all known output directories /// </summary> /// <remarks> /// The project root (excluding node_modules) is always considered an output directory /// </remarks> protected virtual void ProcessOutputs(JavaScriptProject project, ProcessBuilder processBuilder) { // Each project is automatically allowed to write anything under its project root processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.ProjectFolder), SealDirectoryKind.SharedOpaque); if (m_resolverSettings.BlockWritesUnderNodeModules == true) { // There shouldn't be any writes under node_modules. So exclude it explicitly, since that also avoids a usually expensive enumeration // under node_modules when scrubbing. processBuilder.AddOutputDirectoryExclusion(project.NodeModulesFolder(m_context.PathTable)); } // Some projects share their temp folder across their build scripts (e.g. build and test) // So we cannot make them share the temp folder with the infrastructure we have today // (even though not impossible to fix, we could allow temp directories among pips that are part // of the same depedency chain and eagerly delete the folder every time a pip finishes) processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.TempFolder), SealDirectoryKind.SharedOpaque); // Add all the additional output directories that the graph knows about foreach (var outputDirectory in project.OutputDirectories) { processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(outputDirectory), SealDirectoryKind.SharedOpaque); } // Add additional output directories configured in the main config file AddAdditionalOutputDirectories(processBuilder, project.ProjectFolder); }
/// <inheritdoc/> protected override void ProcessOutputs(JavaScriptProject project, ProcessBuilder processBuilder) { base.ProcessOutputs(project, processBuilder); // This makes sure the folder the user profile is pointing to gets actually created processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(UserProfile(project, PathTable)), SealDirectoryKind.SharedOpaque); }
private void ProcessOutputs(ProjectWithPredictions project, ProcessBuilder processBuilder) { // Add all shared opaque directories. foreach (var sharedOutputDirectory in GetOutputDirectories(project)) { processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(sharedOutputDirectory), SealDirectoryKind.SharedOpaque); } }
private void ProcessOutputs(RushProject project, ProcessBuilder processBuilder) { // HACK HACK. We are missing output dirs with exclusions, so we don't include node_modules here, which is a pain for scrubbing. // So let's add known common directories one by one // Ideally we'd like to say 'the root of the project without node_modules'. No projects are supposed to write there. processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.ProjectFolder.Combine(PathTable, "lib")), SealDirectoryKind.SharedOpaque); processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.ProjectFolder.Combine(PathTable, "temp")), SealDirectoryKind.SharedOpaque); processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.ProjectFolder.Combine(PathTable, "dist")), SealDirectoryKind.SharedOpaque); processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.ProjectFolder.Combine(PathTable, "release")), SealDirectoryKind.SharedOpaque); processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.ProjectFolder.Combine(PathTable, "src")), SealDirectoryKind.SharedOpaque); // HACK HACK. Only non-test projects generate these files at the root of the project. So don't add them twice otherwise graph construction complains if (!project.Name.EndsWith("_test")) { processBuilder.AddOutputFile(new FileArtifact(project.ProjectFolder.Combine(PathTable, "test-api.js"), 0), FileExistence.Optional); processBuilder.AddOutputFile(new FileArtifact(project.ProjectFolder.Combine(PathTable, "test-api.d.ts"), 0), FileExistence.Optional); } // Some projects share their temp folder and some files might get consumed across. So treat it as a regular output directory processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.TempFolder), SealDirectoryKind.SharedOpaque); // Add all the additional output directories that the rush graph knows about foreach (var additionalOutput in project.AdditionalOutputDirectories) { processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(additionalOutput), SealDirectoryKind.SharedOpaque); } // Add additional output directories configured in the main config file AddAdditionalOutputDirectories(processBuilder, project.ProjectFolder); }
/// <summary> /// Adds output directory. /// </summary> public ArgumentsBuilder AddOutputDirectoryOption(string optionName, AbsolutePath outputDirectory) { Contract.Requires(!string.IsNullOrEmpty(optionName)); Contract.Requires(outputDirectory.IsValid); Contract.Assert(!m_finished); m_dataBuilder.AddPathOption(optionName, outputDirectory); m_processBuilder.AddOutputDirectory(outputDirectory, SealDirectoryKind.Opaque); return(this); }
private void AddAdditionalOutputDirectories(ProcessBuilder processBuilder, AbsolutePath projectFolder) { if (m_resolverSettings.AdditionalOutputDirectories == null) { return; } foreach (DiscriminatingUnion <AbsolutePath, RelativePath> directoryUnion in m_resolverSettings.AdditionalOutputDirectories) { object directory = directoryUnion.GetValue(); if (directory is AbsolutePath absolutePath) { processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(absolutePath), SealDirectoryKind.SharedOpaque); } else { // The specified relative path is interpreted relative to the project directory folder AbsolutePath absoluteDirectory = projectFolder.Combine(PathTable, (RelativePath)directory); processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(absoluteDirectory), SealDirectoryKind.SharedOpaque); } } }
private void ProcessOutputs(RushProject project, ProcessBuilder processBuilder) { // Each project is automatically allowed to write anything under its project root // TODO: we should exclude node_modules when shared opaques start to support exclusions processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.ProjectFolder), SealDirectoryKind.SharedOpaque); // Some projects share their temp folder across their build scripts (e.g. build and test) // So we cannot make them share the temp folder with the infrastructure we have today // (even though not impossible to fix, we could allow temp directories among pips that are part // of the same depedency chain and eagerly delete the folder every time a pip finishes) processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(project.TempFolder), SealDirectoryKind.SharedOpaque); // This makes sure the folder the user profile is pointing to gets actually created processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(UserProfile(project, PathTable)), SealDirectoryKind.SharedOpaque); // Add all the additional output directories that the rush graph knows about foreach (var outputDirectory in project.OutputDirectories) { processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(outputDirectory), SealDirectoryKind.SharedOpaque); } // Add additional output directories configured in the main config file AddAdditionalOutputDirectories(processBuilder, project.ProjectFolder); }
private void AddOutputs(NinjaNode node, ProcessBuilder processBuilder) { foreach (AbsolutePath output in node.Outputs) { FileArtifact file; if (m_outputFileArtifacts.TryGetValue(output, out file)) { processBuilder.AddOutputFile(file, FileExistence.Required); } else { processBuilder.AddOutputFile(output, FileExistence.Required); } } processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(m_projectRoot), SealDirectoryKind.SharedOpaque); }
private void AddOutputs(NinjaNode node, ProcessBuilder processBuilder) { foreach (AbsolutePath output in node.Outputs) { // TODO: outputs should be optional/required depending on the Ninja graph semantics instead of always optional FileArtifact file; if (m_outputFileArtifacts.TryGetValue(output, out file)) { processBuilder.AddOutputFile(file, FileExistence.Optional); } else { processBuilder.AddOutputFile(output, FileExistence.Optional); } } processBuilder.AddOutputDirectory(DirectoryArtifact.CreateWithZeroPartialSealId(m_projectRoot), SealDirectoryKind.SharedOpaque); }