From: Mike McLaughlin Date: Fri, 24 Aug 2018 23:56:12 +0000 (-0700) Subject: Dependent builds, publishing and packaging (#65) X-Git-Tag: submit/tizen/20190813.035844~82 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33982daaae50d5003d04da109fbf3587b10691b4;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Dependent builds, publishing and packaging (#65) Restore Microsoft.DotNet.BuildTools to generate the native build _version.h/version.cpp. Generate proper version header and source file for native binaries. Issue https://github.com/dotnet/diagnostics/issues/19. --- diff --git a/.vsts-dotnet-ci.yml b/.vsts-dotnet-ci.yml index 5c3ed1f1e..0c9a0f858 100644 --- a/.vsts-dotnet-ci.yml +++ b/.vsts-dotnet-ci.yml @@ -3,7 +3,6 @@ phases: parameters: phaseName: Windows agentOs: Windows_NT - buildReason: IndividualCI queue: name: Hosted VS2017 demands: @@ -13,19 +12,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test Build_Release: _BuildConfig: Release _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: CentOS_7 agentOs: Linux - buildReason: IndividualCI dockerImage: microsoft/dotnet-buildtools-prereqs:centos-7-c103199-20180628120549 queue: name: DotNetCore-Linux @@ -36,19 +30,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test Build_Release: _BuildConfig: Release _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: MacOS agentOs: Darwin - buildReason: IndividualCI queue: name: Hosted macOS Preview demands: @@ -58,11 +47,7 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test Build_Release: _BuildConfig: Release _BuildArch: x64 - _PublishType: none - _SignType: test diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index e53c98680..d2bdab7aa 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -1,9 +1,30 @@ phases: +- template: /eng/build.yml + parameters: + phaseName: Windows + agentOs: Windows_NT + queue: + name: DotNetCore-Build + demands: + - agent.os -equals Windows_NT + parallel: 3 + matrix: + Build_Debug: + _BuildConfig: Debug + _BuildArch: x64 + Build_Release: + _BuildConfig: Release + _BuildArch: x64 + _PublishArtifacts: bin + Build_Release_x86: + _BuildConfig: Release + _BuildArch: x86 + _PublishArtifacts: bin/Windows_NT.x86 + - template: /eng/build.yml parameters: phaseName: CentOS_7 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:centos-7-c103199-20180628120549 queue: name: DotNet-Build @@ -14,37 +35,37 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test + _PublishArtifacts: bin/Linux.x64 Build_Release: _BuildConfig: Release _BuildArch: x64 - _PublishType: none - _SignType: real + _PublishArtifacts: bin/Linux.x64 - template: /eng/build.yml parameters: - phaseName: Debian_Stretch - agentOs: Linux - buildReason: Internal - dockerImage: microsoft/dotnet-buildtools-prereqs:debian-stretch-c103199-20180628122423 - queue: - name: DotNet-Build + phaseName: MacOS + agentOs: Darwin + queue: + name: Hosted macOS Preview demands: - - agent.os -equals Linux + - agent.os -equals Darwin + parallel: 2 matrix: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test + Build_Release: + _BuildConfig: Release + _BuildArch: x64 + _PublishArtifacts: bin/OSX.x64 - template: /eng/build.yml parameters: - phaseName: Fedora_24 + phaseName: Debian_Stretch agentOs: Linux - buildReason: Internal - dockerImage: microsoft/dotnet-buildtools-prereqs:fedora-24-c103199-20180628122443 + dockerImage: microsoft/dotnet-buildtools-prereqs:debian-stretch-c103199-20180628122423 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -53,15 +74,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: Fedora_27 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:fedora-27-c103199-20180628122443 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -70,15 +90,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: Fedora_28 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:fedora-28-c103199-20180628122443 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -87,15 +106,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: OpenSuse_42_1 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:opensuse-42.1-c103199-20180628122439 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -104,15 +122,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: real - template: /eng/build.yml parameters: phaseName: OpenSuse_42_3 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:opensuse-42.3-c103199-20180628122439 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -121,15 +138,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: Ubuntu_14_04 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-c103199-20180628134413 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -138,15 +154,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: Ubuntu_16_04 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-c103199-20180628134544 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -155,15 +170,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: Ubuntu_17_10 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:ubuntu-17.10-c103199-20180628134544 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -172,15 +186,14 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test - template: /eng/build.yml parameters: phaseName: Ubuntu_18_04 agentOs: Linux - buildReason: Internal dockerImage: microsoft/dotnet-buildtools-prereqs:ubuntu-18.04-c103199-20180628134610 + dependsOn: CentOS_7 + testOnly: true queue: name: DotNet-Build demands: @@ -189,55 +202,249 @@ phases: Build_Debug: _BuildConfig: Debug _BuildArch: x64 - _PublishType: none - _SignType: test -- template: /eng/build.yml - parameters: - phaseName: MacOS - agentOs: Darwin - buildReason: Internal - queue: - name: Hosted macOS Preview - demands: - - agent.os -equals Darwin - parallel: 2 - matrix: - Build_Debug: - _BuildConfig: Debug - _BuildArch: x64 - _PublishType: none - _SignType: test - Build_Release: - _BuildConfig: Release - _BuildArch: x64 - _PublishType: none - _SignType: real +- phase: Sign_Package_Publish + dependsOn: + - Windows + - CentOS_7 + - MacOS + queue: + name: DotNetCore-Build + demands: + - agent.os -equals Windows_NT + steps: + - task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1 + displayName: Install MicroBuild plugin + inputs: + signType: real + zipSources: false + esrpSigning: true + env: + TeamName: DotNetCore + continueOnError: false + condition: succeeded() -- template: /eng/build.yml - parameters: - phaseName: Windows - agentOs: Windows_NT - buildReason: Internal - queue: - name: DotNetCore-Build - demands: - - agent.os -equals Windows_NT - parallel: 3 - matrix: - Build_Debug: - _BuildConfig: Debug - _BuildArch: x64 - _PublishType: none - _SignType: test - Build_Release: - _BuildConfig: Release - _BuildArch: x64 - _PublishType: none - _SignType: real - Build_Release_x86: - _BuildConfig: Release - _BuildArch: x86 - _PublishType: none - _SignType: real + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'DotNet-Engineering-Services_KeyVault' + KeyVaultName: EngKeyVault + SecretsFilter: 'dotnetfeed-storage-access-key-1' + condition: succeeded() + + # Windows x64 download, copy and archive. Everything under "bin" is published for the Windows x64 build. + + - task: DownloadBuildArtifacts@0 + displayName: Download Windows x64 and Managed Artifacts + inputs: + artifactName: Windows_Build_Release + downloadPath: '$(System.ArtifactsDirectory)' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Windows Artifacts + inputs: + sourceFolder: '$(System.ArtifactsDirectory)/Windows_Build_Release' + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin' + condition: succeeded() + + - task: ArchiveFiles@2 + displayName: Archive Windows x64 Artifacts + inputs: + archiveType: zip + includeRootFolder: false + rootFolderOrFile: '$(Build.SourcesDirectory)/artifacts/Release/bin/Windows_NT.x64' + archiveFile: '$(Build.SourcesDirectory)/artifacts/Release/sos-win-x64.zip' + condition: succeeded() + + # Windows x86 download, copy and archive. + + - task: DownloadBuildArtifacts@0 + displayName: Download Windows x86 Artifacts + inputs: + artifactName: Windows_Build_Release_x86 + downloadPath: '$(System.ArtifactsDirectory)' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Windows x86 Artifacts + inputs: + sourceFolder: '$(System.ArtifactsDirectory)/Windows_Build_Release_x86' + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/Windows_NT.x86' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Windows x86 Artifacts + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/SOS.NETCore/netcoreapp1.0' + contents: 'SOS.NETCore.dll' + overWrite: true + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/Windows_NT.x86' + condition: succeeded() + + - task: ArchiveFiles@2 + displayName: Archive Windows x86 Artifacts + inputs: + archiveType: zip + includeRootFolder: false + rootFolderOrFile: '$(Build.SourcesDirectory)/artifacts/Release/bin/Windows_NT.x86' + archiveFile: '$(Build.SourcesDirectory)/artifacts/Release/sos-win-x86.zip' + condition: succeeded() + + # Copy and archive the files for windbg extension gallery. + + - task: CopyFiles@2 + displayName: Copy Extension Gallery Files + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/Windows_NT.x64' + contents: 'sos.dll' + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/gallery/x64' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Extension Gallery Files + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/SOS.NETCore/netcoreapp1.0' + contents: 'SOS.NETCore.dll' + overWrite: true + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/gallery/x64' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Extension Gallery Files + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/Windows_NT.x86' + contents: 'sos.dll' + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/gallery/x86' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Extension Gallery Files + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/SOS.NETCore/netcoreapp1.0' + contents: 'SOS.NETCore.dll' + overWrite: true + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/gallery/x86' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Extension Gallery Files + inputs: + sourceFolder: '$(Build.SourcesDirectory)/eng' + contents: 'GalleryManifest.xml' + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/gallery' + condition: succeeded() + + - task: ArchiveFiles@2 + displayName: Archive Extension Gallery Files + inputs: + archiveType: zip + includeRootFolder: false + rootFolderOrFile: '$(Build.SourcesDirectory)/artifacts/Release/gallery' + archiveFile: '$(Build.SourcesDirectory)/artifacts/Release/sos-gallery.zip' + condition: succeeded() + + # Linux download, copy and archive + + - task: DownloadBuildArtifacts@0 + displayName: Download Linux Artifacts + inputs: + artifactName: CentOS_7_Build_Release + downloadPath: '$(System.ArtifactsDirectory)' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Linux Artifacts + inputs: + sourceFolder: '$(System.ArtifactsDirectory)/CentOS_7_Build_Release' + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/Linux.x64' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy Linux Artifacts + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/SOS.NETCore/netcoreapp1.0' + contents: 'SOS.NETCore.dll' + overWrite: true + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/Linux.x64' + condition: succeeded() + + - task: ArchiveFiles@2 + displayName: Archive Linux Artifacts + inputs: + archiveType: tar + includeRootFolder: false + tarCompression: gz + rootFolderOrFile: '$(Build.SourcesDirectory)/artifacts/Release/bin/Linux.x64' + archiveFile: '$(Build.SourcesDirectory)/artifacts/Release/sos-linux-x64.tar.gz' + condition: succeeded() + + # MacOS download, copy and archive + + - task: DownloadBuildArtifacts@0 + displayName: Download MacOS Artifacts + inputs: + artifactName: MacOS_Build_Release + downloadPath: '$(System.ArtifactsDirectory)' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy MacOS Artifacts + inputs: + sourceFolder: '$(System.ArtifactsDirectory)/MacOS_Build_Release' + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/OSX.x64' + condition: succeeded() + + - task: CopyFiles@2 + displayName: Copy MacOS Artifacts + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/SOS.NETCore/netcoreapp1.0' + contents: 'SOS.NETCore.dll' + overWrite: true + targetFolder: '$(Build.SourcesDirectory)/artifacts/Release/bin/OSX.x64' + condition: succeeded() + + - task: ArchiveFiles@2 + displayName: Archive MacOS Artifacts + inputs: + archiveType: tar + includeRootFolder: false + tarCompression: gz + rootFolderOrFile: '$(Build.SourcesDirectory)/artifacts/Release/bin/OSX.x64' + archiveFile: '$(Build.SourcesDirectory)/artifacts/Release/sos-osx-x64.tar.gz' + condition: succeeded() + + # Create nuget package and sign binaries + + - script: $(Build.SourcesDirectory)\eng\cipack.cmd + -configuration Release + -prepareMachine + /p:SignType=$(SignType) + /p:PB_PublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) + /p:PB_PublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json + /p:PB_PublishType=$(PublishType) + displayName: Sign / Package + env: + OfficialBuildId: $(BUILD.BUILDNUMBER) + continueOnError: true + condition: succeeded() + + # Optionally drop the artifacts on a share + + - task: PublishBuildArtifacts@1 + displayName: Drop Artifacts + inputs: + publishLocation: FilePath + pathtoPublish: '$(Build.SourcesDirectory)\artifacts\Release' + artifactName: '$(Build.BuildNumber)' + targetPath: '$(DropRoot)\DotNetCore\$(Build.DefinitionName)' + condition: and(succeeded(), eq(variables['DropArtifacts'], 'true')) + + # Optionally publish the packages to a myget feed + + - task: NuGetCommand@2 + displayName: Publish TestHelpers to MyGet dotnet-buildtools feed + inputs: + command: custom + arguments: 'push $(Build.SourcesDirectory)\artifacts\Release\packages\Shipping\Microsoft.Diagnostic.TestHelpers.*.nupkg -ApiKey $(dotnet-myget-org-api-key) -Source $(MyGetBuildToolsFeed)' + condition: and(succeeded(), eq(variables['PushPackages'], 'true')) diff --git a/Build.cmd b/Build.cmd index 075bdce94..2b5bba51f 100644 --- a/Build.cmd +++ b/Build.cmd @@ -1,3 +1,3 @@ @echo off -call %~dp0eng\Build.cmd -restore -build %* +call %~dp0eng\Build.cmd -restore -build -build-native %* exit /b %ErrorLevel% diff --git a/CMakeLists.txt b/CMakeLists.txt index 2475b2e3f..c39471bf9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,14 @@ if (WIN32) endif (WIN32) set(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -#set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.cpp") + +# Where the version source file for xplat is generated +set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.cpp") + +# Where _version.h for Windows is generated +if (WIN32) +include_directories("${CMAKE_BINARY_DIR}") +endif (WIN32) set(CORECLR_SET_RPATH ON) if(CORECLR_SET_RPATH) diff --git a/build.sh b/build.sh index 75055e9c9..3bbc31edf 100755 --- a/build.sh +++ b/build.sh @@ -13,4 +13,4 @@ while [[ -h $source ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -"$scriptroot/eng/build.sh" --restore --build $@ +"$scriptroot/eng/build.sh" --restore --build --build-native $@ diff --git a/diagnostics.sln b/diagnostics.sln index f5adb8e08..a821688fd 100644 --- a/diagnostics.sln +++ b/diagnostics.sln @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SOS", "SOS", "{41638A4C-0DA EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SOS.UnitTests", "src\SOS\SOS.UnitTests\SOS.UnitTests.csproj", "{1532DB3C-7DCD-45C6-B697-62B8378A16A2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildTools", "eng\BuildTools.csproj", "{32F02701-A0CD-48DD-BC34-536251B90461}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -71,6 +73,18 @@ Global {1532DB3C-7DCD-45C6-B697-62B8378A16A2}.Release|x64.Build.0 = Release|Any CPU {1532DB3C-7DCD-45C6-B697-62B8378A16A2}.Release|x86.ActiveCfg = Release|Any CPU {1532DB3C-7DCD-45C6-B697-62B8378A16A2}.Release|x86.Build.0 = Release|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Debug|Any CPU.Build.0 = Debug|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Debug|x64.ActiveCfg = Debug|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Debug|x64.Build.0 = Debug|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Debug|x86.ActiveCfg = Debug|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Debug|x86.Build.0 = Debug|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Release|Any CPU.ActiveCfg = Release|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Release|Any CPU.Build.0 = Release|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Release|x64.ActiveCfg = Release|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Release|x64.Build.0 = Release|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Release|x86.ActiveCfg = Release|Any CPU + {32F02701-A0CD-48DD-BC34-536251B90461}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/eng/Build-Native.cmd b/eng/Build-Native.cmd index fd9ed8562..499f24b4f 100644 --- a/eng/Build-Native.cmd +++ b/eng/Build-Native.cmd @@ -72,7 +72,7 @@ if /i "%1" == "-h" goto Usage if /i "%1" == "-help" goto Usage if /i "%1" == "--help" goto Usage -if /i "%1" == "-build" (set __Build=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-build-native" (set __Build=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-test" (set __Test=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-configuration" (set __BuildType=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) if /i "%1" == "-architecture" (set __BuildArch=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) @@ -81,6 +81,7 @@ if /i "%1" == "-verbosity" (set __Verbosity=%2&set processedArgs=!proc if /i "%1" == "-ci" (set __TestArgs=!__TestArgs! %1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-solution" (set __TestArgs=!__TestArgs! %1 %2&set processedArgs=!processedArgs! %1&shift&shift&goto Arg_Loop) :: These options are ignored for a native build +if /i "%1" == "-build" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-rebuild" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-sign" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-restore" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) @@ -152,13 +153,17 @@ REM ============================================================================ @if defined _echo @echo on -REM Parse the optdata package versions out of msbuild so that we can pass them on to CMake +:: Parse the optdata package versions out of msbuild so that we can pass them on to CMake set DotNetCli=%__ProjectDir%\.dotnet\dotnet.exe if not exist "%DotNetCli%" ( - echo %__MsgPrefix%Assertion failed: dotnet.exe not found at path "%DotNetCli%" + echo %__MsgPrefix%Assertion failed: dotnet cli not found at path "%DotNetCli%" + exit /b 1 +) +set MSBuildPath=%__ProjectDir%\.dotnet\sdk\2.1.300\MSBuild.dll +if not exist "%MSBuildPath%" ( + echo %__MsgPrefix%Assertion failed: dotnet cli sdk not found at path "%MSBuildPath%" exit /b 1 ) -set MSBuildPath=%__ProjectDir%\.dotnet\sdk\2.1.300-rc1-008673\msbuild.dll REM ========================================================================================= REM === @@ -209,6 +214,14 @@ if %__Build% EQU 1 ( if not exist "!VSINSTALLDIR!DIA SDK" goto NoDIA :GenVSSolution + echo Generating Version Header + set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog" + %DotNetCli% %MSBuildPath% %__ProjectDir%\eng\CreateVersionFile.csproj /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionHeader2 /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + if not !errorlevel! == 0 ( + echo Generate Version Header FAILED + exit /b 1 + ) + if defined __SkipConfigure goto SkipConfigure echo %__MsgPrefix%Regenerating the Visual Studio solution @@ -229,22 +242,14 @@ if %__Build% EQU 1 ( echo %__MsgPrefix%Error: failed to generate native component build project! exit /b 1 ) + set __BuildLog="%__LogDir%\Native.Build.binlog" - set __BuildLogRootName=Native - set __BuildLog="%__LogDir%\!__BuildLogRootName!.log" - set __BuildWrn="%__LogDir%\!__BuildLogRootName!.wrn" - set __BuildErr="%__LogDir%\!__BuildLogRootName!.err" - set __MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog! - set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn! - set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr! - - msbuild.exe %__IntermediatesDir%\install.vcxproj /v:!__Verbosity! !__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + :: For some currently unknown reason, "%DotNetCli% msbuild" fails because VCTargetsPath isn't defined. + msbuild.exe %__IntermediatesDir%\install.vcxproj /v:!__Verbosity! /bl:!__BuildLog! /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% - if not !errorlevel! == 0 ( + if not !ERRORLEVEL! == 0 ( echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details: echo !__BuildLog! - echo !__BuildWrn! - echo !__BuildErr! exit /b 1 ) @@ -293,24 +298,16 @@ if /i "%__DoCrossArchBuild%"=="1" ( echo %__MsgPrefix%Error: failed to generate cross-arch components build project! exit /b 1 ) - if defined __ConfigureOnly goto SkipCrossCompBuild - set __BuildLogRootName=Native.Cross - set __BuildLog="%__LogDir%\!__BuildLogRootName!.log" - set __BuildWrn="%__LogDir%\!__BuildLogRootName!.wrn" - set __BuildErr="%__LogDir%\!__BuildLogRootName!.err" - set __MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog! - set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn! - set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr! + set __BuildLog="%__LogDir%\Cross.Build.binlog" - msbuild.exe %__CrossCompIntermediatesDir%\install.vcxproj /v:!__Verbosity! !__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! /p:Configuration=%__BuildType% /p:Platform=%__CrossArch% %__UnprocessedBuildArgs% + :: For some currently unknown reason, "%DotNetCli% msbuild" fails because VCTargetsPath isn't defined. + msbuild.exe %__CrossCompIntermediatesDir%\install.vcxproj /v:!__Verbosity! /bl:!__BuildLog! /p:Configuration=%__BuildType% /p:Platform=%__CrossArch% %__UnprocessedBuildArgs% - if not !errorlevel! == 0 ( + if not !ERRORLEVEL! == 0 ( echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details: echo !__BuildLog! - echo !__BuildWrn! - echo !__BuildErr! exit /b 1 ) @@ -336,7 +333,7 @@ if %__Test% EQU 1 ( :: Run the xunit tests powershell -ExecutionPolicy ByPass -NoProfile -command "& """%__ProjectDir%\eng\common\Build.ps1""" -test -configuration %__BuildType% -verbosity %__Verbosity% %__TestArgs%" - exit /b %ERRORLEVEL + exit /b !ERRORLEVEL! ) exit /b 0 @@ -356,7 +353,7 @@ echo. echo All arguments are optional. The options are: echo. echo.-? -h -help --help: view this message. -echo -build - build native components +echo -build-native - build native components echo -test - test components echo -architecture echo -configuration diff --git a/eng/Build.cmd b/eng/Build.cmd index 16bbed608..8ef13939c 100644 --- a/eng/Build.cmd +++ b/eng/Build.cmd @@ -1,13 +1,15 @@ @echo off setlocal -:: remove the -test option and pass it to build-native.cmd -set "__args=%*" -set "__args=%__args:-test=%" +:: remove the -test and -build-native options and pass it to build-native.cmd +set __args="%*" +set __args=%__args:-test=% +set __args=%__args:-build-native=% +if %__args% == "" set __args= :: build managed components powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0common\Build.ps1""" %__args%" -if NOT '%ERRORLEVEL%' == '0' exit /b %ERRORLEVEL% +if NOT '%ERRORLEVEL%' == '0' (exit /b %ERRORLEVEL%) :: build native componments and test managed/native call %~dp0build-native.cmd %* diff --git a/eng/BuildTask.targets b/eng/BuildTask.targets deleted file mode 100644 index 6f3b5366c..000000000 --- a/eng/BuildTask.targets +++ /dev/null @@ -1,71 +0,0 @@ - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - - - false - true - - - - - - %(RecursiveDir)%(Filename)%(Extension) - - - - - - - - - - - - All - true - runtime - - - All - true - - - - false - - - - - - $(TargetsForTfmSpecificContentInPackage);CollectAssets - - - - - - - - tools/$(TargetFramework)/%(FilteredFileToPublish.RelativePath) - - - - diff --git a/eng/BuildTools.csproj b/eng/BuildTools.csproj new file mode 100644 index 000000000..01dcd1301 --- /dev/null +++ b/eng/BuildTools.csproj @@ -0,0 +1,41 @@ + + + + + + netcoreapp2.1 + BuildTools + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/CIBuild.cmd b/eng/CIBuild.cmd index 2cd76c23c..6ed2ac841 100644 --- a/eng/CIBuild.cmd +++ b/eng/CIBuild.cmd @@ -1,3 +1,3 @@ @echo off -call %~dp0Build.cmd -restore -build -test -publish -sign -pack -ci %* +call %~dp0Build.cmd -restore -build -build-native -test -publish -ci %* exit /b %ErrorLevel% diff --git a/eng/CreateVersionFile.csproj b/eng/CreateVersionFile.csproj new file mode 100644 index 000000000..525194beb --- /dev/null +++ b/eng/CreateVersionFile.csproj @@ -0,0 +1,58 @@ + + + + $(BUILD_BUILDNUMBER) + + + + + + + $(BuildVersionFilePath)BuildVersion2-$(TodayTimeStamp).props + true + + + + + + + + + + + + $(MajorVersion).$(MinorVersion).$(_BuildNumberFiveDigitDateStamp).$(_BuildNumberBuildOfTheDayPadded) + $(_BuildNumberFiveDigitDateStamp) + $(_BuildNumberBuildOfTheDayPadded) + + + + + + + $(FileVersion) + $(BuildNumberMajor) + $(BuildNumberMinor) + + +]]> + + + + + + + + + + + diff --git a/eng/GalleryManifest.xml b/eng/GalleryManifest.xml new file mode 100644 index 000000000..60f7cb81a --- /dev/null +++ b/eng/GalleryManifest.xml @@ -0,0 +1,39 @@ + + + SOS + 1.0.0.0 + Debugging aid for .NET Core programs and runtimes + + + + + + + + + + + + + + + !clrstack + Provides a stack trace of managed code only + + + + + !clrthreads + List the managed threads running + + + + + !soshelp + Displays all available SOS commands or details about the command + + + + + + diff --git a/eng/SignToolData.json b/eng/SignToolData.json index aede13693..1592fa20d 100644 --- a/eng/SignToolData.json +++ b/eng/SignToolData.json @@ -4,8 +4,15 @@ "certificate": "MicrosoftSHA2", "strongName": "MsSharedLib72", "values": [ + "bin/Microsoft.Diagnostic.TestHelpers/netcoreapp2.0/Microsoft.Diagnostic.TestHelpers.dll", "bin/SOS.NETCore/netcoreapp1.0/SOS.NETCore.dll", - "bin/Microsoft.Diagnostic.TestHelpers/netcoreapp2.0/Microsoft.Diagnostic.TestHelpers.dll" + ] + }, + { + "certificate": "MicrosoftSHA2", + "values": [ + "bin/Windows_NT.x64/sos.dll", + "bin/Windows_NT.x86/sos.dll" ] }, { @@ -14,6 +21,13 @@ "values": [ "packages/Shipping/*.nupkg" ] + }, + { + "certificate": null, + "strongName": null, + "values": [ + "*.zip" + ] } ], "exclude": [ diff --git a/eng/Versions.props b/eng/Versions.props index 50a3d6613..c8e1daacb 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -7,6 +7,7 @@ 1.0.0 beta + 2.2.0-preview1-03108-01 1.0.0-beta2-63127-01 2.8.0-beta6-62830-08 true diff --git a/eng/build-native.sh b/eng/build-native.sh index 868e1e432..c556b47c0 100755 --- a/eng/build-native.sh +++ b/eng/build-native.sh @@ -28,36 +28,19 @@ __CrossBuild=0 __NumProc=1 __Build=0 __Test=0 +__CI=0 __TestArgs= __UnprocessedBuildArgs= -# resolve python-version to use -if [ "$PYTHON" == "" ] ; then - if ! PYTHON=$(command -v python2.7 || command -v python2 || command -v python) - then - echo "Unable to locate build-dependency python2.x!" 1>&2 - exit 1 - fi -fi - -# validate python-dependency -# useful in case of explicitly set option. -if ! command -v $PYTHON > /dev/null -then - echo "Unable to locate build-dependency python2.x ($PYTHON)!" 1>&2 - exit 1 -fi - -echo $PYTHON - usage() { echo "Usage: $0 [options]" - echo "--build - build native components" + echo "--build-native - build native components" echo "--test - test native components" echo "--architecture " echo "--configuration " echo "--clangx.y - optional argument to build using clang version x.y" + echo "--ci - CI lab build" echo "--verbosity " echo "--help - this help message" exit 1 @@ -169,21 +152,23 @@ while :; do exit 1 ;; - --build) + --build-native) __Build=1 ;; + # Passed to common build script when testing --test) __Test=1 ;; - # Passed to common build script when testing --ci) + __CI=1 __TestArgs="$__TestArgs $1" ;; --solution) __TestArgs="$__TestArgs $1 $2" + shift ;; --verbosity) @@ -191,10 +176,6 @@ while :; do shift ;; - # Ignored for a native build - --rebuild|--sign|--restore|--pack|--publish|--preparemachine) - ;; - --configuration) __BuildType="$(to_lowercase "$2")" shift @@ -245,6 +226,10 @@ while :; do shift ;; + # Ignored for a native build + --build|--rebuild|--sign|--restore|--pack|--publish|--preparemachine) + ;; + *) __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" ;; @@ -260,6 +245,33 @@ if [ "$__BuildType" == "debug" ]; then __BuildType=Debug fi +# Needs to be set for generate version source file/msbuild +if [[ -z $NUGET_PACKAGES ]]; then + if [[ $__CI ]]; then + export NUGET_PACKAGES="$__ProjectRoot/.packages" + else + export NUGET_PACKAGES="$HOME/.nuget/packages" + fi +fi + +# Resolve python-version to use +if [ "$PYTHON" == "" ] ; then + if ! PYTHON=$(command -v python2.7 || command -v python2 || command -v python) + then + echo "Unable to locate build-dependency python2.x!" 1>&2 + exit 1 + fi +fi + +# Validate python-dependency. Useful in case of explicitly set option. +if ! command -v $PYTHON > /dev/null +then + echo "Unable to locate build-dependency python2.x ($PYTHON)!" 1>&2 + exit 1 +fi + +echo $PYTHON + __RootBinDir=$__ProjectRoot/artifacts __ConfigBinDir=$__RootBinDir/$__BuildType __BinDir=$__ConfigBinDir/bin/$__BuildOS.$__BuildArch @@ -268,6 +280,17 @@ __IntermediatesDir=$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType __ResultsDir=$__ConfigBinDir/TestResults __PackagesBinDir=$__ConfigBinDir/packages __ExtraCmakeArgs=-DCLR_MANAGED_BINARY_DIR=$__ConfigBinDir/bin +__DotNetCli=$__ProjectRoot/.dotnet/dotnet +__MSBuildPath=$__ProjectRoot/.dotnet/sdk/2.1.300/MSBuild.dll + +if [ ! -e $__DotNetCli ]; then + echo "dotnet cli not installed $__DotNetCli" + exit 1 +fi +if [ ! -e $__MSBuildPath ]; then + echo "dotnet cli sdk not installed $__MSBuildPath" + exit 1 +fi # Specify path to be set for CMAKE_INSTALL_PREFIX. # This is where all built native libraries will copied to. @@ -427,6 +450,14 @@ fi # Build native components if [ $__Build == 1 ]; then + echo "Generating Version Source File" + __GenerateVersionLog="$__LogDir/GenerateVersion.binlog" + $__DotNetCli $__MSBuildPath $__ProjectRoot/eng/CreateVersionFile.csproj /noconlog /bl:$__GenerateVersionLog /t:GenerateVersionSourceFile2 /p:GenerateVersionSourceFile=true /p:NativeVersionSourceFile="$__IntermediatesDir/version.cpp" /p:Configuration="$__BuildType" /p:Platform="$__BuildArch" $__UnprocessedBuildArgs + if [ $? != 0 ]; then + echo "Generating Version Source File FAILED" + exit 1 + fi + build_native "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeArgs" fi diff --git a/eng/build.sh b/eng/build.sh index 73db51936..ed8e0e985 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -17,7 +17,7 @@ done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" # remove the options that build.sh can't handle and pass it to build-native.sh -__args="$(echo $@ | sed 's/--test//g;s/--clang[0-9]\.[0-9]//g')" +__args="$(echo $@ | sed 's/--test//g;s/--build-native//g;s/--clang[0-9]\.[0-9]//g')" # build managed components "$scriptroot/common/build.sh" $__args diff --git a/eng/build.yml b/eng/build.yml index 17a66c285..6bf5430ea 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -4,132 +4,133 @@ # agentOs: [Windows_NT (default), Linux, OSX] Used in templates to define variables which are OS specific # dockerImage: If defined, specifies docker image to run build steps in # matrix: build matrix -# queueName: agent pool name # enableTelemetry: send telemetry if build is not a PR or CI build +# queue YAML object - https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-schema.md#queue +# variables YAML object - https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-schema.md#phase parameters: phaseName: '' agentOs: Windows_NT dockerImage: '' + testOnly: false + dependsOn: '' enableTelemetry: true queue: {} - useEsrpSigning: true + variables: {} phases: - template: /eng/common/templates/phases/base.yml parameters: + name: ${{ parameters.phaseName }} agentOs: ${{ parameters.agentOs }} - buildConfig: $(_BuildConfig) - phaseName: ${{ parameters.phaseName }} + dependsOn: ${{ parameters.dependsOn }} enableTelemetry: ${{ parameters.enableTelemetry }} - helixType: build/product - ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - helixSource: official/dotnet/arcade/$(Build.SourceBranch) - ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - helixSource: pr/dotnet/arcade/$(Build.SourceBranch) - phase: - queue: ${{ parameters.queue }} - variables: - _DockerImageName: ${{ parameters.dockerImage }} - _PhaseName : ${{ parameters.phaseName }} - ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - _PublishBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json - _TeamName: DotNetCore - _UseEsrpSigning: ${{ parameters.useEsrpSigning }} - ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - _PublishArgs: /p:PB_PublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) - /p:PB_PublishBlobFeedUrl=$(_PublishBlobFeedUrl) - /p:PB_PublishType=$(_PublishType) - ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - _PublishArgs: '' + queue: ${{ parameters.queue }} - steps: - - template: /eng/common/templates/steps/run-on-windows.yml - parameters: - agentOs: ${{ parameters.agentOs }} - steps: - - template: /eng/common/templates/steps/build-reason.yml - parameters: - conditions: not IndividualCI,BatchedCI,PullRequest - steps: - - task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1 - displayName: Install MicroBuild plugin - inputs: - signType: $(_SignType) - zipSources: false - esrpSigning: $(_UseEsrpSigning) - env: - TeamName: $(_TeamName) - continueOnError: false - condition: and(succeeded(), in(variables._SignType, 'real', 'test')) - - task: AzureKeyVault@1 - inputs: - azureSubscription: 'DotNet-Engineering-Services_KeyVault' - KeyVaultName: EngKeyVault - SecretsFilter: 'dotnetfeed-storage-access-key-1' - condition: succeeded() - - script: $(Build.SourcesDirectory)\eng\cibuild.cmd - -configuration $(_BuildConfig) - -architecture $(_BuildArch) - -prepareMachine - /p:SignType=$(_SignType) - $(_PublishArgs) - name: Build_Test - displayName: Build / Test - env: - OfficialBuildId: $(BUILD.BUILDNUMBER) - condition: succeeded() + variables: + ${{ insert }}: ${{ parameters.variables }} + _PortableLinuxBuild: CentOS_7_Build_$(_BuildConfig) + _DockerImageName: ${{ parameters.dockerImage }} + _PhaseName : ${{ parameters.phaseName }} + _HelixType: build/product + _HelixBuildConfig: $(_BuildConfig) + ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: + _HelixSource: official/dotnet/arcade/$(Build.SourceBranch) + ${{ if eq(parameters.testOnly, 'true') }}: + _LinuxScript: $(Build.SourcesDirectory)/eng/citest.sh + ${{ if ne(parameters.testOnly, 'true') }}: + _LinuxScript: $(Build.SourcesDirectory)/eng/cibuild.sh + ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}: + _HelixSource: pr/dotnet/arcade/$(Build.SourceBranch) + _LinuxScript: $(Build.SourcesDirectory)/eng/cibuild.sh - - ${{ if eq(parameters.agentOs, 'Linux') }}: - - script: $(Build.SourcesDirectory)/eng/docker-cibuild.sh - --docker-image $(_DockerImageName) - --source-directory $(Build.SourcesDirectory) - --container-name diagnostics-$(Build.BuildId) - --configuration $(_BuildConfig) - --architecture $(_BuildArch) - --prepareMachine - /p:SignType=$(_SignType) - $(_PublishArgs) - name: Build_Test - displayName: Docker Build / Test + steps: + # Internal only build steps + - template: /eng/common/templates/steps/run-on-windows.yml + parameters: + agentOs: ${{ parameters.agentOs }} + steps: + - script: $(Build.SourcesDirectory)\eng\cibuild.cmd + -configuration $(_BuildConfig) + -architecture $(_BuildArch) + -prepareMachine + displayName: Build / Test env: OfficialBuildId: $(BUILD.BUILDNUMBER) condition: succeeded() - - ${{ if eq(parameters.agentOs, 'Darwin') }}: - - script: $(Build.SourcesDirectory)/eng/cibuild.sh - --configuration $(_BuildConfig) - --architecture $(_BuildArch) - --prepareMachine - /p:SignType=$(_SignType) - $(_PublishArgs) - name: Build_Test - displayName: Build / Test - env: - OfficialBuildId: $(BUILD.BUILDNUMBER) + - ${{ if eq(parameters.agentOs, 'Linux') }}: + - ${{ if eq(parameters.testOnly, 'true') }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Linux-x64 Artifacts + inputs: + artifactName: $(_PortableLinuxBuild) + downloadPath: '$(System.ArtifactsDirectory)' condition: succeeded() - - template: /eng/common/templates/steps/build-reason.yml - parameters: - conditions: not IndividualCI,BatchedCI,PullRequest - steps: - - task: CopyFiles@2 - displayName: Gather Logs - inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts' - Contents: '**/*log' - TargetFolder: '$(Build.StagingDirectory)/BuildLogs' - continueOnError: true - condition: always() + - task: CopyFiles@2 + displayName: Place Linux-x64 Artifacts + inputs: + sourceFolder: '$(System.ArtifactsDirectory)/$(_PortableLinuxBuild)' + targetFolder: '$(Build.SourcesDirectory)/artifacts/$(_BuildConfig)/bin/Linux.x64' + condition: succeeded() + + - script: $(Build.SourcesDirectory)/eng/docker-build.sh + --docker-image $(_DockerImageName) + --source-directory $(Build.SourcesDirectory) + --container-name diagnostics-$(Build.BuildId) + $(_LinuxScript) + --configuration $(_BuildConfig) + --architecture $(_BuildArch) + --prepareMachine + /p:BUILD_BUILDNUMBER=$(BUILD.BUILDNUMBER) + displayName: Docker Build / Test + env: + OfficialBuildId: $(BUILD.BUILDNUMBER) + condition: succeeded() + + - ${{ if eq(parameters.agentOs, 'Darwin') }}: + - script: $(Build.SourcesDirectory)/eng/cibuild.sh + --configuration $(_BuildConfig) + --architecture $(_BuildArch) + --prepareMachine + displayName: Build / Test + env: + OfficialBuildId: $(BUILD.BUILDNUMBER) + condition: succeeded() + + # Internal only build steps (until publishing artifacts in public CI is supported) + - template: /eng/common/templates/steps/build-reason.yml + parameters: + conditions: not IndividualCI,BatchedCI,PullRequest + steps: + - task: PublishBuildArtifacts@1 + displayName: Upload Artifacts + inputs: + pathtoPublish: '$(Build.SourcesDirectory)/artifacts/$(_BuildConfig)/$(_PublishArtifacts)' + artifactName: $(_PhaseName)_$(Agent.JobName) + condition: and(succeeded(), ne(variables['_PublishArtifacts'], '')) + + - task: CopyFiles@2 + displayName: Gather Build Logs + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/$(_BuildConfig)/log' + targetFolder: '$(Build.StagingDirectory)/BuildLogs' + continueOnError: true + condition: always() + + - task: CopyFiles@2 + displayName: Gather Test Logs + inputs: + sourceFolder: '$(Build.SourcesDirectory)/artifacts/$(_BuildConfig)/TestResults' + targetFolder: '$(Build.StagingDirectory)/BuildLogs' + continueOnError: true + condition: always() - - task: PublishBuildArtifacts@1 - displayName: Publish Logs to VSTS - inputs: - PathtoPublish: '$(Build.StagingDirectory)/BuildLogs' - PublishLocation: Container - ${{ if eq(parameters.agentOs, 'Windows_NT') }}: - ArtifactName: Windows_NT_$(Agent.JobName) - ${{ if ne(parameters.agentOs, 'Windows_NT') }}: - ArtifactName: Linux_$(_PhaseName)_$(Agent.JobName) - continueOnError: true - condition: always() + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + pathtoPublish: '$(Build.StagingDirectory)/BuildLogs' + artifactName: Logs_$(_PhaseName)_$(Agent.JobName) + continueOnError: true + condition: always() diff --git a/eng/cibuild.sh b/eng/cibuild.sh index 632885f06..1a064f685 100755 --- a/eng/cibuild.sh +++ b/eng/cibuild.sh @@ -37,7 +37,7 @@ if [ "$__osname" == "Linux" ]; then fi fi -"$scriptroot/build.sh" --restore --build --test --publish --pack --ci $@ +"$scriptroot/build.sh" --restore --build --build-native --test --publish --ci $@ if [[ $? != 0 ]]; then exit 1 fi diff --git a/eng/cipack.cmd b/eng/cipack.cmd new file mode 100644 index 000000000..b26c4a421 --- /dev/null +++ b/eng/cipack.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0common\Build.ps1""" -restore -sign -pack %*" +exit /b %ErrorLevel% diff --git a/eng/citest.sh b/eng/citest.sh new file mode 100755 index 000000000..4057516d2 --- /dev/null +++ b/eng/citest.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where + # the symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +# Fix any CI lab docker image problems + +__osname=$(uname -s) +if [ "$__osname" == "Linux" ]; then + if [ -e /etc/os-release ]; then + source /etc/os-release + if [[ $ID == "ubuntu" ]]; then + if [[ $VERSION_ID == "18.04" ]]; then + # Fix the CI lab's ubuntu 18.04 docker image: install curl. + sudo apt-get update + sudo apt-get install -y curl + fi + fi + elif [ -e /etc/redhat-release ]; then + __redhatRelease=$(> /etc/sudoers" + +echo "Execute $args" +$docker_bin exec --workdir=$source_directory --user $container_user_name $docker_id $args +lasterrorcode=$? + +echo "Cleanup Docker Container/Network" +$docker_bin container stop $docker_id +$docker_bin network rm vsts_network_$docker_container_name + +exit $lasterrorcode + diff --git a/eng/docker-cibuild.sh b/eng/docker-cibuild.sh deleted file mode 100755 index c06eb2820..000000000 --- a/eng/docker-cibuild.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) .NET Foundation and contributors. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -source_directory= -docker_image= -docker_container_name= - -while [ $# -ne 0 ]; do - name=$1 - case $name in - -s|--source-directory) - shift - source_directory=$1 - ;; - -i|--docker-image) - shift - docker_image=$1 - ;; - -c|--container-name) - shift - docker_container_name=$1 - ;; - *) - args="$args $1" - ;; - esac - shift -done - -echo "Initialize Docker Container" -docker_bin=$(which docker) -$docker_bin --version - -# Get user id -user_name=$(whoami) -echo "user name: $user_name" -user_id=$(id -u $user_name) -echo "user id: $user_id" - -# Download image -$docker_bin pull $docker_image - -# Create local network to avoid port conflicts when multiple agents run on same machine -$docker_bin network create vsts_network_$docker_container_name - -# Create and start container -docker_id="$($docker_bin create -it --rm --privileged --ulimit core=-1 \ - --name vsts_container_$docker_container_name \ - --network=vsts_network_$docker_container_name \ - --volume $source_directory:$source_directory \ - --workdir=$source_directory $docker_image bash --verbose)" -$docker_bin start $docker_id - -# Create an user with the same uid in the container -container_user_name=vsts_$user_name -echo "container user name: $container_user_name" - -# Add sudo user with same uid that can run any sudo command without password -$docker_bin exec $docker_id useradd -m -u $user_id $container_user_name -$docker_bin exec $docker_id groupadd container_SUDO_user -$docker_bin exec $docker_id usermod -a -G container_SUDO_user $container_user_name -$docker_bin exec $docker_id su -c "$source_directory/eng/docker-init.sh" -$docker_bin exec $docker_id su -c "echo '%container_SUDO_user ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers" - -echo "Execute cibuild.sh $args" -$docker_bin exec --workdir=$source_directory --user $container_user_name $docker_id $source_directory/eng/cibuild.sh $args -lasterrorcode=$? - -echo "Cleanup Docker Container/Network" -$docker_bin container stop $docker_id -$docker_bin network rm vsts_network_$docker_container_name - -exit $lasterrorcode - diff --git a/functions.cmake b/functions.cmake index afdd19006..d952e22c5 100644 --- a/functions.cmake +++ b/functions.cmake @@ -156,11 +156,7 @@ function(install_clr targetName) endfunction() function(_add_executable) - if(NOT WIN32) - add_executable(${ARGV} ${VERSION_FILE_PATH}) - else() - add_executable(${ARGV}) - endif(NOT WIN32) + add_executable(${ARGV}) list(FIND CLR_CROSS_COMPONENTS_LIST ${ARGV0} INDEX) if (DEFINED CLR_CROSS_COMPONENTS_LIST AND ${INDEX} EQUAL -1) set_target_properties(${ARGV0} PROPERTIES EXCLUDE_FROM_ALL 1) @@ -168,11 +164,7 @@ function(_add_executable) endfunction() function(_add_library) - if(NOT WIN32) - add_library(${ARGV} ${VERSION_FILE_PATH}) - else() - add_library(${ARGV}) - endif(NOT WIN32) + add_library(${ARGV}) list(FIND CLR_CROSS_COMPONENTS_LIST ${ARGV0} INDEX) if (DEFINED CLR_CROSS_COMPONENTS_LIST AND ${INDEX} EQUAL -1) set_target_properties(${ARGV0} PROPERTIES EXCLUDE_FROM_ALL 1) @@ -180,11 +172,19 @@ function(_add_library) endfunction() function(add_library_clr) - _add_library(${ARGV}) + if(NOT WIN32) + _add_library(${ARGV} ${VERSION_FILE_PATH}) + else() + _add_library(${ARGV}) + endif(NOT WIN32) endfunction() function(add_executable_clr) - _add_executable(${ARGV}) + if(NOT WIN32) + _add_executable(${ARGV} ${VERSION_FILE_PATH}) + else() + _add_executable(${ARGV}) + endif(NOT WIN32) endfunction() function(_install) diff --git a/pack.cmd b/pack.cmd deleted file mode 100644 index 421727fe1..000000000 --- a/pack.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -pack %*" -exit /b %ErrorLevel% diff --git a/src/SOS/SOS.NETCore/SOS.NETCore.csproj b/src/SOS/SOS.NETCore/SOS.NETCore.csproj index a88c47e8b..93ed689de 100644 --- a/src/SOS/SOS.NETCore/SOS.NETCore.csproj +++ b/src/SOS/SOS.NETCore/SOS.NETCore.csproj @@ -6,12 +6,68 @@ true ;1591;1701 true - Managed SOS Services + .NET Core SOS + SOS $(Description) SOS + false + + + <_PackageFiles Include="$(ArtifactsBinDir)\SOS.NETCore\netcoreapp1.0\SOS.NETCore.dll"> + None + tools/win-x64 + + <_PackageFiles Include="$(ArtifactsBinDir)\Windows_NT.x64\sos.dll"> + None + tools/win-x64 + + + <_PackageFiles Include="$(ArtifactsBinDir)\SOS.NETCore\netcoreapp1.0\SOS.NETCore.dll"> + None + tools/win-x86 + + <_PackageFiles Include="$(ArtifactsBinDir)\Windows_NT.x86\sos.dll"> + None + tools/win-x86 + + + <_PackageFiles Include="$(ArtifactsBinDir)\SOS.NETCore\netcoreapp1.0\SOS.NETCore.dll"> + None + tools/linux-x64 + + <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64\libsosplugin.so"> + None + tools/linux-x64 + + <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64\libsos.so"> + None + tools/linux-x64 + + <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64\sosdocsunix.txt"> + None + tools/linux-x64 + + + <_PackageFiles Include="$(ArtifactsBinDir)\SOS.NETCore\netcoreapp1.0\SOS.NETCore.dll"> + None + tools/osx-x64 + + <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64\libsosplugin.dylib"> + None + tools/osx-x64 + + <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64\libsos.dylib"> + None + tools/osx-x64 + + <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64\sosdocsunix.txt"> + None + tools/osx-x64 + + diff --git a/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj b/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj index 1171ef9f5..f914a8b3d 100644 --- a/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj +++ b/src/SOS/SOS.UnitTests/SOS.UnitTests.csproj @@ -2,6 +2,7 @@ netcoreapp2.0 + false ;1591;1701 $(DefineConstants);CORE_CLR diff --git a/src/SOS/Strike/sosdocs.txt b/src/SOS/Strike/sosdocs.txt index b62cef4bd..344574955 100644 --- a/src/SOS/Strike/sosdocs.txt +++ b/src/SOS/Strike/sosdocs.txt @@ -23,7 +23,7 @@ Type "!help " for detailed info on that function. Object Inspection Examining code and stacks ----------------------------- ----------------------------- -DumpObj (do) Threads +DumpObj (do) Threads (clrthreads) DumpArray (da) ThreadState DumpAsync IP2MD DumpStackObjects (dso) U @@ -399,6 +399,7 @@ The arguments in detail: \\ +COMMAND: dso. COMMAND: dumpstackobjects. !DumpStackObjects [-verify] [top stack [bottom stack]] @@ -719,6 +720,7 @@ The arguments in detail: the finalizer thread when it gets a chance to run. \\ +COMMAND: pe. COMMAND: printexception. !PrintException [-nested] [-lines] [-ccw] [] [] @@ -850,6 +852,7 @@ Possible thread states: Failed to Start Detached \\ +COMMAND: clrthreads. COMMAND: threads. !Threads [-live] [-special] diff --git a/src/SOS/dbgutil/CMakeLists.txt b/src/SOS/dbgutil/CMakeLists.txt index 1c0d49a24..7b2a68a76 100644 --- a/src/SOS/dbgutil/CMakeLists.txt +++ b/src/SOS/dbgutil/CMakeLists.txt @@ -13,4 +13,4 @@ if(CLR_CMAKE_PLATFORM_UNIX) add_compile_options(-fPIC) endif(CLR_CMAKE_PLATFORM_UNIX) -add_library_clr(dbgutil STATIC ${DBGUTIL_SOURCES}) +_add_library(dbgutil STATIC ${DBGUTIL_SOURCES}) diff --git a/src/SOS/debugshim/CMakeLists.txt b/src/SOS/debugshim/CMakeLists.txt index 8537f5642..3deae4b9c 100644 --- a/src/SOS/debugshim/CMakeLists.txt +++ b/src/SOS/debugshim/CMakeLists.txt @@ -12,4 +12,4 @@ set(DEBUGSHIM_SOURCES debugshim.cpp ) -add_library_clr(debugshim STATIC ${DEBUGSHIM_SOURCES}) +_add_library(debugshim STATIC ${DEBUGSHIM_SOURCES}) diff --git a/src/SOS/lldbplugin.tests/TestDebuggee/TestDebuggee.csproj b/src/SOS/lldbplugin.tests/TestDebuggee/TestDebuggee.csproj index cb3144fc2..a6585e5c2 100644 --- a/src/SOS/lldbplugin.tests/TestDebuggee/TestDebuggee.csproj +++ b/src/SOS/lldbplugin.tests/TestDebuggee/TestDebuggee.csproj @@ -3,6 +3,7 @@ Exe netcoreapp2.0 + false true ;1591;1701 diff --git a/src/SOS/lldbplugin/CMakeLists.txt b/src/SOS/lldbplugin/CMakeLists.txt index b97d97d7e..98b72b5c1 100644 --- a/src/SOS/lldbplugin/CMakeLists.txt +++ b/src/SOS/lldbplugin/CMakeLists.txt @@ -118,7 +118,7 @@ set(SOURCES services.cpp ) -_add_library(sosplugin SHARED ${SOURCES}) +add_library_clr(sosplugin SHARED ${SOURCES}) if(NOT ${LLDB_LIB} STREQUAL "") target_link_libraries(sosplugin ${LLDB_LIB}) diff --git a/src/inc/_version.h b/src/inc/_version.h deleted file mode 100644 index 684aa96d5..000000000 --- a/src/inc/_version.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef VER_COMPANYNAME_STR -#define VER_COMPANYNAME_STR "Microsoft Corporation" -#endif -#ifndef VER_FILEDESCRIPTION_STR -#define VER_FILEDESCRIPTION_STR "build" -#endif -#ifndef VER_INTERNALNAME_STR -#define VER_INTERNALNAME_STR VER_FILEDESCRIPTION_STR -#endif -#ifndef VER_ORIGINALFILENAME_STR -#define VER_ORIGINALFILENAME_STR VER_FILEDESCRIPTION_STR -#endif -#ifndef VER_PRODUCTNAME_STR -#define VER_PRODUCTNAME_STR "Microsoft\xae .NET Framework" -#endif -#undef VER_PRODUCTVERSION -#define VER_PRODUCTVERSION 4,6,26508,0 -#undef VER_PRODUCTVERSION_STR -#define VER_PRODUCTVERSION_STR "4.6.26508.0" -#undef VER_FILEVERSION -#define VER_FILEVERSION 4,6,26508,0 -#undef VER_FILEVERSION_STR -#define VER_FILEVERSION_STR "4.6.26508.0" -#ifndef VER_LEGALCOPYRIGHT_STR -#define VER_LEGALCOPYRIGHT_STR "\xa9 Microsoft Corporation. All rights reserved." -#endif -#ifndef VER_DEBUG -#define VER_DEBUG VS_FF_DEBUG -#endif diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index a866bf8dc..b81173f8e 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -200,7 +200,7 @@ set(SOURCES thread/thread.cpp ) -add_library(coreclrpal +_add_library(coreclrpal STATIC ${SOURCES} ${ARCH_SOURCES} diff --git a/src/palrt/CMakeLists.txt b/src/palrt/CMakeLists.txt index 2631a03fe..fd83b324d 100644 --- a/src/palrt/CMakeLists.txt +++ b/src/palrt/CMakeLists.txt @@ -27,7 +27,7 @@ set(PALRT_SOURCES variant.cpp ) -add_library_clr(palrt +_add_library(palrt STATIC ${PALRT_SOURCES} )