diff options
-rw-r--r-- | docs/markdown/Wrap-maintainer-tools.md | 17 | ||||
-rw-r--r-- | docs/markdown/Wrap-review-guidelines.md | 34 | ||||
-rw-r--r-- | docs/sitemap.txt | 1 | ||||
-rw-r--r-- | mesonbuild/build.py | 35 | ||||
-rw-r--r-- | mesonbuild/mtest.py | 20 | ||||
-rw-r--r-- | test cases/common/215 link custom/custom_target.c | 6 | ||||
-rw-r--r-- | test cases/common/215 link custom/custom_target.py | 6 | ||||
-rw-r--r-- | test cases/common/215 link custom/dummy.c | 1 | ||||
-rw-r--r-- | test cases/common/215 link custom/meson.build | 19 | ||||
-rw-r--r-- | test cases/common/215 link custom/outerlib.c | 3 | ||||
-rwxr-xr-x | tools/boost_names.py | 6 |
11 files changed, 112 insertions, 36 deletions
diff --git a/docs/markdown/Wrap-maintainer-tools.md b/docs/markdown/Wrap-maintainer-tools.md deleted file mode 100644 index 717d0d2..0000000 --- a/docs/markdown/Wrap-maintainer-tools.md +++ /dev/null @@ -1,17 +0,0 @@ -# Wrap maintainer tools - -The [mesonwrap repository](https://github.com/mesonbuild/mesonwrap) provides tools -to maintain the WrapDB. Read-only features such can be used by anyone without Meson admin rights. - -## Personal access token - -Some tools require access to the Github API. -A [personal access token](https://github.com/settings/tokens) may be required -if the freebie Github API quota is exhausted. `public_repo` scope is required -for write operations. - -``` -$ cat ~/.config/mesonwrap.ini -[mesonwrap] -github_token = <github token> -``` diff --git a/docs/markdown/Wrap-review-guidelines.md b/docs/markdown/Wrap-review-guidelines.md index 3e41a8d..389328b 100644 --- a/docs/markdown/Wrap-review-guidelines.md +++ b/docs/markdown/Wrap-review-guidelines.md @@ -7,8 +7,25 @@ package is rejected. What should be done will be determined on a case-by-case basis. Similarly meeting all these requirements does not guarantee that the package will get accepted. Use common sense. -The review process is partially automated by the [mesonwrap](Wrap-maintainer-tools.md) -`review` tool. +## Setting up the tools + +The [mesonwrap repository](https://github.com/mesonbuild/mesonwrap) provides tools +to maintain the WrapDB. Read-only features such can be used by anyone without Meson admin rights. + +## Personal access token + +Some tools require access to the Github API. +A [personal access token](https://github.com/settings/tokens) may be required +if the freebie Github API quota is exhausted. `public_repo` scope is required +for write operations. + +``` +$ cat ~/.config/mesonwrap.ini +[mesonwrap] +github_token = <github token> +``` + +## Reviewing code ``` mesonwrap review zlib --pull-request=1 [--approve] @@ -34,3 +51,16 @@ Encourage wrap readability. Use your own judgement. If the code looks good use the `--approve` flag to merge it. The tool automatically creates a release. + +If you need to create a release manually (because, for example, a MR +was merged by hand), the command to do it is the following: + +```shell +mesonwrap publish reponame version +``` + +An example invocation would look like this: + +```shell +mesonwrap publish expat 2.2.9 +``` diff --git a/docs/sitemap.txt b/docs/sitemap.txt index bdded3e..246ee3e 100644 --- a/docs/sitemap.txt +++ b/docs/sitemap.txt @@ -74,7 +74,6 @@ index.md Adding-new-projects-to-wrapdb.md Using-the-WrapDB.md Using-wraptool.md - Wrap-maintainer-tools.md Wrap-best-practices-and-tips.md Wrap-review-guidelines.md Shipping-prebuilt-binaries-as-wraps.md diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 8d2a22f..bc1f54a 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1130,10 +1130,16 @@ You probably should put it in link_with instead.''') def link(self, target): for t in unholder(listify(target)): - if isinstance(self, StaticLibrary) and self.need_install and t.is_internal(): - # When we're a static library and we link_with to an - # internal/convenience library, promote to link_whole. - return self.link_whole(t) + if isinstance(self, StaticLibrary) and self.need_install: + if isinstance(t, (CustomTarget, CustomTargetIndex)): + if not t.should_install(): + mlog.warning('Try to link an installed static library target {} with a custom target ' + 'that is not installed, this might cause problems when you try to use ' + 'this static library'.format(self.name)) + elif t.is_internal(): + # When we're a static library and we link_with to an + # internal/convenience library, promote to link_whole. + return self.link_whole(t) if not isinstance(t, (Target, CustomTargetIndex)): raise InvalidArguments('{!r} is not a target.'.format(t)) if not t.is_linkable_target(): @@ -2274,6 +2280,18 @@ class CustomTarget(Target): def get_all_link_deps(self): return [] + def is_internal(self) -> bool: + if not self.should_install(): + return True + for out in self.get_outputs(): + # Can't check if this is a static library, so try to guess + if not out.endswith(('.a', '.lib')): + return False + return True + + def extract_all_objects_recurse(self): + return self.get_outputs() + def type_suffix(self): return "@cus" @@ -2419,6 +2437,15 @@ class CustomTargetIndex: if suf == '.a' or suf == '.dll' or suf == '.lib' or suf == '.so': return True + def should_install(self) -> bool: + return self.target.should_install() + + def is_internal(self) -> bool: + return self.target.is_internal() + + def extract_all_objects_recurse(self): + return self.target.extract_all_objects_recurse() + class ConfigureFile: def __init__(self, subdir, sourcename, targetname, configuration_data): diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index ee1d412..caf4039 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -917,15 +917,17 @@ class TestHarness: if result.res is TestResult.FAIL: result_str += ' ' + returncode_to_status(result.returncode) if not self.options.quiet or result.res not in ok_statuses: - if result.res not in ok_statuses and mlog.colorize_console(): - if result.res in bad_statuses: - self.collected_failures.append(result_str) - decorator = mlog.red - elif result.res is TestResult.SKIP: - decorator = mlog.yellow - else: - sys.exit('Unreachable code was ... well ... reached.') - print(decorator(result_str).get_text(True)) + if result.res not in ok_statuses: + self.collected_failures.append(result_str) + if mlog.colorize_console(): + if result.res in bad_statuses: + self.collected_failures.append(result_str) + decorator = mlog.red + elif result.res is TestResult.SKIP: + decorator = mlog.yellow + else: + sys.exit('Unreachable code was ... well ... reached.') + print(decorator(result_str).get_text(True)) else: print(result_str) result_str += "\n\n" + result.get_log() diff --git a/test cases/common/215 link custom/custom_target.c b/test cases/common/215 link custom/custom_target.c new file mode 100644 index 0000000..1bbe82c --- /dev/null +++ b/test cases/common/215 link custom/custom_target.c @@ -0,0 +1,6 @@ +void outer_lib_func(void); + +int main(void) { + outer_lib_func(); + return 0; +} diff --git a/test cases/common/215 link custom/custom_target.py b/test cases/common/215 link custom/custom_target.py new file mode 100644 index 0000000..c246344 --- /dev/null +++ b/test cases/common/215 link custom/custom_target.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import shutil, sys + +if __name__ == '__main__': + shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/215 link custom/dummy.c b/test cases/common/215 link custom/dummy.c new file mode 100644 index 0000000..53a4a40 --- /dev/null +++ b/test cases/common/215 link custom/dummy.c @@ -0,0 +1 @@ +void inner_lib_func(void) {}
\ No newline at end of file diff --git a/test cases/common/215 link custom/meson.build b/test cases/common/215 link custom/meson.build index 013da04..837e960 100644 --- a/test cases/common/215 link custom/meson.build +++ b/test cases/common/215 link custom/meson.build @@ -57,3 +57,22 @@ d2_i = declare_dependency(link_whole: clib[0]) exe4_i = executable('prog4_i', 'prog.c', dependencies: d2_i) test('linkwhole2_i', exe2_i) + +# Link with custom target + +dummy = static_library('dummy', 'dummy.c') + +custom_prog = find_program('custom_target.py') +t = custom_target('custom', input: dummy, output: 'libcustom.a', command: [custom_prog, '@INPUT@', '@OUTPUT@']) + +dep1 = declare_dependency(link_with: t) +dep2 = declare_dependency(link_with: t[0]) + +lib1 = static_library('lib1', 'outerlib.c', dependencies: dep1) +lib2 = static_library('lib2', 'outerlib.c', dependencies: dep2) + +exe1 = executable('exe1', 'custom_target.c', link_with: lib1) +test('custom_target_1', exe1) + +exe1_2 = executable('exe1_2', 'custom_target.c', link_with: lib2) +test('custom_target_2', exe2)
\ No newline at end of file diff --git a/test cases/common/215 link custom/outerlib.c b/test cases/common/215 link custom/outerlib.c new file mode 100644 index 0000000..6861f8d --- /dev/null +++ b/test cases/common/215 link custom/outerlib.c @@ -0,0 +1,3 @@ +void inner_lib_func(void); + +void outer_lib_func(void) { inner_lib_func(); }
\ No newline at end of file diff --git a/tools/boost_names.py b/tools/boost_names.py index 897b4fd..89926ec 100755 --- a/tools/boost_names.py +++ b/tools/boost_names.py @@ -48,12 +48,12 @@ class BoostLibrary(): self.single = sorted(set(single)) self.multi = sorted(set(multi)) - def __lt__(self, other: object) -> T.Union[bool, 'NotImplemented']: + def __lt__(self, other: object) -> bool: if isinstance(other, BoostLibrary): return self.name < other.name return NotImplemented - def __eq__(self, other: object) -> T.Union[bool, 'NotImplemented']: + def __eq__(self, other: object) -> bool: if isinstance(other, BoostLibrary): return self.name == other.name elif isinstance(other, str): @@ -71,7 +71,7 @@ class BoostModule(): self.desc = desc self.libs = libs - def __lt__(self, other: object) -> T.Union[bool, 'NotImplemented']: + def __lt__(self, other: object) -> bool: if isinstance(other, BoostModule): return self.key < other.key return NotImplemented |