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 cdbbc0d commit 674d972
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions mesonbuild/modules/nsbundle.py
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)

0 comments on commit 674d972

Please sign in to comment.