summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-07-19 13:26:27 -0700
committerXavier Claessens <xclaesse@gmail.com>2023-07-20 14:20:46 -0400
commit01b5581a100bbb5c608cd054dfccbec721285be9 (patch)
tree4fe2d44270a33e8fdd877cd06ca588661d598f01
parent68da3669a41d3423bc5db593b66def8a59d2f625 (diff)
downloadmeson-01b5581a100bbb5c608cd054dfccbec721285be9.tar.gz
build|interpreter: move main_class to typed_kwargs
Also move it into the Jar class. This is an exclusive Jar keyword argument, and is only used inside java paths, so there's no reason to have this in all build targets.
-rw-r--r--mesonbuild/build.py5
-rw-r--r--mesonbuild/interpreter/kwargs.py3
-rw-r--r--mesonbuild/interpreter/type_checking.py4
3 files changed, 6 insertions, 6 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 6438b836d..c303ffe0f 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1150,10 +1150,6 @@ class BuildTarget(Target):
(str, bool))
self.install_mode = kwargs.get('install_mode', None)
self.install_tag = stringlistify(kwargs.get('install_tag', [None]))
- main_class = kwargs.get('main_class', '')
- if not isinstance(main_class, str):
- raise InvalidArguments('Main class must be a string')
- self.main_class = main_class
if isinstance(self, Executable):
# This kwarg is deprecated. The value of "none" means that the kwarg
# was not specified and win_subsystem should be used instead.
@@ -2913,6 +2909,7 @@ class Jar(BuildTarget):
self.filename = self.name + '.jar'
self.outputs = [self.filename]
self.java_args = kwargs.get('java_args', [])
+ self.main_class = kwargs.get('main_class', '')
self.java_resources: T.Optional[StructuredSources] = kwargs.get('java_resources', None)
def get_main_class(self):
diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py
index d46d4e323..95bf9bcf1 100644
--- a/mesonbuild/interpreter/kwargs.py
+++ b/mesonbuild/interpreter/kwargs.py
@@ -352,4 +352,5 @@ class BuildTarget(Library):
class Jar(_BaseBuildTarget):
- pass
+
+ main_class: str
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index f2a74080f..cc1f944a7 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -532,7 +532,9 @@ SHARED_MOD_KWS = [
# Arguments exclusive to JAR. These are separated to make integrating
# them into build_target easier
-_EXCLUSIVE_JAR_KWS: T.List[KwargInfo] = []
+_EXCLUSIVE_JAR_KWS: T.List[KwargInfo] = [
+ KwargInfo('main_class', str, default=''),
+]
# The total list of arguments used by JAR
JAR_KWS = [