Skip to content
This repository was archived by the owner on May 2, 2024. It is now read-only.

Allow for per-leg packaging and add osx-x64 package #138

Merged
merged 7 commits into from
Mar 29, 2023
Merged
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
83 changes: 77 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
<Project>
<PropertyGroup Label="CalculateTargetOS">
<_hostOS>Linux</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">OSX</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('FREEBSD'))">FreeBSD</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('NETBSD'))">NetBSD</_hostOS>
<_hostOS>linux</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('OSX'))">osx</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('FREEBSD'))">freebsd</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('NETBSD'))">netbsd</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('ILLUMOS'))">illumos</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('SOLARIS'))">Solaris</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('SOLARIS'))">solaris</_hostOS>
<_hostOS Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">windows</_hostOS>
<HostOS>$(_hostOS)</HostOS>
<TargetOS Condition="'$(TargetOS)' == ''">$(_hostOS)</TargetOS>

<_hostRid Condition="'$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</_hostRid>
<_hostRid Condition="'$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</_hostRid>
<_parseDistroRid>$(__DistroRid)</_parseDistroRid>
<_parseDistroRid Condition="'$(_parseDistroRid)' == ''">$(_hostRid)</_parseDistroRid>
<_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex>

<_runtimeOS Condition="'$(_runtimeOS)' == ''">$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</_runtimeOS>

<_portableOS>linux</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'linux-musl' or $(_runtimeOS.StartsWith('alpine'))">linux-musl</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'linux-bionic'">linux-bionic</_portableOS>
<_portableOS Condition="'$(_hostOS)' == 'osx'">osx</_portableOS>
<_portableOS Condition="$(_runtimeOS.StartsWith('win')) or '$(TargetOS)' == 'windows'">win</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'freebsd' or '$(TargetOS)' == 'freebsd'">freebsd</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'illumos' or '$(TargetOS)' == 'illumos'">illumos</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'solaris' or '$(TargetOS)' == 'solaris'">solaris</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'maccatalyst'">maccatalyst</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'ios'">ios</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'iossimulator'">iossimulator</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'tvos'">tvos</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'tvossimulator'">tvossimulator</_portableOS>
<_portableOS Condition="'$(_runtimeOS)' == 'android'">android</_portableOS>

<_runtimeOS>$(_portableOS)</_runtimeOS>
</PropertyGroup>

<PropertyGroup Label="CalculateArch">
Expand All @@ -27,6 +52,52 @@
<Platform Condition="'$(Platform)' == '' and '$(InferPlatformFromTargetArchitecture)' == 'true'">$(TargetArchitecture)</Platform>
</PropertyGroup>

<PropertyGroup>
<_packageLibc Condition="$(TargetOS.Contains('musl'))">-musl</_packageLibc>
<_packageOS>$(_portableOS)$(_packageLibc)</_packageOS>
<PackageRID>$(_packageOS)-$(TargetArchitecture)</PackageRID>
<OutputRid Condition="'$(OutputRid)' == '' and '$(DotNetBuildFromSource)' == 'true'">$(_hostRid)</OutputRid>
<OutputRid Condition="'$(OutputRid)' == ''">$(PackageRID)</OutputRid>
<OutputRid Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture)</OutputRid>
</PropertyGroup>

<PropertyGroup>
<StaticLibPrefix>lib</StaticLibPrefix>
<ExeSuffix Condition="'$(HostOS)' == 'windows'">.exe</ExeSuffix>
</PropertyGroup>

<!-- Add path globs specific to native binaries to exclude unnecessary files from packages. -->
<Choose>
<When Condition="'$(TargetOS)' == 'windows'">
<PropertyGroup>
<LibSuffix>.dll</LibSuffix>
<StaticLibSuffix>.lib</StaticLibSuffix>
<SymbolsSuffix>.pdb</SymbolsSuffix>
</PropertyGroup>
</When>
<When Condition="'$(TargetOS)' == 'OSX'">
<PropertyGroup>
<LibPrefix>lib</LibPrefix>
<LibSuffix>.dylib</LibSuffix>
<StaticLibSuffix>.a</StaticLibSuffix>
<SymbolsSuffix>.dwarf</SymbolsSuffix>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<LibPrefix>lib</LibPrefix>
<LibSuffix>.so</LibSuffix>
<StaticLibSuffix>.a</StaticLibSuffix>
<SymbolsSuffix>.dbg</SymbolsSuffix>
</PropertyGroup>
</Otherwise>
</Choose>

