[Squirrel-sql-commits] mavenize mavenize.pl,1.6,1.7
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
From: Rob M. <man...@us...> - 2009-09-04 23:28:13
|
Update of /cvsroot/squirrel-sql/mavenize In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14993 Modified Files: mavenize.pl Log Message: Heavily refactored to work with the new SVN repository. This will now only work correctly with the SVN repo that was setup last weekend. But it does manage to produce a clean build. Index: mavenize.pl =================================================================== RCS file: /cvsroot/squirrel-sql/mavenize/mavenize.pl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mavenize.pl 30 Aug 2009 21:29:23 -0000 1.6 --- mavenize.pl 4 Sep 2009 23:28:02 -0000 1.7 *************** *** 22,27 **** ################################################################################################ - $SVN_DELETE_UNUSED_RESOURCES=0; - $mavenizeDir = `pwd`; $mavenizeDir =~ s/\s//g; --- 22,25 ---- *************** *** 186,193 **** # Miscellaneous ! print ! "Installing L&F Plugin Assembly ($mavenizeDir/laf-plugin/laf-plugin-assembly.xml) in $lafPluginDir/src/main/resources/assemblies\n"; ! `mkdir -p $lafPluginDir/src/main/resources/assemblies`; ! `cp $mavenizeDir/laf-plugin/laf-plugin-assembly.xml $lafPluginDir/src/main/resources/assemblies`; # End of script; Begin Subroutines --- 184,188 ---- # Miscellaneous ! installLafPluginAssembly(); # End of script; Begin Subroutines *************** *** 254,258 **** sub wanted_for_source { ! if ( $_ =~ /^plugin_build.xml$/ ) { chdir('./src') or die "Couldn't change to src directory in $File::Find::dir : $!\n"; print "Removing main directory in $File::Find::dir\n"; --- 249,254 ---- sub wanted_for_source { ! if ( $_ =~ /^plugin_build.xml$/) { ! chdir('./src') or die "Couldn't change to src directory in $File::Find::dir : $!\n"; print "Removing main directory in $File::Find::dir\n"; *************** *** 261,265 **** # Java source files into src/main/java ! findAndCopyJava(); # Properties files into src/main/resources --- 257,261 ---- # Java source files into src/main/java ! findAndCopyJava(); # Properties files into src/main/resources *************** *** 273,277 **** # *.png image files into src/main/resources ! findAndCopyResources('*.png'); chdir($File::Find::dir) or die "Couldn't change dir back to $File::Find::dir: $!\n"; --- 269,273 ---- # *.png image files into src/main/resources ! findAndCopyResources('*.png'); chdir($File::Find::dir) or die "Couldn't change dir back to $File::Find::dir: $!\n"; *************** *** 280,284 **** findAndCopyDoc($File::Find::dir); } ! chdir($File::Find::dir) or die "Couldn't change dir back to $File::Find::dir: $!\n"; } --- 276,280 ---- findAndCopyDoc($File::Find::dir); } ! chdir($File::Find::dir) or die "Couldn't change dir back to $File::Find::dir: $!\n"; } *************** *** 294,304 **** return; } $package = getPackageFromFile($File::Find::name); @parts = split /src/, $File::Find::name; if ( $parts[0] =~ /app\/$/ ) { ! #print "Found an app package: $package\n\tfor $File::Find::name\n"; $packagemap->{$package} = "app"; --- 290,303 ---- return; } + $package = getPackageFromFile($File::Find::name); + print "wanted_for_packagemap: javafile: $_ (package=$package)\n"; + @parts = split /src/, $File::Find::name; if ( $parts[0] =~ /app\/$/ ) { ! print "Found an app package: $package\n\tfor $File::Find::name\n"; $packagemap->{$package} = "app"; *************** *** 306,310 **** elsif ( $parts[0] =~ /fw\/$/ ) { ! #print "Found an fw package: $package\n\tfor $File::Find::name\n"; $packagemap->{$package} = "fw"; --- 305,309 ---- elsif ( $parts[0] =~ /fw\/$/ ) { ! print "Found an fw package: $package\n\tfor $File::Find::name\n"; $packagemap->{$package} = "fw"; *************** *** 312,316 **** elsif ( $File::Find::name =~ /plugins/ ) { ! #print "Found a plugin package: $package\n\tfor $File::Find::name\n"; $packagemap->{$package} = "plugin"; --- 311,315 ---- elsif ( $File::Find::name =~ /plugins/ ) { ! print "Found a plugin package: $package\n\tfor $File::Find::name\n"; $packagemap->{$package} = "plugin"; *************** *** 318,322 **** elsif ( $parts[0] =~ /build\/$/ ) { ! #print "Found a build package: $package\n\tfor $File::Find::name\n"; } --- 317,321 ---- elsif ( $parts[0] =~ /build\/$/ ) { ! print "Found a build package: $package\n\tfor $File::Find::name\n"; } *************** *** 348,353 **** --- 347,355 ---- return; } + $package = getPackageFromFile($File::Find::name); + print "wanted_for_testsources: \$_= $_ filename=$File::Find::name | package=$package\n"; + $category = $packagemap->{$package}; *************** *** 380,397 **** #print "copying test $File::Find::name to app folder $relativeDir\n"; ! `mkdir -p $appDir/src/test/java/$relativeDir`; ! `cp $File::Find::name $appDir/src/test/java/$relativeDir`; } elsif ( $category eq 'fw' ) { #print "copying test $File::Find::name to fw folder $relativeDir\n"; ! `mkdir -p $fwDir/src/test/java/$relativeDir`; ! `cp $File::Find::name $fwDir/src/test/java/$relativeDir`; } elsif ( $category eq 'plugin' ) { ! #if (! defined $onetimeonly) { ! #$onetimeonly = 1; ! #print "relativeDir: $relativeDir\n"; @parts = split /plugins\//, $relativeDir; $pluginName = $parts[1]; --- 382,398 ---- #print "copying test $File::Find::name to app folder $relativeDir\n"; ! svnmkdir("$appDir/src/test/java/$relativeDir"); ! ! `svn move $File::Find::name $appDir/src/test/java/$relativeDir`; } elsif ( $category eq 'fw' ) { #print "copying test $File::Find::name to fw folder $relativeDir\n"; ! svnmkdir("$fwDir/src/test/java/$relativeDir"); ! `svn move $File::Find::name $fwDir/src/test/java/$relativeDir`; } elsif ( $category eq 'plugin' ) { ! print "relativeDir: $relativeDir\n"; @parts = split /plugins\//, $relativeDir; $pluginName = $parts[1]; *************** *** 402,414 **** } print "pluginName: $pluginName\n"; - `mkdir -p $pluginsDir/$pluginName/src/test/java/$relativeDir`; - `cp $File::Find::name $pluginsDir/$pluginName/src/test/java/$relativeDir`; - print "Copied $File::Find::name to $pluginsDir/$pluginName/src/test/java/$relativeDir\n"; ! #} } } sub getPackageFromFile { $file = shift; --- 403,433 ---- } print "pluginName: $pluginName\n"; ! ! svnmkdir("$pluginsDir/$pluginName/src/test/java/$relativeDir"); ! `svn add $pluginsDir/$pluginName/src/test`; ! `svn move $File::Find::name $pluginsDir/$pluginName/src/test/java/$relativeDir`; } } + sub svnmkdir { + my $absolutepath = shift; + + `svn mkdir --parents $absolutepath`; + + # my @parts = split /\//, $absolutepath; + # + # my $curpath; + # for $part (@parts) { + # $curpath .= $part . '/'; + # if (! -e $curpath) { + # print "Path: $curpath doesn't exist. Creating it with SVN\n"; + # `svn mkdir --quiet $curpath`; + # } + # } + + } + sub getPackageFromFile { $file = shift; *************** *** 444,451 **** `rm -rf $pluginsDir/squirrelsql-plugins-assembly-descriptor`; ! `cp -r squirrelsql-plugins-assembly-descriptor $pluginsDir`; `rm -rf $pluginsDir/squirrelsql-plugins-parent-pom`; ! `cp -r squirrelsql-plugins-parent-pom $pluginsDir`; chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; --- 463,474 ---- `rm -rf $pluginsDir/squirrelsql-plugins-assembly-descriptor`; ! `cp -r $mavenizeDir/squirrelsql-plugins-assembly-descriptor $pluginsDir`; `rm -rf $pluginsDir/squirrelsql-plugins-parent-pom`; ! `cp -r $mavenizeDir/squirrelsql-plugins-parent-pom $pluginsDir`; ! ! chdir($pluginsDir) or die "Couldn't change directory to $pluginsDir: $!\n"; ! `svn add squirrelsql-plugins-assembly-descriptor`; ! `svn add squirrelsql-plugins-parent-pom`; chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; *************** *** 460,469 **** # create maven directories ! `mkdir -p $fwDir/src/main`; ! `mkdir -p $fwDir/src/test/resources`; ! `mkdir -p $fwDir/src/test/java`; ! `cp fw-pom.xml $fwDir/pom.xml`; ! `cp test-log4j.properties $fwDir/src/test/resources/log4j.properties`; chdir("$fwDir/src") or die "Couldn't change directory to $fwDir/src: $!\n"; --- 483,492 ---- # create maven directories ! svnmkdir("$fwDir/src/main"); ! svnmkdir("$fwDir/src/test/resources"); ! svnmkdir("$fwDir/src/test/java"); ! `cp $mavenizeDir/fw-pom.xml $fwDir/pom.xml`; ! `cp $mavenizeDir/test-log4j.properties $fwDir/src/test/resources/log4j.properties`; chdir("$fwDir/src") or die "Couldn't change directory to $fwDir/src: $!\n"; *************** *** 476,505 **** findAndCopyResources('*.png'); ! $SVN_DELETE_UNUSED_RESOURCES && `svn delete net`; chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; } - sub findAndCopyJava { - print "Copying source files from src/... to /src/main/java...\n"; - `find . -name *.java -printf "%h\n" | grep -v "^./main/" | grep -v ".svn" | uniq | sort | xargs -i mkdir -p ./main/java/{}`; - `find . -type f -name *.java -print | grep -v "^./main/" | grep -v ".svn" | uniq | sort | xargs -i cp {} ./main/java/{}`; - } - - sub findAndCopyResources { - my $fileType = shift; - `find . -name $fileType -printf "%h\n" | grep -v "^./main/" | grep -v ".svn" | xargs -i mkdir -p main/resources/{}`; - `find . -type f -name $fileType -print | grep -v "^./main/" | grep -v ".svn" | xargs -i cp {} main/resources/{}`; - } - - sub findAndCopyDoc { - my $baseDir = shift; - print "findAndCopyDoc: Copying documentation files from $baseDir/doc/... to $baseDir/src/main/resources/doc...\n"; - chdir("$baseDir/doc") or die "findAndCopyDoc: Couldn't chdir to $baseDir: $!\n"; - `find . -type f -printf "%h\n" | grep -v "^./main/" | grep -v ".svn" | uniq | sort | xargs -i mkdir -p $baseDir/src/main/resources/doc/{}`; - `find . -type f -print | grep -v "^./main/" | grep -v ".svn" | uniq | sort | xargs -i cp {} $baseDir/src/main/resources/doc/{}`; - } - - sub restructureAppModule { --- 499,509 ---- findAndCopyResources('*.png'); ! `svn add --quiet main`; ! `svn add --quiet test`; ! `svn delete net`; chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; } sub restructureAppModule { *************** *** 511,517 **** `cp app-pom.xml $appDir/pom.xml`; ! `mkdir -p $appDir/src/main/java`; ! `mkdir -p $appDir/src/main/resources`; ! `mkdir -p $appDir/src/test/java`; chdir("$appDir/src") or die "Couldn\'t change directory to $appDir/src: $!\n"; --- 515,521 ---- `cp app-pom.xml $appDir/pom.xml`; ! svnmkdir("$appDir/src/main/java"); ! svnmkdir("$appDir/src/main/resources"); ! svnmkdir("$appDir/src/test/java"); chdir("$appDir/src") or die "Couldn\'t change directory to $appDir/src: $!\n"; *************** *** 520,523 **** --- 524,528 ---- print "Restructuring fw resources\n"; + findAndCopyResources('*.properties'); findAndCopyResources('*.gif'); *************** *** 526,534 **** findAndCopyResources('*.jpg'); ! $SVN_DELETE_UNUSED_RESOURCES && `svn delete net`; chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; } sub copyInstallerProjects { --- 531,566 ---- findAndCopyResources('*.jpg'); ! `svn delete net`; ! `svn add test`; chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; } + sub findAndCopyJava { + print "Copying source files from src/... to /src/main/java...\n"; + `find . -name *.java -printf "%h\n" | grep -v "^./main/" | grep -v "^./test/" | grep -v ".svn" | uniq | sort | xargs -ti svn mkdir --parents ./main/java/{}`; + `svn add --quiet main`; + `find main -type d | grep -v .svn | sort | xargs -ti svn add --quiet {}`; + `find . -type f -name *.java -print | grep -v "^./main/" | grep -v "^./test/" | grep -v ".svn" | uniq | sort | xargs -ti svn move {} ./main/java/{}`; + } + + sub findAndCopyResources { + my $fileType = shift; + `find . -name $fileType -printf "%h\n" | grep -v "^./main/" | grep -v "^./test/" | grep -v ".svn" | uniq | xargs -ti mkdir -p main/resources/{}`; + `svn add --quiet main`; + `find main -type d | grep -v .svn | sort | xargs -ti svn add --quiet {}`; + `find . -type f -name $fileType -print | grep -v "^./main/" | grep -v "^./test/" | grep -v ".svn" | uniq | xargs -ti svn move {} main/resources/{}`; + } + + sub findAndCopyDoc { + my $baseDir = shift; + print + "findAndCopyDoc: moving documentation files from $baseDir/doc/... to $baseDir/src/main/resources/doc...\n"; + chdir("$baseDir/doc") or die "findAndCopyDoc: Couldn't chdir to $baseDir: $!\n"; + `find . -type f -printf "%h\n" | grep -v "^./main/" | grep -v ".svn" | uniq | sort | xargs -i mkdir -p $baseDir/src/main/resources/doc/{}`; + `svn add $baseDir/src/main/resources/doc/`; + `find . -type f -print | grep -v "^./main/" | grep -v ".svn" | uniq | sort | xargs -ti svn move {} $baseDir/src/main/resources/doc/{}`; + } + sub copyInstallerProjects { *************** *** 538,546 **** `rm -rf $installerDir`; `mkdir -p $installerDir`; ! `cp -r squirrelsql-java-version-checker $installerDir`; ! `cp -r squirrelsql-launcher $installerDir`; ! `cp -r squirrelsql-other-installer $installerDir`; ! `cp installer-pom.xml $installerDir/pom.xml`; } --- 570,582 ---- `rm -rf $installerDir`; `mkdir -p $installerDir`; ! `cp -r $mavenizeDir/squirrelsql-java-version-checker $installerDir`; ! `cp -r $mavenizeDir/squirrelsql-launcher $installerDir`; ! `cp -r $mavenizeDir/squirrelsql-other-installer $installerDir`; ! `cp $mavenizeDir/installer-pom.xml $installerDir/pom.xml`; + chdir($topDir); + `svn add installer`; + + chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; } *************** *** 551,556 **** print "Copying in translations project\n"; `rm -rf $topDir/squirrelsql-translations`; ! `cp -r squirrelsql-translations $topDir`; } --- 587,596 ---- print "Copying in translations project\n"; `rm -rf $topDir/squirrelsql-translations`; ! `cp -r $mavenizeDir/squirrelsql-translations $topDir`; + chdir($topDir); + `svn add squirrelsql-translations`; + + chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; } *************** *** 564,576 **** chdir("$docDir") or die "Couldn't change directory to $docDir: $!\n"; ! `cp *.txt $docDir/src/main/resources/`; ! `cp *.html $docDir/src/main/resources/`; ! `cp *.css $docDir/src/main/resources/`; ! ! `cp ./images/* $docDir/src/main/resources/`; ! ! `cp ./licences/* $docDir/src/main/resources/`; ! $SVN_DELETE_UNUSED_RESOURCES && `svn delete *.txt *.html *.css images licences`; chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; --- 604,616 ---- chdir("$docDir") or die "Couldn't change directory to $docDir: $!\n"; ! `svn add pom.xml`; ! `svn add src`; ! print "Creating directories beneath src/main/resources"; ! `find . -type f -printf "%h\n" | grep -v .svn| grep -v pom.xml | grep -v target | uniq | sort | xargs -ti mkdir -p src/main/resources/{}`; ! print "Adding directories beneath src/main/resources to subversion"; ! `find src -type d | egrep -v "\.svn" | uniq | sort | xargs -ti svn add --quiet {}`; ! print "Moving files in subversion to src/main/resources/..."; ! `find . -type f -print | grep -v .svn | grep -v pom.xml | grep -v target | uniq | sort | xargs -ti svn move {} src/main/resources/{}`; chdir($mavenizeDir) or die "Couldn't change directory to $mavenizeDir: $!\n"; *************** *** 618,619 **** --- 658,669 ---- close(MODULEPOMFILE); } + + sub installLafPluginAssembly { + + my $lafPluginAssemblyFile = "$mavenizeDir/laf-plugin/laf-plugin-assembly.xml"; + my $targetFolder = "$lafPluginDir/src/main/resources/assemblies"; + print "Installing L&F Plugin Assembly ($lafPluginAssemblyFile) in $targetFolder\n"; + `mkdir -p $lafPluginDir/src/main/resources/assemblies`; + `cp $lafPluginAssemblyFile $targetFolder`; + chdir($lafPluginDir) or die "Couldn't change dir to ($lafPluginDir): $!\n"; + } |