Esempio n. 1
0
def gmake_with_bear(out=None, append=False, context=None):
    v = _get_bear_version()
    if v is None:
        return [mx.gmake_cmd(context=context)]
    else:
        ret = ['bear']
        if append:
            ret.append('--append' if v >= 3 else '-a')
        if out is not None:
            ret.append('--output' if v >= 3 else '-o')
            ret.append(out)
        if v >= 3:
            ret.append('--')
        ret.append(mx.gmake_cmd(context=context))
        return ret
Esempio n. 2
0
def _build(args, debug, shared_library, threading, parallelism, debug_mode,
           output_dir):
    _mxrun([
        './configure', '--partly-static', '--build-only-native',
        '--without-dtrace', '--without-snapshot', '--shared-zlib',
        '--shared-graalvm',
        _getJdkHome(), '--shared-trufflejs',
        mx.distribution('graal-js:GRAALJS').path
    ] + debug + shared_library + threading,
           cwd=_suite.dir,
           verbose=True)

    _mxrun([mx.gmake_cmd(), '-j%d' % parallelism],
           cwd=_suite.dir,
           verbose=True)

    if _currentOs == 'darwin':
        nodePath = join(_suite.dir, 'out',
                        'Debug' if debug_mode else 'Release', 'node')
        _mxrun([
            'install_name_tool', '-add_rpath',
            join(_getJdkHome(), 'jre', 'lib'), nodePath
        ],
               verbose=True)

    _createSymLinks()
Esempio n. 3
0
def _build(args, debug, shared_library, threading, parallelism, debug_mode,
           output_dir):
    _mxrun([
        './configure', '--partly-static', '--build-only-native',
        '--without-dtrace', '--without-snapshot', '--shared-graalvm',
        _getJdkHome(), '--shared-trufflejs',
        mx.distribution('graal-js:GRAALJS').path
    ] + debug + shared_library + threading,
           cwd=_suite.dir,
           verbose=True)

    verbose = 'V={}'.format('1' if mx.get_opts().verbose else '')
    _mxrun([mx.gmake_cmd(), '-j%d' % parallelism, verbose],
           cwd=_suite.dir,
           verbose=True)

    # put headers for native modules into out/headers
    _setEnvVar('HEADERS_ONLY', '1')
    out = None if mx.get_opts().verbose else open(os.devnull, 'w')
    _mxrun([
        join(_suite.mxDir, 'python2', 'python'), 'tools/install.py', 'install',
        'out/headers', '/'
    ],
           out=out)

    if _currentOs == 'darwin':
        nodePath = join(_suite.dir, 'out',
                        'Debug' if debug_mode else 'Release', 'node')
        _mxrun([
            'install_name_tool', '-add_rpath',
            join(_getJdkHome(), 'jre', 'lib'), nodePath
        ],
               verbose=True)

    _createSymLinks()
Esempio n. 4
0
def _runmake(args):
    """run the JDK make process

To build hotspot and import it into the JDK: "mx make hotspot import-hotspot"
{0}"""

    jdkBuildDir = _get_jdk_build_dir()
    if not exists(jdkBuildDir):
        # JDK9 must be bootstrapped with a JDK8
        compliance = mx.JavaCompliance('8')
        jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value)
        cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', '--with-jvm-features=graal',
               '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home, '--with-jvm-features=graal']
        mx.run(cmd, cwd=_jdkSourceRoot)
    cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
    if mx.get_opts().verbose:
        cmd.append('LOG=debug')
    cmd.extend(args)
    if mx.get_opts().use_jdk_image and 'images' not in args:
        cmd.append('images')

    if not mx.get_opts().verbose:
        mx.log('--------------- make execution ----------------------')
        mx.log('Working directory: ' + _jdkSourceRoot)
        mx.log('Command line: ' + ' '.join(cmd))
        mx.log('-----------------------------------------------------')

    mx.run(cmd, cwd=_jdkSourceRoot)
Esempio n. 5
0
def _runmake(args):
    """run the JDK make process

To build hotspot and import it into the JDK: "mx make hotspot import-hotspot"
{0}"""

    jdkBuildDir = _get_jdk_build_dir()
    if not exists(jdkBuildDir):
        # JDK10 must be bootstrapped with a JDK9
        compliance = mx.JavaCompliance('9')
        jdk9 = mx.get_jdk(compliance.exactMatch,
                          versionDescription=compliance.value)
        cmd = [
            'sh', 'configure', '--with-debug-level=' + _vm.debugLevel,
            '--with-native-debug-symbols=external',
            '--disable-precompiled-headers', '--with-jvm-features=graal',
            '--with-jvm-variants=' + _vm.jvmVariant,
            '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk9.home,
            '--with-jvm-features=graal'
        ]
        mx.run(cmd, cwd=_jdkSourceRoot)
    cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
    if mx.get_opts().verbose:
        cmd.append('LOG=debug')
    cmd.extend(args)
    if mx.get_opts().use_jdk_image and 'images' not in args:
        cmd.append('images')

    if not mx.get_opts().verbose:
        mx.log('--------------- make execution ----------------------')
        mx.log('Working directory: ' + _jdkSourceRoot)
        mx.log('Command line: ' + ' '.join(cmd))
        mx.log('-----------------------------------------------------')

    mx.run(cmd, cwd=_jdkSourceRoot)
Esempio n. 6
0
 def clean(self, forBuild=False):
     if not forBuild:
         if _is_windows:
             if exists(self._build_dir):
                 mx.run([join(mx.library('NINJA').extract_path, 'ninja.exe'), '-C', self._build_dir, '-t', 'clean'])
         else:
             mx.run([mx.gmake_cmd(), 'clean'], nonZeroIsFatal=False, cwd=_suite.dir)
         for f in _generated_config_files:
             if exists(f):
                 mx.rmtree(f)
Esempio n. 7
0
 def clean(self, forBuild=False):
     if not forBuild:
         if _currentOs is 'windows':
             mx.run([
                 join('.', 'vcbuild.bat'), 'clean', 'java-home',
                 _getJdkHome()
             ],
                    cwd=_suite.dir)
         else:
             mx.run([mx.gmake_cmd(), 'clean'],
                    nonZeroIsFatal=False,
                    cwd=_suite.dir)
 def clean(self, forBuild=False):
     if not forBuild:
         if _currentOs == 'windows':
             mx.run([join('.', 'vcbuild.bat'),
                     'clean',
                     'java-home', _getJdkHome()
                 ], cwd=_suite.dir)
         else:
             mx.run([mx.gmake_cmd(), 'clean'], nonZeroIsFatal=False, cwd=_suite.dir)
         for f in _generated_config_files:
             if exists(f):
                 mx.rmtree(f)
Esempio n. 9
0
def _runmake(args):
    """run the JDK make process

To build hotspot and import it into the JDK: "mx make hotspot import-hotspot"
{0}"""

    jdkBuildDir = _get_jdk_build_dir()
    if not exists(jdkBuildDir):
        # JDK9 must be bootstrapped with a JDK8
        compliance = mx.JavaCompliance('8')
        jdk8 = mx.get_jdk(compliance.exactMatch,
                          versionDescription=compliance.value)
        cmd = [
            'sh', 'configure', '--with-debug-level=' + _vm.debugLevel,
            '--with-native-debug-symbols=external',
            '--disable-precompiled-headers',
            '--with-jvm-variants=' + _vm.jvmVariant,
            '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home
        ]
        mx.run(cmd, cwd=_jdkSourceRoot)
    cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
    if mx.get_opts().verbose:
        cmd.append('LOG=debug')
    cmd.extend(args)
    if mx.get_opts().use_jdk_image and 'images' not in args:
        cmd.append('images')

    if not mx.get_opts().verbose:
        mx.log('--------------- make execution ----------------------')
        mx.log('Working directory: ' + _jdkSourceRoot)
        mx.log('Command line: ' + ' '.join(cmd))
        mx.log('-----------------------------------------------------')

    mx.run(cmd, cwd=_jdkSourceRoot)

    if 'images' in cmd:
        jdkImageDir = join(jdkBuildDir, 'images', 'jdk')

        # The OpenJDK build creates an empty cacerts file so copy one from
        # the default JDK (which is assumed to be an OracleJDK)
        srcCerts = join(
            mx.get_jdk(tag='default').home, 'lib', 'security', 'cacerts')
        if not exists(srcCerts):
            # Might be building with JDK8 which has cacerts under jre/
            srcCerts = join(
                mx.get_jdk(tag='default').home, 'jre', 'lib', 'security',
                'cacerts')
        dstCerts = join(jdkImageDir, 'lib', 'security', 'cacerts')
        shutil.copyfile(srcCerts, dstCerts)

        _create_jdk_bundle(jdkBuildDir, _vm.debugLevel, jdkImageDir)
