1 | # ------------------------------------------------------------------------------ |
---|
2 | # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
3 | # |
---|
4 | # This file is part of FCM, tools for managing and building source code. |
---|
5 | # |
---|
6 | # FCM is free software: you can redistribute it and/or modify |
---|
7 | # it under the terms of the GNU General Public License as published by |
---|
8 | # the Free Software Foundation, either version 3 of the License, or |
---|
9 | # (at your option) any later version. |
---|
10 | # |
---|
11 | # FCM is distributed in the hope that it will be useful, |
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | # GNU General Public License for more details. |
---|
15 | # |
---|
16 | # You should have received a copy of the GNU General Public License |
---|
17 | # along with FCM. If not, see <http://www.gnu.org/licenses/>. |
---|
18 | # ------------------------------------------------------------------------------ |
---|
19 | use strict; |
---|
20 | use warnings; |
---|
21 | |
---|
22 | # ------------------------------------------------------------------------------ |
---|
23 | package FCM::System::Make::Build::FileType::Data; |
---|
24 | use base qw{FCM::System::Make::Build::FileType}; |
---|
25 | |
---|
26 | use FCM::Context::Make::Build; # for FCM::Context::Make::Build::Target |
---|
27 | use FCM::System::Make::Build::Task::Install; |
---|
28 | |
---|
29 | # Handler of tasks |
---|
30 | my %TASK_CLASS_OF = (install => 'FCM::System::Make::Build::Task::Install'); |
---|
31 | |
---|
32 | sub new { |
---|
33 | my ($class, $attrib_ref) = @_; |
---|
34 | bless( |
---|
35 | FCM::System::Make::Build::FileType->new({ |
---|
36 | id => q{}, |
---|
37 | source_analyse_dep_of => {}, |
---|
38 | source_to_targets => \&_source_to_targets, |
---|
39 | target_file_ext_of => {}, |
---|
40 | task_class_of => {%TASK_CLASS_OF}, |
---|
41 | %{$attrib_ref}, |
---|
42 | }), |
---|
43 | $class, |
---|
44 | ); |
---|
45 | } |
---|
46 | |
---|
47 | # Returns a list of targets for a given build source. |
---|
48 | sub _source_to_targets { |
---|
49 | my ($attrib_ref, $source) = @_; |
---|
50 | FCM::Context::Make::Build::Target->new( |
---|
51 | { category => FCM::Context::Make::Build::Target->CT_ETC, |
---|
52 | key => $source->get_ns(), |
---|
53 | task => 'install', |
---|
54 | } |
---|
55 | ); |
---|
56 | } |
---|
57 | |
---|
58 | # ------------------------------------------------------------------------------ |
---|
59 | 1; |
---|
60 | __END__ |
---|
61 | |
---|
62 | =head1 NAME |
---|
63 | |
---|
64 | FCM::System::Make::Build::FileType::Data |
---|
65 | |
---|
66 | =head1 SYNOPSIS |
---|
67 | |
---|
68 | use FCM::System::Make::Build::FileType::Data; |
---|
69 | my $helper = FCM::System::Make::Build::FileType::Data->new(); |
---|
70 | $helper->source_analyse($handle); |
---|
71 | |
---|
72 | =head1 DESCRIPTION |
---|
73 | |
---|
74 | A class based on |
---|
75 | L<FCM::System::Make::Build::FileType|FCM::System::Make::Build::FileType> |
---|
76 | with configurations to install data files to the etc/ sub-directory of a build. |
---|
77 | |
---|
78 | =head1 COPYRIGHT |
---|
79 | |
---|
80 | Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. |
---|
81 | |
---|
82 | =cut |
---|