Skip to content

Commit

Permalink
make de-duping legal notices optional
Browse files Browse the repository at this point in the history
  • Loading branch information
dougxc committed Mar 18, 2020
1 parent 13dcc56 commit 0469062
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion compiler/mx.compiler/mx_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,9 @@ def _copy_file(src, dst):
module_dists = _graal_config().dists
_check_using_latest_jars(module_dists)
vendor_info = {'vendor-version' : vm_name}
jlink_new_jdk(jdk, tmp_dst_jdk_dir, module_dists, root_module_names=root_module_names, vendor_info=vendor_info)
# Setting dedup_legal_notices=False avoids due to license files conflicting
# when switching JAVA_HOME from an OpenJDK to an OracleJDK or vice versa between executions.
jlink_new_jdk(jdk, tmp_dst_jdk_dir, module_dists, root_module_names=root_module_names, vendor_info=vendor_info, dedup_legal_notices=False)
jre_dir = tmp_dst_jdk_dir
jvmci_dir = mx.ensure_dir_exists(join(jre_dir, 'lib', 'jvmci'))
if export_truffle:
Expand Down
12 changes: 9 additions & 3 deletions sdk/mx.sdk/mx_sdk_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,12 @@ def jdk_omits_warning_for_jlink_set_ThreadPriorityPolicy(jdk): # pylint: disable
setattr(jdk, '.omits_ThreadPriorityPolicy_warning', '-XX:ThreadPriorityPolicy=1 may require system level permission' not in out.data)
return getattr(jdk, '.omits_ThreadPriorityPolicy_warning')

def jlink_new_jdk(jdk, dst_jdk_dir, module_dists, root_module_names=None, missing_export_target_action='create', with_source=lambda x: True, vendor_info=None):
def jlink_new_jdk(jdk, dst_jdk_dir, module_dists,
root_module_names=None,
missing_export_target_action='create',
with_source=lambda x: True,
vendor_info=None,
dedup_legal_notices=True):
"""
Uses jlink from `jdk` to create a new JDK image in `dst_jdk_dir` with `module_dists` and
their dependencies added to the JDK image, replacing any existing modules of the same name.
Expand Down Expand Up @@ -636,10 +641,11 @@ def jlink_new_jdk(jdk, dst_jdk_dir, module_dists, root_module_names=None, missin
jlink.append('--module-path=' + module_path)
jlink.append('--output=' + dst_jdk_dir)

# These options are inspired by how OpenJDK runs jlink to produce the final runtime image.
# These options are derived from how OpenJDK runs jlink to produce the final runtime image.
jlink.extend(['-J-XX:+UseSerialGC', '-J-Xms32M', '-J-Xmx512M', '-J-XX:TieredStopAtLevel=1'])
jlink.append('-J-Dlink.debug=true')
jlink.append('--dedup-legal-notices=error-if-not-same-content')
if dedup_legal_notices:
jlink.append('--dedup-legal-notices=error-if-not-same-content')
jlink.append('--keep-packaged-modules=' + join(dst_jdk_dir, 'jmods'))

if jdk_has_new_jlink_options(jdk):
Expand Down

0 comments on commit 0469062

Please sign in to comment.