You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by le...@apache.org on 2004/06/23 15:08:36 UTC
svn commit: rev 21606 - excalibur/trunk/site/scripts
Author: leosimons
Date: Wed Jun 23 06:08:35 2004
New Revision: 21606
Added:
excalibur/trunk/site/scripts/
excalibur/trunk/site/scripts/aggregate-dependencies.rb
excalibur/trunk/site/scripts/gen-site.sh
Log:
Work on autogenerating website
Added: excalibur/trunk/site/scripts/aggregate-dependencies.rb
==============================================================================
--- (empty file)
+++ excalibur/trunk/site/scripts/aggregate-dependencies.rb Wed Jun 23 06:08:35 2004
@@ -0,0 +1,143 @@
+def strip( xml )
+ result = xml.gsub( /<[^>]+>[^<>]*<\/[^>]+>/m, '' )
+ result.gsub!( /<[^>]+>/m, '' )
+ result.gsub!( /[\n\t ]/, '' )
+
+ return result
+end
+
+def extractArtifactId( dependency )
+ id = ''
+ if dependency.include? "artifactId" then
+ id = dependency.gsub( /\<artifactId\>([^<>]*)\<\/artifactId\>/, '\1' )
+ else
+ id = dependency.gsub( /\<id\>([^<>]*)\<\/id\>/, '\1' )
+ end
+
+ return strip( id )
+end
+
+def extractGroupId( dependency )
+ id = ''
+ if dependency.include? "groupId" then
+ id = dependency.gsub( /\<groupId\>([^<>]*)\<\/groupId\>/, '\1' )
+ else
+ id = dependency.gsub( /\<id\>([^<>]*)\<\/id\>/, '\1' )
+ end
+
+ return strip( id )
+end
+
+def extractVersion( dependency )
+ version = dependency.gsub( /\<version\>([^<>]*)\<\/version\>/, '\1' )
+ return strip( version )
+end
+
+def getDepList( project, depList )
+ dependencies = project[/\<dependencies\>.*\<\/dependencies\>/m]
+
+ if ! dependencies
+ return depList
+ end
+
+ dependencies.gsub!( /\<\!--.*?--\>/m, '' )
+
+ dependencies.split( /\<\/dependency\>/ ).each { |dependency|
+
+ artifact = extractArtifactId( dependency )
+ group = extractGroupId( dependency )
+ version = extractVersion( dependency )
+
+ #puts "found artifact " + artifact
+ #puts "current artifacts: " + result
+ #puts ""
+
+ if artifact.empty?
+ next
+ end
+
+ if depList.include? artifact
+ next
+ end
+
+ curr = " <dependency>\n" +
+ " <id>" + artifact + "</id>\n" +
+ " <version>" + version + "</version>\n"
+
+ if( artifact != group ) then
+ curr = curr +
+ " <groupId>" + group + "</groupId>\n"
+ end
+
+ curr = curr + " </dependency>\n"
+
+ depList = depList + curr + "\n"
+ }
+
+ return depList
+end
+
+def processFile( projectFile, dest, depList )
+ puts "processing " + projectFile
+
+ source = File.open( projectFile, 'r' )
+ project = source.read
+
+ newDepList = getDepList( project, depList )
+
+ return newDepList
+end
+
+def processAll( files )
+ count = 0
+ depFile = "project-all-deps.xml"
+ if FileTest.exist?( depFile )
+ depFile = depFile + ".new"
+ end
+ dest = File.open( depFile, 'w' )
+ dest.puts "<project>
+ <extend>${basedir}/../../../buildsystem/project-common.xml</extend>
+
+ <name>Apache Excalibur</name>
+ <id>excalibur-javadocs</id>
+
+ <shortDescription>Apache Excalibur</shortDescription>
+ <description>Apache Excalibur</description>
+
+ <reports>
+ <report>maven-clover-plugin</report>
+ <report>maven-junit-report-plugin</report>
+ <report>maven-javadoc-plugin</report>
+ </reports>
+
+ <dependencies>
+"
+ depList = ''
+
+ files.each { |path|
+ projectFile = path.gsub( /\n/, "" )
+ #projectFile.gsub!( /\.\//, "" )
+
+ depList = processFile( projectFile, dest, depList )
+ count = count + 1
+ }
+
+ dest.puts depList
+ dest.puts "
+ </dependencies>
+</project>
+"
+
+ return count
+end
+
+ # runs the processor
+ def main()
+ files = `find .. -type f -name 'project.xml' ! -path '*site*' ! -path '*bean*' -maxdepth 4`
+ count = processAll( files )
+
+ puts "transformed #{count} files.\n"
+ end
+
+ main()
+
Added: excalibur/trunk/site/scripts/gen-site.sh
==============================================================================
--- (empty file)
+++ excalibur/trunk/site/scripts/gen-site.sh Wed Jun 23 06:08:35 2004
@@ -0,0 +1,27 @@
+# clean up
+rm -Rf target
+
+# create site
+#maven site
+
+# create merged source tree
+mkdir -p target/base/src
+find .. -path '*/src' ! -path '*site*' -exec echo \{\}/* \; | cat > target/src.txt
+rsync -r --exclude='*.svn*' `cat target/src.txt` target/base/src/
+
+# create merged project.xml
+ruby scripts/aggregate-dependencies.rb
+mv project-all-deps.xml target/base/project.xml
+
+cd target/base
+
+# run merged tests
+# run merged clover
+# create merged javadocs
+maven site
+
+# copy merged data into main tree
+cd ../..
+mkdir -p target/docs
+cp -r target/base/target/docs/apidocs target/docs
+cp -r target/base/target/docs/clover target/docs
---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org