aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/templates/mesontemplates.py
diff options
context:
space:
mode:
authorMichael <michaelbrockus@gmail.com>2020-03-02 08:34:58 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2020-03-08 13:52:01 +0200
commit99202c9ccdcb35894b2743c9eb505791412b196b (patch)
tree052b8304b66472707fccfb1481ea952c60dd1c83 /mesonbuild/templates/mesontemplates.py
parent5df106592c353bf3adc800287d02066b3ea07542 (diff)
downloadmeson-99202c9ccdcb35894b2743c9eb505791412b196b.zip
meson-99202c9ccdcb35894b2743c9eb505791412b196b.tar.gz
meson-99202c9ccdcb35894b2743c9eb505791412b196b.tar.bz2
add logic for Java jar project
Diffstat (limited to 'mesonbuild/templates/mesontemplates.py')
-rw-r--r--mesonbuild/templates/mesontemplates.py36
1 files changed, 29 insertions, 7 deletions
diff --git a/mesonbuild/templates/mesontemplates.py b/mesonbuild/templates/mesontemplates.py
index f9dd442..2739c9d 100644
--- a/mesonbuild/templates/mesontemplates.py
+++ b/mesonbuild/templates/mesontemplates.py
@@ -21,6 +21,18 @@ executable('{executable}',
install : true)
'''
+
+meson_jar_template = '''project('{project_name}', '{language}',
+ version : '{version}',
+ default_options : [{default_options}])
+
+jar('{executable}',
+ {sourcespec},{depspec},
+ main_class: {main_class},
+ install : true)
+'''
+
+
def create_meson_build(options):
if options.type != 'executable':
raise SystemExit('\nGenerating a meson.build file from existing sources is\n'
@@ -40,12 +52,22 @@ def create_meson_build(options):
depspec += ',\n '.join("dependency('{}')".format(x)
for x in options.deps.split(','))
depspec += '],'
- content = meson_executable_template.format(project_name=options.name,
- language=options.language,
- version=options.version,
- executable=options.executable,
- sourcespec=sourcespec,
- depspec=depspec,
- default_options=formatted_default_options)
+ if options.language != 'java':
+ content = meson_executable_template.format(project_name=options.name,
+ language=options.language,
+ version=options.version,
+ executable=options.executable,
+ sourcespec=sourcespec,
+ depspec=depspec,
+ default_options=formatted_default_options)
+ else:
+ content = meson_jar_template.format(project_name=options.name,
+ language=options.language,
+ version=options.version,
+ executable=options.executable,
+ main_class=options.name,
+ sourcespec=sourcespec,
+ depspec=depspec,
+ default_options=formatted_default_options)
open('meson.build', 'w').write(content)
print('Generated meson.build file:\n\n' + content)