Stop loading Time::HiRes in the base test schema - there is no need
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 56_autogen_schema_files.pl
CommitLineData
a2c29633 1require File::Spec;
6635c6d2 2my $test_ddl_fn = File::Spec->catfile(qw( t lib sqlite.sql ));
c0329273 3my @test_ddl_cmd = qw( -I lib -Mt::lib::ANFANG -- maint/gen_sqlite_schema_files --schema-class DBICTest::Schema );
6635c6d2 4
5my $example_ddl_fn = File::Spec->catfile(qw( examples Schema db example.sql ));
6my $example_db_fn = File::Spec->catfile(qw( examples Schema db example.db ));
7my @example_ddl_cmd = qw( -I lib -I examples/Schema -- maint/gen_sqlite_schema_files --schema-class MyApp::Schema );
8my @example_pop_cmd = qw( -I lib -I examples/Schema -- examples/Schema/insertdb.pl );
a2c29633 9
10# If the author doesn't have the prereqs, still generate a Makefile
11# The EUMM build-stage generation will run unconditionally and
12# errors will not be ignored unlike here
13require DBIx::Class::Optional::Dependencies;
14if ( DBIx::Class::Optional::Dependencies->req_ok_for ('deploy') ) {
15 print "Regenerating $test_ddl_fn\n";
16 system( $^X, @test_ddl_cmd, '--ddl-out' => $test_ddl_fn );
17
6635c6d2 18 print "Regenerating $example_ddl_fn and $example_db_fn\n";
19 system( $^X, @example_ddl_cmd, '--ddl-out' => $example_ddl_fn, '--deploy-to' => $example_db_fn );
20
21 print "Populating $example_db_fn\n";
22 system( $^X, @example_pop_cmd );
23
a2c29633 24 # if we don't do it some git tools (e.g. gitk) get confused that the
25 # ddl file is modified, when it clearly isn't
26 system('git status --porcelain >' . File::Spec->devnull);
27}
28
29postamble <<"EOP";
30
31clonedir_generate_files : dbic_clonedir_regen_test_ddl
32
33dbic_clonedir_regen_test_ddl :
34\t\$(ABSPERLRUN) @test_ddl_cmd --ddl-out @{[ $mm_proto->quote_literal($test_ddl_fn) ]}
6635c6d2 35\t\$(ABSPERLRUN) @example_ddl_cmd --ddl-out @{[ $mm_proto->quote_literal($example_ddl_fn) ]} --deploy-to @{[ $mm_proto->quote_literal($example_db_fn) ]}
36\t\$(ABSPERLRUN) @example_pop_cmd
a2c29633 37EOP
38
39# keep the Makefile.PL eval happy
401;