Skip to content

Commit

Permalink
Construct AppBundle via nsbundle module
Browse files Browse the repository at this point in the history
  • Loading branch information
2xsaiko committed Jan 12, 2025
1 parent 5f190e4 commit e559398
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions mesonbuild/modules/nsbundle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 Marco Rebhan <[email protected]>

from __future__ import annotations

import typing as T

from . import NewExtensionModule, ModuleInfo, ModuleReturnValue
from mesonbuild.build import AppBundle
from mesonbuild.interpreter.type_checking import 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.AppBundle
) -> ModuleReturnValue:
tgt = state.create_build_target(AppBundle, args, kwargs)
return ModuleReturnValue(tgt, [tgt])


def initialize(*args: T.Any, **kwargs: T.Any) -> NSBundleModule:
return NSBundleModule(*args, **kwargs)

0 comments on commit e559398

Please sign in to comment.