aspnetcore/src/Installers/Debian/Runtime.debproj

111 lines
5.9 KiB
Plaintext

<!--
This project produces a debian installer for Linux x64 platforms only.
-->
<Project DefaultTargets="Build">
<UsingTask Condition=" '$(BuildToolsTaskAssembly)' != '' AND Exists('$(BuildToolsTaskAssembly)') " TaskName="Microsoft.AspNetCore.BuildTools.GenerateFileFromTemplate" AssemblyFile="$(BuildToolsTaskAssembly)" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<!-- Output paths -->
<PropertyGroup>
<BaseIntermediateOutputPath>$(RepositoryRoot)obj\Debian\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(SharedFxRid)\</IntermediateOutputPath>
<!-- Must be named "package_root/". This is expected by the build.sh script in this project. -->
<IntermediatePackageRoot>$(IntermediateOutputPath)package_root\</IntermediatePackageRoot>
<OutputFileName>$(RuntimeInstallerBaseName)-$(SharedFxVersion)-x64.deb</OutputFileName>
<OutputPath>$(InstallersOutputPath)</OutputPath>
<TargetPath>$(InstallersOutputPath)$(OutputFileName)</TargetPath>
</PropertyGroup>
<!-- Installer settings -->
<PropertyGroup>
<DebianPackageInstallRoot>/usr/share/dotnet</DebianPackageInstallRoot>
</PropertyGroup>
<!-- Installer versions -->
<PropertyGroup>
<!-- CLI would take a dependency such as 'aspnetcore-runtime-M.N >= M.N.P'. Here M.N is part of the id and M.N.P is the PackageVersion -->
<PackageId>$(RuntimeInstallerBaseName)-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)</PackageId>
<!-- PackageVersion does not match the ASP.NET Core runtime verison. -->
<PackageVersion>$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion)</PackageVersion>
<!-- Deb installers are versioned as M.N.P~PreReleaseLabel-Build following the core-setup convention -->
<PackageVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">$(PackageVersion)~$(PreReleaseLabel)-$(BuildNumber)</PackageVersion>
<PackageRevision>1</PackageRevision>
<!-- Needed some creativity to convert the PackageVersion M.N.P-PreReleaseLabel-Build to the installer version M.N.P~PreReleaseLabel-Build, The conditional handles stabilized builds -->
<DotnetRuntimeDependencyVersion>$(MicrosoftNETCoreAppPackageVersion)</DotnetRuntimeDependencyVersion>
<DotnetRuntimeDependencyVersion Condition="$(DotnetRuntimeDependencyVersion.Contains('-'))">$(DotnetRuntimeDependencyVersion.Substring(0, $(DotnetRuntimeDependencyVersion.IndexOf('-'))))~$(DotnetRuntimeDependencyVersion.Substring($([MSBuild]::Add($(DotnetRuntimeDependencyVersion.IndexOf('-')), 1))))</DotnetRuntimeDependencyVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Framework\**\Microsoft.AspNetCore.All.shfxproj">
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<OutputItemType>_ResolvedFxProjects</OutputItemType>
</ProjectReference>
<ProjectReference Include="..\..\Framework\**\Microsoft.AspNetCore.App.shfxproj">
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
<OutputItemType>_ResolvedFxProjects</OutputItemType>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<Target Name="GetTargetPath" Returns="$(TargetPath)" />
<Target Name="PrepareForBuild">
<Error Text="Currently only linux-x64 is supported by Debian installers." Condition=" '$(SharedFxRid)' != 'linux-x64' " />
<MakeDir Directories="$(IntermediateOutputPath);$(IntermediatePackageRoot);$(OutputPath)" />
</Target>
<Target Name="Build" DependsOnTargets="PrepareForBuild;ResolveProjectReferences;GetTargetPath">
<!-- Layout files in package_root/ for the build.sh script. -->
<ItemGroup>
<SharedFxAssetFolder Include="%(_ResolvedFxProjects.InstallerAssetPaths)" SharedFxName="%(_ResolvedFxProjects.SharedFxName)" />
<PackageFiles Include="%(SharedFxAssetFolder.Identity)\**\*">
<DestinationDir>$(IntermediatePackageRoot)shared\%(SharedFxAssetFolder.SharedFxName)\$(SharedFxVersion)\</DestinationDir>
</PackageFiles>
</ItemGroup>
<Copy SourceFiles="@(PackageFiles)" DestinationFiles="@(PackageFiles->'%(DestinationDir)%(RecursiveDir)%(FileName)%(Extension)')" />
<!-- Generate debian_config.json. We can't simply use WriteLinesToFile because of https://github.com/Microsoft/msbuild/issues/1622. Use our custom GenerateFileFromTemplate task instead -->
<PropertyGroup>
<DebianConfigProperties>
AspNetCoreMajorVersion=$(AspNetCoreMajorVersion);
AspNetCoreMinorVersion=$(AspNetCoreMinorVersion);
Authors=$(Authors);
DebianPackageInstallRoot=$(DebianPackageInstallRoot);
DotnetRuntimeDependencyVersion=$(DotnetRuntimeDependencyVersion);
MaintainerEmail=$(MaintainerEmail);
PackageId=$(PackageId);
PackageLicenseType=$(PackageLicenseType);
PackageProjectUrl=$(PackageProjectUrl);
PackageRevision=$(PackageRevision);
PackageVersion=$(PackageVersion);
SharedFxDescription=$(SharedFxDescription);
SharedFxProductName=$(SharedFxProductName);
</DebianConfigProperties>
</PropertyGroup>
<GenerateFileFromTemplate TemplateFile="debian_config.json.in"
Properties="$(DebianConfigProperties)"
OutputPath="$(IntermediateOutputPath)debian_config.json" />
<!-- Build SharedFx Bundle Deb package -->
<Exec Command="./build.sh -i '$(IntermediateOutputPath)' -o '$(IntermediateOutputPath)out/'" />
<PropertyGroup>
<!-- Map our RIDs to the arch names used by debuild. -->
<DebArch Condition=" '$(SharedFxRid)' == 'linux-x64' ">amd64</DebArch>
<BuildScriptOutputFileName>$(PackageId)_$(PackageVersion)-$(PackageRevision)_$(DebArch).deb</BuildScriptOutputFileName>
</PropertyGroup>
<Copy SourceFiles="$(IntermediateOutputPath)out/$(BuildScriptOutputFileName)" DestinationFiles="$(TargetPath)" />
</Target>
</Project>