97 references to Utilities
Microsoft.Build.Tasks.CodeAnalysis (15)
src\Compilers\Core\MSBuildTask\CommandLineBuilderExtension.cs (1)
268
bool flagSet =
Utilities
.TryConvertItemMetadataToBool(parameter, metadataNames[i]);
src\Compilers\Core\MSBuildTask\Csc.cs (2)
363
bool embed =
Utilities
.TryConvertItemMetadataToBool(reference,
404
throw
Utilities
.GetLocalizedArgumentException(
src\Compilers\Core\MSBuildTask\ManagedCompiler.cs (1)
1099
item.ItemSpec =
Utilities
.GetFullPathNoThrow(item.ItemSpec);
src\Compilers\Core\MSBuildTask\MapSourceRoots.cs (5)
78
return string.IsNullOrEmpty(path) ? path : EnsureEndsWithSlash(
Utilities
.GetFullPathNoThrow(path));
177
string nestedRoot =
Utilities
.FixFilePath(root.GetMetadata(Names.NestedRoot));
180
string containingRoot = NormalizePath(
Utilities
.FixFilePath(root.GetMetadata(Names.ContainingRoot)));
187
if (
Utilities
.TryCombine(containingRoot, nestedRoot, out var combinedPath))
189
var fullOriginalPath =
Utilities
.GetFullPathNoThrow(combinedPath);
src\Compilers\Core\MSBuildTask\Utilities.cs (2)
51
throw
Utilities
.GetLocalizedArgumentException(
77
throw
Utilities
.GetLocalizedArgumentException(
src\Compilers\Core\MSBuildTask\Vbc.cs (4)
325
Utilities
.DeleteNoThrow(desiredPdbInfo.FullName);
333
catch (Exception e) when (
Utilities
.IsIoRelatedException(e))
374
throw
Utilities
.GetLocalizedArgumentException(e,
582
bool embed =
Utilities
.TryConvertItemMetadataToBool(reference, "EmbedInteropTypes");
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (82)
MapSourceRootTests.cs (82)
37
new TaskItem(
Utilities
.FixFilePath(@"c:\packages\SourcePackage1\")),
39
new TaskItem(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\"), new Dictionary<string, string>
43
new TaskItem(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\b\"), new Dictionary<string, string>
47
{ "ContainingRoot",
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\") },
60
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\packages\SourcePackage1\")), task.MappedSourceRoots[0].ItemSpec);
63
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath("/packages/SourcePackage2/")), task.MappedSourceRoots[1].ItemSpec);
66
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\")), task.MappedSourceRoots[2].ItemSpec);
70
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\b\")), task.MappedSourceRoots[3].ItemSpec);
109
Assert.Equal(
Utilities
.FixFilePath(
Utilities
.GetFullPathNoThrow(@"!@#:;$%^&*()_+|{}\")), task.MappedSourceRoots[0].ItemSpec);
112
Assert.Equal(
Utilities
.FixFilePath(
Utilities
.GetFullPathNoThrow("****/")), task.MappedSourceRoots[1].ItemSpec);
116
Assert.Equal(
Utilities
.FixFilePath(
Utilities
.GetFullPathNoThrow(@"****\|||:;\")), task.MappedSourceRoots[2].ItemSpec);
160
new TaskItem(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\")),
161
new TaskItem(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\a\"), new Dictionary<string, string>
164
{ "ContainingRoot",
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\") },
166
new TaskItem(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\b\"), new Dictionary<string, string>
169
{ "ContainingRoot",
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\") },
171
new TaskItem(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\c\"), new Dictionary<string, string>
174
{ "ContainingRoot",
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\") },
186
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\")), task.MappedSourceRoots[0].ItemSpec);
189
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\a\")), task.MappedSourceRoots[1].ItemSpec);
192
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\b\")), task.MappedSourceRoots[2].ItemSpec);
195
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\c\")), task.MappedSourceRoots[3].ItemSpec);
211
new TaskItem(
Utilities
.FixFilePath(@"c:\packages\SourcePackage1\")),
212
new TaskItem(
Utilities
.FixFilePath(@"C:\packages\SourcePackage1\")),
213
new TaskItem(
Utilities
.FixFilePath(@"c:\packages\SourcePackage2\")),
224
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\packages\SourcePackage1\")), task.MappedSourceRoots[0].ItemSpec);
227
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"C:\packages\SourcePackage1\")), task.MappedSourceRoots[1].ItemSpec);
230
Assert.Equal(
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\packages\SourcePackage2\")), task.MappedSourceRoots[2].ItemSpec);
241
var path1 =
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\1\");
242
var path2 =
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\2\");
243
var path3 =
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\");
269
"MapSourceRoots.NoSuchTopLevelSourceRoot", "SourceRoot.ContainingRoot", "SourceRoot",
Utilities
.GetFullPathNoThrow(path2))) + Environment.NewLine +
271
"MapSourceRoots.NoSuchTopLevelSourceRoot", "SourceRoot.ContainingRoot", "SourceRoot",
Utilities
.GetFullPathNoThrow(path1))) + Environment.NewLine, engine.Log);
284
var path1 =
Utilities
.FixFilePath(@"c:\packages\SourcePackage1\");
285
var path2 =
Utilities
.FixFilePath(@"c:\packages\SourcePackage2\");
286
var path3 =
Utilities
.FixFilePath(@"c:\packages\SourcePackage3\");
330
"MapSourceRoots.ContainsDuplicate", "SourceRoot",
Utilities
.GetFullPathNoThrow(path1), "SourceControl", "git", "tfvc")) + Environment.NewLine +
332
"MapSourceRoots.ContainsDuplicate", "SourceRoot",
Utilities
.GetFullPathNoThrow(path1), "RevisionId", "RevId1", "RevId2")) + Environment.NewLine +
334
"MapSourceRoots.ContainsDuplicate", "SourceRoot",
Utilities
.GetFullPathNoThrow(path1), "NestedRoot", "NR1A", "NR1B")) + Environment.NewLine +
336
"MapSourceRoots.ContainsDuplicate", "SourceRoot",
Utilities
.GetFullPathNoThrow(path1), "ContainingRoot", path3, "CR")) + Environment.NewLine +
338
"MapSourceRoots.ContainsDuplicate", "SourceRoot",
Utilities
.GetFullPathNoThrow(path1), "MappedPath", "MP1", "MP2")) + Environment.NewLine +
340
"MapSourceRoots.ContainsDuplicate", "SourceRoot",
Utilities
.GetFullPathNoThrow(path1), "SourceLinkUrl", "URL1", "URL2")) + Environment.NewLine,
346
$"'{
Utilities
.GetFullPathNoThrow(path1)}' SourceControl='git' RevisionId='RevId1' NestedRoot='NR1A' ContainingRoot='{(deterministic ?
Utilities
.GetFullPathNoThrow(path3) : path3)}' MappedPath='{(deterministic ? "/_/NR1A/" :
Utilities
.GetFullPathNoThrow(path1))}' SourceLinkUrl='URL1'",
347
$"'{
Utilities
.GetFullPathNoThrow(path2)}' SourceControl='git' RevisionId='' NestedRoot='NR2' ContainingRoot='{(deterministic ?
Utilities
.GetFullPathNoThrow(path3) : path3)}' MappedPath='{(deterministic ? "/_/NR2/" :
Utilities
.GetFullPathNoThrow(path2))}' SourceLinkUrl=''",
348
$"'{
Utilities
.GetFullPathNoThrow(path3)}' SourceControl='' RevisionId='' NestedRoot='' ContainingRoot='' MappedPath='{(deterministic ? "/_/" :
Utilities
.GetFullPathNoThrow(path3))}' SourceLinkUrl=''",
364
new TaskItem(
Utilities
.FixFilePath(@"c:\MyProjects\MYPROJECT\")),
365
new TaskItem(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\b\"), new Dictionary<string, string>
369
{ "ContainingRoot",
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\") },
378
"MapSourceRoots.NoSuchTopLevelSourceRoot", "SourceRoot.ContainingRoot", "SourceRoot",
Utilities
.GetFullPathNoThrow(
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\")))) + Environment.NewLine, engine.Log);
420
var path1 =
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\b\");
451
$"'{
Utilities
.GetFullPathNoThrow(path1)}' SourceControl='' RevisionId='' NestedRoot='a/b' ContainingRoot='{(deterministic ?
Utilities
.GetFullPathNoThrow(path1) : path1)}' MappedPath='{
Utilities
.GetFullPathNoThrow(path1)}' SourceLinkUrl=''",
463
var originalPath1 =
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\b\..\c\");
464
var normalizedPath1 =
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\c\");
465
var originalPath2 =
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\b\..\c\d\..\e\");
466
var normalizedPath2 =
Utilities
.FixFilePath(@"c:\MyProjects\MyProject\a\c\e\");
486
var expectedMappedPath1 = deterministic ? "/_/" :
Utilities
.GetFullPathNoThrow(normalizedPath1);
488
var expectedContainingRoot = deterministic ?
Utilities
.GetFullPathNoThrow(normalizedPath1) : originalPath1;
489
var expectedMappedPath2 = deterministic ? "/_/e/" :
Utilities
.GetFullPathNoThrow(normalizedPath2);
494
'{
Utilities
.GetFullPathNoThrow(normalizedPath1)}' SourceControl='' RevisionId='' NestedRoot='' ContainingRoot='' MappedPath='{expectedMappedPath1}' SourceLinkUrl=''
495
'{
Utilities
.GetFullPathNoThrow(normalizedPath2)}' SourceControl='' RevisionId='' NestedRoot='{expectedNestedRoot}' ContainingRoot='{expectedContainingRoot}' MappedPath='{expectedMappedPath2}' SourceLinkUrl=''