Esempio n. 10
0
    def build(self):
        pre_ts = GraalNodeJsBuildTask._get_newest_ts(self.subject.getResults(), fatalIfMissing=False)

        build_env = os.environ.copy()
        _setEnvVar('PATH', '%s%s%s' % (join(_suite.mxDir, 'python2'), pathsep, build_env['PATH']), build_env)

        debug = ['--debug'] if self._debug_mode else []
        shared_library = ['--enable-shared-library'] if hasattr(self.args, 'sharedlibrary') and self.args.sharedlibrary else []

        newest_config_file_ts = GraalNodeJsBuildTask._get_newest_ts(_config_files, fatalIfMissing=True)
        newest_generated_config_file_ts = GraalNodeJsBuildTask._get_newest_ts(_generated_config_files, fatalIfMissing=False)
        # Lazily generate config files only if `configure` and `configure.py` are older than the files they generate.
        # If we don't do this, the `Makefile` always considers `config.gypi` out of date, triggering a second, unnecessary configure.
        lazy_generator = ['--lazy-generator'] if newest_generated_config_file_ts.isNewerThan(newest_config_file_ts) else []

        if _is_windows:
            processDevkitRoot(env=build_env)
            _setEnvVar('PATH', pathsep.join([build_env['PATH']] + [mx.library(lib_name).get_path(True) for lib_name in ('NASM', 'NINJA')]), build_env)
            extra_flags = ['--ninja', '--dest-cpu=x64', '--without-etw', '--without-snapshot']
        else:
            extra_flags = []

        _mxrun(python_cmd() + [join(_suite.dir, 'configure'),
                '--partly-static',
                '--without-dtrace',
                '--without-snapshot',
                '--without-node-snapshot',
                '--java-home', _java_home()
                ] + debug + shared_library + lazy_generator + extra_flags,
                cwd=_suite.dir, verbose=True, env=build_env)

        if _is_windows:
            verbose = ['-v'] if mx.get_opts().verbose else []
            # The custom env is not used to resolve the location of the executable
            _mxrun([join(mx.library('NINJA').get_path(True), 'ninja.exe')] + verbose + ['-j%d' % self.parallelism, '-C', self._build_dir], env=build_env)
        else:
            verbose = 'V={}'.format('1' if mx.get_opts().verbose else '')
            _mxrun([mx.gmake_cmd(), '-j%d' % self.parallelism, verbose], cwd=_suite.dir, verbose=True, env=build_env)

        # put headers for native modules into out/headers
        _setEnvVar('HEADERS_ONLY', '1', build_env)
        out = None if mx.get_opts().verbose else open(os.devnull, 'w')
        _mxrun(python_cmd() + [join('tools', 'install.py'), 'install', join('out', 'headers'), sep], out=out, env=build_env)

        post_ts = GraalNodeJsBuildTask._get_newest_ts(self.subject.getResults(), fatalIfMissing=True)
        mx.logv('Newest time-stamp before building: {}\nNewest time-stamp after building: {}\nHas built? {}'.format(pre_ts, post_ts, post_ts.isNewerThan(pre_ts)))
        built = post_ts.isNewerThan(pre_ts)
        if built and _current_os == 'darwin':
            nodePath = join(self._build_dir, 'node')
            _mxrun(['install_name_tool', '-add_rpath', join(_java_home(), 'jre', 'lib'), '-add_rpath', join(_java_home(), 'lib'), nodePath], verbose=True, env=build_env)
        return built
    def build(self):
        pre_ts = GraalNodeJsBuildTask._get_newest_ts(self.subject.getResults(), fatalIfMissing=False)

        pythonPath = join(_suite.mxDir, 'python2')
        prevPATH = os.environ['PATH']
        _setEnvVar('PATH', "%s:%s" % (pythonPath, prevPATH))

        debug_mode = hasattr(self.args, 'debug') and self.args.debug
        debug = ['--debug'] if debug_mode else []
        shared_library = ['--enable-shared-library'] if hasattr(self.args, 'sharedlibrary') and self.args.sharedlibrary else []

        if _currentOs == 'windows':
            _mxrun([join(_suite.dir, 'vcbuild.bat'),
                    'projgen',
                    'no-cctest',
                    'noetw',
                    'nosnapshot',
                    'java-home', _getJdkHome()
                    ] + debug + shared_library,
                   cwd=_suite.dir, verbose=True)
        else:
            newest_config_file_ts = GraalNodeJsBuildTask._get_newest_ts(_config_files, fatalIfMissing=True)
            newest_generated_config_file_ts = GraalNodeJsBuildTask._get_newest_ts(_generated_config_files, fatalIfMissing=False)
            # Lazily generate config files only if `configure` and `configure.py` are older than the files they generate.
            # If we don't do this, the `Makefile` always considers `config.gypi` out of date, triggering a second, unnecessary configure.
            lazy_generator = ['--lazy-generator'] if newest_generated_config_file_ts.isNewerThan(newest_config_file_ts) else []

            _mxrun([join(_suite.dir, 'configure'),
                    '--partly-static',
                    '--without-dtrace',
                    '--without-snapshot',
                    '--without-node-snapshot',
                    '--java-home', _getJdkHome()
                    ] + debug + shared_library + lazy_generator,
                   cwd=_suite.dir, verbose=True)

            verbose = 'V={}'.format('1' if mx.get_opts().verbose else '')
            _mxrun([mx.gmake_cmd(), '-j%d' % self.parallelism, verbose], cwd=_suite.dir, verbose=True)

        # put headers for native modules into out/headers
        _setEnvVar('HEADERS_ONLY', '1')
        out = None if mx.get_opts().verbose else open(os.devnull, 'w')
        _mxrun([python_cmd(), join('tools', 'install.py'), 'install', join('out', 'headers'), '/'], out=out)

        post_ts = GraalNodeJsBuildTask._get_newest_ts(self.subject.getResults(), fatalIfMissing=True)
        mx.logv('Newest time-stamp before building: {}\nNewest time-stamp after building: {}\nHas built? {}'.format(pre_ts, post_ts, post_ts.isNewerThan(pre_ts)))
        built = post_ts.isNewerThan(pre_ts)
        if built and _currentOs == 'darwin':
            nodePath = join(_suite.dir, 'out', 'Debug' if debug_mode else 'Release', 'node')
            _mxrun(['install_name_tool', '-add_rpath', join(_getJdkHome(), 'jre', 'lib'), '-add_rpath', join(_getJdkHome(), 'lib'), nodePath], verbose=True)
        return built
Esempio n. 12
0
def makeInNodeEnvironment(args):
    argGroups = setupNodeEnvironment(args)
    _setEnvVar('NODE_JVM_OPTIONS', ' '.join(argGroups[1]))
    makeCmd = mx.gmake_cmd()
    if _currentOs == 'solaris':
        # we have to use GNU make and cp because the Solaris versions
        # do not support options used by Node.js Makefile and gyp files
        _setEnvVar('MAKE', makeCmd)
        _mxrun(['sh', '-c', 'ln -s `which gcp` ' + join(_suite.dir, 'cp')])
        prevPATH = os.environ['PATH']
        _setEnvVar('PATH', "%s:%s" % (_suite.dir, prevPATH))
    _mxrun([makeCmd] + argGroups[2], cwd=_suite.dir)
    if _currentOs == 'solaris':
        _mxrun(['rm', 'cp'])
Esempio n. 13
0
def _runmake(args):
    """run the JDK make process

To build hotspot and import it into the JDK: "mx make hotspot import-hotspot"
{0}"""

    jdkBuildDir = _get_jdk_build_dir()
    if not exists(jdkBuildDir):
        # JDK9 must be bootstrapped with a JDK8
        compliance = mx.JavaCompliance('8')
        jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value)
        cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers',
               '--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home]
        mx.run(cmd, cwd=_jdkSourceRoot)
    cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
    if mx.get_opts().verbose:
        cmd.append('LOG=debug')
    cmd.extend(args)
    if mx.get_opts().use_jdk_image and 'images' not in args:
        cmd.append('images')

    if not mx.get_opts().verbose:
        mx.log('--------------- make execution ----------------------')
        mx.log('Working directory: ' + _jdkSourceRoot)
        mx.log('Command line: ' + ' '.join(cmd))
        mx.log('-----------------------------------------------------')

    mx.run(cmd, cwd=_jdkSourceRoot)

    if 'images' in cmd:
        jdkImageDir = join(jdkBuildDir, 'images', 'jdk')

        # The OpenJDK build creates an empty cacerts file so copy one from
        # the default JDK (which is assumed to be an OracleJDK)
        srcCerts = join(mx.get_jdk(tag='default').home, 'lib', 'security', 'cacerts')
        if not exists(srcCerts):
            # Might be building with JDK8 which has cacerts under jre/
            srcCerts = join(mx.get_jdk(tag='default').home, 'jre', 'lib', 'security', 'cacerts')
        dstCerts = join(jdkImageDir, 'lib', 'security', 'cacerts')
        if srcCerts != dstCerts:
            shutil.copyfile(srcCerts, dstCerts)

        _create_jdk_bundle(jdkBuildDir, _vm.debugLevel, jdkImageDir)
