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 16, 2025
1 parent 98753ff commit 68c7252
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/markdown/NSBundle-module.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# NSBundle module

TODO
1 change: 1 addition & 0 deletions docs/sitemap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ index.md
Icestorm-module.md
Java-module.md
Keyval-module.md
NSBundle-module.md
Pkgconfig-module.md
Python-3-module.md
Python-module.md
Expand Down
1 change: 1 addition & 0 deletions docs/theme/extra/templates/navbar_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
("Icestorm-module.html","Icestorm"), \
("Java-module.html","Java"), \
("Keyval-module.html","Keyval"), \
("NSBundle-module.html","NSBundle"), \
("Pkgconfig-module.html","Pkgconfig"), \
("Python-3-module.html","Python 3"), \
("Python-module.html","Python"), \
Expand Down
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


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


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])

0 comments on commit 68c7252

Please sign in to comment.