Skip to content

Commit

Permalink
Port build system to Meson
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomato committed Aug 15, 2020
1 parent 88c2e56 commit 15caef0
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 563 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
language: c
script: ./autogen.sh && make all check distcheck
sudo: required
dist: trusty
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq gjs
dist: focal
addons:
apt:
packages:
- gjs
- meson
script: meson _build && ninja -C _build && RUN_THOROUGH_TESTS=yes meson test -C _build
107 changes: 0 additions & 107 deletions Makefile.am

This file was deleted.

39 changes: 29 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ From Git:
```sh
git clone https://github.com/ptomato/jasmine-gjs
cd jasmine-gjs
./autogen.sh
make
sudo make install
meson _build
ninja -C _build
sudo ninja -C _build install
```

From a tarball:

```sh
tar xJf jasmine-gjs-2.1.3.tar.xz
cd jasmine-gjs-2.1.3
./configure
make
sudo make install
meson _build
ninja -C _build
sudo ninja -C _build install
```

## Usage
Expand Down Expand Up @@ -131,6 +131,23 @@ This is mainly useful if your Javascript code uses a private C library;
you can add `LD_LIBRARY_PATH` and `GI_TYPELIB_PATH` to `environment` in
order to expose that library to GJS's GObject introspection repository.

## Integration with Meson

If using Meson, you might want to integrate your test suite into your build process.
Meson can parse the output of the TAP reporter automatically and display a full report at the end.

Put this code in `meson.build`:

```
jasmine = find_program('jasmine')
test(test_name, jasmine, args: [test_file, '--tap', '--no-config'],
protocol: 'tap')
```

Where `test_name` and `test_file` are the name of your test and the JS
script to run, respectively.

## Integration with Autotools

If using autotools, you might want to integrate your test suite into
Expand Down Expand Up @@ -173,16 +190,18 @@ If you don't want that, remove the `JS_LOG_DRIVER_FLAGS` line.

If you use on-disk test fixtures, you should note that someone may be
building your software with separate source and build trees.
Notably, `make distcheck` does this.
Notably, Meson does this.
In that case, you have to make sure that your fixtures can be found both
when running tests from the source directory and from a separate build
directory.
I suggest defining an environment variable in your makefile that tells
where the fixtures can be found.
For example, in Jasmine GJS's own tests, this line is in `Makefile.am`:
For example, in Jasmine GJS's own tests, this line is in `meson.build`:

```make
AM_TESTS_ENVIRONMENT = export SRCDIR='$(srcdir)';
```
test_env = {
'SRCDIR': meson.current_source_dir(),
}
```

The test code then reads the environment variable like this:
Expand Down
25 changes: 0 additions & 25 deletions autogen.sh

This file was deleted.

16 changes: 0 additions & 16 deletions configure.ac

This file was deleted.

7 changes: 3 additions & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ Section: devel
Priority: optional
Maintainer: Philip Chimento <[email protected]>
Build-Depends: debhelper (>= 9),
dh-autoreconf,
gir1.2-glib-2.0,
gir1.2-gtk-3.0,
gjs (>= 1.39.3)
gjs (>= 1.58.0),
meson (>= 0.50.0)
Standards-Version: 3.9.5
Homepage: https://github.com/ptomato/jasmine-gjs

Package: jasmine-gjs
Architecture: all
Depends: ${misc:Depends},
gir1.2-glib-2.0,
gjs (>= 1.39.3)
gjs (>= 1.58.0)
Description: Behavior-driven development framework for GJS
This module allows you to run Jasmine specs for your GJS code. The output will
be displayed in your terminal.
4 changes: 2 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#export DH_VERBOSE=1

%:
dh $@ --with autoreconf
dh $@

# Print out test log on failure, so that we can diagnose failures on OBS
override_dh_auto_test:
dh_auto_test || (find . -name test-suite.log | xargs cat ; exit 1)
dh_auto_test || (find . -name testlog.txt | xargs cat ; exit 1)
Loading

0 comments on commit 15caef0

Please sign in to comment.