Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
29 changes: 4 additions & 25 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ Fix steps:

# publish netcoreapp2.0 reference assemblies
try {
Push-Location "$PSScriptRoot/src/TypeCatalogGen"
$refAssemblies = Get-Content -Path $incFileName | Where-Object { $_ -like "*microsoft.netcore.app*" } | ForEach-Object { $_.TrimEnd(';') }
Push-Location "$PSScriptRoot/src/Microsoft.PowerShell.SDK/gen"
$refAssemblies = Get-Content -Path "RefAssemblyList.inc" | Where-Object { $_ -like "*microsoft.netcore.app*" } | ForEach-Object { $_.TrimEnd(';') }
$refDestFolder = Join-Path -Path $publishPath -ChildPath "ref"

if (Test-Path $refDestFolder -PathType Container) {
Expand Down Expand Up @@ -1715,33 +1715,12 @@ function Start-TypeGen
# Add .NET CLI tools to PATH
Find-Dotnet

$GetDependenciesTargetPath = "$PSScriptRoot/src/Microsoft.PowerShell.SDK/obj/Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets"
$GetDependenciesTargetValue = @'
<Project>
<Target Name="_GetDependencies"
DependsOnTargets="ResolveAssemblyReferencesDesignTime">
<ItemGroup>
<_RefAssemblyPath Include="%(_ReferencesFromRAR.ResolvedPath)%3B" Condition=" '%(_ReferencesFromRAR.Type)' == 'assembly' And '%(_ReferencesFromRAR.PackageName)' != 'Microsoft.Management.Infrastructure' " />
</ItemGroup>
<WriteLinesToFile File="$(_DependencyFile)" Lines="@(_RefAssemblyPath)" Overwrite="true" />
</Target>
</Project>
'@
Set-Content -Path $GetDependenciesTargetPath -Value $GetDependenciesTargetValue -Force -Encoding Ascii

Push-Location "$PSScriptRoot/src/Microsoft.PowerShell.SDK"
try {
$ps_inc_file = "$PSScriptRoot/src/TypeCatalogGen/$IncFileName"
dotnet msbuild .\Microsoft.PowerShell.SDK.csproj /t:_GetDependencies "/property:DesignTimeBuild=true;_DependencyFile=$ps_inc_file" /nologo
} finally {
Pop-Location
}

Push-Location "$PSScriptRoot/src/TypeCatalogGen"
try {
dotnet run ../System.Management.Automation/CoreCLR/CorePsTypeCatalog.cs $IncFileName
dotnet msbuild .\Microsoft.PowerShell.SDK.csproj /t:"Clean;TypeCatalogGen" "/property:DesignTimeBuild=true"
} finally {
Pop-Location
log "Finish Start-TypeGen"
}
}

Expand Down
50 changes: 50 additions & 0 deletions src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,54 @@
<PackageReference Include="Microsoft.NETCore.Windows.ApiSets" Version="1.0.1" />
</ItemGroup>

<!-- TypeCatalogGen properties -->
<PropertyGroup>
<RefAssemblyRelPath>gen</RefAssemblyRelPath>
<RefAssemblyFileName>RefAssemblyList.inc</RefAssemblyFileName>
<RefAssemblyDirPath>$(MSBuildProjectDirectory)\$(RefAssemblyRelPath)</RefAssemblyDirPath>
<RefAssemblyFilePath>$(RefAssemblyDirPath)\$(RefAssemblyFileName)</RefAssemblyFilePath>

<CorePsTypeCatalogFilePath>$(MSBuildProjectDirectory)\..\Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs</CorePsTypeCatalogFilePath>
<TypeCatalogProjectFilePath>$(MSBuildProjectDirectory)\..\TypeCatalogGen\TypeCatalogGen.csproj</TypeCatalogProjectFilePath>
</PropertyGroup>

<!-- Create file with Assembly Reference list -->
<Target Name="ResolveAssemblyReferencesDesignTimeSDK"
DependsOnTargets="ResolveAssemblyReferencesDesignTime"
Condition=" '$(DesignTimeBuild)' == 'true' ">

<MakeDir Directories="$(RefAssemblyRelPath)" Condition=" !Exists('$(RefAssemblyRelPath)') "/>

<ItemGroup>
<_RefAssemblyPath Include="%(_ReferencesFromRAR.ResolvedPath)%3B" Condition=" '%(_ReferencesFromRAR.Type)' == 'assembly' And '%(_ReferencesFromRAR.PackageName)' != 'Microsoft.Management.Infrastructure' " />
</ItemGroup>

<ReadLinesFromFile
File="$(RefAssemblyFilePath)" >
<Output
TaskParameter="Lines"
ItemName="ItemsFromFile"/>
</ReadLinesFromFile>

<WriteLinesToFile
Condition=" @(ItemsFromFile) != @(_RefAssemblyPath) "
File="$(RefAssemblyFilePath)"
Lines="@(_RefAssemblyPath)" Overwrite="true" />
</Target>

<!-- Used in standard Clean target -->
<ItemGroup>
<Clean Include="$(RefAssemblyDirPath)\**"/>
</ItemGroup>

<Target Name="TypeCatalogGen"
DependsOnTargets="ResolveAssemblyReferencesDesignTimeSDK"
Condition=" '$(DesignTimeBuild)' == 'true' "
Inputs="$(RefAssemblyFilePath)"
Outputs="$(CorePsTypeCatalogFilePath)">

<Message Text="Project File Name" />
<Exec Command="dotnet run --project $(TypeCatalogProjectFilePath) $(CorePsTypeCatalogFilePath) $(RefAssemblyFilePath) "/>
</Target>

</Project>