diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-04-02 19:59:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-02 19:59:00 +0300 |
commit | 519cd40a064d43e1ce57b60d898a7adabd9e6034 (patch) | |
tree | 5df3096f16c68325ad9ca78104483e073dcdcd19 | |
parent | 51a19521729484b9bd3c42653303a29489c574f1 (diff) | |
parent | 2dc1e87caeeefa5f15f0b8b6454ee65c18012c06 (diff) | |
download | meson-519cd40a064d43e1ce57b60d898a7adabd9e6034.zip meson-519cd40a064d43e1ce57b60d898a7adabd9e6034.tar.gz meson-519cd40a064d43e1ce57b60d898a7adabd9e6034.tar.bz2 |
Merge D feature flag fix branch
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 8 | ||||
-rw-r--r-- | test cases/d/6 unittest/app.d | 4 | ||||
-rw-r--r-- | test cases/d/6 unittest/meson.build | 6 | ||||
-rw-r--r-- | test cases/d/6 unittest/second_unit.d | 10 | ||||
-rw-r--r-- | test cases/d/9 features/app.d | 9 | ||||
-rw-r--r-- | test cases/d/9 features/extra.d | 9 | ||||
-rw-r--r-- | test cases/d/9 features/meson.build | 10 |
7 files changed, 45 insertions, 11 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index bfac4c7..2eff796 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2199,6 +2199,11 @@ rule FORTRAN_DEP_HACK # near the end since these are supposed to override everything else. commands += self.escape_extra_args(compiler, target.get_extra_args(compiler.get_language())) + + # D specific additional flags + if compiler.language == 'd': + commands += compiler.get_feature_args(target.d_features, self.build_to_src) + # Add source dir and build dir. Project-specific and target-specific # include paths must override per-target compile args, include paths # from external dependencies, internal dependencies, and from @@ -2292,9 +2297,6 @@ rule FORTRAN_DEP_HACK depelem.write(outfile) commands += compiler.get_module_outdir_args(self.get_target_private_dir(target)) - if compiler.language == 'd': - commands += compiler.get_feature_args(target.d_features, self.build_to_src) - element = NinjaBuildElement(self.all_outputs, rel_obj, compiler_name, rel_src) for d in header_deps: if isinstance(d, File): diff --git a/test cases/d/6 unittest/app.d b/test cases/d/6 unittest/app.d index 751e754..71c6414 100644 --- a/test cases/d/6 unittest/app.d +++ b/test cases/d/6 unittest/app.d @@ -23,10 +23,14 @@ unittest { writeln ("TEST"); import core.stdc.stdlib : exit; + import second_unit; assert (getFour () > 2); assert (getFour () == 4); + // this is a regression test for https://github.com/mesonbuild/meson/issues/3337 + secondModuleTestFunc (); + // we explicitly terminate here to give the unittest program a different exit // code than the main application has. // (this prevents the regular main() from being executed) diff --git a/test cases/d/6 unittest/meson.build b/test cases/d/6 unittest/meson.build index 1551e94..49a0700 100644 --- a/test cases/d/6 unittest/meson.build +++ b/test cases/d/6 unittest/meson.build @@ -1,8 +1,8 @@ project('D Unittests', 'd') -e = executable('dapp', 'app.d', install : true) +e = executable('dapp', ['app.d', 'second_unit.d'], install : true) test('dapp_run', e, should_fail: true) -e_test = executable('dapp_test', 'app.d', - d_args: meson.get_compiler('d').unittest_args()) +e_test = executable('dapp_test', ['app.d', 'second_unit.d'], + d_unittest: true) test('dapp_test', e_test) diff --git a/test cases/d/6 unittest/second_unit.d b/test cases/d/6 unittest/second_unit.d new file mode 100644 index 0000000..fdb62a9 --- /dev/null +++ b/test cases/d/6 unittest/second_unit.d @@ -0,0 +1,10 @@ + +void secondModuleTestFunc () +{ + import std.stdio : writeln; + + version (unittest) + writeln ("Hello!"); + else + assert (0); +} diff --git a/test cases/d/9 features/app.d b/test cases/d/9 features/app.d index 37cc1dd..6b43bf0 100644 --- a/test cases/d/9 features/app.d +++ b/test cases/d/9 features/app.d @@ -3,6 +3,8 @@ import std.stdio; import std.array : split; import std.string : strip; +import extra; + auto getMenu () { auto foods = import ("food.txt").strip.split ("\n"); @@ -31,7 +33,12 @@ void main (string[] args) version (With_People) { if (request == "people") { writeln ("People: ", getPeople.join (", ")); - exit (0); + + // only exit successfully if the second module also had its module version set. + // this checks for issue https://github.com/mesonbuild/meson/issues/3337 + if (secondModulePeopleVersionSet ()) + exit (0); + exit (1); } } diff --git a/test cases/d/9 features/extra.d b/test cases/d/9 features/extra.d new file mode 100644 index 0000000..832b292 --- /dev/null +++ b/test cases/d/9 features/extra.d @@ -0,0 +1,9 @@ + +auto secondModulePeopleVersionSet () +{ + version (With_People) { + return true; + } else { + return false; + } +} diff --git a/test cases/d/9 features/meson.build b/test cases/d/9 features/meson.build index 356e9f3..694e488 100644 --- a/test cases/d/9 features/meson.build +++ b/test cases/d/9 features/meson.build @@ -6,8 +6,10 @@ project('D Features', 'd') # STRINGS TO PATHS MANUALLY! data_dir = join_paths(meson.current_source_dir(), 'data') +test_src = ['app.d', 'extra.d'] + e_plain_bcompat = executable('dapp_menu_bcompat', - 'app.d', + test_src, d_import_dirs: [data_dir] ) test('dapp_menu_t_fail_bcompat', e_plain_bcompat, should_fail: true) @@ -18,7 +20,7 @@ test('dapp_menu_t_bcompat', e_plain_bcompat, args: ['menu']) data_dir = include_directories('data') e_plain = executable('dapp_menu', - 'app.d', + test_src, d_import_dirs: [data_dir] ) test('dapp_menu_t_fail', e_plain, should_fail: true) @@ -27,7 +29,7 @@ test('dapp_menu_t', e_plain, args: ['menu']) # test feature versions and string imports e_versions = executable('dapp_versions', - 'app.d', + test_src, d_import_dirs: [data_dir], d_module_versions: ['No_Menu', 'With_People'] ) @@ -36,7 +38,7 @@ test('dapp_versions_t', e_versions, args: ['people']) # test everything and unittests e_test = executable('dapp_test', - 'app.d', + test_src, d_import_dirs: [data_dir], d_module_versions: ['No_Menu', 'With_People'], d_unittest: true |