2016-06-28 01:26:57 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2016-08-28 04:10:23 +00:00
|
|
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2016-08-25 22:53:15 +00:00
|
|
|
|
2016-08-27 22:57:14 +00:00
|
|
|
<UsingTask TaskName="DotNetDebTool" AssemblyFile="$(CLIBuildDll)" />
|
|
|
|
|
2017-02-14 23:42:13 +00:00
|
|
|
<Import Project="Installer.DEB.targets" />
|
2016-08-19 21:52:06 +00:00
|
|
|
|
2018-07-26 21:48:10 +00:00
|
|
|
<!-- Re-enable "TestSdkDeb" when the following issue is resolved: https://github.com/dotnet/cli/issues/9672 -->
|
2016-08-19 21:52:06 +00:00
|
|
|
<Target Name="GenerateDebs"
|
2016-08-30 18:45:58 +00:00
|
|
|
DependsOnTargets="SetupDebProps;
|
2018-07-12 23:20:39 +00:00
|
|
|
TestDebuild;
|
2018-07-26 21:48:10 +00:00
|
|
|
BuildSdkDeb"
|
2017-06-13 19:42:51 +00:00
|
|
|
Condition=" '$(IsDebianBaseDistro)' == 'True' "
|
2016-08-28 04:10:23 +00:00
|
|
|
Outputs="@(GeneratedInstallers)"/>
|
2016-08-18 17:11:20 +00:00
|
|
|
|
2018-01-09 23:36:23 +00:00
|
|
|
<Target Name="GetAspNetSharedFxInstallArgs" DependsOnTargets="EvaluateRuntimeCoherence">
|
|
|
|
<PropertyGroup>
|
2018-07-10 01:05:56 +00:00
|
|
|
<AspNetVersionPrereleaseSeparator>$(AspNetCoreSharedFxBaseRuntimeVersion.IndexOf('-'))</AspNetVersionPrereleaseSeparator>
|
|
|
|
<AspNetSimpleVersion>$(AspNetCoreSharedFxBaseRuntimeVersion)</AspNetSimpleVersion>
|
|
|
|
<AspNetSimpleVersion Condition=" '$(AspNetVersionPrereleaseSeparator)' != -1 ">$(AspNetCoreSharedFxBaseRuntimeVersion.Substring(0, $(AspNetVersionPrereleaseSeparator)))</AspNetSimpleVersion>
|
|
|
|
|
2018-07-12 23:20:39 +00:00
|
|
|
<AspNetVersionPatchSeparator>$(AspNetSimpleVersion.LastIndexOf('.'))</AspNetVersionPatchSeparator>
|
|
|
|
<AspNetSimpleVersion Condition=" '$(AspNetVersionPatchSeparator)' != -1 ">$(AspNetSimpleVersion.Substring(0, $(AspNetVersionPatchSeparator)))</AspNetSimpleVersion>
|
|
|
|
|
2018-07-10 01:05:56 +00:00
|
|
|
<!-- dotnet-runtime package may not currently be available -->
|
|
|
|
<InstallAspNetCoreSharedFxArgs>--ignore-depends=dotnet-runtime-$(AspNetSimpleVersion)</InstallAspNetCoreSharedFxArgs>
|
2018-01-09 23:36:23 +00:00
|
|
|
</PropertyGroup>
|
|
|
|
</Target>
|
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<Target Name="BuildSdkDeb"
|
2017-06-13 19:42:51 +00:00
|
|
|
Condition=" '$(IsDebianBaseDistro)' == 'True' AND '$(DebuildPresent)' == 'true' "
|
2016-08-27 22:57:14 +00:00
|
|
|
DependsOnTargets="PrepareDotnetDebDirectories;
|
2018-01-09 21:27:50 +00:00
|
|
|
PrepareDotnetDebTool;
|
2018-01-09 23:36:23 +00:00
|
|
|
GetAspNetSharedFxInstallArgs;"
|
2016-08-28 00:49:21 +00:00
|
|
|
Inputs="@(CLISdkFiles)"
|
2016-08-18 17:11:20 +00:00
|
|
|
Outputs="$(SdkInstallerFile)" >
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Install Shared Framework Packages -->
|
2018-01-09 23:36:23 +00:00
|
|
|
|
2018-01-05 23:23:15 +00:00
|
|
|
<Exec Command="sudo dpkg -i $(DownloadedRuntimeDepsInstallerFile)" />
|
2016-08-18 17:11:20 +00:00
|
|
|
<Exec Command="sudo dpkg -i $(DownloadedSharedHostInstallerFile)" />
|
|
|
|
<Exec Command="sudo dpkg -i $(DownloadedHostFxrInstallerFile)" />
|
|
|
|
<Exec Command="sudo dpkg -i $(DownloadedSharedFrameworkInstallerFile)" />
|
2018-01-09 23:36:23 +00:00
|
|
|
<Exec Command="sudo dpkg $(InstallAspNetCoreSharedFxArgs) -i $(DownloadedAspNetCoreSharedFxInstallerFile)" />
|
2016-08-18 17:11:20 +00:00
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Create layout: Binaries -->
|
2016-08-19 21:52:06 +00:00
|
|
|
<Copy
|
2016-08-28 00:49:21 +00:00
|
|
|
DestinationFiles="@(CLISdkFiles->'$(LayoutPackageRootDir)/sdk/%(RecursiveDir)%(Filename)%(Extension)')"
|
2017-04-26 19:12:25 +00:00
|
|
|
SourceFiles="@(CLISdkFiles)"
|
2016-08-19 21:52:06 +00:00
|
|
|
OverwriteReadOnlyFiles="True"
|
|
|
|
SkipUnchangedFiles="False"
|
2016-08-28 00:49:21 +00:00
|
|
|
UseHardlinksIfPossible="False" />
|
2017-04-26 19:12:25 +00:00
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Create layout: Man Pages -->
|
2016-08-19 21:52:06 +00:00
|
|
|
<Copy
|
2016-08-28 00:49:21 +00:00
|
|
|
DestinationFiles="@(SdkDebManPageFiles->'$(LayoutDocsDir)/%(RecursiveDir)%(Filename)-$(SdkVersion)%(Extension)')"
|
2016-08-19 21:52:06 +00:00
|
|
|
SourceFiles="@(SdkDebManPageFiles)"
|
|
|
|
OverwriteReadOnlyFiles="True"
|
|
|
|
SkipUnchangedFiles="False"
|
2016-08-28 00:49:21 +00:00
|
|
|
UseHardlinksIfPossible="False" />
|
2016-08-19 21:52:06 +00:00
|
|
|
|
2017-07-27 06:10:48 +00:00
|
|
|
<!-- Create layout: Generate and Place postinst -->
|
|
|
|
<ReplaceFileContents
|
2018-04-05 03:57:45 +00:00
|
|
|
InputFiles="$(DebianPostinstTemplateFile)"
|
|
|
|
DestinationFiles="$(DebianPostinstFile)"
|
2017-07-27 06:10:48 +00:00
|
|
|
ReplacementItems="@(DebianPostInstTokenValues)" />
|
|
|
|
|
|
|
|
<Chmod
|
|
|
|
Glob="$(DebianPostinstFile)"
|
|
|
|
Mode="ugo+x" />
|
2017-04-26 19:12:25 +00:00
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Create layout: Generate and Place debian_config.json -->
|
2016-08-27 22:57:14 +00:00
|
|
|
<ReplaceFileContents
|
2018-04-05 03:57:45 +00:00
|
|
|
InputFiles="$(DebianConfigTemplateFile)"
|
|
|
|
DestinationFiles="$(DebianConfigJsonFile)"
|
2017-02-23 21:24:21 +00:00
|
|
|
ReplacementItems="@(DebianConfigTokenValues)" />
|
2016-08-27 22:57:14 +00:00
|
|
|
|
2017-04-26 19:12:25 +00:00
|
|
|
<Chmod
|
2017-03-03 21:30:57 +00:00
|
|
|
Glob="$(PackageTool)"
|
|
|
|
Mode="u+x" />
|
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Build SDK Deb package -->
|
2017-08-11 23:13:43 +00:00
|
|
|
<DotNetDebTool ToolPath="$(PreviousStageDirectory)"
|
2016-08-28 00:49:21 +00:00
|
|
|
InputDirectory="$(LayoutDirectory)"
|
|
|
|
OutputDirectory="$(DotNetDebToolOutputDirectory)"
|
2016-08-19 21:52:06 +00:00
|
|
|
PackageName="$(SdkDebianPackageName)"
|
|
|
|
PackageVersion="$(SdkVersion)"
|
|
|
|
WorkingDirectory="$(DotnetDebToolDir)" />
|
2017-04-26 19:12:25 +00:00
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Copy SDK package to output -->
|
2016-08-27 22:57:14 +00:00
|
|
|
<ItemGroup>
|
|
|
|
<GeneratedDebFiles Include="$(DotNetDebToolOutputDirectory)/*.deb" />
|
|
|
|
</ItemGroup>
|
2017-04-26 19:12:25 +00:00
|
|
|
|
2016-08-27 22:57:14 +00:00
|
|
|
<Error Text="@(GeneratedDebFiles->Count()) .deb files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
|
|
|
|
|
|
|
|
<Copy
|
|
|
|
DestinationFiles="$(SdkInstallerFile)"
|
|
|
|
SourceFiles="@(GeneratedDebFiles)"
|
|
|
|
OverwriteReadOnlyFiles="True"
|
|
|
|
SkipUnchangedFiles="False"
|
|
|
|
UseHardlinksIfPossible="False" />
|
2016-08-18 17:11:20 +00:00
|
|
|
|
2018-07-26 21:48:10 +00:00
|
|
|
<!-- Proactively remove all possible Shared Framework and Debian Packages -->
|
2018-08-30 17:16:28 +00:00
|
|
|
<ItemGroup>
|
|
|
|
<SetupDebPackageToRemove Include="$(SdkDebianPackageName)" />
|
|
|
|
<SetupDebPackageToRemove Include="$(AspNetCoreSharedFxDebianPackageName)" />
|
|
|
|
<SetupDebPackageToRemove Include="$(AspNetCoreSharedFxDebianPackageFileName)" />
|
|
|
|
<SetupDebPackageToRemove Include="$(SharedFxDebianPackageName)" />
|
|
|
|
<SetupDebPackageToRemove Include="$(SharedFxDebianPackageFileName)" />
|
|
|
|
<SetupDebPackageToRemove Include="$(HostFxrDebianPackageName)" />
|
|
|
|
<SetupDebPackageToRemove Include="$(HostFxrDebianPackageFileName)" />
|
|
|
|
<SetupDebPackageToRemove Include="$(HostDebianPackageName)" />
|
|
|
|
<SetupDebPackageToRemove Include="$(RuntimeDepsPackageName)" />
|
|
|
|
</ItemGroup>
|
|
|
|
<!-- The following line is needed. So it won't warning dotnet folder is not empty after uninstall -->
|
|
|
|
<Exec Command="sudo rm -rf /usr/share/dotnet/sdk/NuGetFallbackFolder" />
|
|
|
|
<Exec Command="!(dpkg-query -W %(SetupDebPackageToRemove.Identity)) || sudo dpkg -r %(SetupDebPackageToRemove.Identity)" />
|
2016-08-18 17:11:20 +00:00
|
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="TestSdkDeb"
|
2018-01-12 18:11:44 +00:00
|
|
|
Condition=" '$(CLIBUILD_SKIP_TESTS)' != 'true' and '$(IsDebianBaseDistro)' == 'True' and '$(DebuildPresent)' == 'true' "
|
2018-01-09 23:36:23 +00:00
|
|
|
DependsOnTargets="RestoreTests;GetAspNetSharedFxInstallArgs"
|
2016-08-18 17:11:20 +00:00
|
|
|
Inputs="$(DownloadedSharedHostInstallerFile);
|
|
|
|
$(DownloadedHostFxrInstallerFile);
|
|
|
|
$(DownloadedSharedFrameworkInstallerFile);
|
|
|
|
$(SdkInstallerFile);"
|
|
|
|
Outputs="$(DebianTestResultsXmlFile)" >
|
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Install Dependencies and SDK Packages -->
|
2018-01-06 00:14:57 +00:00
|
|
|
<Exec Command="sudo dpkg -i $(DownloadedRuntimeDepsInstallerFile)" />
|
2017-01-25 19:43:07 +00:00
|
|
|
<Exec Command="sudo dpkg -i $(DownloadedSharedHostInstallerFile)" />
|
|
|
|
<Exec Command="sudo dpkg -i $(DownloadedHostFxrInstallerFile)" />
|
|
|
|
<Exec Command="sudo dpkg -i $(DownloadedSharedFrameworkInstallerFile)" />
|
2018-01-09 23:36:23 +00:00
|
|
|
<Exec Command="sudo dpkg $(InstallAspNetCoreSharedFxArgs) -i $(DownloadedAspNetCoreSharedFxInstallerFile)" />
|
2017-01-25 19:43:07 +00:00
|
|
|
|
2016-08-18 17:11:20 +00:00
|
|
|
<Exec Command="sudo dpkg -i $(SdkInstallerFile)" />
|
|
|
|
|
|
|
|
<!-- Run E2E -->
|
2017-04-26 19:12:25 +00:00
|
|
|
<DotNetRestore ProjectPath="$(EndToEndTestProject)"
|
|
|
|
ToolPath="$(DebianInstalledDirectory)" />
|
|
|
|
|
2016-11-12 07:46:29 +00:00
|
|
|
<DotNetTest ProjectPath="$(EndToEndTestProject)"
|
2016-08-18 17:11:20 +00:00
|
|
|
EnvironmentVariables="@(TestSdkDebTaskEnvironmentVariables)"
|
2017-01-26 20:52:55 +00:00
|
|
|
ToolPath="$(DebianInstalledDirectory)" />
|
2016-08-18 17:11:20 +00:00
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Clean up Packages -->
|
2018-08-15 21:13:07 +00:00
|
|
|
<!-- The following line is needed. So it won't warning dotnet folder is not empty after uninstall -->
|
|
|
|
<Exec Command="sudo rm -rf /usr/share/dotnet/sdk/NuGetFallbackFolder" />
|
|
|
|
|
2018-08-30 17:16:28 +00:00
|
|
|
<ItemGroup>
|
|
|
|
<TestSdkDebPackageToRemove Include="$(SdkDebianPackageName)" />
|
|
|
|
<TestSdkDebPackageToRemove Include="$(AspNetCoreSharedFxDebianPackageName)" />
|
|
|
|
<TestSdkDebPackageToRemove Include="$(SharedFxDebianPackageName)" />
|
|
|
|
<TestSdkDebPackageToRemove Include="$(HostFxrDebianPackageName)" />
|
|
|
|
<TestSdkDebPackageToRemove Include="$(HostDebianPackageName)" />
|
|
|
|
<TestSdkDebPackageToRemove Include="$(RuntimeDepsPackageName)"/>
|
|
|
|
</ItemGroup>
|
|
|
|
<!-- If package installed remove it -->
|
|
|
|
<Exec Command="!(dpkg-query -W %(TestSdkDebPackageToRemove.Identity)) || sudo dpkg -r %(TestSdkDebPackageToRemove.Identity)" />
|
2016-08-18 17:11:20 +00:00
|
|
|
</Target>
|
|
|
|
|
2016-08-19 21:52:06 +00:00
|
|
|
<Target Name="PrepareDotnetDebDirectories">
|
|
|
|
|
|
|
|
<!-- Clean the workspace -->
|
|
|
|
<ItemGroup>
|
2016-08-28 00:49:21 +00:00
|
|
|
<FilesToClean Remove="*" />
|
|
|
|
<FilesToClean Include="$(SdkInstallerFile)" />
|
|
|
|
|
|
|
|
<WorkspaceDirectories Remove="*" />
|
|
|
|
<WorkspaceDirectories Include="$(SdkDebianIntermediateDirectory);
|
|
|
|
$(LayoutDirectory)" />
|
|
|
|
|
|
|
|
<LayoutSubDirectories Remove="*" />
|
|
|
|
<LayoutSubDirectories Include="$(LayoutPackageRootDir);
|
|
|
|
$(LayoutAbsolutePlacementDir);
|
|
|
|
$(LayoutSamplesDir);
|
|
|
|
$(LayoutDocsDir);
|
|
|
|
$(LayoutDebianFilesDir)" />
|
2016-08-19 21:52:06 +00:00
|
|
|
</ItemGroup>
|
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<Delete Files="@(FilesToClean)" />
|
|
|
|
<RemoveDir Directories="@(WorkspaceDirectories)" />
|
|
|
|
|
|
|
|
<!-- Rebuild the workspace -->
|
|
|
|
<MakeDir Directories="@(WorkspaceDirectories)" />
|
|
|
|
<MakeDir Directories="@(LayoutSubDirectories)" />
|
|
|
|
<MakeDir Directories="$(DotNetDebToolOutputDirectory)" />
|
2016-08-19 21:52:06 +00:00
|
|
|
</Target>
|
2016-08-18 17:11:20 +00:00
|
|
|
|
2017-09-01 19:12:10 +00:00
|
|
|
<Target Name="PrepareDotnetDebTool">
|
2016-08-18 17:11:20 +00:00
|
|
|
|
2017-08-11 23:13:43 +00:00
|
|
|
<DotNetRestore ToolPath="$(PreviousStageDirectory)"
|
2017-02-22 17:55:36 +00:00
|
|
|
WorkingDirectory="$(DotnetDebToolDir)" />
|
2016-08-18 17:11:20 +00:00
|
|
|
</Target>
|
|
|
|
|
2016-08-27 22:57:14 +00:00
|
|
|
<Target Name="TestDebuild">
|
2016-08-29 18:18:34 +00:00
|
|
|
<Message Text="Don't remove this" />
|
2017-04-26 19:12:25 +00:00
|
|
|
|
2018-08-06 20:23:11 +00:00
|
|
|
<!-- run Debuild -->
|
|
|
|
<!-- NB: IgnoreExitCode prevents Exec from failing, but does not prevent us from retrieving the exit code. -->
|
|
|
|
<Exec Command="/usr/bin/env debuild -h > /dev/null 2>&1" IgnoreExitCode="true">
|
2016-08-25 22:53:15 +00:00
|
|
|
<Output TaskParameter="ExitCode" PropertyName="DebuildExitCode" />
|
2017-04-26 19:12:25 +00:00
|
|
|
</Exec>
|
2016-08-25 20:19:22 +00:00
|
|
|
|
2016-08-28 00:49:21 +00:00
|
|
|
<!-- Check if it returned 0 -->
|
2016-08-25 22:53:15 +00:00
|
|
|
<PropertyGroup>
|
|
|
|
<DebuildPresent>false</DebuildPresent>
|
|
|
|
<DebuildPresent Condition=" '$(DebuildExitCode)' == '0' ">true</DebuildPresent>
|
|
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
<!-- Workaround for Ubuntu16 Jenkins https://github.com/dotnet/core-setup/issues/167 -->
|
|
|
|
<Message Condition=" '$(DebuildPresent)' != 'true' "
|
|
|
|
Text="Debuild Not found, Debian packages will not be built."
|
|
|
|
Importance="High" />
|
2016-08-25 20:19:22 +00:00
|
|
|
</Target>
|
2016-06-28 01:26:57 +00:00
|
|
|
</Project>
|