Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source-build fixes for rel/17 #3040

Merged
merged 1 commit into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,15 @@ jobs:
vmImage: $[ variables['vmImage'] ]
variables:
buildConfiguration: 'Release'
VSTestRTMBuild: 'false'
steps:
- script: ./build.sh -c $(buildConfiguration)
- script: chmod +x ./scripts/vsts-prebuild.sh
displayName: 'Preparing for set version'

- script: ./scripts/vsts-prebuild.sh -build "preview-$(Build.BuildNumber)" -rtm "$(VSTestRTMBuild)" -branch "$(Build.SourceBranch)"
displayName: 'Set Version'

- script: ./build.sh -c $(buildConfiguration) -v "$(BuildVersionPrefix)" -vs "$(BuildVersionSuffix)" -ci true -verbose
displayName: 'Build'

- script: ./test.sh -c $(buildConfiguration) -p Unit
Expand Down
2 changes: 2 additions & 0 deletions eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<BaseInnerSourceBuildCommand>./build.sh</BaseInnerSourceBuildCommand>

<InnerBuildArgs>-DotNetBuildFromSource</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) -v "$(BuildVersionPrefix)"</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) -vs "$(BuildVersionSuffix)"</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) -DotNetCoreSdkDir $(DotNetRoot)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) -c $(Configuration)</InnerBuildArgs>
</PropertyGroup>
Expand Down
22 changes: 17 additions & 5 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ $TPB_CIBuild = $CIBuild
$TPB_PublishTests = $PublishTestArtifacts
$TPB_LocalizedBuild = !$DisableLocalizedBuild
$TPB_PackageOutDir = Join-Path $env:TP_OUT_DIR $TPB_Configuration\packages
$TPB_SourceBuildPackageOutDir = Join-Path $TPB_PackageOutDir "source-build"

$language = @("cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-Hans", "zh-Hant")

Expand Down Expand Up @@ -970,15 +971,21 @@ function Update-VsixVersion($vsixProjectDir)
Write-Log "Update-VsixVersion: Completed."
}

function Generate-Manifest
function Generate-Manifest ($PackageFolder)
{
Write-Log "Generate-Manifest: Started."
$packagesFolderName = [System.IO.Path]::GetFileName($PackageFolder)
Write-Log "Generate-Manifest ($packagesFolderName): Started."

$generateManifestPath = Join-Path $env:TP_ROOT_DIR "scripts\build\GenerateManifest.proj"
$msbuildPath = Locate-MSBuildPath
& $msbuildPath $generateManifestPath /t:PublishToBuildAssetRegistry /p:PackagesToPublishPattern=$TPB_PackageOutDir\*.nupkg /p:BUILD_BUILDNUMBER=$BuildNumber /p:Configuration=$TPB_Configuration /bl:"$env:TP_OUT_DIR\log\$Configuration\manifest-generation.binlog"

Write-Log "Generate-Manifest: Completed."
& $msbuildPath $generateManifestPath /t:PublishToBuildAssetRegistry /p:PackagesToPublishPattern=$PackageFolder\*.nupkg `
/p:BUILD_BUILDNUMBER=$BuildNumber `
/p:PackagesPath="$PackageFolder\" `
/p:Configuration=$TPB_Configuration `
/bl:"$env:TP_OUT_DIR\log\$Configuration\manifest-generation-$packagesFolderName.binlog"

Write-Log "Generate-Manifest ($packagesFolderName): Completed."
}

function Build-SpecificProjects
Expand Down Expand Up @@ -1078,7 +1085,12 @@ if ($Force -or $Steps -contains "Publish") {
}

if ($Force -or $Steps -contains "Publish" -or $Steps -contains "Manifest") {
Generate-Manifest
Generate-Manifest -PackageFolder $TPB_PackageOutDir
if (Test-Path $TPB_SourceBuildPackageOutDir)
{
Generate-Manifest -PackageFolder $TPB_SourceBuildPackageOutDir
}

Copy-PackageIntoStaticDirectory
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/build/TestPlatform.Dependencies.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VSSdkBuildToolsVersion>15.8.3247</VSSdkBuildToolsVersion>
Expand Down
52 changes: 52 additions & 0 deletions scripts/vsts-prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
# Copyright (c) Microsoft. All rights reserved.

set -o nounset # Fail on uninitialized variables.
set -e # Fail on non-zero exit code.

# Parameter
TP_BUILD_SUFFIX="dev"
BRANCH=
IS_RTM=false

while [ $# -gt 0 ]; do
lowerI="$(echo ${1:-} | awk '{print tolower($0)}')"
case $lowerI in
-build)
TP_BUILD_SUFFIX=$2
shift
;;
-branch)
BRANCH=$2
shift
;;
-rtm)
IS_RTM=$2
shift
;;
*)
break
;;
esac
shift
done

TP_ROOT_DIR=$(cd "$(dirname "$0")/.."; pwd -P)
TP_BUILD_PREFIX=$(grep TPVersionPrefix $TP_ROOT_DIR/scripts/build/TestPlatform.Settings.targets | head -1 | cut -d'>' -f2 | cut -d'<' -f1 || echo $TP_BUILD_PREFIX)
PACKAGE_VERSION="$TP_BUILD_PREFIX-$TP_BUILD_SUFFIX"

# Script
if [ $IS_RTM == true ]; then
PACKAGE_VERSION="$TP_BUILD_PREFIX"
TP_BUILD_SUFFIX=
else
if [ ! -z "$BRANCH" ] && [[ $BRANCH =~ ^refs\/heads\/rel\/.*$ ]]; then
TP_BUILD_SUFFIX="${TP_BUILD_SUFFIX/preview/release}"
fi

PACKAGE_VERSION="$TP_BUILD_PREFIX-$TP_BUILD_SUFFIX"
fi

echo "##vso[task.setvariable variable=BuildVersionPrefix;]$TP_BUILD_PREFIX"
echo "##vso[task.setvariable variable=BuildVersionSuffix;]$TP_BUILD_SUFFIX"
echo "##vso[task.setvariable variable=PackageVersion;]$PACKAGE_VERSION"