Rename --force-incremental-unsafe flag to --no-incremental
This commit is contained in:
parent
947807d457
commit
897c0fa0f0
6 changed files with 17 additions and 14 deletions
|
@ -14,4 +14,4 @@ The following represent warning codes printed by CLI when the project structure
|
||||||
- __[Unknown Compiler]__: csc, vbc, and fsc have known side effects (which files and directories they read, write, and what they are not reading/writing).
|
- __[Unknown Compiler]__: csc, vbc, and fsc have known side effects (which files and directories they read, write, and what they are not reading/writing).
|
||||||
We don’t know this for other compilers. So we choose to be safe and disable incremental compilation for now. We are planning to enable specification of tool side effects in a future version, so that they can participate in incremental compilation as well.
|
We don’t know this for other compilers. So we choose to be safe and disable incremental compilation for now. We are planning to enable specification of tool side effects in a future version, so that they can participate in incremental compilation as well.
|
||||||
|
|
||||||
- __[Forced Unsafe]__: The build was marked unsafe using the `--force-incremental-unsafe` flag. Remove this flag to enable incremental compilation.
|
- __[Forced Unsafe]__: The build was not incremental because the `--no-incremental` flag was used. Remove this flag to enable incremental compilation.
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
internal class BuilderCommandApp : CompilerCommandApp
|
internal class BuilderCommandApp : CompilerCommandApp
|
||||||
{
|
{
|
||||||
public const string BuildProfileFlag = "--build-profile";
|
public const string BuildProfileFlag = "--build-profile";
|
||||||
public const string ForceUnsafeFlag = "--force-incremental-unsafe";
|
public const string ForceUnsafeFlag = "--no-incremental";
|
||||||
|
|
||||||
public bool BuildProfileValue => OptionHasValue(BuildProfileFlag);
|
public bool BuildProfileValue => OptionHasValue(BuildProfileFlag);
|
||||||
public bool ForceUnsafeValue => OptionHasValue(ForceUnsafeFlag);
|
public bool ForceUnsafeValue => OptionHasValue(ForceUnsafeFlag);
|
||||||
|
@ -16,7 +16,7 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
public BuilderCommandApp(string name, string fullName, string description) : base(name, fullName, description)
|
public BuilderCommandApp(string name, string fullName, string description) : base(name, fullName, description)
|
||||||
{
|
{
|
||||||
AddNoValueOption(BuildProfileFlag, "Set this flag to print the incremental safety checks that prevent incremental compilation");
|
AddNoValueOption(BuildProfileFlag, "Set this flag to print the incremental safety checks that prevent incremental compilation");
|
||||||
AddNoValueOption(ForceUnsafeFlag, "Set this flag to mark the entire build as not safe for incrementality");
|
AddNoValueOption(ForceUnsafeFlag, "Set this flag to turn off incremental build");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -30,3 +30,6 @@ In addition Compile's parameters, Build adds the following flag:
|
||||||
|
|
||||||
--build-profile
|
--build-profile
|
||||||
Prints out the incremental safety checks that users need to address in order for incremental compilation to be automatically turned on.
|
Prints out the incremental safety checks that users need to address in order for incremental compilation to be automatically turned on.
|
||||||
|
|
||||||
|
--no-incremental
|
||||||
|
Marks the build as unsafe for incrementality. This turns off incremental compilation and forces a clean rebuild of the project dependency graph.
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
private bool _nativeCppMode;
|
private bool _nativeCppMode;
|
||||||
private string _cppCompilerFlags;
|
private string _cppCompilerFlags;
|
||||||
private bool _buildProfile;
|
private bool _buildProfile;
|
||||||
private bool _forceIncrementalUnsafe;
|
private bool _noIncremental;
|
||||||
|
|
||||||
private string OutputOption
|
private string OutputOption
|
||||||
{
|
{
|
||||||
|
@ -146,12 +146,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ForceIncrementalUnsafe
|
private string NoIncremental
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _forceIncrementalUnsafe ?
|
return _noIncremental ?
|
||||||
"--force-incremental-unsafe" :
|
"--no-incremental" :
|
||||||
"";
|
"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
bool nativeCppMode=false,
|
bool nativeCppMode=false,
|
||||||
string cppCompilerFlags="",
|
string cppCompilerFlags="",
|
||||||
bool buildProfile=true,
|
bool buildProfile=true,
|
||||||
bool forceIncrementalUnsafe=false
|
bool noIncremental=false
|
||||||
)
|
)
|
||||||
: base("dotnet")
|
: base("dotnet")
|
||||||
{
|
{
|
||||||
|
@ -190,7 +190,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
_nativeCppMode = nativeCppMode;
|
_nativeCppMode = nativeCppMode;
|
||||||
_cppCompilerFlags = cppCompilerFlags;
|
_cppCompilerFlags = cppCompilerFlags;
|
||||||
_buildProfile = buildProfile;
|
_buildProfile = buildProfile;
|
||||||
_forceIncrementalUnsafe = forceIncrementalUnsafe;
|
_noIncremental = noIncremental;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override CommandResult Execute(string args = "")
|
public override CommandResult Execute(string args = "")
|
||||||
|
@ -214,7 +214,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
|
|
||||||
private string BuildArgs()
|
private string BuildArgs()
|
||||||
{
|
{
|
||||||
return $"{BuildProfile} {ForceIncrementalUnsafe} \"{_projectPath}\" {OutputOption} {TempOutputOption} {ConfigurationOption} {NoHostOption} {NativeOption} {ArchitectureOption} {IlcArgsOption} {IlcPathOption} {AppDepSDKPathOption} {NativeCppModeOption} {CppCompilerFlagsOption}";
|
return $"{BuildProfile} {NoIncremental} \"{_projectPath}\" {OutputOption} {TempOutputOption} {ConfigurationOption} {NoHostOption} {NativeOption} {ArchitectureOption} {IlcArgsOption} {IlcPathOption} {AppDepSDKPathOption} {NativeCppModeOption} {CppCompilerFlagsOption}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,13 +48,13 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
||||||
File.SetLastWriteTimeUtc(file, DateTime.UtcNow);
|
File.SetLastWriteTimeUtc(file, DateTime.UtcNow);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CommandResult BuildProject(bool forceIncrementalUnsafe = false, bool expectBuildFailure = false)
|
protected CommandResult BuildProject(bool noIncremental = false, bool expectBuildFailure = false)
|
||||||
{
|
{
|
||||||
var outputDir = GetBinDirectory();
|
var outputDir = GetBinDirectory();
|
||||||
var intermediateOutputDir = Path.Combine(Directory.GetParent(outputDir).FullName, "obj", _mainProject);
|
var intermediateOutputDir = Path.Combine(Directory.GetParent(outputDir).FullName, "obj", _mainProject);
|
||||||
var mainProjectFile = GetProjectFile(_mainProject);
|
var mainProjectFile = GetProjectFile(_mainProject);
|
||||||
|
|
||||||
var buildCommand = new BuildCommand(mainProjectFile, output: outputDir, tempOutput: intermediateOutputDir ,forceIncrementalUnsafe : forceIncrementalUnsafe);
|
var buildCommand = new BuildCommand(mainProjectFile, output: outputDir, tempOutput: intermediateOutputDir ,noIncremental : noIncremental);
|
||||||
var result = buildCommand.ExecuteWithCapturedOutput();
|
var result = buildCommand.ExecuteWithCapturedOutput();
|
||||||
|
|
||||||
if (!expectBuildFailure)
|
if (!expectBuildFailure)
|
||||||
|
|
|
@ -22,12 +22,12 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestForceIncrementalUnsafe()
|
public void TestNoIncrementalFlag()
|
||||||
{
|
{
|
||||||
var buildResult = BuildProject();
|
var buildResult = BuildProject();
|
||||||
AssertProjectCompiled(_mainProject, buildResult);
|
AssertProjectCompiled(_mainProject, buildResult);
|
||||||
|
|
||||||
buildResult = BuildProject(forceIncrementalUnsafe: true);
|
buildResult = BuildProject(noIncremental: true);
|
||||||
Assert.Contains("[Forced Unsafe]", buildResult.StdOut);
|
Assert.Contains("[Forced Unsafe]", buildResult.StdOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue