|
54 | 54 | CT_BUILD_BY_DEFAULT, |
55 | 55 | CT_INPUT_KW, |
56 | 56 | CT_INSTALL_DIR_KW, |
57 | | - _EXCLUSIVE_EXECUTABLE_KWS, |
| 57 | + EXCLUSIVE_EXECUTABLE_KWS, |
58 | 58 | EXECUTABLE_KWS, |
59 | 59 | JAR_KWS, |
60 | 60 | LIBRARY_KWS, |
@@ -1813,22 +1813,26 @@ def func_dependency(self, node: mparser.BaseNode, args: T.Tuple[T.List[str]], kw |
1813 | 1813 | def func_disabler(self, node, args, kwargs): |
1814 | 1814 | return Disabler() |
1815 | 1815 |
|
1816 | | - def _strip_exe_specific_kwargs(self, kwargs: kwtypes.Executable) -> kwtypes._BuildTarget: |
1817 | | - kwargs = kwargs.copy() |
1818 | | - for exe_kwarg in _EXCLUSIVE_EXECUTABLE_KWS: |
1819 | | - del kwargs[exe_kwarg.name] |
1820 | | - return kwargs |
| 1816 | + def _exe_to_shlib_kwargs(self, kwargs: kwtypes.Executable) -> kwtypes.SharedLibrary: |
| 1817 | + nkwargs = T.cast('kwtypes.SharedLibrary', kwargs.copy()) |
| 1818 | + for exe_kwarg in EXCLUSIVE_EXECUTABLE_KWS: |
| 1819 | + del nkwargs[exe_kwarg.name] # type: ignore[misc] |
| 1820 | + for sh_kwarg in SHARED_LIB_KWS: |
| 1821 | + nkwargs.setdefault(sh_kwarg.name, sh_kwarg.default) # type: ignore[misc] |
| 1822 | + nkwargs['rust_abi'] = None |
| 1823 | + nkwargs['rust_crate_type'] = 'cdylib' |
| 1824 | + return nkwargs |
1821 | 1825 |
|
1822 | 1826 | @permittedKwargs(build.known_exe_kwargs) |
1823 | 1827 | @typed_pos_args('executable', str, varargs=SOURCES_VARARGS) |
1824 | 1828 | @typed_kwargs('executable', *EXECUTABLE_KWS, allow_unknown=True) |
1825 | 1829 | def func_executable(self, node: mparser.BaseNode, |
1826 | 1830 | args: T.Tuple[str, SourcesVarargsType], |
1827 | | - kwargs: kwtypes.Executable) -> build.Executable: |
| 1831 | + kwargs: kwtypes.Executable) -> T.Union[build.Executable, build.SharedLibrary]: |
1828 | 1832 | for_machine = kwargs['native'] |
1829 | 1833 | m = self.environment.machines[for_machine] |
1830 | 1834 | if m.is_android() and kwargs.get('android_exe_type') == 'application': |
1831 | | - holder = self.build_target(node, args, self._strip_exe_specific_kwargs(kwargs), build.SharedLibrary) |
| 1835 | + holder = self.build_target(node, args, self._exe_to_shlib_kwargs(kwargs), build.SharedLibrary) |
1832 | 1836 | holder.shared_library_only = True |
1833 | 1837 | return holder |
1834 | 1838 | return self.build_target(node, args, kwargs, build.Executable) |
|
0 commit comments