Update wren to 0.3.0

Upstream repo got wren-cli split out into a separate
git repo so it can't be built as part of the wren
repo anymore. Unit tests have also changed, meson
script now relies on a python find script to get all
the *.wren files that should be passed to the unit
test executable.
This commit is contained in:
King_DuckZ 2021-01-22 11:52:20 +01:00
parent 4360ad03cf
commit aac87d85c0
5 changed files with 59 additions and 70 deletions

View file

@ -1,5 +1,4 @@
option('build_testing', type: 'boolean', value: false)
option('build_examples', type: 'boolean', value: false)
option('wren_with_cli', type: 'boolean', value: true, yield: true)
option('wren_with_rand', type: 'boolean', value: false, yield: true)
option('wren_with_meta', type: 'boolean', value: false, yield: true)

View file

@ -0,0 +1,12 @@
#!/usr/bin/env python
from pathlib import Path
import sys
if len(sys.argv) < 2:
sys.stderr.write("Please specify a search directory\n")
exit(2)
for search_path in sys.argv[1:]:
for path in Path(search_path).rglob('*.wren'):
sys.stdout.write(str(path) + "\n")

View file

@ -1,6 +1,6 @@
project('wren', 'c',
version: '0.2.0',
meson_version: '>=0.49.2',
version: '0.3.0',
meson_version: '>=0.54.0',
default_options: ['buildtype=release', 'c_std=c99', 'build_testing=true'],
)
@ -19,8 +19,7 @@ endif
wren_incl = include_directories('wren/src/include', is_system: true)
wren_pvt_incl = include_directories('wren/src/vm', 'wren/src/optional')
module_incl = include_directories('wren/src/module')
cli_incl = include_directories('wren/src/cli')
test_incl = include_directories('wren/test')
threads_dep = dependency('threads')
libuv_dep = c_compiler.find_library('libuv', required: true)
@ -32,21 +31,13 @@ opt_src = [
]
vm_src = [
'wren/src/vm/wren_debug.c',
'wren/src/vm/wren_compiler.c',
'wren/src/vm/wren_core.c',
'wren/src/vm/wren_debug.c',
'wren/src/vm/wren_primitive.c',
'wren/src/vm/wren_utils.c',
'wren/src/vm/wren_vm.c',
'wren/src/vm/wren_value.c',
'wren/src/vm/wren_primitive.c',
'wren/src/vm/wren_compiler.c',
]
module_src = [
'wren/src/module/io.c',
'wren/src/module/timer.c',
'wren/src/module/repl.c',
'wren/src/module/os.c',
'wren/src/module/scheduler.c',
'wren/src/vm/wren_vm.c',
]
force_static = meson.is_subproject()
@ -74,71 +65,59 @@ wren_dep = declare_dependency(
link_with: wren,
)
if get_option('wren_with_cli')
cli = executable(meson.project_name(),
'wren/src/cli/main.c',
'wren/src/cli/path.c',
'wren/src/cli/modules.c',
'wren/src/cli/vm.c',
module_src,
install: not force_static,
include_directories: [cli_incl, module_incl],
dependencies: [wren_dep, libuv_dep],
c_args: ['-D_XOPEN_SOURCE=600'],
)
endif
if get_option('build_testing')
test_api_src = [
'wren/test/api/main.c',
'wren/test/api/reset_stack_after_foreign_construct.c',
'wren/test/api/new_vm.c',
'wren/test/api/get_variable.c',
'wren/test/api/slots.c',
'wren/test/api/lists.c',
'wren/test/api/user_data.c',
fs = import('fs')
test_src = [
'wren/test/api/api_tests.c',
'wren/test/api/benchmark.c',
'wren/test/api/call.c',
'wren/test/api/foreign_class.c',
'wren/test/api/call_calls_foreign.c',
'wren/test/api/call_wren_call_root.c',
'wren/test/api/handle.c',
'wren/test/api/resolution.c',
'wren/test/api/error.c',
'wren/test/api/call_calls_foreign.c',
'wren/test/api/foreign_class.c',
'wren/test/api/get_variable.c',
'wren/test/api/handle.c',
'wren/test/api/lists.c',
'wren/test/api/new_vm.c',
'wren/test/api/reset_stack_after_call_abort.c',
'wren/test/api/benchmark.c',
'wren/test/api/reset_stack_after_foreign_construct.c',
'wren/test/api/resolution.c',
'wren/test/api/slots.c',
'wren/test/api/user_data.c',
'wren/test/main.c',
'wren/test/test.c',
]
test_unit_src = [
'wren/test/unit/main.c',
'wren/test/unit/test.c',
'wren/test/unit/path_test.c',
test_script_paths = [
'api', 'benchmark', 'core', 'language', 'limit', 'regression', 'unit'
]
test_api = executable('api_' + meson.project_name(),
test_api_src,
module_src,
'wren/src/cli/path.c',
'wren/src/cli/modules.c',
'wren/src/cli/vm.c',
if get_option('wren_with_meta')
test_script_paths += ['meta']
endif
if get_option('wren_with_rand')
test_script_paths += ['random']
endif
test_scripts = run_command(
meson.current_source_dir() / 'find_scripts.py',
meson.current_source_dir(),
test_script_paths,
).stdout().strip().split('\n')
test_api = executable(meson.project_name() + '_test',
test_src,
install: false,
dependencies: [wren_dep, libuv_dep],
include_directories: [cli_incl, module_incl],
include_directories: [],
c_args: ['-D_XOPEN_SOURCE=600'],
)
test(meson.project_name() + ' api test', test_api)
test_unit = executable('unit_' + meson.project_name(),
test_unit_src,
module_src,
'wren/src/cli/path.c',
'wren/src/cli/modules.c',
'wren/src/cli/vm.c',
install: false,
include_directories: [cli_incl, module_incl],
dependencies: [wren_dep, libuv_dep],
c_args: ['-D_XOPEN_SOURCE=600'],
)
test(meson.project_name() + ' unit test', test_unit)
foreach test_script : test_scripts
name = fs.stem(test_script)
test(meson.project_name() + ' test ' + name, test_api, args: files(test_script))
endforeach
endif
if not force_static

View file

@ -1,4 +1,3 @@
option('build_testing', type: 'boolean', value: false, yield: true)
option('wren_with_cli', type: 'boolean', value: true, yield: true)
option('wren_with_rand', type: 'boolean', value: false, yield: true)
option('wren_with_meta', type: 'boolean', value: false, yield: true)

@ -1 +1 @@
Subproject commit 6ab4abe9e3a2767ced01589e9a3d583c840f54c3
Subproject commit cd012469976d1a9da796581cd9a9591842cb0cf8