Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ END_UNRELEASED_TEMPLATE
fixing missing transitive dependencies when extras contain hyphens
(e.g., `sqlalchemy[postgresql-psycopg2binary]`).
([#3587](https://github.com/bazel-contrib/rules_python/issues/3587))
* (binaries/tests) Stamped build data generated by Windows actions is readable

{#v0-0-0-added}
### Added
Expand Down
28 changes: 20 additions & 8 deletions python/private/build_data_writer.ps1
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
$OutputPath = $env:OUTPUT

Add-Content -Path $OutputPath -Value "TARGET $env:TARGET"
Add-Content -Path $OutputPath -Value "CONFIG_MODE $env:CONFIG_MODE"
Add-Content -Path $OutputPath -Value "STAMPED $env:STAMPED"
$Lines = @(
"TARGET $env:TARGET",
"CONFIG_MODE $env:CONFIG_MODE",
"STAMPED $env:STAMPED"
)

$VersionFilePath = $env:VERSION_FILE
if (-not [string]::IsNullOrEmpty($VersionFilePath)) {
Get-Content -Path $VersionFilePath | Add-Content -Path $OutputPath
if (-not [string]::IsNullOrEmpty($VersionFilePath) -and (Test-Path $VersionFilePath)) {
$Lines += Get-Content -Path $VersionFilePath
}

$InfoFilePath = $env:INFO_FILE
if (-not [string]::IsNullOrEmpty($InfoFilePath)) {
Get-Content -Path $InfoFilePath | Add-Content -Path $OutputPath
if (-not [string]::IsNullOrEmpty($InfoFilePath) -and (Test-Path $InfoFilePath)) {
$Lines += Get-Content -Path $InfoFilePath
}

# Use .NET to write file to avoid PowerShell encoding/locking quirks
# We use UTF8 without BOM for compatibility with how the bash script writes (and
# what consumers expect).
$Utf8NoBom = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($OutputPath, $Lines, $Utf8NoBom)

$Acl = Get-Acl $OutputPath
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "Read", "Allow")
$Acl.SetAccessRule($AccessRule)
Set-Acl $OutputPath $Acl

exit 0