diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2020-11-12 14:57:49 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-12 12:57:49 -0800 |
commit | 02281a891d28ec60399bfbe2407ced168584f708 (patch) | |
tree | ded9b621e87a812cf889885e9272785276ab9c5b | |
parent | f46bd411f42eeb8120fe2fba9c127ccb8d7fcc8e (diff) | |
download | spack-02281a891d28ec60399bfbe2407ced168584f708.tar.gz spack-02281a891d28ec60399bfbe2407ced168584f708.tar.bz2 spack-02281a891d28ec60399bfbe2407ced168584f708.tar.xz spack-02281a891d28ec60399bfbe2407ced168584f708.zip |
MavenPackage: allow additional build args (#19676)
-rw-r--r-- | lib/spack/docs/build_systems/mavenpackage.rst | 18 | ||||
-rw-r--r-- | lib/spack/spack/build_systems/maven.py | 8 |
2 files changed, 24 insertions, 2 deletions
diff --git a/lib/spack/docs/build_systems/mavenpackage.rst b/lib/spack/docs/build_systems/mavenpackage.rst index e8a8a1b86c..6f833e8bec 100644 --- a/lib/spack/docs/build_systems/mavenpackage.rst +++ b/lib/spack/docs/build_systems/mavenpackage.rst @@ -76,6 +76,24 @@ should add: depends_on('maven@3.5.4:', type='build') +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Passing arguments to the build phase +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The default build and install phases should be sufficient to install +most packages. However, you may want to pass additional flags to +the build phase. For example: + +.. code-block:: python + + def build_args(self): + return [ + '-Pdist,native', + '-Dtar', + '-Dmaven.javadoc.skip=true' + ] + + ^^^^^^^^^^^^^^^^^^^^^^ External documentation ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/lib/spack/spack/build_systems/maven.py b/lib/spack/spack/build_systems/maven.py index c7faaf2014..e9df34e791 100644 --- a/lib/spack/spack/build_systems/maven.py +++ b/lib/spack/spack/build_systems/maven.py @@ -35,15 +35,19 @@ class MavenPackage(PackageBase): """The directory containing the ``pom.xml`` file.""" return self.stage.source_path + def build_args(self): + """List of args to pass to build phase.""" + return [] + def build(self, spec, prefix): """Compile code and package into a JAR file.""" with working_dir(self.build_directory): mvn = which('mvn') if self.run_tests: - mvn('verify') + mvn('verify', *self.build_args()) else: - mvn('package', '-DskipTests') + mvn('package', '-DskipTests', *self.build_args()) def install(self, spec, prefix): """Copy to installation prefix.""" |