Skip to content

Commit 0a20a68

Browse files
committed
fix(ci): write options to a file
1 parent 130acaa commit 0a20a68

1 file changed

Lines changed: 66 additions & 67 deletions

File tree

.github/workflows/build-v8-windows.yml

Lines changed: 66 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
v8_version:
3232
description: 'V8 Version (Tag or Branch)'
3333
required: true
34-
default: '12.4.254.15'
34+
default: 'main'
3535
type: string
3636

3737
jobs:
@@ -73,85 +73,84 @@ jobs:
7373
git checkout ${{ inputs.v8_version }}
7474
gclient sync
7575
76-
- name: Generate GN Args
76+
# --- FIX: WRITE ARGS DIRECTLY TO FILE TO AVOID QUOTING ERRORS ---
77+
- name: Generate Build Config (args.gn)
7778
shell: powershell
78-
id: gn_args
79+
working-directory: ${{ github.workspace }}\v8
7980
run: |
80-
# --- HELPER: Escape quotes for GN (target_cpu="x64" -> target_cpu=\"x64\") ---
81-
function GnStr { param($k, $v) return "$k=\`"$v\`"" }
82-
function GnBool { param($k, $v) return "$k=$v" }
83-
84-
$a = @()
85-
86-
# --- DETERMINE DYNAMIC VALUES ---
87-
# We use standard If/Else instead of ternary (? :) to ensure PowerShell compatibility
88-
$isShared = "false"
89-
if ("${{ inputs.linkage_type }}" -eq "shared") { $isShared = "true" }
90-
91-
$isDebug = "false"
92-
$symbolLevel = "0"
93-
if ("${{ inputs.build_type }}" -eq "debug") {
94-
$isDebug = "true"
95-
$symbolLevel = "2"
96-
}
81+
# 1. Create the output directory first
82+
$outDir = "out.gn\build"
83+
New-Item -ItemType Directory -Force -Path $outDir
9784
98-
# --- CORE BUILD SETTINGS ---
99-
$a += GnBool "is_component_build" $isShared
100-
$a += GnBool "is_debug" $isDebug
101-
$a += GnStr "target_cpu" "${{ inputs.target_arch }}"
102-
$a += GnStr "target_os" "win"
103-
104-
# --- MSVC COMPATIBILITY ---
105-
$a += GnBool "is_clang" "false"
106-
$a += GnBool "use_custom_libcxx" "false"
107-
108-
# --- FIBJS / FIBER STABILITY FLAGS ---
109-
$a += GnBool "v8_enable_turbofan" "true"
110-
$a += GnBool "cppgc_enable_caged_heap" "false"
111-
$a += GnBool "v8_enable_pointer_compression" "false"
112-
$a += GnBool "v8_enable_sandbox" "false"
113-
$a += GnBool "v8_control_flow_integrity" "false"
114-
$a += GnBool "v8_use_external_startup_data" "false"
115-
$a += GnBool "v8_use_libm_trig_functions" "false"
116-
$a += GnBool "v8_enable_short_builtin_calls" "false"
117-
$a += GnBool "v8_enable_lazy_source_positions" "false"
118-
$a += GnBool "v8_enable_allocation_folding" "false"
119-
$a += GnBool "v8_allocation_site_tracking" "false"
120-
$a += GnBool "v8_enable_system_instrumentation" "false"
121-
$a += GnBool "v8_enable_lite_mode" "false"
122-
$a += GnBool "v8_enable_gdbjit" "false"
123-
$a += GnBool "v8_enable_webassembly" "true"
124-
125-
# --- STATIC / MONOLITH ---
85+
# 2. Prepare the Argument Content
86+
$content = @()
87+
88+
# Helper variables
89+
$isShared = if ("${{ inputs.linkage_type }}" -eq "shared") { "true" } else { "false" }
90+
$isDebug = if ("${{ inputs.build_type }}" -eq "debug") { "true" } else { "false" }
91+
92+
# Core Settings
93+
$content += "is_component_build = $isShared"
94+
$content += "is_debug = $isDebug"
95+
# PowerShell Syntax: "" inside a string results in a single literal "
96+
$content += "target_cpu = ""${{ inputs.target_arch }}"""
97+
$content += "target_os = ""win"""
98+
99+
# MSVC Settings
100+
$content += "is_clang = false"
101+
$content += "use_custom_libcxx = false"
102+
103+
# Fibjs / Fiber Stability Flags
104+
$content += "v8_enable_turbofan = true"
105+
$content += "cppgc_enable_caged_heap = false"
106+
$content += "v8_enable_pointer_compression = false"
107+
$content += "v8_enable_sandbox = false"
108+
$content += "v8_control_flow_integrity = false"
109+
$content += "v8_use_external_startup_data = false"
110+
$content += "v8_use_libm_trig_functions = false"
111+
$content += "v8_enable_short_builtin_calls = false"
112+
$content += "v8_enable_lazy_source_positions = false"
113+
$content += "v8_enable_allocation_folding = false"
114+
$content += "v8_allocation_site_tracking = false"
115+
$content += "v8_enable_system_instrumentation = false"
116+
$content += "v8_enable_lite_mode = false"
117+
$content += "v8_enable_gdbjit = false"
118+
$content += "v8_enable_webassembly = true"
119+
120+
# Monolith Logic
126121
if ("${{ inputs.linkage_type }}" -eq "static") {
127-
$a += GnBool "v8_monolithic" "true"
122+
$content += "v8_monolithic = true"
128123
}
129124
130-
# --- CLEANUP ---
131-
$a += GnBool "v8_deprecation_warnings" "false"
132-
$a += GnBool "v8_imminent_deprecation_warnings" "false"
133-
$a += GnBool "v8_enable_tests" "false"
134-
$a += GnBool "symbol_level" $symbolLevel
135-
136-
# Join all args with a space
137-
$finalArgs = $a -join " "
125+
# Cleanup / Symbols
126+
$content += "v8_deprecation_warnings = false"
127+
$content += "v8_imminent_deprecation_warnings = false"
128+
$content += "v8_enable_tests = false"
138129
139-
Write-Host "Args: $finalArgs"
140-
echo "ARGS=$finalArgs" >> $env:GITHUB_OUTPUT
130+
if ($isDebug -eq "true") {
131+
$content += "symbol_level = 2"
132+
} else {
133+
$content += "symbol_level = 0"
134+
}
141135
142-
- name: Configure Build
143-
shell: powershell
144-
working-directory: ${{ github.workspace }}\v8
145-
run: |
146-
$env:PATH = "C:\depot_tools;" + $env:PATH
147-
gn gen out.gn/build --args="${{ steps.gn_args.outputs.ARGS }}"
136+
# 3. Write to file
137+
$content | Out-File -FilePath "$outDir\args.gn" -Encoding ascii
138+
139+
# Print for verification
140+
Write-Host "--- Created args.gn ---"
141+
Get-Content "$outDir\args.gn"
148142
149-
- name: Compile
143+
- name: Compile V8
150144
shell: powershell
151145
working-directory: ${{ github.workspace }}\v8
152146
run: |
153147
$env:PATH = "C:\depot_tools;" + $env:PATH
154-
$target = "${{ inputs.linkage_type == 'static' && 'v8_monolith' || 'v8' }}"
148+
149+
# 1. Generate Ninja files (reads from the args.gn we created above)
150+
gn gen out.gn/build
151+
152+
# 2. Build
153+
$target = if ("${{ inputs.linkage_type }}" -eq "static") { "v8_monolith" } else { "v8" }
155154
autoninja -C out.gn/build $target
156155
157156
- name: Collect Artifacts

0 commit comments

Comments
 (0)