Skip to content

Commit

Permalink
Merge pull request #14 from PerlAlien/deprecate-interpolate
Browse files Browse the repository at this point in the history
Deprecate interpolation of `%{meson}`
  • Loading branch information
zmughal authored Oct 29, 2023
2 parents 85ddd60 + bb52cf0 commit 2c5bd41
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Revision history for {{$dist->name}}

{{$NEXT}}
- Deprecate interpolation of `%{meson}`.

0.04 2023-10-28 21:26:14-04:00 America/New_York
- Fix missing $VERSION.
Expand Down
27 changes: 27 additions & 0 deletions lib/Alien/Meson.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ Command line tool:
unshift @PATH, Alien::Meson->bin_dir;
system "@{[ Alien::Meson->exe ]}";
Use in L<alienfile>:
share {
requires 'Alien::Meson';
requires 'Alien::Ninja';
# ...
my $build_dir = '_build';
build [
sub {
my $build = shift;
Alien::Build::CommandSequence->new([
Alien::Meson->exe, 'setup',
'--prefix=%{.install.prefix}',
$build_dir,
])->execute($build);
},
[ '%{ninja}', qw(-C), $build_dir, "test" ],
[ '%{ninja}', qw(-C), $build_dir, 'install' ],
];
}
=head1 DESCRIPTION
This distribution provides meson so that it can be used by other
Expand Down Expand Up @@ -74,6 +95,11 @@ sub bin_dir {
%{meson}
B<WARNING>: This interpolation is deprecated. This will be removed in a future
version as some share installs of Meson are not callable as a single executable
(they need to be prefixed with the Python interpreter). Instead use
C<< Alien::Meson->exe >> directly.
Returns 'meson', 'meson.py', or appropriate command for
platform.
Expand All @@ -82,6 +108,7 @@ platform.
sub alien_helper {
return +{
meson => sub {
warn "Interpolation of %{meson} is deprecated. See POD for Alien::Meson.";
join " ", Alien::Meson->exe;
},
};
Expand Down
6 changes: 4 additions & 2 deletions t/alien_meson.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ diag "Alien::Meson->runtime_prop ", Dumper( [ Alien::Meson->runtime_prop ] );

diag "Alien::Meson->exe: ", Dumper( [ Alien::Meson->exe ] );

helper_ok 'meson';
interpolate_template_is '%{meson}', join " ", Alien::Meson->exe;
like warning {
helper_ok 'meson';
interpolate_template_is '%{meson}', join " ", Alien::Meson->exe;
}, qr/deprecated/, 'helper is deprecated';

run_ok([ Alien::Meson->exe, qw(--version) ])
->success
Expand Down

0 comments on commit 2c5bd41

Please sign in to comment.