| 1 | package Alien::Build::Plugin::Probe::Vcpkg; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use 5.008004; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Alien::Build::Plugin; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | # ABSTRACT: Probe for system libraries using Vcpkg | ||||||||||||||||||||||||||||||||
| 9 | 2 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 2 | has '+name'; | |||||||||||||||||||||||||||||||
| 13 | 2 | has 'lib'; | |||||||||||||||||||||||||||||||
| 14 | 2 | has 'ffi_name'; | |||||||||||||||||||||||||||||||
| 15 | 2 | has 'include'; | |||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | sub init | ||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 19 | 0 | my($self, $meta) = @_; | |||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if(defined $self->include) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 22 | { | ||||||||||||||||||||||||||||||||
| 23 | 0 | $meta->add_requires('configure' => 'Alien::Build::Plugin::Probe::Vcpkg' => '2.16' ); | |||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||
| 25 | elsif(defined $self->ffi_name) | ||||||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||||||
| 27 | 0 | $meta->add_requires('configure' => 'Alien::Build::Plugin::Probe::Vcpkg' => '2.14' ); | |||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||
| 29 | else | ||||||||||||||||||||||||||||||||
| 30 | { | ||||||||||||||||||||||||||||||||
| 31 | 0 | $meta->add_requires('configure' => 'Alien::Build::Plugin::Probe::Vcpkg' => '0' ); | |||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if($meta->prop->{platform}->{compiler_type} eq 'microsoft') | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 35 | { | ||||||||||||||||||||||||||||||||
| 36 | $meta->register_hook( | ||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | probe => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||
| 38 | 0 | my($build) = @_; | |||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | 0 | $build->hook_prop->{probe_class} = __PACKAGE__; | |||||||||||||||||||||||||||||||
| 41 | 0 | $build->hook_prop->{probe_instance_id} = $self->instance_id; | |||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | 0 | eval { | |||||||||||||||||||||||||||||||
| 44 | 0 | require Win32::Vcpkg; | |||||||||||||||||||||||||||||||
| 45 | 0 | require Win32::Vcpkg::List; | |||||||||||||||||||||||||||||||
| 46 | 0 | require Win32::Vcpkg::Package; | |||||||||||||||||||||||||||||||
| 47 | 0 | Win32::Vcpkg->VERSION('0.02'); | |||||||||||||||||||||||||||||||
| 48 | }; | ||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if(my $error = $@) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||||||
| 51 | 0 | $build->log("unable to load Win32::Vcpkg: $error"); | |||||||||||||||||||||||||||||||
| 52 | 0 | return 'share'; | |||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | 0 | my $package; | |||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if($self->name) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 57 | { | ||||||||||||||||||||||||||||||||
| 58 | 0 | $package = Win32::Vcpkg::List->new | |||||||||||||||||||||||||||||||
| 59 | ->search($self->name, include => $self->include); | ||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||
| 61 | elsif($self->lib) | ||||||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||||||
| 63 | 0 | $package = eval { Win32::Vcpkg::Package->new( lib => $self->lib, include => $self->include) }; | |||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | return 'share' if $@; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||
| 66 | else | ||||||||||||||||||||||||||||||||
| 67 | { | ||||||||||||||||||||||||||||||||
| 68 | 0 | $build->log("you must provode either name or lib property for Probe::Vcpkg"); | |||||||||||||||||||||||||||||||
| 69 | 0 | return 'share'; | |||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 0 | my $version = $package->version; | |||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | $version = 'unknown' unless defined $version; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | 0 | $build->install_prop->{plugin_probe_vcpkg}->{$self->instance_id} = { | |||||||||||||||||||||||||||||||
| 76 | version => $version, | ||||||||||||||||||||||||||||||||
| 77 | cflags => $package->cflags, | ||||||||||||||||||||||||||||||||
| 78 | libs => $package->libs, | ||||||||||||||||||||||||||||||||
| 79 | }; | ||||||||||||||||||||||||||||||||
| 80 | 0 | $build->hook_prop->{version} = $version; | |||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $build->install_prop->{plugin_probe_vcpkg}->{$self->instance_id}->{ffi_name} = $self->ffi_name | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 82 | if defined $self->ffi_name; | ||||||||||||||||||||||||||||||||
| 83 | 0 | return 'system'; | |||||||||||||||||||||||||||||||
| 84 | }, | ||||||||||||||||||||||||||||||||
| 85 | 0 | ); | |||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | $meta->register_hook( | ||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | gather_system => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||
| 89 | 0 | my($build) = @_; | |||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||
| 91 | return if $build->hook_prop->{name} eq 'gather_system' | ||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | && ($build->install_prop->{system_probe_instance_id} || '') ne $self->instance_id; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$build->hook_prop->{"name"} eq "gather_system" and ($build->install_prop->{"system_probe_instance_id"} || "") ne $self->instance_id
$build->install_prop->{'system_probe_instance_id'} || ''
MC/DC0%0/2
$build->hook_prop->{"name"} eq "gather_system" and ($build->install_prop->{"system_probe_instance_id"} || "") ne $self->instance_id
$build->hook_prop->{"name"} eq "gather_system"
$build->install_prop->{'system_probe_instance_id'}
Truth table0%0/3
A and B
A= $build->hook_prop->{"name"} eq "gather_system"B= $build->install_prop->{'system_probe_instance_id'}
| |||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if(my $c = $build->install_prop->{plugin_probe_vcpkg}->{$self->instance_id}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | $build->runtime_prop->{version} = $c->{version} unless defined $build->runtime_prop->{version}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 97 | 0 | $build->runtime_prop->{$_} = $c->{$_} for grep { defined $c->{$_} } qw( cflags libs ffi_name ); | |||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||
| 99 | }, | ||||||||||||||||||||||||||||||||
| 100 | 0 | ); | |||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||
| 104 | 2 | 1; | |||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||
| 106 | __END__ | ||||||||||||||||||||||||||||||||