#!/usr/bin/perl # Write out a Makefile and a build.xml file based on the *.inputs files # in the current directory. Steve Wainstead, April 2001. # read in all the input files, loop over each one and build up # text blocks that we will subsitute into the skeletons for Makefile # and build.xml. # reqirements: # sun's java sdk, http://java.sun.com/j2se/ # httpunit, http://httpunit.sf.net # ant, http://jakarta.apache.org/builds/jakarta-ant/release/ # usage: # copy the httpunit jars to this path or add them to your CLASSPATH # fix the url below for your server # run makemakebuild.pl, this creates Makefile (gnu make) and build.xml (ant) # run make, this compiles the classes and runs ant. # if your classpath is wrong run ant separately to test. # run ant for each test. both ant and make can run independently. #my $my_wikiurl = 'http://reini/phpwiki/'; # this will replace steve's url below if defined #----------------------------------------- my $ori_wikiurl = 'http://127.0.0.1:8080/~swain/phpwiki/'; my @files = <*.inputs>; chomp(@files); # prolly unnecessary, but oh well. print "Found ", scalar(@files), " input files.\n"; foreach $inputfile (@files) { $inputfile =~ m/\.inputs$/; $javafile = "$`.java"; $classname = $`; if ($my_wikiurl and ($my_wikiurl ne $ori_wikiurl)) { local $/; open IN, "< $inputfile"; $contents = ; `perl -i.orig -pe 's|$ori_wikiurl|$my_wikiurl|' $inputfile` if $contents =~ m|$ori_wikiurl|; } $test_make_target_names .= "$javafile "; $test_make_targets .=<<"EOLN"; $javafile: $inputfile \tmaketest.pl $inputfile EOLN $test_ant_targets .= <<"EOLN"; EOLN push @test_dependency_names, $classname; } $test_dependency_names = join(',', @test_dependency_names); # print <<"SHOW_RESULTS"; # make's targets: $test_make_target_names # make's acutual targets: # $test_make_targets # ant's target names: $test_dependency_names # ant's targets: # $test_ant_targets # SHOW_RESULTS # these are the skeleton files for the Makefile and the build.xml file $makefile = < $test_ant_targets BUILDXML_SKEL print "Writing Makefile...\n"; open MAKEFILE, ">./Makefile" or die $!; print MAKEFILE $makefile; print "Writing build.xml...\n"; open BUILDXML, ">./build.xml" or die $!; print BUILDXML $buildxml; print "Done.\n";