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

use new features #15

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
fail-fast: false
matrix:
cip_tag:
- static
- "5.37"
- "5.41"
- "5.40"
- "5.38"
- "5.36"
- "5.34"
- "5.32"
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: static

on:
push:
branches:
- '*'
tags-ignore:
- '*'
pull_request:

jobs:
perl:

runs-on: ubuntu-latest

env:
CIP_TAG: static

steps:
- uses: actions/checkout@v2

- name: Bootstrap CIP
run: |
curl -L https://raw.githubusercontent.com/uperl/cip/main/bin/github-bootstrap | bash

- name: Build + Test
run: |
cip script
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}}
- Add support for FFI::Platypus::Lang::V (gh#15)

1.07 2022-10-16 04:37:01 -0600
- Removed mostly harmless warning (gh#10)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dist::Zilla::Plugin::FFI ![linux](https://github.com/PerlFFI/Dist-Zilla-Plugin-FFI/workflows/linux/badge.svg)
# Dist::Zilla::Plugin::FFI ![static](https://github.com/PerlFFI/Dist-Zilla-Plugin-FFI/workflows/static/badge.svg) ![linux](https://github.com/PerlFFI/Dist-Zilla-Plugin-FFI/workflows/linux/badge.svg)

FFI related Dist::Zilla plugins

Expand Down
4 changes: 3 additions & 1 deletion dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ test2_v0 = 1
version_plugin = PkgVersion::Block
github_user = PerlFFI
irc = irc://irc.perl.org/#native
workflow = linux

workflow = static
workflow = linux

[RemovePrereqs]
remove = strict
Expand Down
13 changes: 6 additions & 7 deletions lib/Dist/Zilla/Plugin/FFI.pm
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package Dist::Zilla::Plugin::FFI {
use strict;
use warnings;
use 5.020;
use true;

use strict;
use warnings;
use 5.020;
package Dist::Zilla::Plugin::FFI {

# ABSTRACT: FFI related Dist::Zilla plugins

Expand Down Expand Up @@ -31,6 +32,4 @@ Add L<FFI::CheckLib> checks into your C<Makefile.PL>.

=cut

}

1;
}
39 changes: 25 additions & 14 deletions lib/Dist/Zilla/Plugin/FFI/Build.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use 5.020;
use true;

package Dist::Zilla::Plugin::FFI::Build {

use 5.020;
use Moose;
use experimental qw( signatures );
use List::Util qw( first );

# ABSTRACT: Add FFI::Build to your Makefile.PL
Expand Down Expand Up @@ -125,9 +128,8 @@ EOF2
isa => 'Maybe[Str]',
);

sub munge_files
sub munge_files ($self)
{
my($self) = @_;
my $file = first { $_->name eq 'Makefile.PL' } @{ $self->zilla->files };
$self->log_fatal("unable to find Makefile.PL")
unless $file;
Expand All @@ -139,8 +141,7 @@ EOF2
$file->content($content);
}

sub register_prereqs {
my ($self) = @_;
sub register_prereqs ($self) {
$self->zilla->register_prereqs( +{
phase => 'configure',
type => 'requires',
Expand All @@ -156,6 +157,14 @@ EOF2
},
"FFI::Platypus::Lang::@{[ $self->lang ]}" => 0,
);
if($self->lang eq 'V') {
$self->zilla->register_prereqs( +{
phase => 'runtime',
type => 'requires',
},
"FFI::Build" => '2.10',
)
}
}

if($self->build)
Expand All @@ -166,21 +175,25 @@ EOF2
},
"FFI::Build::File::@{[ $self->build ]}" => 0,,
);
if($self->build eq 'VMod') {
$self->zilla->register_prereqs( +{
phase => 'runtime',
type => 'requires',
},
"FFI::Build" => '2.10',
)
}
}

}

sub metadata
sub metadata ($self)
{
my($self) = @_;
my %meta = ( dynamic_config => 1 );
\%meta;
}

sub prune_files
sub prune_files ($self)
{
my($self) = @_;

my $lang = $self->lang;

foreach my $file ((), @{ $self->zilla->files })
Expand All @@ -203,6 +216,4 @@ EOF2
}

__PACKAGE__->meta->make_immutable;
}

1;
}
24 changes: 9 additions & 15 deletions lib/Dist/Zilla/Plugin/FFI/CheckLib.pm
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package Dist::Zilla::Plugin::FFI::CheckLib {
use 5.020;
use true;

use strict;
use warnings;
use 5.020;
package Dist::Zilla::Plugin::FFI::CheckLib {

# ABSTRACT: FFI::CheckLib alternative to Dist::Zilla::Plugin::CheckLib

use Moose;
use experimental qw( signatures );

with
'Dist::Zilla::Role::FileMunger',
'Dist::Zilla::Role::InstallTool',
Expand Down Expand Up @@ -52,8 +53,7 @@ package Dist::Zilla::Plugin::FFI::CheckLib {
$config
};

sub register_prereqs {
my ($self) = @_;
sub register_prereqs ($self) {
$self->zilla->register_prereqs( +{
phase => 'configure',
type => 'requires',
Expand All @@ -63,9 +63,7 @@ package Dist::Zilla::Plugin::FFI::CheckLib {
}

my %files;
sub munge_files {
my ($self) = @_;

sub munge_files ($self) {
my @mfpl = grep
{; $_->name eq 'Makefile.PL' or $_->name eq 'Build.PL' }
@{ $self->zilla->files };
Expand All @@ -79,9 +77,7 @@ package Dist::Zilla::Plugin::FFI::CheckLib {
()
}

sub setup_installer {
my ($self) = @_;

sub setup_installer ($self) {
my @mfpl = grep
{; $_->name eq 'Makefile.PL' or $_->name eq 'Build.PL' }
@{ $self->zilla->files };
Expand All @@ -103,9 +99,7 @@ package Dist::Zilla::Plugin::FFI::CheckLib {
()
}

sub _munge_file {
my ($self, $file) = @_;

sub _munge_file ($self, $file) {
my $orig_content = $file->content;
$self->log_fatal('could not find position in ' . $file->name . ' to modify!')
unless $orig_content =~ m/use strict;\nuse warnings;\n\n/g;
Expand Down
2 changes: 2 additions & 0 deletions t/00_diag.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ $modules{$_} = $_ for qw(
Path::Tiny
Test2::V0
Test::DZil
experimental
namespace::autoclean
true
);


Expand Down
Loading