Skip to content

Commit

Permalink
Support Custom Output Directories (other than build) (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks authored Dec 18, 2023
1 parent f8568b6 commit fba99d2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
11 changes: 7 additions & 4 deletions onebranch/prepare-ingest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ param (
[string]$OsBranch, # i.e., official/rs_onecore_liof1_stack

[Parameter(Mandatory = $true)]
[string]$OsPrTitle # i.e., Automated: Ingest Ping
[string]$OsPrTitle, # i.e., Automated: Ingest Ping

[Parameter(Mandatory = $true)]
[string]$OutDir # i.e., build
)

Set-StrictMode -Version "Latest";
Expand Down Expand Up @@ -108,13 +111,13 @@ $Manifest = $Manifest.Replace("REPLACE_WITH_VERSION", $Version)
$Manifest = $Manifest.Replace("REPLACE_WITH_OWNER", $Owner)
$Manifest = $Manifest.Replace("REPLACE_WITH_BUILD_ID", $BuildPipelineId)

mkdir build -ErrorAction Ignore | Out-Null
mkdir $OutDir -ErrorAction Ignore | Out-Null

$Manifest | Out-File "build/$($Name).man"
$Manifest | Out-File "$OutDir/$($Name).man"
Write-Output "`n$($Name).man:`n"
Write-Output $Manifest

$Checkin = [GitCheckin]::new($Name, $OsPath, $OsBranch, $OsPrTitle) | ConvertTo-Json -Depth 100
$Checkin | Out-File "build/GitCheckin.json"
$Checkin | Out-File "$OutDir/GitCheckin.json"
Write-Output "`nGitCheckin.json:`n"
Write-Output $Checkin
15 changes: 8 additions & 7 deletions onebranch/v1/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ parameters:
config: 'Debug,Release'
platform: 'x86,x64,arm64'
nativeCompiler: true
outputDirectory: 'build'
sign: false # Only signs UM binaries, for external (to Windows repo) release
# Packaging args
package: false
Expand All @@ -32,7 +33,7 @@ jobs:
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)\build
ob_outputDirectory: $(Build.SourcesDirectory)\${{ parameters.outputDirectory }}
steps:
- powershell: |
# Grab the branch name and write the env variable.
Expand Down Expand Up @@ -105,7 +106,7 @@ jobs:
ver_minor: $[ dependencies.set_version.outputs['verStep.VER_MINOR'] ]
ver_patch: $[ dependencies.set_version.outputs['verStep.VER_PATCH'] ]
# Build variables
ob_outputDirectory: $(Build.SourcesDirectory)\build\bin\$(ob_build_platform_win)$(ob_build_config_win)
ob_outputDirectory: $(Build.SourcesDirectory)\${{ parameters.outputDirectory }}\bin\$(ob_build_platform_win)$(ob_build_config_win)
ob_artifactSuffix: _$(ob_build_platform_win)$(ob_build_config_win)
# https://aka.ms/obpipelines/sdl
ob_sdl_tsa_enabled: false # When TSA is disabled all SDL tools will forced into 'break' build mode.
Expand Down Expand Up @@ -155,7 +156,7 @@ jobs:
command: 'sign'
signing_profile: 'external_distribution'
files_to_sign: '**/*.exe;**/*.dll' # Only supports usermode binaries
search_root: 'build/bin'
search_root: '${{ parameters.outputDirectory }}/bin'

