File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ Revision history for {{$dist->name}}
2
2
3
3
{{$NEXT}}
4
4
- Added ffi_options function (gh#3, gh#8)
5
+ - ffi->test and ffi->combined will now build test lib
6
+ if there is a t/ffi directory (gh#8)
5
7
6
8
0.05 2019-02-18 11:24:43 -0500
7
9
- Fix downstream install bug on Windows (gh#1)
Original file line number Diff line number Diff line change @@ -210,11 +210,45 @@ Returns a L<FFI::Platypus> instance connected to the test for your module.
210
210
211
211
=cut
212
212
213
+ sub _build_test
214
+ {
215
+ if (-d " t/ffi" )
216
+ {
217
+ require FFI::Build::MM;
218
+ require Capture::Tiny;
219
+
220
+ my ($output , $error ) = Capture::Tiny::capture_merged(sub {
221
+ local $@ = ' ' ;
222
+ eval {
223
+ my $fbmm = FFI::Build::MM-> new( save => 0 );
224
+ $fbmm -> mm_args( DISTNAME => " My-Test" ); # the DISTNAME isn't used for building the test anyway.
225
+ $fbmm -> test-> build;
226
+ };
227
+ $@ ;
228
+ });
229
+ if ($error )
230
+ {
231
+ my $ctx = Test2::API::context();
232
+ $ctx -> diag($error );
233
+ $ctx -> diag($output );
234
+ $ctx -> release;
235
+ die $error ;
236
+ }
237
+ else
238
+ {
239
+ my $ctx = Test2::API::context();
240
+ $ctx -> note($output );
241
+ $ctx -> release;
242
+ }
243
+ }
244
+ }
245
+
213
246
sub test
214
247
{
215
248
my ($self ) = @_ ;
216
249
217
250
$self -> {test } ||= do {
251
+ _build_test();
218
252
my $ffi = Test2::Tools::FFI::Platypus-> new( @{ $self -> {new_args } } );
219
253
my @lib = FFI::CheckLib::find_lib(
220
254
lib => ' *' ,
@@ -241,6 +275,7 @@ sub combined
241
275
my ($self ) = @_ ;
242
276
243
277
$self -> {combined } ||= do {
278
+ _build_test();
244
279
my $rt = $self -> runtime;
245
280
my $t = $self -> test;
246
281
my $ffi = Test2::Tools::FFI::Platypus-> new( @{ $self -> {new_args } } );
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ my %modules;
10
10
my $post_diag ;
11
11
12
12
$modules {$_ } = $_ for qw(
13
+ Capture::Tiny
13
14
ExtUtils::MakeMaker
14
15
FFI::Build
15
16
FFI::Build::MM
You can’t perform that action at this time.
0 commit comments