X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=maint%2FMakefile.PL.inc%2F56_autogen_schema_files.pl;fp=maint%2FMakefile.PL.inc%2F56_autogen_schema_files.pl;h=446cc2ada2e02ce4c50856424ee1bfb1aec2b400;hb=a2c296335a7a7190f412ed7470619189bb30766f;hp=0000000000000000000000000000000000000000;hpb=20bfea3fd35252310456e125e8dfe948f6c675c2;p=dbsrgits%2FDBIx-Class.git diff --git a/maint/Makefile.PL.inc/56_autogen_schema_files.pl b/maint/Makefile.PL.inc/56_autogen_schema_files.pl new file mode 100644 index 0000000..446cc2a --- /dev/null +++ b/maint/Makefile.PL.inc/56_autogen_schema_files.pl @@ -0,0 +1,27 @@ +require File::Spec; +my $test_ddl_fn = File::Spec->catfile(qw( t lib sqlite.sql )); +my @test_ddl_cmd = qw( -I lib -I t/lib -- maint/gen_sqlite_schema_files --schema-class DBICTest::Schema ); + +# If the author doesn't have the prereqs, still generate a Makefile +# The EUMM build-stage generation will run unconditionally and +# errors will not be ignored unlike here +require DBIx::Class::Optional::Dependencies; +if ( DBIx::Class::Optional::Dependencies->req_ok_for ('deploy') ) { + print "Regenerating $test_ddl_fn\n"; + system( $^X, @test_ddl_cmd, '--ddl-out' => $test_ddl_fn ); + + # if we don't do it some git tools (e.g. gitk) get confused that the + # ddl file is modified, when it clearly isn't + system('git status --porcelain >' . File::Spec->devnull); +} + +postamble <<"EOP"; + +clonedir_generate_files : dbic_clonedir_regen_test_ddl + +dbic_clonedir_regen_test_ddl : +\t\$(ABSPERLRUN) @test_ddl_cmd --ddl-out @{[ $mm_proto->quote_literal($test_ddl_fn) ]} +EOP + +# keep the Makefile.PL eval happy +1;