forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script for generating a .sln containing all library projects (d…
…otnet#186) * Add a script for generating a .sln containing all library projects * Add a script for generating a .sln containing all library projects
- Loading branch information
1 parent
0d36b2f
commit da1b717
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Licensed to the .NET Foundation under one or more agreements. | ||
# The .NET Foundation licenses this file to you under the MIT license. | ||
# See the LICENSE file in the project root for more information. | ||
|
||
# Creates a .sln that includes all of the library src, ref, or tests projects. | ||
|
||
param ( | ||
[string]$type = "src" # can also be "ref" or "tests" | ||
) | ||
|
||
if (($type -ne "src") -and | ||
($type -ne "ref") -and | ||
($type -ne "tests")) | ||
{ | ||
Write-Host "Unsupported type '$($type)'. Must be 'src', 'ref', or 'tests'." | ||
exit | ||
} | ||
|
||
$SolutionName = "Libraries.$($type).Generated.sln" | ||
|
||
# Delete the existing solution if it exists | ||
if (Test-Path $SolutionName) | ||
{ | ||
Remove-Item $SolutionName | ||
} | ||
|
||
# Create the new solution | ||
dotnet new sln --name $([System.IO.Path]::GetFileNameWithoutExtension($SolutionName)) | ||
|
||
# Populate it with all *\$type\*.csproj projects | ||
foreach ($f in Get-ChildItem -Recurse -Path $([System.IO.Path]::Combine("*", $type)) -Filter *.csproj) | ||
{ | ||
dotnet sln $SolutionName add --in-root $f.FullName | ||
} | ||
|
||
if ($type -eq "src") | ||
{ | ||
# Also add CoreLib if this is for src projects | ||
dotnet sln $SolutionName add --in-root $f.FullName $([System.IO.Path]::Combine("..", "coreclr", "src", "System.Private.CoreLib", "System.Private.CoreLib.csproj")) | ||
} |