Skip to content

Commit 607b230

Browse files
committed
Merge pull request #94789 from Faless/web/fix_thread_cc_with_workaround
[Web] Fix closure compiler builds, enable it in CI.
2 parents c98a706 + 96feb92 commit 607b230

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

.github/workflows/web_builds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
env:
77
# Used for the cache key. Add version suffix to force clean build.
88
GODOT_BASE_BRANCH: master
9-
SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no
9+
SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no use_closure_compiler=yes
1010
EM_VERSION: 3.1.59
1111
EM_CACHE_FOLDER: "emsdk-cache"
1212

platform/web/detect.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ def configure(env: "SConsEnvironment"):
227227
env.Append(LINKFLAGS=["-sDEFAULT_PTHREAD_STACK_SIZE=%sKB" % env["default_pthread_stack_size"]])
228228
env.Append(LINKFLAGS=["-sPTHREAD_POOL_SIZE=8"])
229229
env.Append(LINKFLAGS=["-sWASM_MEM_MAX=2048MB"])
230+
if not env["dlink_enabled"]:
231+
# Workaround https://github.com/emscripten-core/emscripten/issues/21844#issuecomment-2116936414.
232+
# Not needed (and potentially dangerous) when dlink_enabled=yes, since we set EXPORT_ALL=1 in that case.
233+
env.Append(LINKFLAGS=["-sEXPORTED_FUNCTIONS=['__emscripten_thread_crashed','_main']"])
234+
230235
elif env["proxy_to_pthread"]:
231236
print_warning('"threads=no" support requires "proxy_to_pthread=no", disabling proxy to pthread.')
232237
env["proxy_to_pthread"] = False

platform/web/js/libs/library_godot_audio.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Sample {
7777
* Creates a `Sample` based on the params. Will register it to the
7878
* `GodotAudio.samples` registry.
7979
* @param {SampleParams} params Base params
80-
* @param {SampleOptions} [options={}] Optional params
80+
* @param {SampleOptions} [options={{}}] Optional params
8181
* @returns {Sample}
8282
*/
8383
static create(params, options = {}) {
@@ -98,8 +98,7 @@ class Sample {
9898
/**
9999
* `Sample` constructor.
100100
* @param {SampleParams} params Base params
101-
* @param {SampleOptions} [options={}] Optional params
102-
* @constructor
101+
* @param {SampleOptions} [options={{}}] Optional params
103102
*/
104103
constructor(params, options = {}) {
105104
/** @type {string} */
@@ -154,7 +153,7 @@ class Sample {
154153
if (this._audioBuffer == null) {
155154
throw new Error('couldn\'t duplicate a null audioBuffer');
156155
}
157-
/** @type {Float32Array[]} */
156+
/** @type {Array<Float32Array>} */
158157
const channels = new Array(this._audioBuffer.numberOfChannels);
159158
for (let i = 0; i < this._audioBuffer.numberOfChannels; i++) {
160159
const channel = new Float32Array(this._audioBuffer.getChannelData(i));
@@ -189,7 +188,6 @@ class SampleNodeBus {
189188
/**
190189
* `SampleNodeBus` constructor.
191190
* @param {Bus} bus The bus related to the new `SampleNodeBus`.
192-
* @constructor
193191
*/
194192
constructor(bus) {
195193
const NUMBER_OF_WEB_CHANNELS = 6;
@@ -413,8 +411,7 @@ class SampleNode {
413411

414412
/**
415413
* @param {SampleNodeParams} params Base params
416-
* @param {SampleNodeOptions} [options={}] Optional params
417-
* @constructor
414+
* @param {SampleNodeOptions} [options={{}}] Optional params
418415
*/
419416
constructor(params, options = {}) {
420417
/** @type {string} */
@@ -441,7 +438,7 @@ class SampleNode {
441438
this._sampleNodeBuses = new Map();
442439
/** @type {AudioBufferSourceNode | null} */
443440
this._source = GodotAudio.ctx.createBufferSource();
444-
/** @type {AudioBufferSourceNode["onended"]} */
441+
445442
this._onended = null;
446443

447444
this.setPlaybackRate(options.playbackRate ?? 44100);
@@ -558,7 +555,7 @@ class SampleNode {
558555

559556
/**
560557
* Sets the volumes of the `SampleNode` for each buses passed in parameters.
561-
* @param {Bus[]} buses
558+
* @param {Array<Bus>} buses
562559
* @param {Float32Array} volumes
563560
*/
564561
setVolumes(buses, volumes) {
@@ -818,7 +815,6 @@ class Bus {
818815

819816
/**
820817
* `Bus` constructor.
821-
* @constructor
822818
*/
823819
constructor() {
824820
/** @type {Set<SampleNode>} */
@@ -985,7 +981,6 @@ class Bus {
985981
GodotAudio.buses = GodotAudio.buses.filter((v) => v !== this);
986982
}
987983

988-
/** @type {Bus["prototype"]["_syncSampleNodes"]} */
989984
_syncSampleNodes() {
990985
const sampleNodes = Array.from(this._sampleNodes);
991986
for (let i = 0; i < sampleNodes.length; i++) {
@@ -1086,7 +1081,7 @@ const _GodotAudio = {
10861081
// `Bus` class
10871082
/**
10881083
* Registry of `Bus`es.
1089-
* @type {Bus[]}
1084+
* @type {Array<Bus>}
10901085
*/
10911086
buses: null,
10921087
/**
@@ -1309,7 +1304,7 @@ const _GodotAudio = {
13091304
/**
13101305
* Triggered when a sample node volumes need to be updated.
13111306
* @param {string} playbackObjectId Id of the sample playback
1312-
* @param {number[]} busIndexes Indexes of the buses that need to be updated
1307+
* @param {Array<number>} busIndexes Indexes of the buses that need to be updated
13131308
* @param {Float32Array} volumes Array of the volumes
13141309
* @returns {void}
13151310
*/

0 commit comments

Comments
 (0)