Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use as subproject easier #49

Merged
merged 6 commits into from
Feb 12, 2024
Merged

Conversation

fmuellner
Copy link
Contributor

While it is possible to use jasmine-gjs as meson subproject after
commit 6fbd6d8, there are a couple of issues with it:

  • the jasmine test suite is added to the project tests
  • jasmine is installed alongside the project
  • projects needs to set up an environment with
    JASMINE_UNINSTALLED and friends, but only when
    falling back to the subproject

Address those by special-casing the use in a subproject, and

  • skip tests
  • don't install anything
  • generate jasmine/runner to run installed without env vars

The first two seem pretty common for build dependencies (gi-docgen,
blueprint-compiler). Doing the same for a test dependency doesn't
seem too far fetched.

Now that tests are loaded as modules, we can use `imports.meta.url`
to resolve the path to fixtures instead of passing the directory
in the environment.
We variables we currently substitute allow setting up imports
when running installed, but need a separate code path for the
uninstalled case.

Using slightly different variables will allow us to change that.
Instead of using a completely different code path for setting
up imports, override only the substituted variables from the
environment.
Projects that include jasmine-gjs as subproject want to test
their own code, not jasmine-gjs.
Projects that include jasmine-gjs as subproject will typically
use it to run their own test suite with `meson test`, which means
that jasmine-gjs only runs from the build directory.

There is therefore little use for installing jasmine alongside
the project. In fact, it can cause problems for packagers when
multiple projects end up installing their own copy.

Avoid this and simply don't install anything when used as
subproject.
If a project includes jasmine-gjs as subproject for its test
suite, it currently needs to pass a couple of environment
variables for jasmine to work uninstalled.

Now that we no longer install anything when used as subproject,
we can instead use the right substitutions, so projects can use
jasmine in their test suite without special-casing the subproject
case.
Copy link
Owner

@ptomato ptomato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this all makes sense. I wish Meson had better isolation between subprojects and main projects, but that seems to be an intentional decision.

@ptomato ptomato merged commit c6aa28b into ptomato:master Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants