-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Construct AppBundle via nsbundle module
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# SPDX-FileCopyrightText: 2025 Marco Rebhan <me@dblsaiko.net> | ||
|
||
from __future__ import annotations | ||
|
||
import typing as T | ||
|
||
from . import NewExtensionModule, ModuleInfo, ModuleReturnValue | ||
from mesonbuild.build import AppBundle | ||
from mesonbuild.interpreter.type_checking import DEPENDENCIES_KW, INCLUDE_DIRECTORIES, NSAPP_KWS, SOURCES_VARARGS | ||
from mesonbuild.interpreterbase.decorators import FeatureNew, typed_kwargs, typed_pos_args | ||
|
||
if T.TYPE_CHECKING: | ||
from . import ModuleState | ||
from mesonbuild.interpreter.type_checking import SourcesVarargsType | ||
from mesonbuild.interpreter import Interpreter, kwargs as kwtypes | ||
|
||
|
||
class NSBundleModule(NewExtensionModule): | ||
INFO = ModuleInfo('nsbundle', '1.6.99') | ||
|
||
def __init__(self, interpreter: Interpreter): | ||
super().__init__() | ||
self.methods.update( | ||
{ | ||
'application': self.application, | ||
} | ||
) | ||
|
||
@FeatureNew('nsbundle.application', '1.6.99') | ||
@typed_pos_args('nsbundle.application', (str,), varargs=SOURCES_VARARGS) | ||
@typed_kwargs('nsbundle.application', *NSAPP_KWS, allow_unknown=True) | ||
def application( | ||
self, state: ModuleState, args: T.Tuple[str, SourcesVarargsType], kwargs: kwtypes.BuildTarget | ||
) -> ModuleReturnValue: | ||
# TODO | ||
tgt = state._interpreter.build_target(state.current_node, args, kwargs, AppBundle) | ||
return ModuleReturnValue(tgt, []) | ||
|
||
|
||
def initialize(*args: T.Any, **kwargs: T.Any) -> NSBundleModule: | ||
return NSBundleModule(*args, **kwargs) |