timbunce / devel-nytprof

Devel::NYTProf is a powerful feature-rich source code profiler for Perl. (Mostly in maintenance mode, so PRs are much more likely to be acted upon than Issues.)
http://blog.timbunce.org/tag/nytprof/
67 stars 50 forks source link

Makefile.PL: How to create a `disttest_author` target to run as part of `make dist` #183

Closed jkeenan closed 3 years ago

jkeenan commented 3 years ago

When I go to prepare a new release of Devel-NYTProf, I run make dist. In the generated Makefile, the dist target is defined as:

dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
    $(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \
      -e '    if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';' --

$(DIST_DEFAULT), in turn, is (user-)defined in Makefile.PL:

    dist  => {
        DIST_DEFAULT => 'clean distcheck disttest tardist',
        PREOP        => '$(MAKE) -f Makefile.old distdir',
        COMPRESS     => 'gzip -v9',
        SUFFIX       => 'gz',
    },

So when I call make dist, I am in effect running make clean, make distcheck, make disttest and tardist. Of these 4 "sub-targets", clean is defined in Makefile.PL; the other 3 are generated by ExtUtils::MakeMaker.

What I would like to do is to create a new "sub-target", disttest_author, to substitute for disttest. In the generated Makefile, disttest is defined thus:

# --- MakeMaker dist_test section:
disttest : distdir
    cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL 
    cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
    cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)

I would like disttest_author to be exactly the same as this except for test_author rather than simply test in the 4th line. In this way, before creating the tarball I have run certain unit tests and test files that are relevant to me as releasor but not to an end-user.

To do this, I need to figure out a way to define disttest_author inside Makefile.PL. I do not know how to do that. Does anyone have prior art to suggest?

Thank you very much. Jim Keenan

jkeenan commented 3 years ago

grep.metacpan.org helped me out here, leading me to this prior art: https://metacpan.org/release/Bundle-CPAN/source/Makefile.PL#L114

Pull request https://github.com/timbunce/devel-nytprof/pull/185 should take care of this.

jkeenan commented 3 years ago

Handled in CPAN release 6.10. Closing.