Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
3dc0506e
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3dc0506e
编写于
11月 21, 2016
作者:
J
Jared Parsons
提交者:
GitHub
11月 21, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15421 from jaredpar/fix-build
Extend RepoUtil so it can support our internal repo
上级
b998d23f
1c54f2cd
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
72 addition
and
33 deletion
+72
-33
build/Targets/Dependencies.props
build/Targets/Dependencies.props
+3
-0
build/ToolsetPackages/closed.project.json
build/ToolsetPackages/closed.project.json
+10
-0
src/Tools/RepoUtil/ChangeCommand.cs
src/Tools/RepoUtil/ChangeCommand.cs
+5
-3
src/Tools/RepoUtil/GenerateData.cs
src/Tools/RepoUtil/GenerateData.cs
+2
-2
src/Tools/RepoUtil/Program.cs
src/Tools/RepoUtil/Program.cs
+33
-11
src/Tools/RepoUtil/RepoData.cs
src/Tools/RepoUtil/RepoData.cs
+10
-10
src/Tools/RepoUtil/VerifyCommand.cs
src/Tools/RepoUtil/VerifyCommand.cs
+8
-6
src/Tools/RepoUtil/ViewCommand.cs
src/Tools/RepoUtil/ViewCommand.cs
+1
-1
未找到文件。
build/Targets/Dependencies.props
浏览文件 @
3dc0506e
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
<MicrosoftCodeAnalysisAnalyzersVersion>
1.1.0
</MicrosoftCodeAnalysisAnalyzersVersion>
<MicrosoftCodeAnalysisAnalyzersVersion>
1.1.0
</MicrosoftCodeAnalysisAnalyzersVersion>
<MicrosoftCompositionVersion>
1.0.27
</MicrosoftCompositionVersion>
<MicrosoftCompositionVersion>
1.0.27
</MicrosoftCompositionVersion>
<MicrosoftDiagnosticsRuntimeVersion>
0.8.31-beta
</MicrosoftDiagnosticsRuntimeVersion>
<MicrosoftDiagnosticsRuntimeVersion>
0.8.31-beta
</MicrosoftDiagnosticsRuntimeVersion>
<MicrosoftDiagnosticsTracingTraceEventVersion>
1.0.35
</MicrosoftDiagnosticsTracingTraceEventVersion>
<MicrosoftDiaSymReaderVersion>
1.1.0-beta1-60625-03
</MicrosoftDiaSymReaderVersion>
<MicrosoftDiaSymReaderVersion>
1.1.0-beta1-60625-03
</MicrosoftDiaSymReaderVersion>
<MicrosoftDiaSymReaderNativeVersion>
1.5.0-beta1
</MicrosoftDiaSymReaderNativeVersion>
<MicrosoftDiaSymReaderNativeVersion>
1.5.0-beta1
</MicrosoftDiaSymReaderNativeVersion>
<MicrosoftDiaSymReaderPortablePdbVersion>
1.2.0-beta1-60831-01
</MicrosoftDiaSymReaderPortablePdbVersion>
<MicrosoftDiaSymReaderPortablePdbVersion>
1.2.0-beta1-60831-01
</MicrosoftDiaSymReaderPortablePdbVersion>
...
@@ -32,8 +33,10 @@
...
@@ -32,8 +33,10 @@
<SystemDiagnosticsToolsVersion>
4.0.1
</SystemDiagnosticsToolsVersion>
<SystemDiagnosticsToolsVersion>
4.0.1
</SystemDiagnosticsToolsVersion>
<SystemDynamicRuntimeVersion>
4.0.11
</SystemDynamicRuntimeVersion>
<SystemDynamicRuntimeVersion>
4.0.11
</SystemDynamicRuntimeVersion>
<SystemGlobalizationVersion>
4.0.11
</SystemGlobalizationVersion>
<SystemGlobalizationVersion>
4.0.11
</SystemGlobalizationVersion>
<SystemIdentityModelTokensJwtVersion>
5.0.0
</SystemIdentityModelTokensJwtVersion>
<SystemIOVersion>
4.1.0
</SystemIOVersion>
<SystemIOVersion>
4.1.0
</SystemIOVersion>
<SystemIOCompressionVersion>
4.1.0
</SystemIOCompressionVersion>
<SystemIOCompressionVersion>
4.1.0
</SystemIOCompressionVersion>
<SystemIOCompressionZipFileVersion>
4.0.1
</SystemIOCompressionZipFileVersion>
<SystemIOFileSystemVersion>
4.0.1
</SystemIOFileSystemVersion>
<SystemIOFileSystemVersion>
4.0.1
</SystemIOFileSystemVersion>
<SystemIOFileSystemDriveInfoVersion>
4.0.0
</SystemIOFileSystemDriveInfoVersion>
<SystemIOFileSystemDriveInfoVersion>
4.0.0
</SystemIOFileSystemDriveInfoVersion>
<SystemIOFileSystemPrimitivesVersion>
4.0.1
</SystemIOFileSystemPrimitivesVersion>
<SystemIOFileSystemPrimitivesVersion>
4.0.1
</SystemIOFileSystemPrimitivesVersion>
...
...
build/ToolsetPackages/closed.project.json
0 → 100644
浏览文件 @
3dc0506e
{
"dependencies"
:
{
"Microsoft.Diagnostics.Tracing.TraceEvent"
:
"1.0.35"
,
"System.IdentityModel.Tokens.Jwt"
:
"5.0.0"
,
"System.IO.Compression.ZipFile"
:
"4.0.1"
},
"frameworks"
:
{
"net46"
:
{}
}
}
src/Tools/RepoUtil/ChangeCommand.cs
浏览文件 @
3dc0506e
...
@@ -17,10 +17,12 @@ namespace RepoUtil
...
@@ -17,10 +17,12 @@ namespace RepoUtil
internal
sealed
class
ChangeCommand
:
ICommand
internal
sealed
class
ChangeCommand
:
ICommand
{
{
private
readonly
RepoData
_repoData
;
private
readonly
RepoData
_repoData
;
private
readonly
string
_generateDirectory
;
internal
ChangeCommand
(
RepoData
repoData
)
internal
ChangeCommand
(
RepoData
repoData
,
string
generateDir
)
{
{
_repoData
=
repoData
;
_repoData
=
repoData
;
_generateDirectory
=
generateDir
;
}
}
public
bool
Run
(
TextWriter
writer
,
string
[]
args
)
public
bool
Run
(
TextWriter
writer
,
string
[]
args
)
...
@@ -183,7 +185,7 @@ private void ChangeAllCore(ImmutableDictionary<NuGetPackage, NuGetPackage> chang
...
@@ -183,7 +185,7 @@ private void ChangeAllCore(ImmutableDictionary<NuGetPackage, NuGetPackage> chang
private
void
ChangeProjectJsonFiles
(
ImmutableDictionary
<
NuGetPackage
,
NuGetPackage
>
changeMap
)
private
void
ChangeProjectJsonFiles
(
ImmutableDictionary
<
NuGetPackage
,
NuGetPackage
>
changeMap
)
{
{
Console
.
WriteLine
(
"Changing project.json files"
);
Console
.
WriteLine
(
"Changing project.json files"
);
foreach
(
var
filePath
in
ProjectJsonUtil
.
GetProjectJsonFiles
(
_repoData
.
Sources
Path
))
foreach
(
var
filePath
in
ProjectJsonUtil
.
GetProjectJsonFiles
(
_repoData
.
Sources
Directory
))
{
{
if
(
ProjectJsonUtil
.
ChangeDependencies
(
filePath
,
changeMap
))
if
(
ProjectJsonUtil
.
ChangeDependencies
(
filePath
,
changeMap
))
{
{
...
@@ -197,7 +199,7 @@ private void ChangeGeneratedFiles()
...
@@ -197,7 +199,7 @@ private void ChangeGeneratedFiles()
var
msbuildData
=
_repoData
.
RepoConfig
.
MSBuildGenerateData
;
var
msbuildData
=
_repoData
.
RepoConfig
.
MSBuildGenerateData
;
if
(
msbuildData
.
HasValue
)
if
(
msbuildData
.
HasValue
)
{
{
var
fileName
=
new
FileName
(
_
repoData
.
SourcesPath
,
msbuildData
.
Value
.
RelativeFileName
);
var
fileName
=
new
FileName
(
_
generateDirectory
,
msbuildData
.
Value
.
RelativeFilePath
);
var
packages
=
GenerateUtil
.
GetFilteredPackages
(
msbuildData
.
Value
,
_repoData
);
var
packages
=
GenerateUtil
.
GetFilteredPackages
(
msbuildData
.
Value
,
_repoData
);
GenerateUtil
.
WriteMSBuildContent
(
fileName
,
packages
);
GenerateUtil
.
WriteMSBuildContent
(
fileName
,
packages
);
}
}
...
...
src/Tools/RepoUtil/GenerateData.cs
浏览文件 @
3dc0506e
...
@@ -14,12 +14,12 @@ namespace RepoUtil
...
@@ -14,12 +14,12 @@ namespace RepoUtil
/// </summary>
/// </summary>
internal
struct
GenerateData
internal
struct
GenerateData
{
{
internal
string
RelativeFile
Name
{
get
;
}
internal
string
RelativeFile
Path
{
get
;
}
internal
ImmutableArray
<
Regex
>
Packages
{
get
;
}
internal
ImmutableArray
<
Regex
>
Packages
{
get
;
}
internal
GenerateData
(
string
relativeFileName
,
ImmutableArray
<
Regex
>
packages
)
internal
GenerateData
(
string
relativeFileName
,
ImmutableArray
<
Regex
>
packages
)
{
{
RelativeFile
Name
=
relativeFileName
;
RelativeFile
Path
=
relativeFileName
;
Packages
=
packages
;
Packages
=
packages
;
}
}
}
}
...
...
src/Tools/RepoUtil/Program.cs
浏览文件 @
3dc0506e
...
@@ -13,11 +13,12 @@ internal static class Program
...
@@ -13,11 +13,12 @@ internal static class Program
private
sealed
class
ParsedArgs
private
sealed
class
ParsedArgs
{
{
internal
string
RepoUtilDataPath
{
get
;
set
;
}
internal
string
RepoUtilDataPath
{
get
;
set
;
}
internal
string
SourcesPath
{
get
;
set
;
}
internal
string
SourcesDirectory
{
get
;
set
;
}
internal
string
GenerateDirectory
{
get
;
set
;
}
internal
string
[]
RemainingArgs
{
get
;
set
;
}
internal
string
[]
RemainingArgs
{
get
;
set
;
}
}
}
private
delegate
ICommand
CreateCommand
(
RepoConfig
repoConfig
,
string
sources
Path
);
private
delegate
ICommand
CreateCommand
(
RepoConfig
repoConfig
,
string
sources
Dir
,
string
generateDir
);
internal
static
int
Main
(
string
[]
args
)
internal
static
int
Main
(
string
[]
args
)
{
{
...
@@ -54,11 +55,12 @@ private static bool Run(string[] args)
...
@@ -54,11 +55,12 @@ private static bool Run(string[] args)
CreateCommand
func
;
CreateCommand
func
;
if
(!
TryParseCommandLine
(
args
,
out
parsedArgs
,
out
func
))
if
(!
TryParseCommandLine
(
args
,
out
parsedArgs
,
out
func
))
{
{
Usage
();
return
false
;
return
false
;
}
}
var
repoConfig
=
RepoConfig
.
ReadFrom
(
parsedArgs
.
RepoUtilDataPath
);
var
repoConfig
=
RepoConfig
.
ReadFrom
(
parsedArgs
.
RepoUtilDataPath
);
var
command
=
func
(
repoConfig
,
parsedArgs
.
Sources
Path
);
var
command
=
func
(
repoConfig
,
parsedArgs
.
Sources
Directory
,
parsedArgs
.
GenerateDirectory
);
if
(
command
.
Run
(
Console
.
Out
,
parsedArgs
.
RemainingArgs
))
if
(
command
.
Run
(
Console
.
Out
,
parsedArgs
.
RemainingArgs
))
{
{
return
true
;
return
true
;
...
@@ -89,8 +91,9 @@ private static bool TryParseCommandLine(string[] args, out ParsedArgs parsedArgs
...
@@ -89,8 +91,9 @@ private static bool TryParseCommandLine(string[] args, out ParsedArgs parsedArgs
return
false
;
return
false
;
}
}
parsedArgs
.
SourcesPath
=
parsedArgs
.
SourcesPath
??
GetDirectoryName
(
AppContext
.
BaseDirectory
,
5
);
parsedArgs
.
SourcesDirectory
=
parsedArgs
.
SourcesDirectory
??
GetDirectoryName
(
AppContext
.
BaseDirectory
,
5
);
parsedArgs
.
RepoUtilDataPath
=
parsedArgs
.
RepoUtilDataPath
??
Path
.
Combine
(
parsedArgs
.
SourcesPath
,
@"build\config\RepoUtilData.json"
);
parsedArgs
.
GenerateDirectory
=
parsedArgs
.
GenerateDirectory
??
parsedArgs
.
SourcesDirectory
;
parsedArgs
.
RepoUtilDataPath
=
parsedArgs
.
RepoUtilDataPath
??
Path
.
Combine
(
parsedArgs
.
SourcesDirectory
,
@"build\config\RepoUtilData.json"
);
parsedArgs
.
RemainingArgs
=
index
>=
args
.
Length
parsedArgs
.
RemainingArgs
=
index
>=
args
.
Length
?
Array
.
Empty
<
string
>()
?
Array
.
Empty
<
string
>()
:
args
.
Skip
(
index
).
ToArray
();
:
args
.
Skip
(
index
).
ToArray
();
...
@@ -124,7 +127,7 @@ private static bool TryParseCommon(string[] args, ref int index, ParsedArgs pars
...
@@ -124,7 +127,7 @@ private static bool TryParseCommon(string[] args, ref int index, ParsedArgs pars
{
{
if
(
index
<
args
.
Length
)
if
(
index
<
args
.
Length
)
{
{
parsedArgs
.
Sources
Path
=
args
[
index
];
parsedArgs
.
Sources
Directory
=
args
[
index
];
index
++;
index
++;
}
}
else
else
...
@@ -134,6 +137,20 @@ private static bool TryParseCommon(string[] args, ref int index, ParsedArgs pars
...
@@ -134,6 +137,20 @@ private static bool TryParseCommon(string[] args, ref int index, ParsedArgs pars
}
}
break
;
break
;
}
}
case
"-generatepath"
:
{
if
(
index
<
args
.
Length
)
{
parsedArgs
.
GenerateDirectory
=
args
[
index
];
index
++;
}
else
{
Console
.
WriteLine
(
$"The -generatePath switch needs a value"
);
return
false
;
}
break
;
}
case
"-config"
:
case
"-config"
:
{
{
if
(
index
<
args
.
Length
)
if
(
index
<
args
.
Length
)
...
@@ -171,19 +188,19 @@ private static bool TryParseCommand(string[] args, ref int index, out CreateComm
...
@@ -171,19 +188,19 @@ private static bool TryParseCommand(string[] args, ref int index, out CreateComm
switch
(
name
)
switch
(
name
)
{
{
case
"verify"
:
case
"verify"
:
func
=
(
c
,
s
)
=>
new
VerifyCommand
(
c
,
s
);
func
=
(
c
,
s
,
g
)
=>
new
VerifyCommand
(
c
,
s
,
g
);
break
;
break
;
case
"view"
:
case
"view"
:
func
=
(
c
,
s
)
=>
new
ViewCommand
(
c
,
s
);
func
=
(
c
,
s
,
g
)
=>
new
ViewCommand
(
c
,
s
);
break
;
break
;
case
"consumes"
:
case
"consumes"
:
func
=
(
c
,
s
)
=>
new
ConsumesCommand
(
RepoData
.
Create
(
c
,
s
));
func
=
(
c
,
s
,
g
)
=>
new
ConsumesCommand
(
RepoData
.
Create
(
c
,
s
));
break
;
break
;
case
"change"
:
case
"change"
:
func
=
(
c
,
s
)
=>
new
ChangeCommand
(
RepoData
.
Create
(
c
,
s
)
);
func
=
(
c
,
s
,
g
)
=>
new
ChangeCommand
(
RepoData
.
Create
(
c
,
s
),
g
);
break
;
break
;
case
"produces"
:
case
"produces"
:
func
=
(
c
,
s
)
=>
new
ProducesCommand
(
c
,
s
);
func
=
(
c
,
s
,
g
)
=>
new
ProducesCommand
(
c
,
s
);
break
;
break
;
default
:
default
:
Console
.
Write
(
$"Command
{
name
}
is not recognized"
);
Console
.
Write
(
$"Command
{
name
}
is not recognized"
);
...
@@ -193,5 +210,10 @@ private static bool TryParseCommand(string[] args, ref int index, out CreateComm
...
@@ -193,5 +210,10 @@ private static bool TryParseCommand(string[] args, ref int index, out CreateComm
index
++;
index
++;
return
true
;
return
true
;
}
}
private
static
void
Usage
()
{
Console
.
WriteLine
(
"RepoUtil [-sourcesPath <sources path>] [-generatePath <generate path>] [-config <config path>] [verify|view|consumes|change|produces]"
);
}
}
}
}
}
src/Tools/RepoUtil/RepoData.cs
浏览文件 @
3dc0506e
...
@@ -12,7 +12,7 @@ namespace RepoUtil
...
@@ -12,7 +12,7 @@ namespace RepoUtil
{
{
internal
sealed
class
RepoData
internal
sealed
class
RepoData
{
{
internal
string
Sources
Path
{
get
;
}
internal
string
Sources
Directory
{
get
;
}
internal
RepoConfig
RepoConfig
{
get
;
}
internal
RepoConfig
RepoConfig
{
get
;
}
internal
ImmutableArray
<
NuGetFeed
>
NuGetFeeds
{
get
;
}
internal
ImmutableArray
<
NuGetFeed
>
NuGetFeeds
{
get
;
}
internal
ImmutableArray
<
NuGetPackage
>
FloatingBuildPackages
{
get
;
}
internal
ImmutableArray
<
NuGetPackage
>
FloatingBuildPackages
{
get
;
}
...
@@ -21,9 +21,9 @@ internal sealed class RepoData
...
@@ -21,9 +21,9 @@ internal sealed class RepoData
internal
ImmutableArray
<
NuGetPackage
>
FixedPackages
=>
RepoConfig
.
FixedPackages
;
internal
ImmutableArray
<
NuGetPackage
>
FixedPackages
=>
RepoConfig
.
FixedPackages
;
internal
ImmutableArray
<
NuGetPackage
>
AllPackages
{
get
;
}
internal
ImmutableArray
<
NuGetPackage
>
AllPackages
{
get
;
}
private
RepoData
(
RepoConfig
config
,
string
sources
Path
,
IEnumerable
<
NuGetFeed
>
nugetFeeds
,
IEnumerable
<
NuGetPackage
>
floatingPackages
)
private
RepoData
(
RepoConfig
config
,
string
sources
Dir
,
IEnumerable
<
NuGetFeed
>
nugetFeeds
,
IEnumerable
<
NuGetPackage
>
floatingPackages
)
{
{
Sources
Path
=
sourcesPath
;
Sources
Directory
=
sourcesDir
;
RepoConfig
=
config
;
RepoConfig
=
config
;
NuGetFeeds
=
nugetFeeds
.
ToImmutableArray
();
NuGetFeeds
=
nugetFeeds
.
ToImmutableArray
();
FloatingToolsetPackages
=
floatingPackages
FloatingToolsetPackages
=
floatingPackages
...
@@ -56,10 +56,10 @@ private static ImmutableArray<NuGetPackage> Combine(params ImmutableArray<NuGetP
...
@@ -56,10 +56,10 @@ private static ImmutableArray<NuGetPackage> Combine(params ImmutableArray<NuGetP
/// state of the repo and add in the current data. If any conflicting package definitions are detected this method
/// state of the repo and add in the current data. If any conflicting package definitions are detected this method
/// will throw.
/// will throw.
/// </summary>
/// </summary>
internal
static
RepoData
Create
(
RepoConfig
config
,
string
sources
Path
)
internal
static
RepoData
Create
(
RepoConfig
config
,
string
sources
Dir
)
{
{
List
<
NuGetPackageConflict
>
conflicts
;
List
<
NuGetPackageConflict
>
conflicts
;
var
repoData
=
Create
(
config
,
sources
Path
,
out
conflicts
);
var
repoData
=
Create
(
config
,
sources
Dir
,
out
conflicts
);
if
(
conflicts
?.
Count
>
0
)
if
(
conflicts
?.
Count
>
0
)
{
{
throw
new
ConflictingPackagesException
(
conflicts
);
throw
new
ConflictingPackagesException
(
conflicts
);
...
@@ -68,10 +68,10 @@ internal static RepoData Create(RepoConfig config, string sourcesPath)
...
@@ -68,10 +68,10 @@ internal static RepoData Create(RepoConfig config, string sourcesPath)
return
repoData
;
return
repoData
;
}
}
internal
static
RepoData
Create
(
RepoConfig
config
,
string
sources
Path
,
out
List
<
NuGetPackageConflict
>
conflicts
)
internal
static
RepoData
Create
(
RepoConfig
config
,
string
sources
Dir
,
out
List
<
NuGetPackageConflict
>
conflicts
)
{
{
var
nugetFeeds
=
new
List
<
NuGetFeed
>();
var
nugetFeeds
=
new
List
<
NuGetFeed
>();
foreach
(
var
nugetConfig
in
NuGetConfigUtil
.
GetNuGetConfigFiles
(
sources
Path
))
foreach
(
var
nugetConfig
in
NuGetConfigUtil
.
GetNuGetConfigFiles
(
sources
Dir
))
{
{
var
nugetFeed
=
NuGetConfigUtil
.
GetNuGetFeeds
(
nugetConfig
);
var
nugetFeed
=
NuGetConfigUtil
.
GetNuGetFeeds
(
nugetConfig
);
nugetFeeds
.
AddRange
(
nugetFeed
);
nugetFeeds
.
AddRange
(
nugetFeed
);
...
@@ -81,14 +81,14 @@ internal static RepoData Create(RepoConfig config, string sourcesPath, out List<
...
@@ -81,14 +81,14 @@ internal static RepoData Create(RepoConfig config, string sourcesPath, out List<
var
fixedPackageSet
=
new
HashSet
<
NuGetPackage
>(
config
.
FixedPackages
,
default
(
Constants
.
IgnoreGenerateNameComparer
));
var
fixedPackageSet
=
new
HashSet
<
NuGetPackage
>(
config
.
FixedPackages
,
default
(
Constants
.
IgnoreGenerateNameComparer
));
var
floatingPackageMap
=
new
Dictionary
<
string
,
NuGetPackageSource
>(
Constants
.
NugetPackageNameComparer
);
var
floatingPackageMap
=
new
Dictionary
<
string
,
NuGetPackageSource
>(
Constants
.
NugetPackageNameComparer
);
foreach
(
var
filePath
in
ProjectJsonUtil
.
GetProjectJsonFiles
(
sources
Path
))
foreach
(
var
filePath
in
ProjectJsonUtil
.
GetProjectJsonFiles
(
sources
Dir
))
{
{
if
(
config
.
ProjectJsonExcludes
.
Any
(
x
=>
x
.
IsMatch
(
filePath
)))
if
(
config
.
ProjectJsonExcludes
.
Any
(
x
=>
x
.
IsMatch
(
filePath
)))
{
{
continue
;
continue
;
}
}
var
fileName
=
FileName
.
FromFullPath
(
sources
Path
,
filePath
);
var
fileName
=
FileName
.
FromFullPath
(
sources
Dir
,
filePath
);
foreach
(
var
package
in
ProjectJsonUtil
.
GetDependencies
(
filePath
))
foreach
(
var
package
in
ProjectJsonUtil
.
GetDependencies
(
filePath
))
{
{
if
(
fixedPackageSet
.
Contains
(
package
))
if
(
fixedPackageSet
.
Contains
(
package
))
...
@@ -116,7 +116,7 @@ internal static RepoData Create(RepoConfig config, string sourcesPath, out List<
...
@@ -116,7 +116,7 @@ internal static RepoData Create(RepoConfig config, string sourcesPath, out List<
}
}
}
}
return
new
RepoData
(
config
,
sources
Path
,
nugetFeeds
,
floatingPackageMap
.
Values
.
Select
(
x
=>
x
.
NuGetPackage
));
return
new
RepoData
(
config
,
sources
Dir
,
nugetFeeds
,
floatingPackageMap
.
Values
.
Select
(
x
=>
x
.
NuGetPackage
));
}
}
}
}
}
}
src/Tools/RepoUtil/VerifyCommand.cs
浏览文件 @
3dc0506e
...
@@ -14,13 +14,15 @@ namespace RepoUtil
...
@@ -14,13 +14,15 @@ namespace RepoUtil
/// </summary>
/// </summary>
internal
sealed
class
VerifyCommand
:
ICommand
internal
sealed
class
VerifyCommand
:
ICommand
{
{
private
readonly
string
_sourcesPath
;
private
readonly
string
_sourcesDirectory
;
private
readonly
string
_generateDirectory
;
private
readonly
RepoConfig
_repoConfig
;
private
readonly
RepoConfig
_repoConfig
;
internal
VerifyCommand
(
RepoConfig
repoConfig
,
string
sources
Path
)
internal
VerifyCommand
(
RepoConfig
repoConfig
,
string
sources
Dir
,
string
generateDir
)
{
{
_repoConfig
=
repoConfig
;
_repoConfig
=
repoConfig
;
_sourcesPath
=
sourcesPath
;
_sourcesDirectory
=
sourcesDir
;
_generateDirectory
=
generateDir
;
}
}
public
bool
Run
(
TextWriter
writer
,
string
[]
args
)
public
bool
Run
(
TextWriter
writer
,
string
[]
args
)
...
@@ -46,7 +48,7 @@ private bool VerifyProjectJsonContents(TextWriter writer, out RepoData repoData)
...
@@ -46,7 +48,7 @@ private bool VerifyProjectJsonContents(TextWriter writer, out RepoData repoData)
writer
.
WriteLine
(
$"Verifying project.json contents"
);
writer
.
WriteLine
(
$"Verifying project.json contents"
);
List
<
NuGetPackageConflict
>
conflicts
;
List
<
NuGetPackageConflict
>
conflicts
;
repoData
=
RepoData
.
Create
(
_repoConfig
,
_sources
Path
,
out
conflicts
);
repoData
=
RepoData
.
Create
(
_repoConfig
,
_sources
Directory
,
out
conflicts
);
if
(
conflicts
?.
Count
>
0
)
if
(
conflicts
?.
Count
>
0
)
{
{
foreach
(
var
conflict
in
conflicts
)
foreach
(
var
conflict
in
conflicts
)
...
@@ -72,7 +74,7 @@ private bool VerifyRepoConfig(TextWriter writer)
...
@@ -72,7 +74,7 @@ private bool VerifyRepoConfig(TextWriter writer)
{
{
writer
.
WriteLine
(
$"Verifying RepoData.json"
);
writer
.
WriteLine
(
$"Verifying RepoData.json"
);
var
packages
=
ProjectJsonUtil
var
packages
=
ProjectJsonUtil
.
GetProjectJsonFiles
(
_sources
Path
)
.
GetProjectJsonFiles
(
_sources
Directory
)
.
SelectMany
(
x
=>
ProjectJsonUtil
.
GetDependencies
(
x
));
.
SelectMany
(
x
=>
ProjectJsonUtil
.
GetDependencies
(
x
));
var
set
=
new
HashSet
<
NuGetPackage
>(
packages
,
default
(
Constants
.
IgnoreGenerateNameComparer
));
var
set
=
new
HashSet
<
NuGetPackage
>(
packages
,
default
(
Constants
.
IgnoreGenerateNameComparer
));
var
allGood
=
true
;
var
allGood
=
true
;
...
@@ -99,7 +101,7 @@ private bool VerifyGeneratedFiles(TextWriter writer, RepoData repoData)
...
@@ -99,7 +101,7 @@ private bool VerifyGeneratedFiles(TextWriter writer, RepoData repoData)
var
packages
=
GenerateUtil
.
GetFilteredPackages
(
data
,
repoData
);
var
packages
=
GenerateUtil
.
GetFilteredPackages
(
data
,
repoData
);
// Need to verify the contents of the generated file are correct.
// Need to verify the contents of the generated file are correct.
var
fileName
=
new
FileName
(
_
sourcesPath
,
data
.
RelativeFileName
);
var
fileName
=
new
FileName
(
_
generateDirectory
,
data
.
RelativeFilePath
);
var
actualContent
=
File
.
ReadAllText
(
fileName
.
FullPath
,
GenerateUtil
.
Encoding
);
var
actualContent
=
File
.
ReadAllText
(
fileName
.
FullPath
,
GenerateUtil
.
Encoding
);
var
expectedContent
=
GenerateUtil
.
GenerateMSBuildContent
(
packages
);
var
expectedContent
=
GenerateUtil
.
GenerateMSBuildContent
(
packages
);
if
(
actualContent
!=
expectedContent
)
if
(
actualContent
!=
expectedContent
)
...
...
src/Tools/RepoUtil/ViewCommand.cs
浏览文件 @
3dc0506e
...
@@ -131,7 +131,7 @@ private bool VerifyGeneratedFiles(TextWriter writer, RepoData repoData)
...
@@ -131,7 +131,7 @@ private bool VerifyGeneratedFiles(TextWriter writer, RepoData repoData)
var
packages
=
GenerateUtil
.
GetFilteredPackages
(
data
,
repoData
);
var
packages
=
GenerateUtil
.
GetFilteredPackages
(
data
,
repoData
);
// Need to verify the contents of the generated file are correct.
// Need to verify the contents of the generated file are correct.
var
fileName
=
new
FileName
(
_sourcesPath
,
data
.
RelativeFile
Name
);
var
fileName
=
new
FileName
(
_sourcesPath
,
data
.
RelativeFile
Path
);
var
actualContent
=
File
.
ReadAllText
(
fileName
.
FullPath
,
GenerateUtil
.
Encoding
);
var
actualContent
=
File
.
ReadAllText
(
fileName
.
FullPath
,
GenerateUtil
.
Encoding
);
var
expectedContent
=
GenerateUtil
.
GenerateMSBuildContent
(
packages
);
var
expectedContent
=
GenerateUtil
.
GenerateMSBuildContent
(
packages
);
if
(
actualContent
!=
expectedContent
)
if
(
actualContent
!=
expectedContent
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录