Skip to content

Commit 577d55d

Browse files
authored
Remove explicit support for JAVA and running closure compiler via java (#20919)
It should still be possible for a user to explictly run the java version of closure using `EMCC_CLOSURE_ARGS=--platform=java` or `--closure-args=--platform=java`, but this isn't something we need to have explict support for and its not something we test.
1 parent 0c95291 commit 577d55d

File tree

9 files changed

+13
-40
lines changed

9 files changed

+13
-40
lines changed

ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ See docs/process.md for more on how version tagging works.
2020

2121
3.1.52 (in development)
2222
-----------------------
23+
- Remove JAVA from the list of `.emscripten` config file settings. In the
24+
past we used this to run the java version of closure compiler. If there are
25+
folks who prefer to use the java version of closure compiler for some reason
26+
it should be possible by adding `--platform=java` to `--closure-args` or
27+
`EMCC_CLOSURE_ARGS` but emscripten will no longer do this automatically.
28+
(#20919)
2329
- The WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG setting was
2430
removed. This was a workaround from 2018 (#7459) that should no longer be
2531
needed. (#20925)

docs/emcc.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,6 @@ Options that are modified or new in *emcc* are listed below:
268268
before the closure-compiled code runs, because then it will
269269
reuse that variable.
270270

271-
* If closure compiler hits an out-of-memory, try adjusting
272-
"JAVA_HEAP_SIZE" in the environment (for example, to 4096m for
273-
4GB).
274-
275271
* Closure is only run if JavaScript opts are being done ("-O2" or
276272
above).
277273

site/source/docs/building_from_source/verify_emscripten_environment.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ Open a terminal in the directory in which you installed Emscripten (on Windows o
2121

2222
.. note:: On Windows, invoke the tool with **emcc** instead of **./emcc**.
2323

24-
For example, the following output reports an installation where Java is missing:
24+
For example, the following output reports that the correct version of clang
25+
could not be found:
2526

2627
.. code-block:: none
2728
:emphasize-lines: 3
2829
2930
emcc (Emscripten GCC-like replacement + linker emulating GNU ld) 1.21.0
3031
shared:INFO: (Emscripten: Running sanity checks)
31-
shared:WARNING: java does not seem to exist, required for closure compiler. -O2 and above will fail. You need to define JAVA in .emscripten
32+
emcc: warning: LLVM version for clang executable "/usr/bin/clang" appears incorrect (seeing "16.0", expected "18") [-Wversion-check]
3233
3334
At this point you need to :ref:`Install and activate <fixing-missing-components-emcc>` any missing components. When everything is set up properly, ``emcc ---check`` should give no warnings, and if you just enter ``emcc`` (without any input files), it will give an error ::
3435

site/source/docs/tools_reference/emcc.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ Options that are modified or new in *emcc* are listed below:
259259

260260
- Consider using ``-sMODULARIZE`` when using closure, as it minifies globals to names that might conflict with others in the global scope. ``MODULARIZE`` puts all the output into a function (see ``src/settings.js``).
261261
- Closure will minify the name of `Module` itself, by default! Using ``MODULARIZE`` will solve that as well. Another solution is to make sure a global variable called `Module` already exists before the closure-compiled code runs, because then it will reuse that variable.
262-
- If closure compiler hits an out-of-memory, try adjusting ``JAVA_HEAP_SIZE`` in the environment (for example, to 4096m for 4GB).
263262
- Closure is only run if JavaScript opts are being done (``-O2`` or above).
264263

265264
``--closure-args=<args>``

test/test_other.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12790,9 +12790,8 @@ def test_config_closure_compiler(self):
1279012790
self.run_process([EMCC, test_file('hello_world.c'), '--closure=1'])
1279112791
with env_modify({'EM_CLOSURE_COMPILER': sys.executable}):
1279212792
err = self.expect_fail([EMCC, test_file('hello_world.c'), '--closure=1'])
12793-
self.assertContained('closure compiler', err)
12793+
self.assertContained('emcc: error: unrecognized closure compiler --version output', err)
1279412794
self.assertContained(sys.executable, err)
12795-
self.assertContained('not execute properly!', err)
1279612795

1279712796
def test_node_unhandled_rejection(self):
1279812797
create_file('pre.js', '''

tools/building.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -454,25 +454,19 @@ def get_closure_compiler():
454454
return cmd
455455

456456

457-
def check_closure_compiler(cmd, args, env, allowed_to_fail):
457+
def check_closure_compiler(cmd, args, env):
458458
cmd = cmd + args + ['--version']
459459
try:
460460
output = run_process(cmd, stdout=PIPE, env=env).stdout
461461
except Exception as e:
462-
if allowed_to_fail:
463-
return False
464462
if isinstance(e, subprocess.CalledProcessError):
465463
sys.stderr.write(e.stdout)
466464
sys.stderr.write(str(e) + '\n')
467465
exit_with_error('closure compiler (%s) did not execute properly!' % shared.shlex_join(cmd))
468466

469467
if 'Version:' not in output:
470-
if allowed_to_fail:
471-
return False
472468
exit_with_error('unrecognized closure compiler --version output (%s):\n%s' % (shared.shlex_join(cmd), output))
473469

474-
return True
475-
476470

477471
# Remove this once we require python3.7 and can use std.isascii.
478472
# See: https://docs.python.org/3/library/stdtypes.html#str.isascii
@@ -488,25 +482,7 @@ def isascii(s):
488482
def get_closure_compiler_and_env(user_args):
489483
env = shared.env_with_node_in_path()
490484
closure_cmd = get_closure_compiler()
491-
492-
native_closure_compiler_works = check_closure_compiler(closure_cmd, user_args, env, allowed_to_fail=True)
493-
if not native_closure_compiler_works and not any(a.startswith('--platform') for a in user_args):
494-
# Run with Java Closure compiler as a fallback if the native version does not work
495-
user_args.append('--platform=java')
496-
check_closure_compiler(closure_cmd, user_args, env, allowed_to_fail=False)
497-
498-
if config.JAVA and '--platform=java' in user_args:
499-
# Closure compiler expects JAVA_HOME to be set *and* java.exe to be in the PATH in order
500-
# to enable use the java backend. Without this it will only try the native and JavaScript
501-
# versions of the compiler.
502-
java_bin = os.path.dirname(config.JAVA)
503-
if java_bin:
504-
def add_to_path(dirname):
505-
env['PATH'] = env['PATH'] + os.pathsep + dirname
506-
add_to_path(java_bin)
507-
java_home = os.path.dirname(java_bin)
508-
env.setdefault('JAVA_HOME', java_home)
509-
485+
check_closure_compiler(closure_cmd, user_args, env)
510486
return closure_cmd, env
511487

512488

tools/config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
LLVM_ADD_VERSION = None
2929
CLANG_ADD_VERSION = None
3030
CLOSURE_COMPILER = None
31-
JAVA = None
3231
JS_ENGINES: List[List[str]] = []
3332
WASMER = None
3433
WASMTIME = None
@@ -130,7 +129,6 @@ def parse_config_file():
130129
'LLVM_ADD_VERSION',
131130
'CLANG_ADD_VERSION',
132131
'CLOSURE_COMPILER',
133-
'JAVA',
134132
'JS_ENGINES',
135133
'WASMER',
136134
'WASMTIME',

tools/config_template.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
# This engine must exist, or nothing can be compiled.
2020
NODE_JS = '{{{ NODE }}}' # executable
2121

22-
JAVA = 'java' # executable
23-
2422
################################################################################
2523
#
2624
# Test suite options:

tools/scons/site_scons/site_tools/emscripten/emscripten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def generate(env, emscripten_path=None, **kw):
2727
'EMSCRIPTEN_SUPPRESS_USAGE_WARNING', 'NODE_PATH', 'EMCC_JSOPT_MIN_CHUNK_SIZE',
2828
'EMCC_JSOPT_MAX_CHUNK_SIZE', 'EMCC_CORES', 'EMCC_NO_OPT_SORT',
2929
'EMCC_BUILD_DIR', 'EMCC_DEBUG_SAVE', 'EMCC_SKIP_SANITY_CHECK',
30-
'EM_PKG_CONFIG_PATH', 'EMCC_CLOSURE_ARGS', 'JAVA_HEAP_SIZE',
30+
'EM_PKG_CONFIG_PATH', 'EMCC_CLOSURE_ARGS',
3131
'EMCC_FORCE_STDLIBS', 'EMCC_ONLY_FORCED_STDLIBS', 'EM_PORTS', 'IDL_CHECKS', 'IDL_VERBOSE']:
3232
if os.environ.get(var):
3333
env['ENV'][var] = os.environ.get(var)

0 commit comments

Comments
 (0)