summaryrefslogtreecommitdiff
path: root/qpid/cpp/rubygen/generate
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-07-27 21:32:16 +0000
committerAlan Conway <aconway@apache.org>2009-07-27 21:32:16 +0000
commit401607f0a25273441a04b1a058cf6f9c9143ea34 (patch)
tree225816de8df25ef5ad23cd1c5ce261ba55ea4a1c /qpid/cpp/rubygen/generate
parentd7a34316af75bb1757d56d48cc0972674479c4cb (diff)
downloadqpid-python-401607f0a25273441a04b1a058cf6f9c9143ea34.tar.gz
Separate generated public header files from non-public headers, generated code re-organization.
The gen/ directory has been removed, code is now generated into: $(builddir)/src - all .cpp files and non-public .h files. $(builddir)/include - all public .h files. The gen/ directory was originally intended to separate generated code from hand-written code. However both automake and cmake allow you to direct all build output, including generated code, into a separate build directory. In fact both recommend you build this way. Keeping the gen/ directory meant there would have been a total of 8 places to look for header files, all the combinations of builddir/srcdir, src/include and gen/no-gen. This was a mess, 4 is bad enough. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@798291 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/rubygen/generate')
-rwxr-xr-xqpid/cpp/rubygen/generate23
1 files changed, 12 insertions, 11 deletions
diff --git a/qpid/cpp/rubygen/generate b/qpid/cpp/rubygen/generate
index 0ce1fec46a..89b9b99520 100755
--- a/qpid/cpp/rubygen/generate
+++ b/qpid/cpp/rubygen/generate
@@ -25,15 +25,14 @@ require 'amqpgen'
#
if ARGV.size < 3
puts <<EOS
-Usage: #{ARGV[0]} OUTDIR SPEC.xml [ ... ] TEMPLATE.rb [ ... ]
-or: #{ARGV[0]} OUTDIR SPEC.xml [ ... ] all [ makefragment.mk |
- makefragment.cmake ]
+Usage: #{ARGV[0]} SRCDIR APIDIR SPEC.xml [ ... ] TEMPLATE.rb [ ... ]
+or: #{ARGV[0]} SRCDIR APIDIR SPEC.xml [ ... ] all [ makefragment.mk | makefragment.cmake ]
Parse all SPEC.xml files to create an AMQP model, run each TEMPLATE
-putting the resulting files under OUTDIR. Prints a list of files
-generated to standard output.
+putting the resulting files under SRCDIR, public API files in APIdir.
+Prints a list of files generated to standard output.
-If OUTDIR is '-' then just prints file list without generating files.
+If SRCDIR and APIDIR are '-' then just prints file list without generating files.
EOS
exit 1
end
@@ -58,15 +57,16 @@ gendir=File.dirname(__FILE__)
if ARGV.any? { |arg| arg=="all" }
templates=Dir["#{gendir}/*/*.rb"]
else
- templates=ARGV.grep(/\.rb$/)
+templates=ARGV.grep(/\.rb$/)
ARGV.each { |arg|
d=File.join gendir,arg
templates += Dir["#{d}/*.rb"] if File.directory? d
}
end
-$outdir=ARGV[0]
+$outdir=[ ARGV[0], ARGV[1] ]
$models=parse_specs(ARGV.grep(/\.xml$/))
+
templates.each { |t|
ver=Pathname.new(t).dirname.basename.to_s.split('.')[-1]
$amqp=$models[ver]
@@ -84,17 +84,18 @@ def make_continue(lines) lines.join(" \\\n "); end
makefile=ARGV.grep(/.mk$/)[0]
cmakefile=ARGV.grep(/.cmake$/)[0]
if cmakefile || makefile
+ srcdir,apidir=$outdir
dir=Dir.getwd
Dir.chdir File.dirname(__FILE__)
generator_files=Dir["**/*.rb"] << File.basename(__FILE__)
Dir.chdir dir
rgen_generator=generator_files.map{ |f| "$(rgen_dir)/#{f}" }
cmake_rgen_generator=generator_files.map{ |f| "${rgen_dir}/#{f}" }
- rgen_srcs=GenFiles.get.map{ |f| "#{$outdir}/#{f}" }
+ rgen_srcs=GenFiles.get.map{ |f| "#{GenFiles.public_api?(f) ? apidir : srcdir}/#{f}" }
rgen_subdirs={}
rgen_srcs.each { |src|
- if src.match(%r{#{$outdir}/qpid/([^/]+)/})
- subdir=$1
+ if src.match(%r{(#{srcdir}|#{apidir})/qpid/([^/]+)/})
+ subdir=$2
rgen_subdirs[subdir] ||= []
rgen_subdirs[subdir] << src
end