446cc2ada2e02ce4c50856424ee1bfb1aec2b400
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 56_autogen_schema_files.pl
1 require File::Spec;
2 my $test_ddl_fn = File::Spec->catfile(qw( t lib sqlite.sql ));
3 my @test_ddl_cmd = qw( -I lib -I t/lib -- maint/gen_sqlite_schema_files --schema-class DBICTest::Schema );
4
5 # If the author doesn't have the prereqs, still generate a Makefile
6 # The EUMM build-stage generation will run unconditionally and
7 # errors will not be ignored unlike here
8 require DBIx::Class::Optional::Dependencies;
9 if ( DBIx::Class::Optional::Dependencies->req_ok_for ('deploy') ) {
10   print "Regenerating $test_ddl_fn\n";
11   system( $^X, @test_ddl_cmd, '--ddl-out' => $test_ddl_fn );
12
13   # if we don't do it some git tools (e.g. gitk) get confused that the
14   # ddl file is modified, when it clearly isn't
15   system('git status --porcelain >' . File::Spec->devnull);
16 }
17
18 postamble <<"EOP";
19
20 clonedir_generate_files : dbic_clonedir_regen_test_ddl
21
22 dbic_clonedir_regen_test_ddl :
23 \t\$(ABSPERLRUN) @test_ddl_cmd --ddl-out @{[ $mm_proto->quote_literal($test_ddl_fn) ]}
24 EOP
25
26 # keep the Makefile.PL eval happy
27 1;