# Ingest the newly built VPacks
- ${{ if and(eq(parameters.package, true), eq(parameters.ingest, true)) }}:
Expand All @@ -165,15 +166,15 @@ jobs:
pool:
type: windows
variables:
ob_outputDirectory: $(Build.SourcesDirectory)\build
ob_outputDirectory: $(Build.SourcesDirectory)\${{ parameters.outputDirectory }}
# https://eng.ms/docs/cloud-ai-platform/azure-edge-platform-aep/aep-engineering-systems/productivity-and-experiences/onebranch-windows-undocked/onebranch-windows-undocked/template/thingstoupdateinstartertemplate#updateosmanifest-parameter
ob_updateOSManifest_enabled: true
ob_updateOSManifest_skipFetch: true
ob_updateOSManifest_gitcheckinConfigPath: '$(Build.SourcesDirectory)/build/GitCheckin.json'
ob_updateOSManifest_destination: '$(Build.SourcesDirectory)/build'
ob_updateOSManifest_gitcheckinConfigPath: '$(Build.SourcesDirectory)/${{ parameters.outputDirectory }}/GitCheckin.json'
ob_updateOSManifest_destination: '$(Build.SourcesDirectory)/${{ parameters.outputDirectory }}'
steps:
- task: PowerShell@2
displayName: Prepare Git Checkin
inputs:
filePath: ${{ parameters.owner }}/onebranch/prepare-ingest.ps1
arguments: -Name "${{ parameters.name }}" -Description "${{ parameters.description }}" -Repo $(Build.Repository.Uri) -Branch $(Build.SourceBranch) -Commit $(Build.SourceVersion) -Owner "${{ parameters.owner }}" -BuildPipelineId $(Build.BuildId) -OsPath "${{ parameters.osPath }}" -OsBranch "${{ parameters.osBranch }}" -OsPrTitle "${{ parameters.osPrTitle }}"
arguments: -Name "${{ parameters.name }}" -Description "${{ parameters.description }}" -Repo $(Build.Repository.Uri) -Branch $(Build.SourceBranch) -Commit $(Build.SourceVersion) -Owner "${{ parameters.owner }}" -BuildPipelineId $(Build.BuildId) -OsPath "${{ parameters.osPath }}" -OsBranch "${{ parameters.osBranch }}" -OsPrTitle "${{ parameters.osPrTitle }}" -OutDir "${{ parameters.outputDirectory }}"
2 changes: 1 addition & 1 deletion templates/dll/dll.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetName>dll</TargetName>
<UndockedType>dll</UndockedType>
<UndockedDir>$(SolutionDir)..\</UndockedDir>
<UndockedOut>$(SolutionDir)..\</UndockedOut>
<UndockedOut>$(SolutionDir)..\build\</UndockedOut>
</PropertyGroup>
<Import Project="$(UndockedDir)vs\windows.undocked.props" />
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion templates/exe/exe.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<UndockedUseDriverToolset>true</UndockedUseDriverToolset>
<CharacterSet>Unicode</CharacterSet>
<UndockedDir>$(SolutionDir)..\</UndockedDir>
<UndockedOut>$(SolutionDir)..\</UndockedOut>
<UndockedOut>$(SolutionDir)..\build\</UndockedOut>
</PropertyGroup>
<Import Project="$(UndockedDir)vs\windows.undocked.props" />
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion templates/lib/lib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetName>lib</TargetName>
<UndockedType>lib</UndockedType>
<UndockedDir>$(SolutionDir)..\</UndockedDir>
<UndockedOut>$(SolutionDir)..\</UndockedOut>
<UndockedOut>$(SolutionDir)..\build\</UndockedOut>
</PropertyGroup>
<Import Project="$(UndockedDir)vs\windows.undocked.props" />
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion templates/sys/sys.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetName>sys</TargetName>
<UndockedType>sys</UndockedType>
<UndockedDir>$(SolutionDir)..\</UndockedDir>
<UndockedOut>$(SolutionDir)..\</UndockedOut>
<UndockedOut>$(SolutionDir)..\build\</UndockedOut>
</PropertyGroup>
<Import Project="$(UndockedDir)vs\windows.undocked.props" />
<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions vs/windows.undocked.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Error Condition="'$(UndockedType)' == ''">Must set UndockedType in project file</Error>
<UndockedDir Condition="'$(UndockedDir)' == ''">$(SolutionDir)undocked\</UndockedDir>
<UndockedOut Condition="'$(UndockedOut)' == ''">$(SolutionDir)</UndockedOut>
<UndockedOut Condition="'$(UndockedOut)' == ''">$(SolutionDir)build\</UndockedOut>
<UndockedLoc Condition="'$(UndockedLoc)' == ''">false</UndockedLoc>
<UndockedVerFile Condition="'$(UndockedVerFile)' == ''">$(SolutionDir)version.json</UndockedVerFile>
<UndockedBuildId Condition="'$(UndockedBuildId)' == ''">0</UndockedBuildId>
Expand Down Expand Up @@ -167,8 +167,8 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<!-- Official Windows compiler and linker settings -->
<PropertyGroup>
<IntDir>$(UndockedOut)build\obj\$(WinPlat)$(WinConfig)\$(ProjectName)\</IntDir>
<OutDir>$(UndockedOut)build\bin\$(WinPlat)$(WinConfig)\</OutDir>
<IntDir>$(UndockedOut)obj\$(WinPlat)$(WinConfig)\$(ProjectName)\</IntDir>
<OutDir>$(UndockedOut)bin\$(WinPlat)$(WinConfig)\</OutDir>
<UseDebugLibraries Condition="'$(Configuration)'=='Debug'">true</UseDebugLibraries>
<UseDebugLibraries Condition="'$(Configuration)'=='Release'">false</UseDebugLibraries>
<SignMode>Off</SignMode>
Expand Down

0 comments on commit fba99d2

Please sign in to comment.