|
31 | 31 | v8_version: |
32 | 32 | description: 'V8 Version (Tag or Branch)' |
33 | 33 | required: true |
34 | | - default: '12.4.254.15' |
| 34 | + default: 'main' |
35 | 35 | type: string |
36 | 36 |
|
37 | 37 | jobs: |
@@ -73,85 +73,84 @@ jobs: |
73 | 73 | git checkout ${{ inputs.v8_version }} |
74 | 74 | gclient sync |
75 | 75 |
|
76 | | - - name: Generate GN Args |
| 76 | + # --- FIX: WRITE ARGS DIRECTLY TO FILE TO AVOID QUOTING ERRORS --- |
| 77 | + - name: Generate Build Config (args.gn) |
77 | 78 | shell: powershell |
78 | | - id: gn_args |
| 79 | + working-directory: ${{ github.workspace }}\v8 |
79 | 80 | 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 |
97 | 84 |
|
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 |
126 | 121 | if ("${{ inputs.linkage_type }}" -eq "static") { |
127 | | - $a += GnBool "v8_monolithic" "true" |
| 122 | + $content += "v8_monolithic = true" |
128 | 123 | } |
129 | 124 |
|
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" |
138 | 129 | |
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 | + } |
141 | 135 |
|
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" |
148 | 142 |
|
149 | | - - name: Compile |
| 143 | + - name: Compile V8 |
150 | 144 | shell: powershell |
151 | 145 | working-directory: ${{ github.workspace }}\v8 |
152 | 146 | run: | |
153 | 147 | $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" } |
155 | 154 | autoninja -C out.gn/build $target |
156 | 155 |
|
157 | 156 | - name: Collect Artifacts |
|
0 commit comments