Skip to content

Commit 9e1c321

Browse files
authored
Merge pull request #88 from bleskodev/bd/rebuild-per-package-patch
Fix for per package rebuild problem.
2 parents 1533cd2 + a6c8023 commit 9e1c321

File tree

1 file changed

+9
-143
lines changed

1 file changed

+9
-143
lines changed

msbuild/dbuild/CompileD.cs

Lines changed: 9 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ public CompileD()
6969
private ArrayList switchOrderList = new ArrayList();
7070
private string _compiler = "dmd";
7171

72-
private Dictionary<string, ITaskItem> trackedInputFilesToRemove;
73-
private Dictionary<string, ITaskItem> trackedOutputFilesToRemove;
74-
7572
public string Compiler
7673
{
7774
get { return _compiler; }
@@ -672,6 +669,14 @@ protected override string TrackerIntermediateDirectory
672669
}
673670
}
674671

672+
protected override bool MaintainCompositeRootingMarkers
673+
{
674+
get
675+
{
676+
return true;
677+
}
678+
}
679+
675680
private bool GetBoolProperty(string name)
676681
{
677682
if (base.IsPropertySet(name))
@@ -800,23 +805,6 @@ private ToolSwitchType GetToolSwitchTypeForStringPathArray()
800805
#endif
801806
}
802807

