diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 2292860fd..10b172fc5 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -217,7 +217,8 @@ stages: _LinuxPortable: '' _RuntimeIdentifier: '--runtime-id linux-musl-x64' _BuildArchitecture: 'x64' - _AdditionalBuildParameters: '/p:OSName="linux-musl"' + # Pass in HostOSName when running on alpine + _AdditionalBuildParameters: '/p:OSName="linux-musl" /p:HostOSName="linux-musl"' _TestArg: $(_NonWindowsTestArg) ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: Build_Arm_Release: @@ -261,7 +262,8 @@ stages: _LinuxPortable: '' _RuntimeIdentifier: '--runtime-id linux-musl-x64' _BuildArchitecture: 'x64' - _AdditionalBuildParameters: '/p:OSName="linux-musl"' + # Pass in HostOSName when running on alpine + _AdditionalBuildParameters: '/p:OSName="linux-musl" /p:HostOSName="linux-musl"' Build_Linux_Portable_Deb_Release_x64: _BuildConfig: Release _DockerParameter: '--docker ubuntu.16.04' diff --git a/src/core-sdk-tasks/Crossgen.cs b/src/core-sdk-tasks/Crossgen.cs index eb173d3c6..a45e3d96f 100644 --- a/src/core-sdk-tasks/Crossgen.cs +++ b/src/core-sdk-tasks/Crossgen.cs @@ -27,22 +27,18 @@ namespace Microsoft.DotNet.Build.Tasks public string DestinationPath { get; set; } [Required] - public string JITPath { get; set; } + public string Architecture { get; set; } public string CrossgenPath { get; set; } public bool CreateSymbols { get; set; } - public string DiasymReaderPath { get; set; } - public bool ReadyToRun { get; set; } public ITaskItem[] PlatformAssemblyPaths { get; set; } private string TempOutputPath { get; set; } - private bool _secondInvocationToCreateSymbols; - protected override bool ValidateParameters() { base.ValidateParameters(); @@ -67,7 +63,15 @@ namespace Microsoft.DotNet.Build.Tasks if (toolResult) { - File.Copy(TempOutputPath, DestinationPath, overwrite: true); + var files = System.IO.Directory.GetFiles(Path.GetDirectoryName(TempOutputPath)); + var dest = Path.GetDirectoryName(DestinationPath); + // Copy both dll and pdb files to the destination folder + foreach(var file in files) + { + File.Copy(file, Path.Combine(dest, Path.GetFileName(file)), overwrite: true); + // Delete file in temp + File.Delete(file); + } } if (File.Exists(TempOutputPath)) @@ -76,18 +80,12 @@ namespace Microsoft.DotNet.Build.Tasks } Directory.Delete(tempDirPath); - if (toolResult && CreateSymbols) - { - _secondInvocationToCreateSymbols = true; - toolResult = base.Execute(); - } - return toolResult; } protected override string ToolName { - get { return "crossgen"; } + get { return "crossgen2"; } } protected override MessageImportance StandardOutputLoggingImportance @@ -133,33 +131,23 @@ namespace Microsoft.DotNet.Build.Tasks return CrossgenPath; } - return "crossgen"; + return "crossgen2"; } protected override string GenerateCommandLineCommands() { - if (_secondInvocationToCreateSymbols) - { - return $"{GetReadyToRun()} {GetPlatformAssemblyPaths()} {GetDiasymReaderPath()} {GetCreateSymbols()}"; - } + return $"{GetInPath()} {GetOutPath()} {GetArchitecture()} {GetPlatformAssemblyPaths()} {GetCreateSymbols()}"; + } - return $"{GetReadyToRun()} {GetMissingDependenciesOk()} {GetInPath()} {GetOutPath()} {GetPlatformAssemblyPaths()} {GetJitPath()}"; + private string GetArchitecture() + { + return $"--targetarch {Architecture}"; } private string GetCreateSymbols() { - var option = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "-createpdb" : "-createperfmap"; - return $"{option} \"{Path.GetDirectoryName(DestinationPath)}\" \"{DestinationPath}\""; - } - - private string GetDiasymReaderPath() - { - if (string.IsNullOrEmpty(DiasymReaderPath)) - { - return null; - } - - return $"-diasymreaderpath \"{DiasymReaderPath}\""; + var option = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "--pdb" : "--perfmap"; + return $"{option}"; } private string GetReadyToRun() @@ -174,12 +162,12 @@ namespace Microsoft.DotNet.Build.Tasks private string GetInPath() { - return $"-in \"{SourceAssembly}\""; + return $"\"{SourceAssembly}\""; } private string GetOutPath() { - return $"-out \"{TempOutputPath}\""; + return $"-o \"{TempOutputPath}\""; } private string GetPlatformAssemblyPaths() @@ -190,18 +178,13 @@ namespace Microsoft.DotNet.Build.Tasks { foreach (var excludeTaskItem in PlatformAssemblyPaths) { - platformAssemblyPaths += $"{excludeTaskItem.ItemSpec}{Path.PathSeparator}"; + platformAssemblyPaths += $"-r {excludeTaskItem.ItemSpec}{Path.DirectorySeparatorChar}*.dll "; } } - return $" -platform_assemblies_paths {platformAssemblyPaths.Trim(':')}"; + return platformAssemblyPaths; } - private string GetJitPath() - { - return $"-JITPath {JITPath}"; - } - private string GetMissingDependenciesOk() { return "-MissingDependenciesOK"; diff --git a/src/redist/targets/Crossgen.targets b/src/redist/targets/Crossgen.targets index 3561d2031..79d6264bd 100644 --- a/src/redist/targets/Crossgen.targets +++ b/src/redist/targets/Crossgen.targets @@ -5,26 +5,16 @@ microsoft.netcore.app.runtime.$(SharedFrameworkRid) - <_crossDir Condition="'$(Architecture)' == 'arm64' and '$(BuildArchitecture)' != 'arm64'">/x64_arm64 - <_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">/x86_arm - <_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' != 'win'">/x64_arm - $(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools$(_crossDir)/crossgen$(ExeExtension) - x64_arm64 - x86_arm - x64_arm - $(SharedFrameworkRid) - $(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/runtimes/$(LibCLRJitRid)/native/$(DynamicLibPrefix)clrjit$(DynamicLibExtension) + microsoft.netcore.app.crossgen2.$(HostOSName)-$(BuildArchitecture) + $(NuGetPackageRoot)/$(RuntimeNETCrossgenPackageName)/$(MicrosoftNETCoreAppRuntimePackageVersion)/tools/crossgen2$(ExeExtension) $(RedistLayoutPath)shared/$(SharedFrameworkName)/$(MicrosoftNETCoreAppRuntimePackageVersion) - * - x86 - amd64 - PackageToRestore=$(RuntimeNETCoreAppPackageName); + PackageToRestore=$(RuntimeNETCrossgenPackageName); PackageVersionToRestore=$(MicrosoftNETCoreAppRuntimePackageVersion); TargetFramework=$(TargetFramework) @@ -78,7 +68,6 @@ - @@ -122,31 +111,28 @@ diff --git a/src/redist/targets/GetRuntimeInformation.targets b/src/redist/targets/GetRuntimeInformation.targets index 7d75f8f10..549b8e48b 100644 --- a/src/redist/targets/GetRuntimeInformation.targets +++ b/src/redist/targets/GetRuntimeInformation.targets @@ -5,10 +5,12 @@ win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant) True - win - osx - freebsd - linux + win + osx + freebsd + linux + + $(HostOSName) $(OSName)-$(Architecture)