ExtUtils-Builder-0.017000755001750001750 014775426605 14333 5ustar00leontleont000000000000README100644001750001750 63314775426605 15256 0ustar00leontleont000000000000ExtUtils-Builder-0.017This archive contains the distribution ExtUtils-Builder, version 0.017: An overview of the foundations of the ExtUtils::Builder Plan framework This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v6.032. Changes100644001750001750 557414775426605 15722 0ustar00leontleont000000000000ExtUtils-Builder-0.017Revision history for ExtUtils-Builder 0.017 2025-04-09 10:19:14+02:00 Europe/Brussels - Add is_os and is_os_type delegates in EU::B::MakeMaker - Rename distribution_version to version in EU::B::MakeMaker - Add self and outer methods to all planners - Add verbose stub delegate to EU::B::MakeMaker 0.016 2025-03-30 12:23:45+02:00 Europe/Brussels - Rename load_module to load_extension - Normalize directory pattern without file pattern too 0.015 2025-03-16 22:03:54+01:00 Europe/Brussels - Add create_filter, create_pattern, create_subst and add_seen to Planner - Rename add_plan to merge_plan - Add unix_to_native_path and native_to_unix functions to EU::B::Util 0.014 2025-01-15 18:47:22+01:00 Europe/Brussels - Use absolute paths inside run_dsl - Remove tempdir in t/40-eumm-plan.t 0.013 2024-10-06 15:44:28+02:00 Europe/Brussels - Add code/command/function helper functions to ExtUtils::Builder::Util - Add main_module helper to ExtUtils::Builder::MakeMaker - Rename dist_name to distribution in ExtUtils::Builder::MakeMaker 0.012 2024-09-10 23:03:26+02:00 Europe/Brussels - Allow for phony dependencies of file targets - Add type attribute to nodes 0.011 2024-08-04 20:37:12+02:00 Europe/Brussels - Fix CRLF translation for Windows further 0.010 2024-08-01 22:50:19+02:00 Europe/Brussels - Fix CRLF translation for Windows in test 0.009 2024-08-01 12:54:19+02:00 Europe/Brussels - Add single arg command option - Add jobs and new_planner helpers to EU::B::MakeMaker - Add require_module to export list of ExtUtils::Builder::Util - Allow redefinitions of delegates 0.008 2024-07-15 21:02:09+02:00 Europe/Brussels - Fix function() helper in DSLs - Eliminate logger callback 0.007 2024-07-13 13:47:56+02:00 Europe/Brussels - Add version check to load_module - Fix Node's phony method to return the correct value 0.006 2024-05-05 23:23:42+02:00 Europe/Brussels - Revert "Fix Windows MakeMaker quoting" - Add workaround for Windows test failures - Depend on MakeMaker 6.68 for quote_dep - Add more delegates in MakeMaker extension 0.005 2024-04-28 13:01:57+02:00 Europe/Brussels - Fix Windows MakeMaker quoting 0.004 2024-04-27 12:01:16+02:00 Europe/Brussels - Add dependency on List::Util 1.45 for uniq 0.003 2024-04-27 11:45:41+02:00 Europe/Brussels - Don't test for exact perl paths 0.002 2024-04-26 11:33:00+02:00 Europe/Brussels - Move get_perl into ExtUtils::Builder::Util - Remove accidental test dependency on Devel::Confess 0.001 2024-04-25 14:13:26+02:00 Europe/Brussels First release LICENSE100644001750001750 4644014775426605 15451 0ustar00leontleont000000000000ExtUtils-Builder-0.017This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2013 by Leon Timmermans. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Perl Artistic License 1.0 --- This software is Copyright (c) 2013 by Leon Timmermans. This is free software, licensed under: The Perl Artistic License 1.0 The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End INSTALL100644001750001750 460714775426605 15454 0ustar00leontleont000000000000ExtUtils-Builder-0.017This is the Perl distribution ExtUtils-Builder. Installing ExtUtils-Builder is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm ExtUtils::Builder If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan ExtUtils::Builder ## Manual installation As a last resort, you can manually install it. If you have not already downloaded the release tarball, you can find the download link on the module's MetaCPAN page: https://metacpan.org/pod/ExtUtils::Builder Untar the tarball, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the "{prereqs}{configure}{requires}" key of META.json. ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the "{prereqs}{PHASE}{requires}" key of MYMETA.json. ## Documentation ExtUtils-Builder documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc ExtUtils::Builder For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html dist.ini100644001750001750 205314775426605 16060 0ustar00leontleont000000000000ExtUtils-Builder-0.017name = ExtUtils-Builder author = Leon Timmermans license = Perl_5 copyright_holder = Leon Timmermans copyright_year = 2013 [Prereqs] perl = 5.010 [Git::GatherDir] [PruneCruft] [MetaYAML] [License] [Manifest] [Readme] [AutoPrereqs] [MetaJSON] [GitHub::Meta] [Git::NextVersion] [MetaProvides::Package] [MakeMaker] [FileFinder::Filter / WeaverFiles] finder = :InstallModules skip = FileSet [PodSyntaxTests] [Test::Pod::Coverage::TrustMe] finder = WeaverFiles [Test::Compile] [InstallGuide] [PodWeaver] finder = WeaverFiles [PkgVersion] [NextRelease] [CheckChangesHasContent] [Git::Check] [RunExtraTests] [TestRelease] [ConfirmRelease] [UploadToCPAN] [Git::Commit] [Git::Tag] [Git::Push] [OSPrereqs / MSWin32] Win32::ShellQuote = 0 [RemovePrereqs] remove = Win32::ShellQuote remove = Devel::FindPerl remove = Sub::Util [Prereqs / RuntimeRecommends] Sub::Util = 1.40 [DynamicPrereqs] -raw = use Config; -raw = $WriteMakefileArgs{PREREQ_PM}{'Devel::FindPerl'} = $FallbackPrereqs{'Devel::FindPerl'} = '0' if $Config{userelocatableinc}; t000755001750001750 014775426605 14517 5ustar00leontleont000000000000ExtUtils-Builder-0.017dsl.pl100644001750001750 25214775426605 15755 0ustar00leontleont000000000000ExtUtils-Builder-0.017/tuse strict; use warnings; load_extension("Callback"); add_foo($_) for 0..2; create_node( target => 'foo', dependencies => [ map { "foo$_" } 0..2 ], phony => 1, ); META.yml100644001750001750 623014775426605 15666 0ustar00leontleont000000000000ExtUtils-Builder-0.017--- abstract: 'An overview of the foundations of the ExtUtils::Builder Plan framework' author: - 'Leon Timmermans ' build_requires: Cwd: '0' File::Spec: '0' File::Spec::Functions: '0' File::Temp: '0' IO::Handle: '0' IPC::Open3: '0' Test::Builder: '0' Test::More: '0.89' lib: '0' perl: '5.010' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: ExtUtils-Builder provides: ExtUtils::Builder: file: lib/ExtUtils/Builder.pm version: '0.017' ExtUtils::Builder::Action: file: lib/ExtUtils/Builder/Action.pm version: '0.017' ExtUtils::Builder::Action::Code: file: lib/ExtUtils/Builder/Action/Code.pm version: '0.017' ExtUtils::Builder::Action::Command: file: lib/ExtUtils/Builder/Action/Command.pm version: '0.017' ExtUtils::Builder::Action::Composite: file: lib/ExtUtils/Builder/Action/Composite.pm version: '0.017' ExtUtils::Builder::Action::Function: file: lib/ExtUtils/Builder/Action/Function.pm version: '0.017' ExtUtils::Builder::Action::Perl: file: lib/ExtUtils/Builder/Action/Perl.pm version: '0.017' ExtUtils::Builder::Action::Primitive: file: lib/ExtUtils/Builder/Action/Primitive.pm version: '0.017' ExtUtils::Builder::FileSet: file: lib/ExtUtils/Builder/FileSet.pm version: '0.017' ExtUtils::Builder::FileSet::Filter: file: lib/ExtUtils/Builder/FileSet/Filter.pm version: '0.017' ExtUtils::Builder::FileSet::Free: file: lib/ExtUtils/Builder/FileSet/Free.pm version: '0.017' ExtUtils::Builder::FileSet::Subst: file: lib/ExtUtils/Builder/FileSet/Subst.pm version: '0.017' ExtUtils::Builder::MakeMaker: file: lib/ExtUtils/Builder/MakeMaker.pm version: '0.017' ExtUtils::Builder::Node: file: lib/ExtUtils/Builder/Node.pm version: '0.017' ExtUtils::Builder::Plan: file: lib/ExtUtils/Builder/Plan.pm version: '0.017' ExtUtils::Builder::Planner: file: lib/ExtUtils/Builder/Planner.pm version: '0.017' ExtUtils::Builder::Planner::Extension: file: lib/ExtUtils/Builder/Planner/Extension.pm version: '0.017' ExtUtils::Builder::Serializer: file: lib/ExtUtils/Builder/Serializer.pm version: '0.017' ExtUtils::Builder::Util: file: lib/ExtUtils/Builder/Util.pm version: '0.017' recommends: Sub::Util: '1.40' requires: Carp: '0' Data::Dumper: '0' Exporter: '5.57' ExtUtils::Config: '0' ExtUtils::Config::MakeMaker: '0' ExtUtils::MakeMaker: '6.68' ExtUtils::Manifest: '0' File::Basename: '0' File::Spec: '0' File::Spec::Unix: '0' List::Util: '1.45' Perl::OSType: '0' Scalar::Util: '0' base: '0' parent: '0' perl: '5.010' strict: '0' version: '0' warnings: '0' resources: bugtracker: https://github.com/Leont/extutils-builder-plan/issues repository: git://github.com/Leont/extutils-builder-plan.git version: '0.017' x_generated_by_perl: v5.40.0 x_serialization_backend: 'YAML::Tiny version 1.76' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' MANIFEST100644001750001750 213714775426605 15550 0ustar00leontleont000000000000ExtUtils-Builder-0.017# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.032. Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/ExtUtils/Builder.pm lib/ExtUtils/Builder/Action.pm lib/ExtUtils/Builder/Action/Code.pm lib/ExtUtils/Builder/Action/Command.pm lib/ExtUtils/Builder/Action/Composite.pm lib/ExtUtils/Builder/Action/Function.pm lib/ExtUtils/Builder/Action/Perl.pm lib/ExtUtils/Builder/Action/Primitive.pm lib/ExtUtils/Builder/FileSet.pm lib/ExtUtils/Builder/FileSet/Filter.pm lib/ExtUtils/Builder/FileSet/Free.pm lib/ExtUtils/Builder/FileSet/Subst.pm lib/ExtUtils/Builder/MakeMaker.pm lib/ExtUtils/Builder/Node.pm lib/ExtUtils/Builder/Plan.pm lib/ExtUtils/Builder/Planner.pm lib/ExtUtils/Builder/Planner/Extension.pm lib/ExtUtils/Builder/Serializer.pm lib/ExtUtils/Builder/Util.pm t/00-compile.t t/10-action-code.t t/10-action-command.t t/10-action-function.t t/20-node.t t/30-plan.t t/35-planner.t t/35-serializer.t t/36-dsl.t t/37-fileset.t t/40-eumm-plan.t t/dsl.pl t/lib/Callback.pm t/lib/Function.pm t/lib/Test/LivesOK.pm xt/author/pod-coverage.t xt/author/pod-syntax.t META.json100644001750001750 1172614775426605 16064 0ustar00leontleont000000000000ExtUtils-Builder-0.017{ "abstract" : "An overview of the foundations of the ExtUtils::Builder Plan framework", "author" : [ "Leon Timmermans " ], "dynamic_config" : 1, "generated_by" : "Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "ExtUtils-Builder", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Test::More" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage::TrustMe" : "0" } }, "runtime" : { "recommends" : { "Sub::Util" : "1.40" }, "requires" : { "Carp" : "0", "Data::Dumper" : "0", "Exporter" : "5.57", "ExtUtils::Config" : "0", "ExtUtils::Config::MakeMaker" : "0", "ExtUtils::MakeMaker" : "6.68", "ExtUtils::Manifest" : "0", "File::Basename" : "0", "File::Spec" : "0", "File::Spec::Unix" : "0", "List::Util" : "1.45", "Perl::OSType" : "0", "Scalar::Util" : "0", "base" : "0", "parent" : "0", "perl" : "5.010", "strict" : "0", "version" : "0", "warnings" : "0" } }, "test" : { "requires" : { "Cwd" : "0", "File::Spec" : "0", "File::Spec::Functions" : "0", "File::Temp" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::Builder" : "0", "Test::More" : "0.89", "lib" : "0", "perl" : "5.010" } } }, "provides" : { "ExtUtils::Builder" : { "file" : "lib/ExtUtils/Builder.pm", "version" : "0.017" }, "ExtUtils::Builder::Action" : { "file" : "lib/ExtUtils/Builder/Action.pm", "version" : "0.017" }, "ExtUtils::Builder::Action::Code" : { "file" : "lib/ExtUtils/Builder/Action/Code.pm", "version" : "0.017" }, "ExtUtils::Builder::Action::Command" : { "file" : "lib/ExtUtils/Builder/Action/Command.pm", "version" : "0.017" }, "ExtUtils::Builder::Action::Composite" : { "file" : "lib/ExtUtils/Builder/Action/Composite.pm", "version" : "0.017" }, "ExtUtils::Builder::Action::Function" : { "file" : "lib/ExtUtils/Builder/Action/Function.pm", "version" : "0.017" }, "ExtUtils::Builder::Action::Perl" : { "file" : "lib/ExtUtils/Builder/Action/Perl.pm", "version" : "0.017" }, "ExtUtils::Builder::Action::Primitive" : { "file" : "lib/ExtUtils/Builder/Action/Primitive.pm", "version" : "0.017" }, "ExtUtils::Builder::FileSet" : { "file" : "lib/ExtUtils/Builder/FileSet.pm", "version" : "0.017" }, "ExtUtils::Builder::FileSet::Filter" : { "file" : "lib/ExtUtils/Builder/FileSet/Filter.pm", "version" : "0.017" }, "ExtUtils::Builder::FileSet::Free" : { "file" : "lib/ExtUtils/Builder/FileSet/Free.pm", "version" : "0.017" }, "ExtUtils::Builder::FileSet::Subst" : { "file" : "lib/ExtUtils/Builder/FileSet/Subst.pm", "version" : "0.017" }, "ExtUtils::Builder::MakeMaker" : { "file" : "lib/ExtUtils/Builder/MakeMaker.pm", "version" : "0.017" }, "ExtUtils::Builder::Node" : { "file" : "lib/ExtUtils/Builder/Node.pm", "version" : "0.017" }, "ExtUtils::Builder::Plan" : { "file" : "lib/ExtUtils/Builder/Plan.pm", "version" : "0.017" }, "ExtUtils::Builder::Planner" : { "file" : "lib/ExtUtils/Builder/Planner.pm", "version" : "0.017" }, "ExtUtils::Builder::Planner::Extension" : { "file" : "lib/ExtUtils/Builder/Planner/Extension.pm", "version" : "0.017" }, "ExtUtils::Builder::Serializer" : { "file" : "lib/ExtUtils/Builder/Serializer.pm", "version" : "0.017" }, "ExtUtils::Builder::Util" : { "file" : "lib/ExtUtils/Builder/Util.pm", "version" : "0.017" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/Leont/extutils-builder-plan/issues" }, "repository" : { "type" : "git", "url" : "git://github.com/Leont/extutils-builder-plan.git", "web" : "https://github.com/Leont/extutils-builder-plan" } }, "version" : "0.017", "x_generated_by_perl" : "v5.40.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.39", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } 36-dsl.t100644001750001750 102114775426605 16046 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#!perl use strict; use warnings; use Test::More 0.89; use lib 't/lib'; use Test::LivesOK 'lives_ok'; use ExtUtils::Builder::Planner; my $planner = ExtUtils::Builder::Planner->new; $planner->run_dsl('t/dsl.pl'); my $plan = $planner->materialize; lives_ok { $plan->run('foo') } 'Executing gave no errors'; our @triggered; is_deeply(\@triggered, [ 0..2 ], 'All actions triggered'); my %nodes; my @order = qw/foo2 foo1 foo0/; is_deeply([ $plan->node_names ], [ qw/foo foo0 foo1 foo2/ ], 'Got expected nodes'); done_testing; 20-node.t100644001750001750 144414775426605 16213 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#! perl use strict; use warnings; use Test::More 0.89; use lib 't/lib'; use Test::LivesOK 'lives_ok'; use ExtUtils::Builder::Node; use ExtUtils::Builder::Action::Code; our @triggered; my @actions = map { ExtUtils::Builder::Action::Code->new(code => "push \@::triggered, $_") } 1, 2; my $node; lives_ok { $node = ExtUtils::Builder::Node->new(target => 'foo', dependencies => [ qw/bar baz/ ], actions => \@actions) } 'Can create new object'; lives_ok { $node->execute } 'Can execute quiet command'; is_deeply(\@triggered, [ 1, 2 ], 'Both actions ran'); is_deeply([ $node->flatten ], \@actions, '$node->actions contains all expected actions'); lives_ok { $node->to_command } '$node->to_command doesn\'t give any error'; is($node->preference, 'flatten', 'Preferred action is "flatten"'); done_testing; 30-plan.t100644001750001750 404114775426605 16215 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#! perl use strict; use warnings; use File::Temp 'tempdir'; use Test::More 0.89; use lib 't/lib'; use Test::LivesOK 'lives_ok'; use ExtUtils::Builder::Node; use ExtUtils::Builder::Plan; use ExtUtils::Builder::Action::Code; our @triggered; { local @triggered; my @nodes = map { [ +"foo$_" => ExtUtils::Builder::Node->new( target => "foo$_", dependencies => [], actions => [ ExtUtils::Builder::Action::Code->new(code => "push \@::triggered, $_" ) ], ) ] } 0 .. 2; my %nodes = map { @$_ } @nodes; my $root = ExtUtils::Builder::Node->new(target => "foo", dependencies => [ map { "foo$_" } 0..2 ], actions => []); my $plan; lives_ok { $plan = ExtUtils::Builder::Plan->new(nodes => { %nodes, foo => $root }) } 'Plan could be created'; lives_ok { $plan->run('foo', quiet => 1) } 'Executing gave no errors'; is_deeply(\@triggered, [ 0..2 ], 'All actions triggered'); my @order = qw/foo2 foo1 foo0/; is_deeply([ $plan->node_names ], [ sort keys %nodes, $root->target ], 'Got expected nodes'); } { local @triggered; my $dir = tempdir(TMPDIR => 1, CLEANUP => 1); chdir $dir; my %nodes = map { +"foo$_" => ExtUtils::Builder::Node->new( target => "foo$_", dependencies => [], actions => [ ExtUtils::Builder::Action::Code->new(code => "open my \$fh, '>', 'foo$_'" ) ], ) } 0 .. 2; my $root = ExtUtils::Builder::Node->new(target => "foo", dependencies => [ map { "foo$_" } 0..2 ], actions => [ ExtUtils::Builder::Action::Code->new(code => "open my \$fh, '>', 'foo'; push \@::triggered, 'foo'" ), ]); my $plan; lives_ok { $plan = ExtUtils::Builder::Plan->new(nodes => { %nodes, foo => $root }) } 'Plan could be created'; lives_ok { $plan->run('foo', quiet => 1) } 'Executing gave no errors'; is_deeply(\@triggered, [ 'foo' ], 'Have one foo'); lives_ok { $plan->run('foo', quiet => 1) } 'Executing gave no errors'; is_deeply(\@triggered, [ 'foo' ], 'Have one foo'); my $now = time; utime $now, $now + 120, 'foo2'; lives_ok { $plan->run('foo', quiet => 1) } 'Executing gave no errors'; is_deeply(\@triggered, [ 'foo', 'foo' ], 'Have two foos'); } done_testing; Makefile.PL100644001750001750 502414775426605 16367 0ustar00leontleont000000000000ExtUtils-Builder-0.017# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.032. use strict; use warnings; use 5.010; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "An overview of the foundations of the ExtUtils::Builder Plan framework", "AUTHOR" => "Leon Timmermans ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "ExtUtils-Builder", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.010", "NAME" => "ExtUtils::Builder", "PREREQ_PM" => { "Carp" => 0, "Data::Dumper" => 0, "Exporter" => "5.57", "ExtUtils::Config" => 0, "ExtUtils::Config::MakeMaker" => 0, "ExtUtils::MakeMaker" => "6.68", "ExtUtils::Manifest" => 0, "File::Basename" => 0, "File::Spec" => 0, "File::Spec::Unix" => 0, "List::Util" => "1.45", "Perl::OSType" => 0, "Scalar::Util" => 0, "base" => 0, "parent" => 0, "strict" => 0, "version" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Cwd" => 0, "File::Spec" => 0, "File::Spec::Functions" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::Builder" => 0, "Test::More" => "0.89", "lib" => 0 }, "VERSION" => "0.017", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "Cwd" => 0, "Data::Dumper" => 0, "Exporter" => "5.57", "ExtUtils::Config" => 0, "ExtUtils::Config::MakeMaker" => 0, "ExtUtils::MakeMaker" => "6.68", "ExtUtils::Manifest" => 0, "File::Basename" => 0, "File::Spec" => 0, "File::Spec::Functions" => 0, "File::Spec::Unix" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "List::Util" => "1.45", "Perl::OSType" => 0, "Scalar::Util" => 0, "Test::Builder" => 0, "Test::More" => "0.89", "base" => 0, "lib" => 0, "parent" => 0, "strict" => 0, "version" => 0, "warnings" => 0 ); # inserted by Dist::Zilla::Plugin::DynamicPrereqs 0.040 use Config; $WriteMakefileArgs{PREREQ_PM}{'Devel::FindPerl'} = $FallbackPrereqs{'Devel::FindPerl'} = '0' if $Config{userelocatableinc}; unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; if ( $^O eq 'MSWin32' ) { $WriteMakefileArgs{PREREQ_PM}{'Win32::ShellQuote'} = $FallbackPrereqs{'Win32::ShellQuote'} = '0'; } WriteMakefile(%WriteMakefileArgs); 35-planner.t100644001750001750 124014775426605 16725 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#!perl use strict; use warnings; use Test::More 0.89; use lib 't/lib'; use Test::LivesOK 'lives_ok'; use ExtUtils::Builder::Planner; my $planner = ExtUtils::Builder::Planner->new; $planner->load_extension("Callback"); our @triggered; $planner->add_foo($_) for 0..2; $planner->create_node( target => 'foo', dependencies => [ map { "foo$_" } 0..2 ], phony => 1, ); my $plan = $planner->materialize; lives_ok { $plan->run('foo') } 'Executing gave no errors'; is_deeply(\@triggered, [ 0..2 ], 'All actions triggered'); my %nodes; my @order = qw/foo2 foo1 foo0/; is_deeply([ $plan->node_names ], [ qw/foo foo0 foo1 foo2/ ], 'Got expected nodes'); done_testing; 37-fileset.t100644001750001750 144314775426605 16730 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#!perl use strict; use warnings; use Test::More 0.89; use lib 't/lib'; use Test::LivesOK 'lives_ok'; use ExtUtils::Builder::Planner; use File::Spec::Functions 'catfile'; my $planner = ExtUtils::Builder::Planner->new; $planner->load_extension("Callback"); my $sources = $planner->create_pattern(file => "*.src"); my %sources; my $destination = $planner->create_subst( on => $sources, subst => sub { my ($source) = @_; my $destination = catfile('build', $source); $destination =~ s/\.src$/\.dest/; $sources{$source}++; $planner->create_node( target => $destination, ); } ); $planner->add_seen('foo.src'); $planner->create_node(target => 'bar.src'); $planner->add_seen('baz.nosrc'); is_deeply(\%sources, { 'foo.src' => 1, 'bar.src' => 1}, 'Seen expected sources'); done_testing; 00-compile.t100644001750001750 413014775426605 16707 0ustar00leontleont000000000000ExtUtils-Builder-0.017/tuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 19 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'ExtUtils/Builder.pm', 'ExtUtils/Builder/Action.pm', 'ExtUtils/Builder/Action/Code.pm', 'ExtUtils/Builder/Action/Command.pm', 'ExtUtils/Builder/Action/Composite.pm', 'ExtUtils/Builder/Action/Function.pm', 'ExtUtils/Builder/Action/Perl.pm', 'ExtUtils/Builder/Action/Primitive.pm', 'ExtUtils/Builder/FileSet.pm', 'ExtUtils/Builder/FileSet/Filter.pm', 'ExtUtils/Builder/FileSet/Free.pm', 'ExtUtils/Builder/FileSet/Subst.pm', 'ExtUtils/Builder/MakeMaker.pm', 'ExtUtils/Builder/Node.pm', 'ExtUtils/Builder/Plan.pm', 'ExtUtils/Builder/Planner.pm', 'ExtUtils/Builder/Planner/Extension.pm', 'ExtUtils/Builder/Serializer.pm', 'ExtUtils/Builder/Util.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; 40-eumm-plan.t100644001750001750 315514775426605 17164 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#! perl use strict; use warnings; use Test::More 0.89; use Config; use Cwd qw/getcwd/; use File::Temp qw/tempdir/; use ExtUtils::Builder::Util 'get_perl'; use ExtUtils::Manifest 'mkmanifest'; my $tempdir = tempdir(CLEANUP => 1, TEMPLATE => 'ExtUtilsBuilderXXXX'); my $pwd = getcwd; chdir $tempdir; open my $mfpl, '>', 'Makefile.PL'; my @touch_prefix = $^O eq 'MSWin32' || $^O eq 'VMS' ? (get_perl(), '-MExtUtils::Command', '-e') : (); my $touch = join ', ', map { qq{'$_'} } @touch_prefix, 'touch'; printf $mfpl <<'END', $touch; use ExtUtils::MakeMaker; use ExtUtils::Builder::MakeMaker; use ExtUtils::Builder::Util qw/command code/; WriteMakefile( NAME => 'FOO', VERSION => 0.001, NO_MYMETA => 1, NO_META => 1, ); sub MY::make_plans { my ($self, $planner, $config) = @_; my $action1 = command(%s, 'very_unlikely_name'); my $action2 = code(code => 'open my $fh, "\\x{3e}", "other_unlikely_name"'); $planner->create_node(target => 'foo', actions => [ $action1, $action2 ]); $planner->create_node(target => 'pure_all', dependencies => [ 'foo' ], phony => 1); } END close $mfpl; { local $ExtUtils::Manifest::Verbose = 0; mkmanifest; } system get_perl(), 'Makefile.PL'; ok(-e 'Makefile', 'Makefile exists'); open my $mf, '<', 'Makefile' or die "Couldn't open Makefile: $!"; my $content = do { local $/; <$mf> }; like($content, qr/^\t .* touch .* very_unlikely_name/xm, 'Makefile contains very_unlikely_name'); my $make = $ENV{MAKE} // $Config{make}; system $make; ok(-e 'very_unlikely_name', "Unlikely file has been touched"); ok(-e 'other_unlikely_name', "Unlikely file has been touched"); chdir $pwd; done_testing; 35-serializer.t100644001750001750 232414775426605 17443 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#!perl use strict; use warnings; use Test::More 0.89; use lib 't/lib'; use Test::LivesOK 'lives_ok'; use ExtUtils::Builder::Node; use ExtUtils::Builder::Plan; use ExtUtils::Builder::Util 'code'; use ExtUtils::Builder::Action::Code; use ExtUtils::Builder::Serializer; our @triggered; my @nodes = map { [ +"foo$_" => ExtUtils::Builder::Node->new( target => "foo$_", dependencies => [], actions => [ code(code => "push \@::triggered, $_" ) ], ) ] } 0 .. 2; my %nodes = map { @$_ } @nodes; my $root = ExtUtils::Builder::Node->new(target => "foo", dependencies => [ map { "foo$_" } 0..2 ], actions => []); my $plan; lives_ok { $plan = ExtUtils::Builder::Plan->new(nodes => { %nodes, foo => $root }) } 'Plan could be created'; my $serializer = 'ExtUtils::Builder::Serializer'; my $serialized = $serializer->serialize_plan($plan); ok $serialized, 'serialized'; my $deserialized = $serializer->deserialize_plan($serialized); ok $deserialized, 'deserialized'; lives_ok { $deserialized->run('foo') } 'Executing gave no errors'; is_deeply(\@triggered, [ 0..2 ], 'All actions triggered'); my @order = qw/foo2 foo1 foo0/; is_deeply([ $plan->node_names ], [ sort keys %nodes, $root->target ], 'Got expected nodes'); done_testing; lib000755001750001750 014775426605 15265 5ustar00leontleont000000000000ExtUtils-Builder-0.017/tCallback.pm100644001750001750 64214775426605 17441 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t/libpackage Callback; use strict; use warnings; use parent 'ExtUtils::Builder::Planner::Extension'; use ExtUtils::Builder::Util 'code'; sub add_foo { my ($planner, $num) = @_; $planner->create_node( target => "foo$_", dependencies => [], actions => [ code(code => "push \@::triggered, $_" ) ], ); } sub add_methods { my ($self, $planner) = @_; $planner->add_delegate('add_foo', \&add_foo); return; } 1; Function.pm100644001750001750 22014775426605 17522 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t/libpackage Function; use strict; use warnings; use Exporter 5.57 'import'; our @EXPORT = qw/callback/; sub callback { $::callback->(@_); } 1; 10-action-code.t100644001750001750 262614775426605 17455 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#! perl use strict; use warnings; use Config; use Test::More 0.89; use ExtUtils::Builder::Action::Code; use lib 't/lib'; use Test::LivesOK 'lives_ok'; { my $action; our $callback = sub {}; my %args = ( code => '$::callback->()', message => 'callback', ); lives_ok { $action = ExtUtils::Builder::Action::Code->new(%args) } 'Can create new object'; { my @actions; local $callback = sub { push @actions, 1 }; lives_ok { $action->execute(quiet => 1) } 'Can execute command'; is_deeply(\@actions, [1], 'Command is executed quietly'); } { my (@actions, @messages); local $callback = sub { push @actions, 2 }; open my $stdout, '>', \my $output; select $stdout; lives_ok { $action->execute } 'Can execute command'; select STDOUT; close $stdout; is_deeply(\@actions, [2], 'Command is executed with logging'); is_deeply($output, "callback\n", 'Got the message'); } my @serialized = $action->to_command; is(scalar(@serialized), 1, 'Got one command'); my ($command, @arguments) = @{ shift @serialized }; ok(-x $command, 'Command is executable'); is_deeply(\@arguments, [ '-e', $args{code} ], 'to_command gives correct arguments'); is($action->to_code, $args{code}, 'to_code is "$input"'); is($action->preference, 'execute', 'Prefered means is "execute"'); is($action->preference(qw/code command/), 'code', 'Prefered means between "code" and "command" is "code"'); } done_testing; 10-action-command.t100644001750001750 333414775426605 20156 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#! perl use strict; use warnings; use Test::More 0.89; use ExtUtils::Builder::Action::Command; use lib 't/lib'; use Test::LivesOK 'lives_ok'; { my $action; lives_ok { $action = ExtUtils::Builder::Action::Command->new(command => [ $^X, '-e0' ]) } 'Can create new object'; is_deeply($action->to_command, [$^X, '-e0'], 'Returns perl -e0'); like($action->to_code, qr/ system \( '.*?','-e0' \) \ and \ die /x, 'to_code returns something that might be sensible'); lives_ok { $action->execute(quiet => 1) } 'Can execute quiet command'; open my $stdout, '>', \my $output; select $stdout; lives_ok { $action->execute } 'Can execute logging command'; select STDOUT; close $stdout; like($output, qr/\Q$^X\E .+ -e0 \n \z/x, "Got '$^X -e0' as message"); is($action->preference, 'command', 'Preferred action is "execute"'); } { my $action; lives_ok { $action = ExtUtils::Builder::Action::Command->new(command => 'echo Hello World') } 'Can create new object'; is_deeply($action->to_command, 'echo Hello World', 'Returns perl -e0'); like($action->to_code, qr/ system \( 'echo\ Hello\ World' \) \ and \ die /x, 'to_code returns something that might be sensible'); open my $stdout, '>&', *STDOUT or die; open my $temp, '+>:crlf', undef or die; open STDOUT, '>&', $temp or die; open my $messenger, '>', \my $message; select $messenger; lives_ok { $action->execute } 'Can execute logging command'; select STDOUT; seek($temp, 0, 0); my $output = join '', <$temp>; open STDOUT, '>&', $stdout or die; select STDOUT; is($message, "echo Hello World\n", "Got echo Hello World as message"); is($output, "Hello World\n", 'got Hello World as output'); is($action->preference, 'command', 'Preferred action is "execute"'); } done_testing; Test000755001750001750 014775426605 16204 5ustar00leontleont000000000000ExtUtils-Builder-0.017/t/libLivesOK.pm100644001750001750 62014775426605 20174 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t/lib/Testpackage Test::LivesOK; use strict; use warnings; use Exporter 5.57 'import'; our @EXPORT = qw/lives_ok/; use Test::Builder; my $builder = Test::Builder->new; sub lives_ok(&@) { my ($sub, $desc) = @_; local $Test::Builder::Level = $Test::Builder::Level + 1; my $success = eval { $sub->(); 1; }; $builder->ok($success, $desc) or $builder->note("Exception thrown: $@"); return $success; } 10-action-function.t100644001750001750 300414775426605 20357 0ustar00leontleont000000000000ExtUtils-Builder-0.017/t#!perl use strict; use warnings; use Config; use Test::More 0.89; use ExtUtils::Builder::Action::Function; use lib 't/lib'; use Test::LivesOK 'lives_ok'; { my $action; our $callback = sub {}; my %args = ( function => 'callback', module => 'Function', message => 'callback', arguments => [ 1 ], exports => 1, ); lives_ok { $action = ExtUtils::Builder::Action::Function->new(%args) } 'Can create new object'; { my @actions; local $callback = sub { push @actions, 1 }; lives_ok { $action->execute(quiet => 1) } 'Can execute command'; is_deeply(\@actions, [1], 'Command is executed quietly'); } { my (@actions, @messages); local $callback = sub { push @actions, 2 }; open my $stdout, '>', \my $output; select $stdout; lives_ok { $action->execute } 'Can execute command'; select STDOUT; close $stdout; is_deeply(\@actions, [2], 'Command is executed with logging'); is_deeply($output, "callback\n", 'Got the message'); } my @serialized = $action->to_command; is(scalar(@serialized), 1, 'Got one command'); my ($command, @arguments) = @{ shift @serialized }; ok(-x $command, 'Command is executable'); is_deeply(\@arguments, [ '-MFunction', '-e', 'callback(1)' ], 'to_command gives correct arguments'); is($action->to_code, 'require Function; Function::callback(1)', 'to_code is "$input"'); is($action->preference, 'execute', 'Prefered means is "execute"'); is($action->preference(qw/code command/), 'code', 'Prefered means between "code" and "command" is "code"'); } done_testing; author000755001750001750 014775426605 16211 5ustar00leontleont000000000000ExtUtils-Builder-0.017/xtpod-syntax.t100644001750001750 25214775426605 20623 0ustar00leontleont000000000000ExtUtils-Builder-0.017/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); ExtUtils000755001750001750 014775426605 16603 5ustar00leontleont000000000000ExtUtils-Builder-0.017/libBuilder.pm100644001750001750 1342014775426605 20707 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtilspackage ExtUtils::Builder; $ExtUtils::Builder::VERSION = '0.017'; use strict; use warnings; 1; #ABSTRACT: An overview of the foundations of the ExtUtils::Builder Plan framework __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder - An overview of the foundations of the ExtUtils::Builder Plan framework =head1 VERSION version 0.017 =head1 DESCRIPTION This document describes the foundations of the ExtUtils::Builder Plan framework, including Actions, Nodes and Plans. =head1 OVERVIEW =head2 Action basics Actions are the cornerstone of the ExtUtils::Builder framework. They provide an interface between build tools (e.g. L, L, ...) and building extensions. This allows producing and consuming sides to be completely independent from each other. It is a flexible abstraction around pieces of work, this work can be a piece of perl code, an external command, a mix of those or possibly other things. An action can be consumed in many ways. =over 4 =item * execute(%args) This is often the simplest way of dealing with an action. It simple performs the action immediately, and will throw an exception on failure. =item * to_command(%opts) This converts the action into a list of commands to be executed. The elements of this list are arrayrefs to that can each be executed using along these lines: for my $command ($work->to_command) { system(@$command); } It can take two optional named arguments: C for the path to perl, and C for an L object used the find the current perl. =item * to_code() This converts the action into a list of strings to be Ced in order to execute them. This can be useful when you want to serialize the work that is to be done but don't want to force it to shell out. =item * to_code_hash() This converts the action into a hash that can be used to create a new L. =item * flatten() This will return all primitive actions involved in this action. It may return C<$self>, it may return an empty list. On L actions, C can be called to retrieve the constituent actions, C is guaranteed to only return primitive actions. =item * preference(@options) If a consumer can consume actions in more than one way, the C method can be used to choose between options. This function expects a list of options out of C, C, C and C. You probably want to flatten your action first, as different constituents may have different preferences. for my $action ($work->flatten) { my $preference = $self->preference('code', 'command'); push @serialized, ($preference eq 'code') ? [ eval => $action->to_code ] : [ exec => $action->to_command ]; } =back =head2 Primitives On primitive actions, all serialization methods will return a single item list. There are two types of of primitive actions shipped with this dist: L and L. Commands are essentially an abstraction around a call to an external command, Codes are an abstraction around a piece of Perl code. While these are all implementing the same interfaces, they have their own (hopefully obvious) preferences on how to be treated. C is just an identity operator for primitive actions. =head2 Composites Composite actions are actions that may consist out of multiple actions (though in some cases they may contain only one or even zero actions). C will return all its constituents. C, C and C will all call their respective method on all those values. C is of little use, and will always prefer to flatten when given that option. =head3 Nodes Nodes are composite Actions. Nodes are a simple class with three attributes: =over 4 =item * target This is the filename of the result of this build step. =item * dependencies This is an unordered set of zero or more files that must be build (and must be up-to-date) before the target is build. =item * actions This is a sequence of zero or more actions that must be performed to build the target. =back Essentially, a Node is equivalent to entry in a Makefile =head2 Plans Plans are the equivalent of a (piece of a) Makefile. They are a bunch of nodes that should interconnect. It has one attribute. =over 4 =item * nodes This is a hash mapping (target) names to nodes. =back The C method will perform a topological sort much like C. It will check which steps are necessary and skip the ones which are not. =head1 RATIONALE Writing extensions for various build tools can be a daunting task. This module tries to abstract steps of build processes into reusable building blocks for creating platform and build system agnostic executable descriptions of work. =head1 USAGE package Frobnicator; use ExtUtils::Builder::Action::Code; ... sub add_plans { my ($self, $planner) = @_; my $action = ExtUtils::Builder::Action::Code->new( code => ..., ); $planner->create_node( target => 'frob', actions => [ $action ], ); $planner->create_node( target => 'pure_all', dependencies => [ 'frob' ], phony => 1, ); } ... =head2 Makefile.PL use ExtUtils::MakeMaker; use ExtUtils::Builder::MakeMaker; ... WriteMakeFile( NAME => 'Foo', VERSION => 0.001, ..., ); sub MY::make_plans { my ($self, $planner) = @_; Frobnicator->add_plans($planner); } =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut pod-coverage.t100644001750001750 153014775426605 21110 0ustar00leontleont000000000000ExtUtils-Builder-0.017/xt/author# This file was automatically generated by Dist::Zilla::Plugin::Test::Pod::Coverage::TrustMe v1.0.0 use strict; use warnings; use Test::More; use Test::Pod::Coverage::TrustMe; my $config = {}; my $modules = [ "ExtUtils::Builder", "ExtUtils::Builder::Action", "ExtUtils::Builder::Action::Code", "ExtUtils::Builder::Action::Command", "ExtUtils::Builder::Action::Composite", "ExtUtils::Builder::Action::Function", "ExtUtils::Builder::Action::Perl", "ExtUtils::Builder::Action::Primitive", "ExtUtils::Builder::MakeMaker", "ExtUtils::Builder::Node", "ExtUtils::Builder::Plan", "ExtUtils::Builder::Planner", "ExtUtils::Builder::Planner::Extension", "ExtUtils::Builder::Serializer", "ExtUtils::Builder::Util", ]; plan tests => scalar @$modules; for my $module (@$modules) { pod_coverage_ok($module, $config); } done_testing; Builder000755001750001750 014775426605 20171 5ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtilsNode.pm100644001750001750 503114775426605 21553 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builderpackage ExtUtils::Builder::Node; $ExtUtils::Builder::Node::VERSION = '0.017'; use strict; use warnings; use parent qw/ExtUtils::Builder::Action::Composite/; use Carp 'croak'; sub new { my ($class, %args) = @_; croak('Attribute target is not defined') if not $args{target}; $args{actions} = [ map { $_->flatten } @{ $args{actions} // [] } ]; $args{dependencies} //= []; $args{type} //= delete $args{phony} ? 'phony' : 'file'; return $class->SUPER::new(%args); } sub flatten { my $self = shift; return @{ $self->{actions} }; } sub target { my $self = shift; return $self->{target}; } sub dependencies { my $self = shift; return @{ $self->{dependencies} }; } sub type { my $self = shift; return $self->{type}; } sub phony { my $self = shift; return $self->{type} eq 'phony'; } sub mergeable { my $self = shift; return $self->{type} eq 'phony' && !@{ $self->{actions} }; } sub newer_than { my ($self, $mtime) = @_; return 1 if $self->{type} eq 'phony'; return -d $self->{target} || (-e _ && $mtime <= -M _); } 1; # ABSTRACT: An ExtUtils::Builder Node __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Node - An ExtUtils::Builder Node =head1 VERSION version 0.017 =head1 SYNOPSIS ExtUtils::Builder::Node->new( target => $target_name, dependencies => \@dependencies, actions => \@actions, ); =head1 DESCRIPTION A node is the equivalent of a makefile entry. In essence it boils down to its three attributes: C (the name of the target), C(the names of the dependencies) and C. A Node is a L, meaning that in can be executed or serialized as a whole. =head1 ATTRIBUTES =head2 target The target filename of this node. =head2 dependencies The (file)names of the dependencies of this node. =head2 actions A list of L for this node. =head2 type This must be one of C or C. In the latter case the target will not be represented on the filesystem. =head2 phony B. Instead, pass C<< type => 'phony' >> =head1 METHODS =head2 mergeable This returns true if a node is mergeable, i.e. it's phony and has no actions. =for Pod::Coverage flatten execute to_command to_code newer_than =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Plan.pm100644001750001750 715414775426605 21570 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builderpackage ExtUtils::Builder::Plan; $ExtUtils::Builder::Plan::VERSION = '0.017'; use strict; use warnings; use Carp (); use Scalar::Util (); sub new { my ($class, %args) = @_; return bless { nodes => $args{nodes} // {} }, $class; } sub node { my ($self, $name) = @_; return $self->{nodes}{$name}; } sub nodes { my $self = shift; return @{$self->{nodes}}{ $self->node_names }; } sub node_names { my $self = shift; return sort keys %{ $self->{nodes} }; } sub _node_sorter { my ($self, $name, $callback, $seen, $loop) = @_; Carp::croak("$name has a circular dependency, aborting!\n") if exists $loop->{$name}; return if $seen->{$name}++; if (my $node = $self->{nodes}{$name}) { local $loop->{$name} = 1; $self->_node_sorter($_, $callback, $seen, $loop) for $node->dependencies; $callback->($name, $node); } elsif (not -e $name) { Carp::confess("Node $name doesn't exist") } return; } sub run { my ($self, $targets, %options) = @_; my @targets = ref($targets) ? @{$targets} : $targets; my (%seen, %loop); my $run_node = sub { my ($name, $node) = @_; return if $self->_up_to_date($node); $node->execute(%options); }; $self->_node_sorter($_, $run_node, \%seen, \%loop) for @targets; return; } sub _up_to_date { my ($self, $node) = @_; return 0 if $node->type eq 'phony' or not -e $node->target; my $mtime = -M _; for my $dep_name (sort $node->dependencies) { if (my $dep = $self->{nodes}{$dep_name}) { return 0 unless $dep->newer_than($mtime); } else { return 0 unless -e $dep_name && $mtime <= -M _; } } return 1; } sub merge { my ($self, $other) = @_; Carp::croak('Right side of merge is not a Plan') if not $other->isa(__PACKAGE__); my $double = join ', ', grep { $other->{nodes}{$_} } keys %{ $self->{nodes} }; Carp::croak("Found key(s) $double on both sides of merge") if $double; my %nodes = (%{ $self->{nodes} }, %{ $other->{nodes} }); return ref($self)->new(nodes => [ values %nodes ]); } sub phonies { my ($self) = @_; return sort map { $_->target } grep { $_->phony } values %{ $self->{nodes} }; } 1; # ABSTRACT: An ExtUtils::Builder Plan __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Plan - An ExtUtils::Builder Plan =head1 VERSION version 0.017 =head1 SYNOPSIS package Frobnicate; sub plan { my %nodes = ...; return ExtUtils::Builder::Plan->new( nodes => \%nodes, ); } my $plan = Frobnicate->plan(@args); # various consumption methods $plan->run('foo'); say $_->target for $plan->nodes; =head1 DESCRIPTION An object of this class describes a process. It contains one or more nodes. This is enough to describe whole building processes, in fact its C method is a tiny C engine. =head1 ATTRIBUTES =head2 nodes This is the set of all nodes in this plan. =head1 METHODS =head2 run($target, %options) This runs the process. Similar to C, it checks for each node if it is necessary to run, and if not skips it. C<$target> may either be a single string or an array ref of strings for the targets to run. =head2 node($target) Returns the node for the specified C<$target>. =head2 node_names() Returns the names of all the nodes. =head2 merge($other) This merges this plan with another, and returns the new plan. Each entry may only exist on one side of the merge. =head2 phonies() This returns the names of all phony targets. =for Pod::Coverage new =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Util.pm100644001750001750 1061414775426605 21626 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builderpackage ExtUtils::Builder::Util; $ExtUtils::Builder::Util::VERSION = '0.017'; use strict; use warnings; use Exporter 5.57 'import'; our @EXPORT_OK = qw/get_perl require_module unix_to_native_path native_to_unix_path command code function/; use Carp 'croak'; use Config; use ExtUtils::Config; use File::Spec; use File::Spec::Unix; use Scalar::Util 'tainted'; sub get_perl { my (%opts) = @_; my $config = $opts{config} // ExtUtils::Config->new; if (File::Spec->file_name_is_absolute($^X) and not tainted($^X)) { return $^X; } elsif ($config->get('userelocatableinc')) { require Devel::FindPerl; return Devel::FindPerl::find_perl_interpreter($config); } else { return $opts{config}->get('perlpath'); } } sub require_module { my $module = shift; (my $filename = "$module.pm") =~ s{::}{/}g; require $filename; return $module; } sub command { my (@command) = @_; require ExtUtils::Builder::Action::Command; return ExtUtils::Builder::Action::Command->new(command => \@command); } sub code { my %args = @_; require ExtUtils::Builder::Action::Code; return ExtUtils::Builder::Action::Code->new(%args); } sub function { my %args = @_; require ExtUtils::Builder::Action::Function; return ExtUtils::Builder::Action::Function->new(%args); } my %cache; sub glob_to_regex { my $input = shift; return $cache{$input} ||= do { my $regex = _glob_to_regex_string($input); qr/^$regex$/; }; } sub _glob_to_regex_string { my $glob = shift; my $in_curlies; local $_ = $glob; my $regex = !/\A(?=\.)/ ? '(?=[^\.])' : ''; while (!/\G\z/mgc) { if (/\G([^\/.()|+^\$@%\\*?{},\[\]]+)/gc) { $regex .= $1; } elsif (m{\G/}gc) { $regex .= !/\G(?=\.)/gc ? '/(?=[^\.])' : '/' } elsif (/ \G ( [.()|+^\$@%] ) /xmgc) { $regex .= quotemeta $1; } elsif (/ \G \\ ( [*?{}\\,] ) /xmgc) { $regex .= quotemeta $1; } elsif (/\G\*/mgc) { $regex .= "[^/]*"; } elsif (/\G\?/mgc) { $regex .= "[^/]"; } elsif (/\G\{/mgc) { $regex .= "("; ++$in_curlies; } elsif (/\G \[ ( [^\]]+ ) \] /xgc) { $regex .= "[\Q$1\E]"; } elsif ($in_curlies && /\G\}/mgc) { $regex .= ")"; --$in_curlies; } elsif ($in_curlies && /\G,/mgc) { $regex .= "|"; } elsif (/\G([},]+)/gc) { $regex .= $1; } else { croak sprintf "Couldn't parse at %s|%s", substr($_, 0 , pos), substr $_, pos; } } return $regex; } sub unix_to_native_path { my ($input) = @_; my ($volume, $unix_dir, $file) = File::Spec::Unix->splitpath($input); my @splitdir = File::Spec::Unix->splitdir($unix_dir); my $catdir = File::Spec->catdir(@splitdir); return File::Spec->catpath($volume, $catdir, $file); } sub native_to_unix_path { my ($input) = @_; my ($volume, $unix_dir, $file) = File::Spec->splitpath($input); my @splitdir = File::Spec->splitdir($unix_dir); my $catdir = File::Spec::Unix->catdir(@splitdir); return File::Spec::Unix->catpath($volume, $catdir, $file); } 1; # ABSTRACT: Utility functions for ExtUtils::Builder __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Util - Utility functions for ExtUtils::Builder =head1 VERSION version 0.017 =head1 DESCRIPTION This is a module containing some helper functions for L. =head1 FUNCTIONS =head2 function(%arguments) This is a shorthand for calling L's contructor. =head2 command(%arguments) This is a shorthand for calling L's contructor. =head2 code(@command) This is a shorthand for calling L's contructor, with C<@command> passed as its C argument. =head2 glob_to_regex($glob) This translates a unix glob expression (e.g. C<*.txt>) to a regex. =head2 unix_to_native_path($path) This converts a unix path to a native path. =head2 native_to_unix_path($path) This converts a native path to a unix path. =head2 get_perl(%options) This function takes a hash with various (optional) keys: =over 4 =item * config An L (compatible) object. =back =head2 require_module($module) Dynamically require a module. =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Action.pm100644001750001750 745114775426605 22113 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builderpackage ExtUtils::Builder::Action; $ExtUtils::Builder::Action::VERSION = '0.017'; use strict; use warnings; sub new { my ($class, %args) = @_; return bless { %args }, $class; } sub preference { my ($self, @possibilities) = @_; my $map = $self->_preference_map; my @keys = @possibilities ? @possibilities : keys %{$map}; my ($ret) = reverse sort { $map->{$a} <=> $map->{$b} } @keys; return $ret; } sub to_code_hash { my ($self, %opts) = @_; return { code => $self->to_code(%opts), } } 1; #ABSTRACT: The ExtUtils::Builder Action role __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Action - The ExtUtils::Builder Action role =head1 VERSION version 0.017 =head1 SYNOPSIS $_->execute for @actions; open my $script, '>', 'foo.sh'; print $script shell_quote(@{$_}) for map { $_->to_command } @actions; =head1 DESCRIPTION Actions are the cornerstone of the ExtUtils::Builder framework. They provide an interface between build tools (L, L) and building extensions. This allows both sides to be completely independent from each other. It is a flexible abstraction around pieces of work, this work can be a piece of perl code, an external command, a mix of those or possibly other things. =head1 OVERVIEW An action can be consumed in many ways. It can be Cd, which is often the simplest way to deal with them. It can be serialized to commands that can be passed on to system or strings that can be Cled. If a consumer can deal with multiple of these, the C method can be used to choose between options. On L actions, C can be called to retrieve the constituent actions, on L actions it's just an identity operator. This is particularly useful before calling preference, because different sub-actions are likely to have different preferences. =head1 METHODS =head2 execute(%arguments) Execute this action immediately. This may throw an exception on errors, but doesn't otherwise return anything. C<%arguments> may be used by the command. =over 4 =item * quiet If true, this suppresses logging. =back =head2 to_command(%options) Convert the action into a set of platform appropriate commands. It returns a list of array-refs, each array-ref being an individual command that can be passes to C or equivalent. C<%options> can influence how something is serialized in action-type specific ways, but shouldn't fundamentally affect the action that is performed. All options are optional. =over 4 =item perl This contains the path to the current perl interpreter. =item config This should contain an ExtUtils::Config object, or equivalent. =back =head2 to_code(%options) This returns a list of strings that can be evalled to sub-refs. C<%options> can influence how something is serialized in action-type specific ways, but shouldn't fundamentally affect the action that is performed. =head2 to_code_hash(%options) This returns a list of hashes that can be used to create L objects. =head2 preference(@possibilities) This action returns the favored out of C<@possibilities>. Valid values are C, C, C, C. If no arguments are given, the favorite from all valid values is given. =head2 flatten This action returns all actions behind this action. It may return itself, it may return a long list of actions, it may even return an empty list. =for Pod::Coverage new =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut FileSet.pm100644001750001750 134614775426605 22226 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builderpackage ExtUtils::Builder::FileSet; $ExtUtils::Builder::FileSet::VERSION = '0.017'; use strict; use warnings; use Carp (); sub new { my ($class, %args) = @_; my $self = bless { entries => [], dependents => [], callback => $args{callback}, }, $class; return $self; } sub entries { my $self = shift; return @{ $self->{entries} }; } sub add_dependent { my ($self, $dep) = @_; push @{ $self->{dependents} }, $dep; for my $file (@{ $self->{entries} }) { $dep->add_input($file); } return; } sub _pass_on { my ($self, $entry) = @_; push @{ $self->{entries} }, $entry; $self->{callback}->($entry) if $self->{callback}; for my $dependent (@{ $self->{dependents} }) { $dependent->add_input($entry); } return; } 1; Planner.pm100644001750001750 2721514775426605 22315 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builderpackage ExtUtils::Builder::Planner; $ExtUtils::Builder::Planner::VERSION = '0.017'; use strict; use warnings; use Carp (); use File::Basename; use File::Spec; use List::Util 1.45 (); use Scalar::Util (); use ExtUtils::Builder::Plan; use ExtUtils::Builder::Node; use ExtUtils::Builder::Util; use ExtUtils::Builder::FileSet::Free; use ExtUtils::Builder::FileSet::Filter; use ExtUtils::Builder::FileSet::Subst; my $class_counter = 0; sub new { my $base_class = shift; my $all_files = ExtUtils::Builder::FileSet::Free->new; return $base_class->_new_scope($base_class, undef, {}, { 'all-files' => $all_files }); } sub _new_scope { my ($self, $base_class, $outer, $nodes, $filesets) = @_; my $class = __PACKAGE__ . '::Anon_' . ++$class_counter; no strict 'refs'; push @{ "$class\::ISA" }, $base_class; my $new = bless { nodes => $nodes, filesets => $filesets }, $class; $new->add_delegate('self', sub { $new }); $new->add_delegate('outer', sub { $outer }); return $new; } sub new_scope { my ($self) = @_; return $self->_new_scope(ref($self), $self, $self->{nodes}, $self->{filesets}); } sub add_node { my ($self, $node) = @_; my $target = $node->target; if (exists $self->{nodes}{$target}) { Carp::croak("Duplicate for target $target") if !$node->mergeable or !$self->{nodes}{$target}->mergeable; my @dependencies = List::Util::uniq($self->{nodes}{$target}->dependencies, $node->dependencies); my $new = ExtUtils::Builder::Node->new(target => $target, dependencies => \@dependencies, phony => 1); $self->{nodes}{$target} = $new; } else { $self->{nodes}{$target} = $node; $self->{filesets}{'all-files'}->add_input($target) if not $node->phony; } return $node->target; } sub create_node { my ($self, %args) = @_; my $node = ExtUtils::Builder::Node->new(%args); return $self->add_node($node); } sub create_phony { my ($self, $target, @dependencies) = @_; return $self->create_node( target => $target, dependencies => \@dependencies, type => 'phony', ); } my $counter = 0; sub _create_callback { my ($self, $add_to) = @_; return undef unless $add_to; my $this = $self; Scalar::Util::weaken($this); return sub { my ($entry) = @_; $this->create_phony($add_to, $entry); }; } sub create_filter { my ($self, %args) = @_; my $set = ExtUtils::Builder::FileSet::Filter->new( condition => $args{condition}, callback => $self->_create_callback($args{add_to}), ); my $on = $args{on} // 'all-files'; my @sources = ref($on) eq 'ARRAY' ? @{$on} : $on; for my $source (@sources) { my $object = $self->{filesets}{$source} or die "No such source $source"; $object->add_dependent($set); } my $name = $args{name} // 'filter-' . $counter++; $self->{filesets}{$name} = $set; return $name; } sub _make_pattern { my ($self, %options) = @_; if ($options{file}) { my $file = ExtUtils::Builder::Util::glob_to_regex($options{file}); if ($options{dir}) { my $dir = ExtUtils::Builder::Util::native_to_unix_path($options{dir}); return sub { my ($input) = @_; my $filename = ExtUtils::Builder::Util::native_to_unix_path($input); $filename =~ s{(?_make_pattern(%args); my $callback = $args{negate} ? sub { !$positive->($_[0]) } : $positive; return $self->create_filter(%args, condition => $callback); } sub create_subst { my ($self, %args) = @_; my $set = ExtUtils::Builder::FileSet::Subst->new( subst => $args{subst}, callback => $self->_create_callback($args{add_to}), ); my $on = $args{on} // 'all-files'; my @sources = ref($on) eq 'ARRAY' ? @{$on} : $on; for my $source (@sources) { my $object = $self->{filesets}{$source} or die "No such source $source"; $object->add_dependent($set); } my $name = $args{name} // 'subst-' . $counter++; $self->{filesets}{$name} = $set; return $name; } sub add_seen { my ($self, $entry) = @_; $self->{filesets}{'all-files'}->add_input($entry); return; } sub merge_plan { my ($self, $plan) = @_; $self->add_node($_) for $plan->nodes; return; } my $set_subname = eval { require Sub::Util; Sub::Util->VERSION('1.40'); \&Sub::Util::set_subname } // sub { $_[1] }; sub add_delegate { my ($self, $name, $sub) = @_; my $full_name = ref($self) . '::' . $name; no strict 'refs'; no warnings 'redefine'; *{$full_name} = $set_subname->($full_name, $sub); return; } sub load_extension { my ($self, $plannable, $version, %options) = @_; ExtUtils::Builder::Util::require_module($plannable); $plannable->VERSION($version) if $version; return $plannable->add_methods($self, %options); } *load_module = \&load_extension; sub materialize { my $self = shift; my %nodes = %{ $self->{nodes} }; return ExtUtils::Builder::Plan->new(nodes => \%nodes); } my %dsl_commands = ( command => \&ExtUtils::Builder::Util::command, code => \&ExtUtils::Builder::Util::code, function => \&ExtUtils::Builder::Util::function, ); sub run_dsl { my ($self, $filename) = @_; my $dsl_module = ref($self) . '::DSL'; if (not defined &{ "$dsl_module\::AUTOLOAD" }) { no strict 'refs'; *{ "$dsl_module\::AUTOLOAD" } = sub { my $name = our $AUTOLOAD; $name =~ s/.*:://; if (my $method = $self->can($name)) { my $delegate = $set_subname->($name, sub { $self->$method(@_); }); *{ "$dsl_module\::$name" } = $delegate; goto &$delegate; } else { Carp::croak("No such subroutine $name"); } }; for my $name (keys %dsl_commands) { *{ "$dsl_module\::$name" } = $dsl_commands{$name} if not $dsl_module->can($name); } } my $path = File::Spec->rel2abs($filename); eval "package $dsl_module; my \$ret = do \$path; die \$@ if \$@; defined \$ret || !\$!" or die $@ // Carp::shortmess("Can't run $path: $!"); return; } 1; # ABSTRACT: An ExtUtils::Builder Plan builder __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Planner - An ExtUtils::Builder Plan builder =head1 VERSION version 0.017 =head1 SYNOPSIS my $planner = ExtUtils::Builder::Planner->new; $planner->create_node( target => 'foo', dependencies => [ 'bar' ], actions => \@actions, ); my $plan = $planner->materialize; =head1 DESCRIPTION A Planner is an object that creates a L that can be executed. The primary objective of this class is to gather a set of nodes (triplets of target, dependencies and actions), that represent building graph. To aid building this graph, this modules provides filesets to filter and transform filenames. Delegates can be mixed into the planner to aid in building these nodes and filesets. Extensions are a collection of such delegates. =head1 METHODS =head2 add_node($node) This adds an L to the planner. It will also be added to the C<'all-files'> fileset if it's a file node. =head2 create_node(%args) This creates a new node and adds it to the planner using C. It takes the same named arguments as C. =over 4 =item * target The target of the node. This is mandatory. =item * dependencies The list of dependencies for this node. =item * actions The actions to perform to create or update this node. =item * type This marks the type of the node: C or C, defaulting to the former. =back =head2 merge_plan($plan) This merges all nodes of the plan to the planner. =head2 add_delegate($name, $sub) This adds C<$sub> as a helper method to this planner, with the name C<$name>. =head2 create_phony($target, @dependencies) This is a helper function that calls C for a action-free phony target. =head2 create_filter(%options) This will filter an existing fileset based on a condition, and return the name of the new fileset. =over 4 =item * condition If this callback returns true the file will be included in the new filesets. =item * on this sets the input fileset, it defaults to c<'all-files'>. =item * name this sets the name of the new set, if none is given one will be generated. =back =head2 create_pattern(%options) This is a wrapper for C for various common constructs. It takes several named options, at the moment at least one of C or C is mandatory. =over 4 =item * file A unix glob pattern that each filename is compared to, e.g. C<'*.pm'>. =item * dir The directory under which files should be (e.g. C<'lib'>). =item * negate This negates all the match. =item * on this sets the input fileset, it defaults to C<'all-files'>. =item * name this sets the name of the new set, if none is given one will be generated. =back =head2 create_subst(%options) This creates a new node based on the old one (source). =over 4 =item * subst This callback is called for all entries in the input set. It should do two things: =over 4 =item 1. Return the name of the new target node. =item 2. It should add a node to create the target from the source. The node should have source as its dependency. =back =item * on this sets the input fileset, it defaults to c<'all-files'>. =item * name this sets the name of the new set, if none is given one will be generated. =back =head2 add_seen($filename) This marks a file as existing on the filesystem by adding it to the C<'all-files'> fileset. =head2 load_extension($extension, $version, %options) This adds the delegate from the given module. If C<$version> is defined it will verify if the extension is at least that version. C is a depreciated alias for this function. =head2 new_scope() This opens a new scope on the planner. It return a child planner that shared the build tree state with its parent, but any delegated added to it will not be added to the parent. =head2 run_dsl($filename) This runs C<$filename> as a DSL file. This is a script file that includes Planner methods as functions. For example: use strict; use warnings; load_extension("Foo"); add_foo("a.foo", "a.bar"); create_subst( on => create_pattern(file => '*.src'), subst => sub { my ($source) = @_; my $target = $source =~ s/\.src$//r; return create_node( target => $target, dependencies => [ $source ], actions => [ command('convert', $target, $source), function(module => 'Foo', function => 'bar'), code(code => 'print "Hello World"'), ], ); }, ); This will also add C, C and C helper functions that correspond to L, L and L respectively. =head2 materialize() This returns a new L object based on the planner. =head2 self() This returns the planner. =head2 outer() This returns the planner matching the outer scope of the current planner object. =for Pod::Coverage new load_module =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut MakeMaker.pm100644001750001750 1306614775426605 22552 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builderpackage ExtUtils::Builder::MakeMaker; $ExtUtils::Builder::MakeMaker::VERSION = '0.017'; use strict; use warnings; our @ISA; use ExtUtils::MakeMaker 6.68; use ExtUtils::Builder::Planner; use ExtUtils::Config::MakeMaker; use ExtUtils::Manifest (); use version (); sub import { my ($class, @args) = @_; if (!MM->isa(__PACKAGE__)) { @ISA = @MM::ISA; @MM::ISA = __PACKAGE__; splice @ExtUtils::MakeMaker::Overridable, -1, 0, 'make_plans'; } return; } my $escape_command = sub { my ($maker, $elements) = @_; return join ' ', map { (my $temp = m{[^\w/\$().-]} ? $maker->quote_literal($_) : $_) =~ s/\n/\\\n\t/g; $temp } @{$elements}; }; my %double_colon = map { $_ => 1 } qw/all pure_all subdirs config dynamic static clean distdir test install/; my $make_entry = sub { my ($maker, $target, $dependencies, $actions) = @_; my @commands = map { $maker->$escape_command($_) } map { $_->to_command(perl => '$(ABSPERLRUN)') } @{$actions}; my @dependencies = map { $maker->quote_dep($_) } @{$dependencies}; my $colon = $double_colon{$target} ? '::' : ':'; return join "\n\t", join(' ', $target, $colon, @dependencies), @commands; }; sub postamble { my ($maker, %args) = @_; my @ret = split "\n\n", $maker->SUPER::postamble(%args); my $planner = ExtUtils::Builder::Planner->new; $planner->add_delegate('makemaker', sub { $maker }); my $config = ExtUtils::Config::MakeMaker->new($maker); $planner->add_delegate('config', sub { $config }); $planner->add_delegate('distribution', sub { $maker->{DIST_NAME} }); $planner->add_delegate('version', sub { version->new($maker->{VERSION}) }); $planner->add_delegate('main_module', sub { $maker->{NAME} }); $planner->add_delegate('pureperl_only', sub { $maker->{PUREPERL_ONLY} }); $planner->add_delegate('perl_path', sub { $maker->{ABSPERLRUN} }); $planner->add_delegate('verbose', sub { !!0 }); $planner->add_delegate('uninst', sub { $maker->{UNINST} }); $planner->add_delegate('meta', sub { CPAN::Meta->load_file('META.json') }); $planner->add_delegate('release_status', sub { CPAN::Meta->load_file('META.json')->release_status }); $planner->add_delegate('jobs', sub { 1 }); $planner->add_delegate('is_os', sub { my ($self, @wanted) = @_; return not not grep { $_ eq $^O } @wanted }); $planner->add_delegate('is_os_type', sub { my ($self, $wanted) = @_; require Perl::OSType; return Perl::OSType::is_os_type($wanted); }); $planner->add_delegate('new_planner', sub { my $inner = ExtUtils::Builder::Planner->new; $inner->add_delegate('config', sub { $config }); return $inner; }); $planner->add_seen($_) for sort keys %{ ExtUtils::Manifest::maniread() }; $maker->make_plans($planner, %args) if $maker->can('make_plans'); for my $file (glob 'planner/*.pl') { $planner->new_scope->run_dsl($file); } my $plan = $planner->materialize; push @ret, map { $maker->$make_entry($_->target, [ $_->dependencies ], [ $_ ]) } $plan->nodes; if ($maker->is_make_type('gmake') || $maker->is_make_type('bsdmake')) { my @phonies = grep { !$double_colon{$_} } $plan->phonies; push @ret, $maker->$make_entry('.PHONY', \@phonies) if @phonies } return join "\n\n", @ret; } 1; #ABSTRACT: A MakeMaker consumer for ExtUtils::Builder Plan objects __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::MakeMaker - A MakeMaker consumer for ExtUtils::Builder Plan objects =head1 VERSION version 0.017 =head1 SYNOPSIS use ExtUtils::MakeMaker; use ExtUtils::Builder::MakeMaker; ... WriteMakeFile( NAME => 'Foo', VERSION => 0.001, ); sub MY::make_plans { my ($self, $planner) = @_; $planner->load_extension('Some::Module'); ... # Add plans to $planner } =head1 DESCRIPTION This MakeMaker extension will call your C method with a L as argument so that you can add entries to it; these entries will be added to your Makefile. It will also call any C<.pl> files in C as DSL files, these are run in a new scope so delegates don't leak out. Entries may depend on existing MakeMaker entries and vice-versa. Typically one would make their target a dependency of a MakeMaker entry like C or C. =head1 DELEGATES By default, the following delegates are defined on your L: =over 4 =item * meta A L object representing the C file. =item * distribution The name of the distribution =item * version The version of the distribution =item * main_module The main module of the distribution. =item * release_status The release status of the distribution (e.g. C<'stable'>). =item * perl_path The path to the perl executable. =item * config The L object for this build =item * is_os(@os_names) This returns true if the current operating system matches any of the listed ones. =item * is_os_type($os_type) This returns true if the type of the OS matches C<$os_type>. Legal values are C, C and C. =item * verbose This is always false. =item * uninst The value of the C command line argument. =item * jobs This is always C<1>. =item * pureperl_only The value of the C command line argument. =back These are the same ones as L sets except C is missing. =for Pod::Coverage postamble =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Serializer.pm100644001750001750 653614775426605 23012 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builderpackage ExtUtils::Builder::Serializer; $ExtUtils::Builder::Serializer::VERSION = '0.017'; use strict; use warnings; use Carp 'croak'; use ExtUtils::Builder::Action::Command; use ExtUtils::Builder::Action::Code; use ExtUtils::Builder::Node; use ExtUtils::Builder::Plan; sub serialize_plan { my ($self, $plan) = @_; my %nodes; for my $node_name ($plan->node_names) { $nodes{$node_name} = $self->serialize_node($plan->node($node_name)); } return { nodes => \%nodes, } } sub serialize_node { my ($self, $node, %opts) = @_; my @actions = map { $self->serialize_action($_, %opts) } $node->flatten; return { dependencies => [ $node->dependencies ], actions => \@actions, type => $node->type, } } sub serialize_action { my ($self, $action, %opts) = @_; my $preference = $action->preference('code', 'command'); my $method = $preference eq 'code' ? 'serialize_code' : 'serialize_command'; return $self->$method($action, %opts); } sub serialize_code { my ($self, $action, %opts) = @_; return [ 'code', $action->to_code_hash(%opts) ]; } sub serialize_command { my ($self, $action, %opts) = @_; return map { [ 'command', $_ ] } $action->to_command(%opts) } sub deserialize_plan { my ($self, $serialized, %options) = @_; my %nodes; for my $node_name (keys %{ $serialized->{nodes} }) { $nodes{$node_name} = $self->deserialize_node($node_name, $serialized->{nodes}{$node_name}, %options); } return ExtUtils::Builder::Plan->new( nodes => \%nodes, ); } sub deserialize_node { my ($self, $name, $serialized, %options) = @_; my @actions = map { $self->deserialize_action($_, %options) } @{ $serialized->{actions} }; return ExtUtils::Builder::Node->new( target => $name, dependencies => [ @{ $serialized->{dependencies} } ], actions => \@actions, type => $serialized->{type}, ); } sub deserialize_action { my ($self, $serialized, %options) = @_; my ($command, @args) = @{$serialized}; if ($command eq 'command') { return ExtUtils::Builder::Action::Command->new(command => $args[0]); } elsif ($command eq 'code') { return map { ExtUtils::Builder::Action::Code->new(%$_) } @args; } else { croak "Unknown serialized command $command"; } } 1; #ABSTRACT: __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Serializer - =head1 VERSION version 0.017 =head1 DESCRIPTION XXX =head1 METHODS =head2 serialize_plan($plan) Serialize a plan into a JSON compatible hash structure. =head2 serialize_node($node) Serialize a node into a JSON compatible hash structure. =head2 serialize_action($action) Serialize an action into a JSON compatible hash structure. =head2 serialize_code($action) Serialize a code action into a JSON compatible hash structure. =head2 serialize_command($action) Serialize a command action into a JSON compatible hash structure. =head2 deserialize_plan($plan) Deserialize a plan from a JSON compatible hash structure. =head2 deserialize_node($node) Deserialize a node from a JSON compatible hash structure. =head2 deserialize_action($action) Deserialize an action from a JSON compatible hash structure. =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Action000755001750001750 014775426605 21406 5ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/BuilderCode.pm100644001750001750 506114775426605 22760 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/Actionpackage ExtUtils::Builder::Action::Code; $ExtUtils::Builder::Action::Code::VERSION = '0.017'; use strict; use warnings; use parent 'ExtUtils::Builder::Action::Perl'; use Carp (); use ExtUtils::Builder::Util 'get_perl'; sub new { my ($class, %args) = @_; Carp::croak('Need to define code') if !$args{code}; $args{modules} //= []; my $self = $class->SUPER::new(%args); return $self; } sub modules { my $self = shift; return @{ $self->{modules} }; } sub execute { my ($self, %opts) = @_; my $code = $self->to_code(); if (!$opts{quiet}) { my $message = $self->{message} // $code; print "$message\n"; } eval $code . '; 1' or die $@; return; } sub to_code { my ($self, %opts) = @_; my @modules = $opts{skip_loading} ? () : map { "require $_" } $self->modules; return join '; ', @modules, $self->{code}; } sub to_command { my ($self, %opts) = @_; my @modules = map { "-M$_" } $self->modules; my $perl = $opts{perl} // get_perl(%opts); return [ $perl, @modules, '-e', $self->to_code(skip_loading => 'main') ]; } 1; #ABSTRACT: Action objects for perl code __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Action::Code - Action objects for perl code =head1 VERSION version 0.017 =head1 SYNOPSIS my $action = ExtUtils::Builder::Action::Code->new( code => 'Frob::nicate(@_)', modules => ['Frob'], message => 'frobnicateing foo', ); $action->execute(target => 'bar'); say "Executed: ", join ' ', @$_, target => 'bar' for $action->to_command; =head1 DESCRIPTION This is a primitive action object wrapping a piece of perl code. The easiest way to use it is to execute it immediately. For more information on using actions, see L. The core attributes are code and serialized, though only one of them must be given, both is strongly recommended. =head1 ATTRIBUTES =head2 code This is a code-ref containing the action. On execution, it is passed the arguments of the execute method; when run as command it is passed @ARGV. In either case, C is also passed. Of not given, it is Ced from C. =head2 modules This is an optional list of modules that will be dynamically loaded before the action is run in any way. This attribute is optional. =for Pod::Coverage new to_code modules =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Perl.pm100644001750001750 253714775426605 23015 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/Actionpackage ExtUtils::Builder::Action::Perl; $ExtUtils::Builder::Action::Perl::VERSION = '0.017'; use strict; use warnings; use parent 'ExtUtils::Builder::Action::Primitive'; sub _preference_map { return { execute => 3, code => 2, command => 1, flatten => 0, }; } sub message { my $self = shift; return $self->{message}; } sub to_code_hash { my ($self, %opts) = @_; my %result = ( modules => [ $self->modules ], code => $self->to_code(skip_loading => 1, %opts), ); $result{message} = $self->{message} if defined $self->{message}; return \%result; } 1; # ABSTRACT: A base-role for Code actions __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Action::Perl - A base-role for Code actions =head1 VERSION version 0.017 =head1 DESCRIPTION This class provides most functionality of Code Actions. =head1 ATTRIBUTES =head2 message This is a message that will be logged during execution. This attribute is optional. =head1 METHODS =head2 modules This will return the modules needed for this action. =for Pod::Coverage execute to_command preference =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut FileSet000755001750001750 014775426605 21524 5ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/BuilderFree.pm100644001750001750 37514775426605 23070 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/FileSetpackage ExtUtils::Builder::FileSet::Free; $ExtUtils::Builder::FileSet::Free::VERSION = '0.017'; use strict; use warnings; use base 'ExtUtils::Builder::FileSet'; sub add_input { my ($self, $entry) = @_; $self->_pass_on($entry); return $entry; } 1; Subst.pm100644001750001750 75514775426605 23311 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/FileSetpackage ExtUtils::Builder::FileSet::Subst; $ExtUtils::Builder::FileSet::Subst::VERSION = '0.017'; use strict; use warnings; use base 'ExtUtils::Builder::FileSet'; use Carp (); use Scalar::Util (); sub new { my ($class, %args) = @_; my $self = $class->SUPER::new(%args); $self->{subst} = $args{subst} or Carp::croak("No subst given"); return $self; } sub add_input { my ($self, $source) = @_; my $target = $self->{subst}->($source); $self->_pass_on($target); return $target; } 1; Command.pm100644001750001750 517714775426605 23474 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/Actionpackage ExtUtils::Builder::Action::Command; $ExtUtils::Builder::Action::Command::VERSION = '0.017'; use strict; use warnings; use parent 'ExtUtils::Builder::Action::Primitive'; sub _preference_map { return { command => 3, execute => 2, code => 1, flatten => 0, }; } sub to_code { my ($self, %args) = @_; require Data::Dumper; if (ref $self->{command}) { my $serialized = Data::Dumper->new([$self->{command}])->Terse(1)->Indent(0)->Dump; $serialized =~ s/ \A \[ (.*?) \] \z /$1/xms; return qq{system($serialized) and die "Could not run command " . join ' ', $serialized}; } else { my $serialized = Data::Dumper->new([$self->{command}])->Terse(1)->Indent(0)->Dump; return qq{system($serialized) and die "Could not run command $serialized"}; } } sub to_command { my $self = shift; return ref $self->{command} ? [ @{ $self->{command} } ] : $self->{command}; } my $quote = $^O eq 'MSWin32' ? do { require Win32::ShellQuote; \&Win32::ShellQuote::quote_system_list } : sub { @_ }; sub execute { my ($self, %opts) = @_; if (ref $self->{command}) { my @command = @{ $self->{command} }; my $message = join ' ', map { my $arg = $_; $arg =~ s/ (?= ['#] ) /\\/gx ? "'$arg'" : $arg } @command; print "$message\n" if not $opts{quiet}; system($quote->(@command)) and die "Could not run command @command" if not $opts{dry_run}; } else { my $command = $self->{command}; print "$command\n" if not $opts{quiet}; system($command) and die "Could not run command $command" if not $opts{dry_run}; } return; } 1; #ABSTRACT: An action object for external commands __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Action::Command - An action object for external commands =head1 VERSION version 0.017 =head1 SYNOPSIS my @cmd = qw/echo Hello World!/; my $action = ExtUtils::Builder::Action::Command->new(command => \@cmd); $action->execute; say "Executed: ", join ' ', @{$_} for $action->to_command; =head1 DESCRIPTION This is a primitive action object wrapping an external command. The easiest way to use it is to serialize it to command, though it doesn't mind being executed right away. For more information on actions, see L. =head1 ATTRIBUTES =head2 command This is the command that should be run, represented as an array ref. =for Pod::Coverage execute to_command to_code preference flatten =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Filter.pm100644001750001750 74714775426605 23437 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/FileSetpackage ExtUtils::Builder::FileSet::Filter; $ExtUtils::Builder::FileSet::Filter::VERSION = '0.017'; use strict; use warnings; use base 'ExtUtils::Builder::FileSet'; use Carp (); sub new { my ($class, %args) = @_; my $self = $class->SUPER::new(%args); $self->{condition} = $args{condition} or Carp::croak('No condition given'); return $self; } sub add_input { my ($self, $source) = @_; if ($self->{condition}->($source)) { $self->_pass_on($source); } return $source; } 1; Function.pm100644001750001750 711714775426605 23677 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/Actionpackage ExtUtils::Builder::Action::Function; $ExtUtils::Builder::Action::Function::VERSION = '0.017'; use strict; use warnings; use Carp 'croak'; use ExtUtils::Builder::Util 'get_perl'; use parent 'ExtUtils::Builder::Action::Perl'; sub new { my ($class, %args) = @_; croak 'Attribute module is not defined' if not defined $args{module}; croak 'Attribute function is not defined' if not defined $args{function}; $args{fullname} = join '::', $args{module}, $args{function}; $args{exports} ||= !!0; $args{arguments} //= []; my $self = $class->SUPER::new(%args); return $self; } sub modules { my ($self) = @_; return $self->{module}; } sub module { my ($self) = @_; return $self->{module}; } sub function { my ($self) = @_; return $self->{function}; } sub arguments { my ($self) = @_; return @{ $self->{arguments} }; } sub execute { my ($self, %args) = @_; my $module = $self->{module}; (my $filename = $module) =~ s{::}{/}g; require "$filename.pm"; if (!$args{quiet}) { my $message = $self->{message} // sprintf "%s(%s)", $self->{fullname}, join ", ", $self->arguments; print "$message\n"; } my $code = do { no strict 'refs'; \&{ $self->{fullname} } }; $code->($self->arguments); } sub to_code { my ($self, %args) = @_; my $shortcut = $args{skip_loading} && $args{skip_loading} eq 'main' && $self->{exports}; my $name = $shortcut ? $self->{function} : $self->{fullname}; my @modules = $args{skip_loading} ? () : "require $self->{module}"; my $arguments = $self->arguments ? do { require Data::Dumper; (Data::Dumper->new([ [ $self->arguments ] ])->Terse(1)->Indent(0)->Dump =~ /^ \[ (.*) \] $/x)[0] } : ''; return join '; ', @modules, sprintf '%s(%s)', $name, $arguments; } sub to_command { my ($self, %opts) = @_; my $module = $self->{exports} eq 'explicit' ? "-M$self->{module}=$self->{function}" : "-M$self->{module}"; my $perl = $opts{perl} // get_perl(%opts); return [ $perl, $module, '-e', $self->to_code(skip_loading => 'main') ]; } 1; #ABSTRACT: Actions for perl function calls __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Action::Function - Actions for perl function calls =head1 VERSION version 0.017 =head1 SYNOPSIS my $action = ExtUtils::Builder::Action::Function->new( module => 'Frob', function => 'nicate', arguments => [ target => 'bar' ], ); $action->execute(); say "Executed: ", join ' ', @$_, target => 'bar' for $action->to_command; =head1 DESCRIPTION This Action class is a specialization of L that makes the common case of calling a simple function easier. The first statement in the synopsis is roughly equivalent to: my $action = ExtUtils::Builder::Action::Code->new( code => 'Frob::nicate(target => 'bar')', module => ['Frob'], message => 'Calling Frob::nicate', ); Except that it serializes more cleanly. =head1 ATTRIBUTES =head2 arguments These are additional arguments to the action, that are passed on regardless of how the action is run. This attribute is optional. =head2 module The module to be loaded. =head2 function The name of the function to be called. =head2 exports If C<"always">, the function is assumed to be exported by the module. If C<"explicit">, it's assumed to need explicit exporting (e.g. C). =for Pod::Coverage to_code =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Composite.pm100644001750001750 312514775426605 24047 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/Actionpackage ExtUtils::Builder::Action::Composite; $ExtUtils::Builder::Action::Composite::VERSION = '0.017'; use strict; use warnings; use parent 'ExtUtils::Builder::Action'; sub _preference_map { return { flatten => 3, execute => 2, command => 1, code => 0, }; } sub execute { my ($self, %opts) = @_; $_->execute(%opts) for $self->flatten(%opts); return; } sub to_code { my ($self, %opts) = @_; return map { $_->to_code(%opts) } $self->flatten(%opts); } sub to_command { my ($self, %opts) = @_; return map { $_->to_command(%opts) } $self->flatten(%opts); } 1; # ABSTRACT: A base role for composite action classes __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Action::Composite - A base role for composite action classes =head1 VERSION version 0.017 =head1 DESCRIPTION This is a base-role for all composite action classes =head1 METHODS =head2 preference This will prefer handling methods in the following order: flatten, execute, command, code =head2 execute Execute all actions in this collection. =head2 to_command This returns the list commands of all actions in the collection. =head2 to_code This returns the list of evaluatable strings of all actions in the collection. =head2 preference This will prefer handling methods in the following order: flatten, execute, command, code =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Primitive.pm100644001750001750 171314775426605 24056 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/Actionpackage ExtUtils::Builder::Action::Primitive; $ExtUtils::Builder::Action::Primitive::VERSION = '0.017'; use strict; use warnings; use parent 'ExtUtils::Builder::Action'; sub flatten { my $self = shift; return $self; } 1; # ABSTRACT: A base role for primitive action classes __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Action::Primitive - A base role for primitive action classes =head1 VERSION version 0.017 =head1 DESCRIPTION This is a base role for primitive action classes such as L and L. =head1 METHODS =head2 flatten This is an identity operator (it returns C<$self>). =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Planner000755001750001750 014775426605 21570 5ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/BuilderExtension.pm100644001750001750 265114775426605 24246 0ustar00leontleont000000000000ExtUtils-Builder-0.017/lib/ExtUtils/Builder/Plannerpackage ExtUtils::Builder::Planner::Extension; $ExtUtils::Builder::Planner::Extension::VERSION = '0.017'; use strict; use warnings; sub add_delegate { my ($self, $planner, $as, $make_node) = @_; my $delegate = sub { my ($self, @args) = @_; for my $node ($make_node->(@args)) { $planner->add_node($node); } }; $planner->add_delegate($as, $delegate); return; } sub add_helper { my ($self, $planner, $as, $helper) = @_; $planner->add_delegate($as, sub { my ($self, @args) = @_; return $helper->(@args); }); return; } 1; #ABSTRACT: a base class for Planner extensions __END__ =pod =encoding UTF-8 =head1 NAME ExtUtils::Builder::Planner::Extension - a base class for Planner extensions =head1 VERSION version 0.017 =head1 METHODS =head2 add_delegate($planner, $as, $make_node) This adds a delegate function to C<$planner> with name C<$as>. The function must return zero or more L objects that will be added to the plan. =head2 add_helper($helper, $as, $sub) This adds a helper function to C<$planner> with name <$as>. It will return whatever C<$sub> returns, but will not affect the build tree in any way. =head1 AUTHOR Leon Timmermans =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2013 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut