diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml index 55934c91b61a12..1f6c14be291483 100644 --- a/eng/pipelines/common/platform-matrix.yml +++ b/eng/pipelines/common/platform-matrix.yml @@ -180,23 +180,25 @@ jobs: ${{ insert }}: ${{ parameters.jobParameters }} # FreeBSD - -# FreeBSD machines are currently offline. Re-enable in the official build when -# the machines are healthy. - -# - template: xplat-setup.yml -# parameters: -# jobTemplate: ${{ parameters.jobTemplate }} -# osGroup: FreeBSD -# archType: x64 -# jobParameters: -# runtimeFlavor: ${{ parameters.runtimeFlavor }} -# buildConfig: ${{ parameters.buildConfig }} -# # There are no FreeBSD helix queues, so we don't run tests at the moment. -# helixQueues: -# asString: '' -# asArray: [] -# ${{ insert }}: ${{ parameters.jobParameters }} +- ${{ if containsValue(parameters.platforms, 'FreeBSD_x64') }}: + - template: xplat-setup.yml + parameters: + jobTemplate: ${{ parameters.jobTemplate }} + helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }} + osGroup: FreeBSD + archType: x64 + platform: FreeBSD_x64 + container: + image: ubuntu-18.04-cross-freebsd-11-20200407092345-a84b0d2 + registry: mcr + jobParameters: + runtimeFlavor: ${{ parameters.runtimeFlavor }} + buildConfig: ${{ parameters.buildConfig }} + helixQueueGroup: ${{ parameters.helixQueueGroup }} + crossrootfsDir: '/crossrootfs/x64' + ${{ if eq(parameters.passPlatforms, true) }}: + platforms: ${{ parameters.platforms }} + ${{ insert }}: ${{ parameters.jobParameters }} # Android x64 diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml index 4467951602b7e7..b3620e27513d20 100644 --- a/eng/pipelines/common/xplat-setup.yml +++ b/eng/pipelines/common/xplat-setup.yml @@ -97,10 +97,6 @@ jobs: name: NetCoreInternal-Pool queue: BuildPool.Ubuntu.1604.Amd64 - # FreeBSD builds only in the internal project - ${{ if and(eq(parameters.osGroup, 'FreeBSD'), ne(variables['System.TeamProject'], 'public')) }}: - name: dnceng-freebsd-internal - # Public OSX Build Pool ${{ if eq(parameters.osGroup, 'OSX') }}: vmImage: 'macOS-10.14' diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml index b343975a710b53..2e7cd7d6a0b663 100644 --- a/eng/pipelines/coreclr/templates/build-job.yml +++ b/eng/pipelines/coreclr/templates/build-job.yml @@ -66,10 +66,6 @@ jobs: - ${{ if and(ne(parameters.osGroup, 'Windows_NT'), eq(parameters.compilerName, 'clang')) }}: - name: compilerArg value: '-clang9' - # Our FreeBSD doesn't yet detect available clang versions, so pass it explicitly. - - ${{ if eq(parameters.osGroup, 'FreeBSD') }}: - - name: compilerArg - value: '-clang6.0' # Building for x64 MUSL happens on Alpine Linux and we need to use the stable version available there - ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubgroup, '_musl'), eq(parameters.archType, 'x64')) }}: - name: compilerArg @@ -128,7 +124,7 @@ jobs: # Build CoreCLR Runtime - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - - script: $(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) -ci $(compilerArg) $(officialBuildIdArg) + - script: $(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(officialBuildIdArg) displayName: Build CoreCLR Runtime - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: - script: set __TestIntermediateDir=int&&$(coreClrRepoRootDir)build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(officialBuildIdArg) @@ -139,11 +135,11 @@ jobs: displayName: Build Cross OS Linux DAC for Windows # Build CoreCLR Managed Components - - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages $(crossArg) -arch $(archType) -c $(buildConfig) $(officialBuildIdArg) -ci + - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.tools+clr.packages $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(officialBuildIdArg) -ci displayName: Build managed product components and packages # Build native test components - - script: $(coreClrRepoRootDir)build-test$(scriptExt) skipmanaged $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(compilerArg) skipgeneratelayout + - script: $(coreClrRepoRootDir)build-test$(scriptExt) skipmanaged $(buildConfig) $(archType) $(crossArg) $(osArg) $(priorityArg) $(compilerArg) skipgeneratelayout displayName: Build native test components # Sign on Windows diff --git a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml index aad6f7bf69fa40..c9f71a959fa61f 100644 --- a/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml +++ b/eng/pipelines/coreclr/templates/xplat-pipeline-job.yml @@ -119,4 +119,11 @@ jobs: - ${{ each variable in parameters.variables }}: - ${{insert}}: ${{ variable }} + - name: osArg + value: '' + + - ${{ if eq(parameters.osGroup, 'FreeBSD') }}: + - name: osArg + value: -os FreeBSD + steps: ${{ parameters.steps }} diff --git a/eng/pipelines/installer/jobs/base-job.yml b/eng/pipelines/installer/jobs/base-job.yml index 3a6494b0b23df9..85e4fa1fc86e47 100644 --- a/eng/pipelines/installer/jobs/base-job.yml +++ b/eng/pipelines/installer/jobs/base-job.yml @@ -80,10 +80,10 @@ jobs: value: /p:OfficialBuildId=$(Build.BuildNumber) - name: buildCommandSourcesDirectory - ${{ if ne(parameters.osGroup, 'Linux') }}: + ${{ if not(in(parameters.osGroup, 'Linux', 'FreeBSD')) }}: value: '$(Build.SourcesDirectory)/' # This job runs within Docker containers, so Build.SourcesDirectory is not accurate. - ${{ if eq(parameters.osGroup, 'Linux') }}: + ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}: value: '/root/runtime/' ### @@ -146,7 +146,7 @@ jobs: $(CommonMSBuildArgs) $(OfficialBuildArg) - - ${{ if eq(parameters.osGroup, 'Linux') }}: + - ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}: # Preserve the NuGet authentication env vars into the Docker container. # The 'NuGetAuthenticate' build step may have set these. @@ -165,10 +165,6 @@ jobs: -e ROOTFS_DIR=${{ parameters.crossrootfsDir }} ${{ parameters.container }} - - ${{ if eq(parameters.name, 'FreeBSD_x64') }}: - - name: RunArguments - value: export DotNetBootstrapCliTarPath=/dotnet-sdk-freebsd-x64.tar && - - name: BuildScript value: ./build.sh - name: MSBuildScript @@ -183,6 +179,7 @@ jobs: - name: CommonMSBuildArgs value: >- /p:Configuration=$(_BuildConfig) + /p:TargetOS=${{ parameters.osGroup }} /p:TargetArchitecture=${{ parameters.archType }} $(OfficialBuildArg) diff --git a/eng/pipelines/libraries/base-job.yml b/eng/pipelines/libraries/base-job.yml index df6f5e31a73468..503b30c5bd3dee 100644 --- a/eng/pipelines/libraries/base-job.yml +++ b/eng/pipelines/libraries/base-job.yml @@ -54,7 +54,7 @@ jobs: - ${{ if ne(parameters.testScope, '') }}: - _testScopeArg: -testscope ${{ parameters.testScope }} - - ${{ if eq(parameters.osGroup, 'Linux') }}: + - ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}: - _crossBuildPropertyArg: /p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }} - ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, '_musl')) }}: @@ -63,20 +63,8 @@ jobs: - ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, ''), eq(parameters.archType, 'arm')) }}: - _runtimeOSArg: /p:RuntimeOS=ubuntu.16.04 - # force a value for OS when cross-building WebAssembly - - ${{ if eq(parameters.osGroup, 'WebAssembly') }}: - - _runtimeOSArg: -os ${{ parameters.osGroup }} - - # force a value for OS when cross-building tvOS on OSX - - ${{ if eq(parameters.osGroup, 'tvOS') }}: - - _runtimeOSArg: -os ${{ parameters.osGroup }} - - # force a value for OS when cross-building iOS on OSX - - ${{ if eq(parameters.osGroup, 'iOS') }}: - - _runtimeOSArg: -os ${{ parameters.osGroup }} - - # force a value for OS when cross-building Android on Linux - - ${{ if eq(parameters.osGroup, 'Android') }}: + # force a value for OS when cross-building + - ${{ if in(parameters.osGroup, 'WebAssembly', 'iOS', 'tvOS', 'Android', 'FreeBSD') }}: - _runtimeOSArg: -os ${{ parameters.osGroup }} - ${{ if ne(parameters.framework, '') }}: diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index 9a7b6d8ef5ea41..408c9f6741ee84 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -197,6 +197,7 @@ jobs: - Windows_NT_x86 - Windows_NT_arm - Windows_NT_arm64 + - FreeBSD_x64 jobParameters: testGroup: innerloop @@ -380,6 +381,7 @@ jobs: - Linux_x64 - OSX_x64 - Windows_NT_x64 + - FreeBSD_x64 jobParameters: liveRuntimeBuildConfig: release @@ -494,6 +496,7 @@ jobs: - Linux_arm64 - Linux_musl_x64 - Windows_NT_x64 + - FreeBSD_x64 jobParameters: liveRuntimeBuildConfig: release liveLibrariesBuildConfig: ${{ variables.debugOnPrReleaseOnRolling }} diff --git a/src/installer/corehost/cli/hostmisc/pal.unix.cpp b/src/installer/corehost/cli/hostmisc/pal.unix.cpp index 65338b619bf8c2..3626761b0ecbb4 100644 --- a/src/installer/corehost/cli/hostmisc/pal.unix.cpp +++ b/src/installer/corehost/cli/hostmisc/pal.unix.cpp @@ -2,6 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#if defined(TARGET_FREEBSD) +#define _WITH_GETLINE +#endif + #include "pal.h" #include "utils.h" #include "trace.h"