hotspot/.mx.jvmci/mx_jvmci.py
changeset 43939 39f5b59549de
parent 40046 01e973266ee4
child 45238 ddc52d9c74e4
equal deleted inserted replaced
43937:def72508767d 43939:39f5b59549de
   156     jdkBuildDir = _get_jdk_build_dir()
   156     jdkBuildDir = _get_jdk_build_dir()
   157     if not exists(jdkBuildDir):
   157     if not exists(jdkBuildDir):
   158         # JDK9 must be bootstrapped with a JDK8
   158         # JDK9 must be bootstrapped with a JDK8
   159         compliance = mx.JavaCompliance('8')
   159         compliance = mx.JavaCompliance('8')
   160         jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value)
   160         jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value)
   161         cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers',
   161         cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', '--with-jvm-features=graal',
   162                '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home]
   162                '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home, '--with-jvm-features=graal']
   163         mx.run(cmd, cwd=_jdkSourceRoot)
   163         mx.run(cmd, cwd=_jdkSourceRoot)
   164     cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
   164     cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
   165     if mx.get_opts().verbose:
   165     if mx.get_opts().verbose:
   166         cmd.append('LOG=debug')
   166         cmd.append('LOG=debug')
   167     cmd.extend(args)
   167     cmd.extend(args)
   173         mx.log('Working directory: ' + _jdkSourceRoot)
   173         mx.log('Working directory: ' + _jdkSourceRoot)
   174         mx.log('Command line: ' + ' '.join(cmd))
   174         mx.log('Command line: ' + ' '.join(cmd))
   175         mx.log('-----------------------------------------------------')
   175         mx.log('-----------------------------------------------------')
   176 
   176 
   177     mx.run(cmd, cwd=_jdkSourceRoot)
   177     mx.run(cmd, cwd=_jdkSourceRoot)
   178 
       
   179     if 'images' in cmd:
       
   180         jdkImageDir = join(jdkBuildDir, 'images', 'jdk')
       
   181 
       
   182         # The OpenJDK build creates an empty cacerts file so copy one from
       
   183         # the default JDK (which is assumed to be an OracleJDK)
       
   184         srcCerts = join(mx.get_jdk(tag='default').home, 'lib', 'security', 'cacerts')
       
   185         if not exists(srcCerts):
       
   186             # Might be building with JDK8 which has cacerts under jre/
       
   187             srcCerts = join(mx.get_jdk(tag='default').home, 'jre', 'lib', 'security', 'cacerts')
       
   188         dstCerts = join(jdkImageDir, 'lib', 'security', 'cacerts')
       
   189         if srcCerts != dstCerts:
       
   190             shutil.copyfile(srcCerts, dstCerts)
       
   191 
       
   192         _create_jdk_bundle(jdkBuildDir, _vm.debugLevel, jdkImageDir)
       
   193 
       
   194 def _get_jdk_bundle_arches():
       
   195     """
       
   196     Gets a list of names that will be the part of a JDK bundle's file name denoting the architecture.
       
   197     The first element in the list is the canonical name. Symlinks should be created for the
       
   198     remaining names.
       
   199     """
       
   200     cpu = mx.get_arch()
       
   201     if cpu == 'amd64':
       
   202         return ['x64', 'x86_64', 'amd64']
       
   203     elif cpu == 'sparcv9':
       
   204         return ['sparcv9']
       
   205     mx.abort('Unsupported JDK bundle arch: ' + cpu)
       
   206 
       
   207 def _create_jdk_bundle(jdkBuildDir, debugLevel, jdkImageDir):
       
   208     """
       
   209     Creates a tar.gz JDK archive, an accompanying tar.gz.sha1 file with its
       
   210     SHA1 signature plus symlinks to the archive for non-canonical architecture names.
       
   211     """
       
   212 
       
   213     arches = _get_jdk_bundle_arches()
       
   214     jdkTgzPath = join(_suite.get_output_root(), 'jdk-bundles', 'jdk9-{}-{}-{}.tar.gz'.format(debugLevel, _get_openjdk_os(), arches[0]))
       
   215     with mx.Archiver(jdkTgzPath, kind='tgz') as arc:
       
   216         mx.log('Creating ' + jdkTgzPath)
       
   217         for root, _, filenames in os.walk(jdkImageDir):
       
   218             for name in filenames:
       
   219                 f = join(root, name)
       
   220                 arcname = 'jdk1.9.0/' + os.path.relpath(f, jdkImageDir)
       
   221                 arc.zf.add(name=f, arcname=arcname, recursive=False)
       
   222 
       
   223     with open(jdkTgzPath + '.sha1', 'w') as fp:
       
   224         mx.log('Creating ' + jdkTgzPath + '.sha1')
       
   225         fp.write(mx.sha1OfFile(jdkTgzPath))
       
   226 
       
   227     def _create_link(source, link_name):
       
   228         if exists(link_name):
       
   229             os.remove(link_name)
       
   230         mx.log('Creating ' + link_name + ' -> ' + source)
       
   231         os.symlink(source, link_name)
       
   232 
       
   233     for arch in arches[1:]:
       
   234         link_name = join(_suite.get_output_root(), 'jdk-bundles', 'jdk9-{}-{}-{}.tar.gz'.format(debugLevel, _get_openjdk_os(), arch))
       
   235         jdkTgzName = os.path.basename(jdkTgzPath)
       
   236         _create_link(jdkTgzName, link_name)
       
   237         _create_link(jdkTgzName + '.sha1', link_name + '.sha1')
       
   238 
   178 
   239 def _runmultimake(args):
   179 def _runmultimake(args):
   240     """run the JDK make process for one or more configurations"""
   180     """run the JDK make process for one or more configurations"""
   241 
   181 
   242     jvmVariantsDefault = ','.join(_jdkJvmVariants)
   182     jvmVariantsDefault = ','.join(_jdkJvmVariants)