803-
private bool InputDependencyFilter(string fullInputPath)
804-
{
805-
if (fullInputPath.EndsWith(".PDB", StringComparison.OrdinalIgnoreCase) ||
806-
fullInputPath.EndsWith(".IDB", StringComparison.OrdinalIgnoreCase))
807-
return false;
808-
return !this.trackedInputFilesToRemove.ContainsKey(fullInputPath);
809-
}
810-
811-
private bool OutputDependencyFilter(string fullOutputPath)
812-
{
813-
if (fullOutputPath.EndsWith(".TLH", StringComparison.OrdinalIgnoreCase) ||
814-
fullOutputPath.EndsWith(".TLI", StringComparison.OrdinalIgnoreCase) ||
815-
fullOutputPath.EndsWith(".DLL", StringComparison.OrdinalIgnoreCase))
816-
return false;
817-
return !this.trackedOutputFilesToRemove.ContainsKey(fullOutputPath);
818-
}
819-
820808
#if TOOLS_V14 || TOOLS_V15
821809
public
822810
#else
@@ -872,130 +860,8 @@ protected override int ExecuteTool(string pathToTool, string responseFileCommand
872860
Log.LogMessage(MessageImportance.High, pathToTool + " " + commandLineCommands + " " + responseFileCommands);
873861
else
874862
Log.LogMessage(MessageImportance.High, "Compiling" + src);
875-
/*
876-
return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
877-
*/
878-
int num = 0;
879-
try
880-
{
881-
num = this.TrackerExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
882-
return num;
883-
}
884-
finally
885-
{
886-
if (this.MinimalRebuildFromTracking || this.TrackFileAccess)
887-
{
888-
CanonicalTrackedOutputFiles trackedOutputFiles = new CanonicalTrackedOutputFiles(this.TLogWriteFiles);
889-
CanonicalTrackedInputFiles trackedInputFiles = new CanonicalTrackedInputFiles(this.TLogReadFiles, this.Sources, this.ExcludedInputPaths, trackedOutputFiles, true, this.MaintainCompositeRootingMarkers);
890-
DependencyFilter includeInTLog = new DependencyFilter(this.OutputDependencyFilter);
891-
DependencyFilter dependencyFilter = new DependencyFilter(this.InputDependencyFilter);
892-
this.trackedInputFilesToRemove = new Dictionary<string, ITaskItem>((IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);
893-
if (this.TrackedInputFilesToIgnore != null)
894-
{
895-
foreach (ITaskItem taskItem in this.TrackedInputFilesToIgnore)
896-
this.trackedInputFilesToRemove.Add(taskItem.GetMetadata("FullPath"), taskItem);
897-
}
898-
this.trackedOutputFilesToRemove = new Dictionary<string, ITaskItem>((IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);
899-
if (this.TrackedOutputFilesToIgnore != null)
900-
{
901-
foreach (ITaskItem taskItem in this.TrackedOutputFilesToIgnore)
902-
this.trackedOutputFilesToRemove.Add(taskItem.GetMetadata("FullPath"), taskItem);
903-
}
904-
trackedOutputFiles.RemoveDependenciesFromEntryIfMissing(this.SourcesCompiled);
905-
trackedInputFiles.RemoveDependenciesFromEntryIfMissing(this.SourcesCompiled);
906-
if (num != 0)
907-
{
908-
ITaskItem[] source1;
909-
ITaskItem[] upToDateSources;
910-
if (this.SourcesCompiled.Length > 1)
911-
{
912-
KeyValuePair<string, bool>[] keyValuePairArray = new KeyValuePair<string, bool>[]{
913-
new KeyValuePair<string, bool>("ObjectFile", true),
914-
/*
915-
new KeyValuePair<string, bool>("BrowseInformationFile", this.BrowseInformation),
916-
new KeyValuePair<string, bool>("XMLDocumentationFileName", this.GenerateXMLDocumentationFiles)
917-
*/
918-
};
919-
foreach (ITaskItem source2 in this.Sources)
920-
{
921-
string sourceKey = FileTracker.FormatRootingMarker(source2);
922-
foreach (KeyValuePair<string, bool> keyValuePair in keyValuePairArray)
923-
{
924-
string metadata = source2.GetMetadata(keyValuePair.Key);
925-
if (keyValuePair.Value && !string.IsNullOrEmpty(metadata))
926-
trackedOutputFiles.AddComputedOutputForSourceRoot(sourceKey, metadata);
927-
}
928-
}
929-
source1 = trackedInputFiles.ComputeSourcesNeedingCompilation();
930-
List<ITaskItem> taskItemList = new List<ITaskItem>();
931-
int index = 0;
932-
foreach (ITaskItem taskItem in this.SourcesCompiled)
933-
{
934-
if (index >= source1.Length)
935-
taskItemList.Add(taskItem);
936-
else if (!source1[index].Equals((object) taskItem))
937-
taskItemList.Add(taskItem);
938-
else
939-
++index;
940-
}
941-
upToDateSources = taskItemList.ToArray();
942-
foreach (ITaskItem source2 in this.Sources)
943-
{
944-
string sourceRoot = FileTracker.FormatRootingMarker(source2);
945-
foreach (KeyValuePair<string, bool> keyValuePair in keyValuePairArray)
946-
{
947-
string metadata = source2.GetMetadata(keyValuePair.Key);
948-
if (keyValuePair.Value && !string.IsNullOrEmpty(metadata))
949-
trackedOutputFiles.RemoveOutputForSourceRoot(sourceRoot, metadata);
950-
}
951-
}
952-
}
953-
else
954-
{
955-
source1 = this.SourcesCompiled;
956-
upToDateSources = new ITaskItem[0];
957-
}
958-
//trackedOutputFiles.RemoveEntriesForSource(source1, this.preprocessOutput);
959-
trackedOutputFiles.SaveTlog(includeInTLog);
960-
trackedInputFiles.RemoveEntriesForSource(source1);
961-
trackedInputFiles.SaveTlog(dependencyFilter);
962-
this.ConstructCommandTLog(upToDateSources, dependencyFilter);
963-
}
964-
else
965-
{
966-
this.RemoveTaskSpecificInputs(trackedInputFiles);
967-
trackedOutputFiles.SaveTlog(includeInTLog);
968-
trackedInputFiles.SaveTlog(dependencyFilter);
969-
this.ConstructCommandTLog(this.SourcesCompiled, dependencyFilter);
970-
}
971-
TrackedVCToolTask.DeleteEmptyFile(this.TLogWriteFiles);
972-
TrackedVCToolTask.DeleteEmptyFile(this.TLogReadFiles);
973-
}
974-
}
975-
}
976863

977-
private void ConstructCommandTLog(ITaskItem[] upToDateSources, DependencyFilter inputFilter)
978-
{
979-
IDictionary<string, string> commandLines = this.MapSourcesToCommandLines();
980-
if (upToDateSources != null)
981-
{
982-
string text = this.SourcesPropertyName ?? "Sources";
983-
string cmdLine = base.GenerateCommandLineExceptSwitches(new string[1] { text },
984-
CommandLineFormat.ForTracking
985-
#if TOOLS_V14 || TOOLS_V15
986-
, EscapeFormat.Default
987-
#endif
988-
);
989-
foreach (ITaskItem upToDateSource in upToDateSources)
990-
{
991-
string metadata = upToDateSource.GetMetadata("FullPath");
992-
if (inputFilter == null || inputFilter(metadata))
993-
commandLines[FileTracker.FormatRootingMarker(upToDateSource)] = cmdLine + " " + metadata.ToUpperInvariant();
994-
else
995-
commandLines.Remove(FileTracker.FormatRootingMarker(upToDateSource));
996-
}
997-
}
998-
this.WriteSourcesToCommandLinesTable(commandLines);
864+
return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
999865
}
1000866

1001867
private System.DateTime _nextToolTypeCheck = new System.DateTime(1900, 1, 1);

0 commit comments

Comments
 (0)