aspnetcore/build/repo.targets

139 lines
6.9 KiB
XML

<Project>
<PropertyGroup>
<PrepareDependsOn>InitializeComponents;$(PrepareDependsOn)</PrepareDependsOn>
<GetArtifactInfoDependsOn>$(GetArtifactInfoDependsOn);GetNativeArtifactsInfo</GetArtifactInfoDependsOn>
<CompileDependsOn Condition="'$(OS)'=='Windows_NT'">BuildNativeAssets;$(CompileDependsOn)</CompileDependsOn>
<PackageDependsOn Condition="'$(OS)'=='Windows_NT'">$(PackageDependsOn);PackageNativeProjects</PackageDependsOn>
<TestDependsOn>$(TestDependsOn);RunNativeTest</TestDependsOn>
<NuGetVerifierRuleFile Condition="'$(OS)' != 'Windows_NT'">$(RepositoryRoot)NuGetPackageVerifier.xplat.json</NuGetVerifierRuleFile>
<SourceBase>$(RepositoryRoot)src\</SourceBase>
<NativeOutput>bin\$(Configuration)\</NativeOutput>
</PropertyGroup>
<ItemGroup>
<Platforms Include="x86" VCPlatform="Win32" />
<Platforms Include="x64" VCPlatform="x64" />
<NativeProjects
Include="$(SourceBase)AspNetCoreModuleV1\AspNetCore\AspNetCore.vcxproj"
NativeAsset="aspnetcore"
BaseOutputPath="AspNetCoreModuleV1" />
<NativeProjects
Include="$(SourceBase)AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj"
NativeAsset="aspnetcorev2"
BaseOutputPath="AspNetCoreModuleV2" />
<NativeProjects
Include="$(SourceBase)AspNetCoreModuleV2\InProcessRequestHandler\InProcessRequestHandler.vcxproj"
NativeAsset="aspnetcorev2_inprocess"
BaseOutputPath="AspNetCoreModuleV2" />
<NativeProjects
Include="$(SourceBase)AspNetCoreModuleV2\OutOfProcessRequestHandler\OutOfProcessRequestHandler.vcxproj"
NativeAsset="aspnetcorev2_outofprocess"
BaseOutputPath="AspNetCoreModuleV2" />
</ItemGroup>
<Target Name="InitializeComponents">
<ItemGroup>
<Components
Include="@(NativeProjects)"
Platform="%(Platforms.Identity)"
VCPlatform="%(Platforms.VCPlatform)" />
</ItemGroup>
</Target>
<Target Name="BuildNativeAssets" DependsOnTargets="Prepare;GetToolsets" >
<PropertyGroup>
<BuildArgs>-p:Configuration=$(Configuration) -v:m -nologo -clp:NoSummary -p:CommitHash=$(CommitHash)</BuildArgs>
</PropertyGroup>
<ItemGroup>
<ANCMProject Include="%(Components.Identity) $(BuildArgs) -p:Platform=%(Components.VCPlatform) -bl:$(LogOutputDir)native.%(Components.VCPlatform)%(Components.FileName).binlog"/>
</ItemGroup>
<Error
Text="Could not find an installation of Visual Studio with the C++ development tools."
Condition="'$(VisualStudioMSBuildx86Path)' == ''" />
<Exec Command="&quot;$(VisualStudioMSBuildx86Path)&quot; %(ANCMProject.Identity)"
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
</Target>
<Target Name="GetNativeArtifactsInfo" DependsOnTargets="InitializeComponents">
<ItemGroup Condition=" '$(OS)' == 'Windows_NT' ">
<ArtifactInfo Include="$(BuildDir)Microsoft.AspNetCore.AspNetCoreModule.$(PackageVersion).nupkg">
<ArtifactType>NuGetPackage</ArtifactType>
<PackageId>Microsoft.AspNetCore.AspNetCoreModule</PackageId>
<Version>$(PackageVersion)</Version>
<RepositoryRoot>$(RepositoryRoot)</RepositoryRoot>
</ArtifactInfo>
<FilesToExcludeFromSigning Include="$(BuildDir)Microsoft.AspNetCore.AspNetCoreModule.$(PackageVersion).nupkg" />
<ArtifactInfo Include="$(BuildDir)Microsoft.AspNetCore.AspNetCoreModuleV2.$(PackageVersion).nupkg">
<ArtifactType>NuGetPackage</ArtifactType>
<PackageId>Microsoft.AspNetCore.AspNetCoreModuleV2</PackageId>
<Version>$(PackageVersion)</Version>
<RepositoryRoot>$(RepositoryRoot)</RepositoryRoot>
</ArtifactInfo>
<FilesToExcludeFromSigning Include="$(BuildDir)Microsoft.AspNetCore.AspNetCoreModuleV2.$(PackageVersion).nupkg" />
<ArtifactInfo Include="$(AncmZipOutputPath)">
<ArtifactType>ZipArchive</ArtifactType>
<RepositoryRoot>$(RepositoryRoot)</RepositoryRoot>
<Category>shipoob</Category>
</ArtifactInfo>
<FilesToSign Include="$(AncmZipOutputPath)" IsContainer="true" />
<FilesToSign Include="@(Components->'%(BaseOutputPath)/%(Platform)/%(NativeAsset).dll')" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
</ItemGroup>
</Target>
<Target Name="PackageNativeProjects">
<PropertyGroup>
<AspNetCoreModuleV2PropsFile>$(MSBuildThisFileDirectory)..\nuget\Microsoft.AspNetCore.AspNetCoreModuleV2.props.in</AspNetCoreModuleV2PropsFile>
<AspNetCoreModuleV2PropsOutputFile>$(MSBuildThisFileDirectory)..\artifacts\Microsoft.AspNetCore.AspNetCoreModuleV2.props</AspNetCoreModuleV2PropsOutputFile>
</PropertyGroup>
<GenerateFileFromTemplate
TemplateFile="$(AspNetCoreModuleV2PropsFile)"
Properties="AspNetCoreModuleOutOfProcessVersion=$(AspNetCoreModuleOutOfProcessVersion)"
OutputPath="$(AspNetCoreModuleV2PropsOutputFile)" />
<PackNuspec NuspecPath="$(MSBuildThisFileDirectory)..\nuget\Microsoft.AspNetCore.AspNetCoreModule.nuspec"
DestinationFolder="$(BuildDir)"
Properties="version=$(PackageVersion);Configuration=$(Configuration)"
Overwrite="true"
BasePath="$(RepositoryRoot)" />
<PackNuspec NuspecPath="$(MSBuildThisFileDirectory)..\nuget\Microsoft.AspNetCore.AspNetCoreModuleV2.nuspec"
DestinationFolder="$(BuildDir)"
Properties="version=$(PackageVersion);Configuration=$(Configuration);AspNetCoreModuleOutOfProcessVersion=$(AspNetCoreModuleOutOfProcessVersion);AspNetCoreModuleV2Props=$(AspNetCoreModuleV2PropsOutputFile)"
Overwrite="true"
BasePath="$(RepositoryRoot)" />
<ItemGroup>
<AncmFiles Include="%(Components.RootDir)%(Components.Directory)$(NativeOutput)%(Components.VCPlatform)\%(Components.NativeAsset).dll" Link="%(Components.BaseOutputPath)\%(Components.Platform)\%(Components.NativeAsset).dll" />
<AncmFiles Include="%(Components.RootDir)%(Components.Directory)$(NativeOutput)%(Components.VCPlatform)\%(Components.NativeAsset).pdb" Link="%(Components.BaseOutputPath)\%(Components.Platform)\%(Components.NativeAsset).pdb" />
<!-- Schema-->
<AncmFiles Include="$(SourceBase)AspNetCoreModuleV1\AspNetCore\aspnetcore_schema.xml" Link="AspNetCoreModuleV1\aspnetcore_schema.xml" />
<AncmFiles Include="$(SourceBase)AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml" Link="AspNetCoreModuleV2\aspnetcore_schema_v2.xml" />
<AncmFiles Include="$(SourceBase)AspNetCoreModuleV2\AspNetCore\ancm.mof" Link="AspNetCoreModuleV2\ancm.mof" />
</ItemGroup>
<ZipArchive File="$(AncmZipOutputPath)"
Overwrite="true"
SourceFiles="@(AncmFiles)"
WorkingDirectory="$(RepositoryRoot)" />
</Target>
<Target Name="RunNativeTest" DependsOnTargets="GetToolsets">
<Exec Command="&quot;$(VisualStudioMSBuildx86Path)&quot; &quot;$(RepositoryRoot)test\CommonLibTests\CommonLibTests.vcxproj&quot; /t:Test $(BuildArgs) -p:Platform=%(Platforms.VCPlatform)"
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
</Target>
</Project>