Skip to content

Commit ad53511

Browse files
committed
[GR-33256] Remove Native Image Maven Plugin
PullRequest: graal/9592
2 parents d53f7aa + e239641 commit ad53511

File tree

11 files changed

+19
-889
lines changed

11 files changed

+19
-889
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
layout: docs
3+
toc_group: native-image
4+
link_title: Native Gradle Plugin
5+
permalink: /reference-manual/native-image/NativeGradlePlugin/
6+
---
7+
# Native Gradle Plugin
8+
9+
Docs for the Gradle plugin are available at [graalvm.github.io/native-build-tools](https://graalvm.github.io/native-build-tools).

docs/reference-manual/native-image/NativeImageMavenPlugin.md

Lines changed: 0 additions & 118 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: docs
3+
toc_group: native-image
4+
link_title: Native Maven Plugin
5+
permalink: /reference-manual/native-image/NativeMavenPlugin/
6+
redirect_from: /reference-manual/native-image/NativeImageMavenPlugin/
7+
---
8+
# Native Maven Plugin
9+
10+
Docs for the Maven plugin have moved to [graalvm.github.io/native-build-tools](https://graalvm.github.io/native-build-tools).

substratevm/mx.substratevm/mx_substratevm.py

Lines changed: 0 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from distutils.dir_util import mkpath, remove_tree # pylint: disable=no-name-in-module
3737
from os.path import join, exists, dirname
3838
import pipes
39-
from xml.dom.minidom import parse
4039
from argparse import ArgumentParser
4140
import fnmatch
4241
import collections
@@ -214,7 +213,6 @@ def __getattr__(self, name):
214213
'helloworld_debug',
215214
'debuginfotest',
216215
'test',
217-
'maven',
218216
'js',
219217
'build',
220218
'benchmarktest',
@@ -421,11 +419,6 @@ def help_stdout_check(output):
421419
test_run([js, '-e', 'print("hello:" + Array.from(new Array(10), (x,i) => i*i ).join("|"))'], 'hello:0|1|4|9|16|25|36|49|64|81\n')
422420
test_js(js, [('octane-richards', 1000, 100, 300)])
423421

424-
with Task('maven plugin checks', tasks, tags=[GraalTags.maven]) as t:
425-
if t:
426-
maven_plugin_install([])
427-
maven_plugin_test([])
428-
429422
with Task('module build demo', tasks, tags=[GraalTags.hellomodule]) as t:
430423
if t:
431424
hellomodule([])
@@ -756,34 +749,6 @@ def native_image_context_run(func, func_args=None, config=None, build_if_missing
756749
with native_image_context(config=config, build_if_missing=build_if_missing) as native_image:
757750
func(native_image, func_args)
758751

759-
def pom_from_template(proj_dir, svmVersion):
760-
# Create native-image-maven-plugin pom with correct version info from template
761-
dom = parse(join(proj_dir, 'template-pom.xml'))
762-
for svmVersionElement in dom.getElementsByTagName('svmVersion'):
763-
svmVersionElement.parentNode.replaceChild(dom.createTextNode(svmVersion), svmVersionElement)
764-
with open(join(proj_dir, 'pom.xml'), 'w') as pom_file:
765-
dom.writexml(pom_file)
766-
767-
def deploy_native_image_maven_plugin(svmVersion, repo, gpg, keyid, mvn_nonzero_fatal=True, mvn_out=None, mvn_err=None):
768-
proj_dir = join(suite.dir, 'src', 'native-image-maven-plugin')
769-
pom_from_template(proj_dir, svmVersion)
770-
# Build and install native-image-maven-plugin into local repository
771-
772-
maven_args = []
773-
if keyid:
774-
maven_args += ['-Dgpg.keyname=' + keyid]
775-
elif not gpg:
776-
maven_args += ['-Dgpg.skip=true']
777-
if repo == mx.maven_local_repository():
778-
maven_args += ['install']
779-
else:
780-
maven_args += [
781-
'-DaltDeploymentRepository={}::default::{}'.format(repo.name, repo.get_url(svmVersion)),
782-
'deploy'
783-
]
784-
return mx.run_maven(maven_args, nonZeroIsFatal=mvn_nonzero_fatal, out=mvn_out, err=mvn_err, cwd=proj_dir)
785-
786-
787752
mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmJreComponent(
788753
suite=suite,
789754
name='SubstrateVM',
@@ -1557,99 +1522,6 @@ def native_unittest(args):
15571522
native_image_context_run(_native_unittest, args)
15581523

15591524

1560-
@mx.command(suite.name, 'maven-plugin-install')
1561-
def maven_plugin_install(args):
1562-
parser = ArgumentParser(prog='mx maven-plugin-install')
1563-
parser.add_argument("--deploy-dependencies", action='store_true', help="This will deploy all the artifacts from all suites before building and deploying the plugin")
1564-
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')
1565-
parser.add_argument('--gpg', action='store_true', help='Sign files with gpg before deploying')
1566-
parser.add_argument('--gpg-keyid', help='GPG keyid to use when signing files (implies --gpg)', default=None)
1567-
parser.add_argument('--suppress-output-on-success', help='Buffers maven output and prints it only in case of errors', default=False, action='store_true')
1568-
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.')
1569-
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')
1570-
parsed = parser.parse_args(args)
1571-
1572-
if not suite.isSourceSuite():
1573-
raise mx.abort("maven-plugin-install requires {} to be a source suite, no a binary suite".format(suite.name))
1574-
1575-
if parsed.url:
1576-
if parsed.licenses:
1577-
licenses = mx.get_license(parsed.licenses.split(','))
1578-
elif parsed.repository_id:
1579-
licenses = mx.repository(parsed.repository_id).licenses
1580-
else:
1581-
licenses = []
1582-
repo = mx.Repository(suite, parsed.repository_id, parsed.url, parsed.url, licenses)
1583-
elif parsed.repository_id:
1584-
repo = mx.repository(parsed.repository_id)
1585-
else:
1586-
repo = mx.maven_local_repository()
1587-
1588-
svm_version = suite.release_version(snapshotSuffix='SNAPSHOT')
1589-
1590-
if parsed.deploy_dependencies:
1591-
mx.warn("native-image-maven-plugin does not have GraalVM maven dependencies anymore. --deploy-dependencies is obsolete.")
1592-
1593-
mvn_out = None
1594-
mvn_err = None
1595-
mvn_nonzero_fatal = True
1596-
if parsed.suppress_output_on_success:
1597-
mvn_out = mvn_err = mx.LinesOutputCapture()
1598-
mvn_nonzero_fatal = False
1599-
mx.log('Installing the maven plugin. Output will be printed only in case of failure.')
1600-
1601-
ret = deploy_native_image_maven_plugin(svm_version, repo, parsed.gpg, parsed.gpg_keyid, mvn_nonzero_fatal=mvn_nonzero_fatal, mvn_out=mvn_out, mvn_err=mvn_err)
1602-
1603-
if not ret:
1604-
success_message = [
1605-
'',
1606-
'Use the following plugin snippet to enable native-image building for your maven project:',
1607-
'',
1608-
'<plugin>',
1609-
' <groupId>org.graalvm.nativeimage</groupId>',
1610-
' <artifactId>native-image-maven-plugin</artifactId>',
1611-
' <version>' + svm_version + '</version>',
1612-
' <executions>',
1613-
' <execution>',
1614-
' <goals>',
1615-
' <goal>native-image</goal>',
1616-
' </goals>',
1617-
' <phase>package</phase>',
1618-
' </execution>',
1619-
' </executions>',
1620-
'</plugin>',
1621-
'',
1622-
]
1623-
mx.log('\n'.join(success_message))
1624-
else:
1625-
mx.log_error('maven-plugin-install failed!')
1626-
mx.log_error('Maven output:')
1627-
for line in mvn_out.lines:
1628-
mx.log_error(line)
1629-
mx.abort(ret)
1630-
1631-
@mx.command(suite.name, 'maven-plugin-test')
1632-
def maven_plugin_test(args):
1633-
# Create native-image-maven-plugin-test pom with correct version info from template
1634-
proj_dir = join(suite.dir, 'src', 'native-image-maven-plugin-test')
1635-
svm_version = suite.release_version(snapshotSuffix='SNAPSHOT')
1636-
pom_from_template(proj_dir, svm_version)
1637-
# Build native image with native-image-maven-plugin
1638-
env = os.environ.copy()
1639-
maven_opts = env.get('MAVEN_OPTS', '').split()
1640-
if not svm_java8():
1641-
# On Java 9+ without native-image executable the plugin needs access to jdk.internal.module
1642-
maven_opts.append('-XX:+UnlockExperimentalVMOptions')
1643-
maven_opts.append('-XX:+EnableJVMCI')
1644-
maven_opts.append('--add-exports=java.base/jdk.internal.module=ALL-UNNAMED')
1645-
env['MAVEN_OPTS'] = ' '.join(maven_opts)
1646-
config = GraalVMConfig.build(native_images=['native-image'])
1647-
with native_image_context(IMAGE_ASSERTION_FLAGS, config=config):
1648-
env['JAVA_HOME'] = _vm_home(config)
1649-
mx.run_maven(['-e', 'package'], cwd=proj_dir, env=env)
1650-
mx.run([join(proj_dir, 'target', 'com.oracle.substratevm.nativeimagemojotest')])
1651-
1652-
16531525
@mx.command(suite, 'javac-image', '[image-options]')
16541526
def javac_image(args):
16551527
"""builds a javac image"""

substratevm/src/native-image-maven-plugin-test/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

substratevm/src/native-image-maven-plugin-test/src/main/java/com/oracle/substratevm/NativeImageMojoTest.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)