Esempio n. 14
0
def _build(args, debug, shared_library, parallelism, debug_mode, output_dir):
    if _currentOs is 'windows':
        _mxrun([
            join('.', 'vcbuild.bat'), 'projgen', 'no-cctest', 'noetw',
            'nosnapshot', 'java-home',
            _getJdkHome()
        ] + debug + shared_library,
               cwd=_suite.dir,
               verbose=True)
    else:
        _mxrun([
            join('.', 'configure'), '--partly-static', '--without-dtrace',
            '--without-snapshot', '--java-home',
            _getJdkHome()
        ] + debug + shared_library,
               cwd=_suite.dir,
               verbose=True)

        verbose = 'V={}'.format('1' if mx.get_opts().verbose else '')
        _mxrun([mx.gmake_cmd(), '-j%d' % parallelism, verbose],
               cwd=_suite.dir,
               verbose=True)

    # put headers for native modules into out/headers
    _setEnvVar('HEADERS_ONLY', '1')
    out = None if mx.get_opts().verbose else open(os.devnull, 'w')
    _mxrun([
        python_cmd(),
        join('tools', 'install.py'), 'install',
        join('out', 'headers'), '/'
    ],
           out=out)

    if _currentOs == 'darwin':
        nodePath = join(_suite.dir, 'out',
                        'Debug' if debug_mode else 'Release', 'node')
        _mxrun([
            'install_name_tool', '-add_rpath',
            join(_getJdkHome(), 'jre', 'lib'), nodePath
        ],
               verbose=True)
Esempio n. 15
0
def makeInNodeEnvironment(args):
    argGroups = setupNodeEnvironment(args)
    _setEnvVar('NODE_JVM_OPTIONS', ' '.join(argGroups[1]))
    if _is_windows:
        _mxrun([
            join('.', 'vcbuild.bat'), 'noprojgen', 'nobuild', 'java-home',
            _java_home()
        ] + argGroups[2],
               cwd=_suite.dir)
    else:
        makeCmd = mx.gmake_cmd()
        if _current_os == 'solaris':
            # we have to use GNU make and cp because the Solaris versions
            # do not support options used by Node.js Makefile and gyp files
            _setEnvVar('MAKE', makeCmd)
            _mxrun(['sh', '-c', 'ln -s `which gcp` ' + join(_suite.dir, 'cp')])
            prevPATH = os.environ['PATH']
            _setEnvVar('PATH', "%s:%s" % (_suite.dir, prevPATH))
        _mxrun([makeCmd] + argGroups[2], cwd=_suite.dir)
        if _current_os == 'solaris':
            _mxrun(['rm', 'cp'])
Esempio n. 16
0
def _makehelp():
    return subprocess.check_output([mx.gmake_cmd(), 'help'], cwd=_jdkSourceRoot)
Esempio n. 17
0
def _makehelp():
    return subprocess.check_output([mx.gmake_cmd(), 'help'],
                                   cwd=_jdkSourceRoot)
Esempio n. 18
0
 def clean(self, forBuild=False):
     if not forBuild:
         mx.run([mx.gmake_cmd(), 'clean'], nonZeroIsFatal=False, cwd=_suite.dir)
         _deleteTruffleNode()
Esempio n. 19
0
def _makehelp():
    return subprocess.check_output([mx.gmake_cmd(), 'help'],
                                   cwd=_get_jdk_dir())
Esempio n. 20
0
def gmake_with_compdb_cmd(context=None):
    if enabled():
        return gmake_with_bear(append=True, context=context)
    else:
        return [mx.gmake_cmd(context=context)]