<ItemGroup>
<AdditionalLibPackageExcludes Condition="'$(SymbolsSuffix)' != ''" Include="%2A%2A\%2A$(SymbolsSuffix)" />
<AdditionalSymbolPackageExcludes Condition="'$(LibSuffix)' != ''" Include="%2A%2A\%2A.a;%2A%2A\%2A$(LibSuffix)" />
</ItemGroup>

<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<PropertyGroup>
Expand All @@ -36,7 +107,7 @@
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<LangVersion>Latest</LangVersion>
<IsPackable>true</IsPackable>
<IsShipping>false</IsShipping>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration>

Expand Down
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
setlocal

set PATH=%CD%\src\msquic\artifacts\dotnet-tools;%PATH%
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -warnAsError:$false -restore -pack %*"
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -warnAsError:$false -build -restore -pack %*"
exit /b %ErrorLevel%
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
export PATH=$PATH:$scriptroot/src/msquic/artifacts/dotnet-tools
"$scriptroot/eng/common/build.sh" --warnAsError false --build --restore $@
"$scriptroot/eng/common/build.sh" --warnAsError false --build --restore --pack $@
2 changes: 1 addition & 1 deletion eng/Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<ItemGroup>
<ProjectToBuild Include="$(RepoRoot)src\System.Net.MsQuic.Transport\System.Net.MsQuic.Transport.csproj" />
<ProjectToBuild Include="$(RepoRoot)src\System.Net.MsQuic.Transport\System.Net.MsQuic.Transport.proj" />
</ItemGroup>
</Project>
26 changes: 0 additions & 26 deletions src/System.Net.MsQuic.Transport/System.Net.MsQuic.Transport.csproj

This file was deleted.

34 changes: 34 additions & 0 deletions src/System.Net.MsQuic.Transport/System.Net.MsQuic.Transport.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeBuildOutput>true</IncludeBuildOutput>
<IsPackable>false</IsPackable>
<IsPackable Condition="'$(OutputRid)' == 'win-x64'">true</IsPackable>
<SuppressDependenciesWhenPacking>false</SuppressDependenciesWhenPacking>
<NoTargetsDoNotReferenceOutputAssemblies>false</NoTargetsDoNotReferenceOutputAssemblies>
<!-- This is a meta package and doesn't contain any libs. -->
<NoWarn>$(NoWarn);NU5128</NoWarn>
</PropertyGroup>

<ItemGroup>
<!-- Make the runtime specific packages non transitive so that they aren't flowing into other projects. -->
<ProjectReference Include="$(MSBuildThisFileDirectory)\pkg\*.proj" Exclude="$(MSBuildProjectFile)" BuildReference="false" />
</ItemGroup>

<PropertyGroup>
<ExtraMsquicArgs Condition="'$(TargetOS)' == 'Linux' and ('$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'arm64')">$(ExtraMsquicArgs) -SysRoot /crossrootfs/$(TargetArchitecture)</ExtraMsquicArgs>
</PropertyGroup>

<Target Name="Build-native" BeforeTargets="Build">
<Exec IgnoreStandardErrorWarningFormat="true"
Command="pwsh scripts/build.ps1 -Config $(Configuration) -Arch $(TargetArchitecture) $(ExtraMsquicArgs) -UseSystemOpenSSLCrypto -DisableTools -DisableTest -DisablePerf"
WorkingDirectory="../msquic"/>
</Target>

<Target Name="PackRidSpecificPackages"
AfterTargets="Pack">
<MSBuild Targets="Pack"
Projects="@(ProjectReference)"
Properties="$(TraversalGlobalProperties)" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<TargetRid>linux-arm</TargetRid>
</PropertyGroup>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<TargetRid>linux-arm64</TargetRid>
</PropertyGroup>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<TargetRid>linux-x64</TargetRid>
</PropertyGroup>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
</Project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
<TargetFramework>netstandard2.0</TargetFramework>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<!-- IncludeBuildOutput needs to be set to true to make NuGet include the passed in debug symbol files. -->
<IncludeBuildOutput>true</IncludeBuildOutput>
<IsPackable>true</IsPackable>
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>$(SymbolsSuffix)</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>
<IsPackable>false</IsPackable>
<IsPackable Condition="'$(OutputRid)' == '$(TargetRid)'">true</IsPackable>
<IncludeSymbols>true</IncludeSymbols>
<!-- When KeepNativeSymbols is set, debug symbols are kept in the .so files. Separate symbol files do not exist that need to be packed. -->
<!-- We don't strip symbols out of elf/macho images. -->
<KeepNativeSymbols Condition="'$(TargetOS)' != 'Windows'">true</KeepNativeSymbols>
<TargetsForTfmSpecificDebugSymbolsInPackage Condition="'$(KeepNativeSymbols)' != 'true'">$(TargetsForTfmSpecificDebugSymbolsInPackage);AddRuntimeSpecificNativeSymbolToPackage</TargetsForTfmSpecificDebugSymbolsInPackage>
<UseRuntimePackageDisclaimer>true</UseRuntimePackageDisclaimer>
<AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>$(SymbolsSuffix)</AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder>
<!-- This is a native package and doesn't contain any ref/lib assets. -->
<NoWarn>$(NoWarn);NU5128</NoWarn>
<!-- Need to figure different configs -->
<TlsFlavor>openssl</TlsFlavor>
<TlsFlavor Condition="'$(TargetOS)' == 'Windows'">schannel</TlsFlavor>
<OsFolder>$(TargetOS)</OsFolder>
<OsFolder Condition="'$(TargetOS)' == 'osx'">macos</OsFolder>
<NativeBinDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'msquic', 'artifacts', 'bin', '$(OsFolder)', '$(TargetArchitecture)_$(Configuration)_$(TlsFlavor)'))</NativeBinDir>
</PropertyGroup>

<ItemGroup>
<None Include="$(NativeBinDir)$(LibPrefix)System.Net.MsQuic.Transport.Native$(LibSuffix)"
PackagePath="runtimes/$(OutputRid)/native"
<None Include="$(NativeBinDir)$(LibPrefix)msquic$(LibSuffix)"
PackagePath="runtimes/$(TargetRid)/native"
Pack="true" />
</ItemGroup>

<Target Name="AddRuntimeSpecificNativeSymbolToPackage">
<PropertyGroup>
<_SymbolFilePath>$([MSBuild]::NormalizePath('$(NativeBinDir)', '$(LibPrefix)msquic$(SymbolsSuffix)'))</_SymbolFilePath>
</PropertyGroup>

<Error Condition="!Exists('$(_SymbolFilePath)') and '$(KeepNativeSymbols)' != 'true'"
Text="Detached symbol file to package not found at: $(_SymbolFilePath)"/>

<ItemGroup>
<TfmSpecificDebugSymbolsFile Include="$(NativeBinDir)$(LibPrefix)System.Net.MsQuic.Transport.Native$(LibSuffix)$(SymbolsSuffix)"
TargetPath="/runtimes/$(OutputRid)/native"
<TfmSpecificDebugSymbolsFile Include="$(NativeBinDir)$(LibPrefix)msquic$(SymbolsSuffix)"
TargetPath="/runtimes/$(TargetRid)/native"
TargetFramework="$(TargetFramework)" />
</ItemGroup>
</Target>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<TargetRid>osx-x64</TargetRid>
</PropertyGroup>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
<PropertyGroup>
<!-- This is a native package, where package baseline validation doesn't really make much sense -->
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
<TargetRid>win-arm64</TargetRid>
</PropertyGroup>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
<PropertyGroup>
<!-- This is a native package, where package baseline validation doesn't really make much sense -->
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
<TargetRid>win-x64</TargetRid>
</PropertyGroup>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
<PropertyGroup>
<!-- This is a native package, where package baseline validation doesn't really make much sense -->
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
<TargetRid>win-x86</TargetRid>
</PropertyGroup>
<Import Project="runtime.native.System.Net.MsQuic.Transport.props" />
</Project>