def _run_downstream_svm(commands, binary=False): new_rewrites = None if binary: localmvn = "/tmp/graalpythonsnapshots" localmvnrepl = "file://%s" % localmvn publicmvn = mx.repository("python-public-snapshots").url publicmvnpattern = re.compile(publicmvn) git = mx.GitConfig() new_rewrites = [{ publicmvnpattern.pattern: { "replacement": localmvnrepl } }] for rewrite in _urlrewrites: if rewrite.pattern.match(publicmvn): # we replace rewrites of our public repo pass elif publicmvnpattern.match(rewrite.replacement): # we rewrite to what we want new_rewrites.append( {rewrite.pattern.pattern: { "replacement": localmvnrepl }}) else: new_rewrites.append({ rewrite.pattern.pattern: { "replacement": rewrite.replacement } }) os.environ["TRUFFLE_PYTHON_VERSION"] = git.tip(_suite.dir).strip() os.environ["TRUFFLE_SULONG_VERSION"] = git.tip(_sulong.dir).strip() prev_urlrewrites = os.environ.get("MX_URLREWRITES") os.environ["MX_URLREWRITES"] = json.dumps(new_rewrites) mx.command_function("deploy-binary")( ["--all-suites", "python-local-snapshots", localmvnrepl]) try: mx.log(str(dict(os.environ))) testdownstream(_suite, [ mx.suite("truffle").vc._remote_url( mx.suite("truffle").dir, "origin") ], "substratevm", commands) finally: if binary: os.environ.pop("TRUFFLE_PYTHON_VERSION") os.environ.pop("TRUFFLE_SULONG_VERSION") if prev_urlrewrites: os.environ["MX_URLREWRITES"] = prev_urlrewrites else: os.environ.pop("MX_URLREWRITES") shutil.rmtree(localmvn, ignore_errors=True)
def maven_plugin_install(args): parser = ArgumentParser(prog='mx maven-plugin-install') parser.add_argument( "--deploy-dependencies", action='store_true', help= "This will deploy all the artifacts from all suites before building and deploying the plugin" ) parser.add_argument( '--licenses', help= 'Comma-separated list of licenses that are cleared for upload. Only used if no url is given. Otherwise licenses are looked up in suite.py' ) parser.add_argument('--gpg', action='store_true', help='Sign files with gpg before deploying') parser.add_argument( '--gpg-keyid', help='GPG keyid to use when signing files (implies --gpg)', default=None) parser.add_argument( 'repository_id', metavar='repository-id', nargs='?', action='store', help= 'Repository ID used for binary deploy. If none is given, mavens local repository is used instead.' ) parser.add_argument( 'url', metavar='repository-url', nargs='?', action='store', help= 'Repository URL used for binary deploy. If no url is given, the repository-id is looked up in suite.py' ) parsed = parser.parse_args(args) if not suite.isSourceSuite(): raise mx.abort( "maven-plugin-install requires {} to be a source suite, no a binary suite" .format(suite.name)) if parsed.url: if parsed.licenses: licenses = mx.get_license(parsed.licenses.split(',')) elif parsed.repository_id: licenses = mx.repository(parsed.repository_id).licenses else: licenses = [] repo = mx.Repository(suite, parsed.repository_id, parsed.url, parsed.url, licenses) elif parsed.repository_id: repo = mx.repository(parsed.repository_id) else: repo = mx.maven_local_repository() svm_version = suite.release_version(snapshotSuffix='SNAPSHOT') if parsed.deploy_dependencies: deploy_args = [ '--suppress-javadoc', '--all-distribution-types', '--validate=full', '--all-suites', ] if parsed.licenses: deploy_args += ["--licenses", parsed.licenses] if parsed.gpg: deploy_args += ["--gpg"] if parsed.gpg_keyid: deploy_args += ["--gpg-keyid", parsed.gpg_keyid] if parsed.repository_id: deploy_args += [parsed.repository_id] if parsed.url: deploy_args += [parsed.url] mx.maven_deploy(deploy_args) deploy_native_image_maven_plugin(svm_version, repo, parsed.gpg, parsed.gpg_keyid) success_message = [ '', 'Use the following plugin snippet to enable native-image building for your maven project:', '', '<plugin>', ' <groupId>com.oracle.substratevm</groupId>', ' <artifactId>native-image-maven-plugin</artifactId>', ' <version>' + svm_version + '</version>', ' <executions>', ' <execution>', ' <goals>', ' <goal>native-image</goal>', ' </goals>', ' <phase>package</phase>', ' </execution>', ' </executions>', '</plugin>', '', ] mx.log('\n'.join(success_message))