Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 4 additions & 18 deletions src/Tasks/Copy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ private bool DoCopyWithRetries(FileState sourceFileState, FileState destinationF
retries++;
Log.LogWarningWithCodeFromResources("Copy.Retrying", sourceFileState.Name,
destinationFileState.Name, retries, RetryDelayMilliseconds, e.Message,
GetLockedFileMessage(destinationFileState.Name));
LockCheck.GetLockedFileMessage(destinationFileState.Name));

// if we have to retry for some reason, wipe the state -- it may not be correct anymore.
destinationFileState.Reset();
Expand All @@ -982,7 +982,7 @@ private bool DoCopyWithRetries(FileState sourceFileState, FileState destinationF
{
// Exception message is logged in caller
Log.LogErrorWithCodeFromResources("Copy.ExceededRetries", sourceFileState.Name,
destinationFileState.Name, Retries, GetLockedFileMessage(destinationFileState.Name));
destinationFileState.Name, Retries, LockCheck.GetLockedFileMessage(destinationFileState.Name));
throw;
}
else
Expand All @@ -996,7 +996,7 @@ private bool DoCopyWithRetries(FileState sourceFileState, FileState destinationF
retries++;
Log.LogWarningWithCodeFromResources("Copy.Retrying", sourceFileState.Name,
destinationFileState.Name, retries, RetryDelayMilliseconds, String.Empty /* no details */,
GetLockedFileMessage(destinationFileState.Name));
LockCheck.GetLockedFileMessage(destinationFileState.Name));

// if we have to retry for some reason, wipe the state -- it may not be correct anymore.
destinationFileState.Reset();
Expand All @@ -1006,7 +1006,7 @@ private bool DoCopyWithRetries(FileState sourceFileState, FileState destinationF
else if (Retries > 0)
{
Log.LogErrorWithCodeFromResources("Copy.ExceededRetries", sourceFileState.Name,
destinationFileState.Name, Retries, GetLockedFileMessage(destinationFileState.Name));
destinationFileState.Name, Retries, LockCheck.GetLockedFileMessage(destinationFileState.Name));
return false;
}
else
Expand All @@ -1019,20 +1019,6 @@ private bool DoCopyWithRetries(FileState sourceFileState, FileState destinationF
return false;
}

/// <summary>
/// Try to get a message to inform the user which processes have a lock on a given file.
/// </summary>
private static string GetLockedFileMessage(string file)
{
string message = string.Empty;
if (NativeMethodsShared.IsWindows)
{
message = LockCheck.GetLockedFileMessage(file);
}

return message;
}

/// <summary>
/// Standard entry point.
/// </summary>
Expand Down
6 changes: 1 addition & 5 deletions src/Tasks/GenerateManifestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,7 @@ private bool WriteManifest()
}
catch (Exception ex)
{
string lockedFileMessage = string.Empty;
if (NativeMethodsShared.IsWindows)
{
lockedFileMessage = LockCheck.GetLockedFileMessage(OutputManifest.ItemSpec);
}
string lockedFileMessage = LockCheck.GetLockedFileMessage(OutputManifest.ItemSpec);
Log.LogErrorWithCodeFromResources("GenerateManifest.WriteOutputManifestFailed", OutputManifest.ItemSpec, ex.Message, lockedFileMessage);

return false;
Expand Down
1 change: 0 additions & 1 deletion src/Tasks/Microsoft.Build.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@
<Compile Include="LC.cs" />
<Compile Include="ListOperators\FindUnderPath.cs" />
<Compile Include="ListOperators\RemoveDuplicates.cs" />
<Compile Include="LockCheck.cs" />
<Compile Include="MakeDir.cs" />
<Compile Include="ManifestUtil\*.cs" Exclude="ManifestUtil\CngLightup.cs" />
<Compile Include="Message.cs" />
Expand Down
7 changes: 2 additions & 5 deletions src/Tasks/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@
</data>
<data name="Copy.Retrying">
<value>MSB3026: Could not copy "{0}" to "{1}". Beginning retry {2} in {3}ms. {4} {5}</value>
<comment>{StrBegin="MSB3026: "} LOCALIZATION: {0} and {1} are paths. {2} and {3} are numbers. {4} is an optional localized message. {5} is either empty or a string from Copy.FileLocked ("The file is locked by: "{0}"")</comment>
<comment>{StrBegin="MSB3026: "} LOCALIZATION: {0} and {1} are paths. {2} and {3} are numbers. {4} is an optional localized message. {5} is either empty or a string from Utilities LockCheck.FileLocked ("The file is locked by: "{0}"")</comment>
</data>
<data name="Copy.ExceededRetries">
<value>MSB3027: Could not copy "{0}" to "{1}". Exceeded retry count of {2}. Failed. {3}</value>
<comment>{StrBegin="MSB3027: "} LOCALIZATION: {0} and {1} are paths. {2} is a number. {3} is either empty or a string from Copy.FileLocked ("The file is locked by: "{0}"")</comment>
<comment>{StrBegin="MSB3027: "} LOCALIZATION: {0} and {1} are paths. {2} is a number. {3} is either empty or a string from Utilities LockCheck.FileLocked ("The file is locked by: "{0}"")</comment>
</data>
<data name="Copy.InvalidRetryCount">
<value>MSB3028: {0} is an invalid retry count. Value must not be negative.</value>
Expand All @@ -293,9 +293,6 @@
<value>MSB3030: Could not copy the file "{0}" because it was not found.</value>
<comment>{StrBegin="MSB3030: "} LOCALIZATION: {0} is a number.</comment>
</data>
<data name="Task.FileLocked">
<value>The file is locked by: "{0}"</value>
</data>

<!--
The CreateItem message bucket is: MSB3031 - MSB3040
Expand Down
13 changes: 4 additions & 9 deletions src/Tasks/Resources/xlf/Strings.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions src/Tasks/Resources/xlf/Strings.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions src/Tasks/Resources/xlf/Strings.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions src/Tasks/Resources/xlf/Strings.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading