<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>trunk/as2api</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1"><span id="added">api_diff.rb</span></a></tt></td><td align="right" id="added">+279</td><td></td><td nowrap="nowrap" align="right">added <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_diff.rb?rev=218&content-type=text/vnd.viewcvs-markup">218</a></td></tr>
<tr class="alt"><td><tt><a href="#file2">api_model.rb</a></tt></td><td align="right" id="added">+4</td><td></td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_model.rb?rev=217&content-type=text/vnd.viewcvs-markup">217</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_model.rb.diff?r1=217&r2=218">-></a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_model.rb?rev=218&content-type=text/vnd.viewcvs-markup">218</a></td></tr>
<tr><td><tt><a href="#file3"><span id="added">html_diff_output.rb</span></a></tt></td><td align="right" id="added">+282</td><td></td><td nowrap="nowrap" align="right">added <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_diff_output.rb?rev=218&content-type=text/vnd.viewcvs-markup">218</a></td></tr>
<tr class="alt"><td><tt>ui/<a href="#file4">cli.rb</a></tt></td><td align="right" id="added">+24</td><td align="right" id="removed">-6</td><td nowrap="nowrap" align="center"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/ui/cli.rb?rev=217&content-type=text/vnd.viewcvs-markup">217</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/ui/cli.rb.diff?r1=217&r2=218">-></a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/ui/cli.rb?rev=218&content-type=text/vnd.viewcvs-markup">218</a></td></tr>
<tr><td></td><td align="right" id="added">+589</td><td align="right" id="removed">-6</td><td></td></tr>
</table>
<small id="info">2 added + 2 modified, total 4 files</small><br />
<div class="tasklist"><ul>
<li><a href="#task1">TODO: handle class>interface, interface>class changes</a></li>
<li><a href="#task2">TODO: smells like an enumeration (RO, WO, RW) is needed,</a></li>
<li><a href="#task3">TODO: pass the ASTypes instead</a></li>
<li><a href="#task4">TODO</a></li>
<li><a href="#task5">TODO</a></li>
<li><a href="#task6">TODO</a></li>
</ul></div>
<pre class="comment">
Very early support for documenting the changes between two API versions.
This is inspired by <<a href="http://jdiff.sf.net/>">http://jdiff.sf.net/></a>;, but the output and implementation
are nowhere near as nice yet.
To use, the new --oldrev-classpath command line option should a an exact copy
of the --classpath option, but pointing at the location of the 'old' revision
of the classes. Both versions of the classes will be parsed, and some
additional HTML files will appear in the 'changes' subdirectory of the
documentation.
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added"><a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk">trunk</a>/<a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api">as2api</a></span><br />
<div class="fileheader" id="added"><big><b>api_diff.rb</b></big> <small id="info">added at <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_diff.rb?rev=218&content-type=text/vnd.viewcvs-markup">218</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/api_diff.rb        2005-08-06 16:58:08 UTC (rev 217)
+++ trunk/as2api/api_diff.rb        2005-08-07 16:38:28 UTC (rev 218)
@@ -0,0 +1,279 @@
</small></pre><pre class="diff" id="added">+
+
+class APIDiff
+ def diff(old, new)
+ added_packages, removed_packages, oldpkg_to_newpkg = diff_lists(old.packages, new.packages) {|old,new| old.name==new.name}
+
+ modified_packages = diff_map(oldpkg_to_newpkg, :diff_package)
+
+ if added_packages.empty? && removed_packages.empty? && modified_packages.empty?
+ nil
+ else
+ APIChanges.new(added_packages, removed_packages, modified_packages)
+ end
+ end
+
+ private
+
+ def diff_lists(oldlist, newlist)
+ removed = []
+ matching = {}
+
+ oldlist.each do |oldval|
+ newval = newlist.detect {|a| yield oldval,a}
+ if newval
+        matching[oldval] = newval
+ else
+        removed << oldval
+ end
+ end
+
+ added = newlist - matching.values
+
+ [added, removed, matching]
+ end
+
+ def find_package(packages, name)
+ packages.detect {|pkg| pkg.name == name}
+ end
+
+ def diff_map(old_to_new, diff_method_sym)
+ result = []
+ old_to_new.each do |oldval, newval|
+ change = send(diff_method_sym, oldval, newval)
+ result << change if change
+ end
+ result
+ end
+
+ def diff_package(oldpkg, newpkg)
+ added_types, removed_types, old_to_new = diff_lists(oldpkg.types, newpkg.types) {|old,new| old.unqualified_name==new.unqualified_name}
+
+ modified_types = diff_map(old_to_new, :diff_type)
+ if added_types.empty? && removed_types.empty? && modified_types.empty?
+ nil
+ else
+ PackageChanges.new(newpkg.name, added_types, removed_types, modified_types)
+ end
+ end
+
+ def diff_type(old_type, new_type)
<a name="task1" />+ # <span class="task">TODO</span>: handle class>interface, interface>class changes
+ if old_type.is_a?(ASClass) && new_type.is_a?(ASClass)
+ added_fields, removed_fields, old_to_new_fields = diff_lists(old_type.fields, new_type.fields) {|old,new| old.name==new.name}
+ modified_fields = diff_map(old_to_new_fields, :diff_field)
+ else
+ added_fields = removed_fields = modified_fields = nil
+ end
+
+ added_methods, removed_methods, old_to_new_methods = diff_lists(old_type.methods, new_type.methods) {|old,new| old.name==new.name}
+ modified_methods = diff_map(old_to_new_methods, :diff_method)
+
+ if added_methods.empty? && removed_methods.empty? && (new_type.is_a?(ASInterface) || new_type.is_a?(ASClass) && modified_methods.empty? && added_fields.empty? && removed_fields.empty? && modified_fields.empty?)
+ nil
+ else
+ TypeChanges.new(new_type, added_methods, removed_methods, modified_methods, added_fields, removed_fields, modified_fields)
+ end
+ end
+
+ def diff_field(old_field, new_field)
+ visibility_change, static_change = diff_access(old_field.access, new_field.access)
+ type_change = diff_typesig(old_field.field_type, new_field.field_type)
+ readwrite_change = diff_field_readwrite(old_field, new_field)
+
+ if visibility_change || static_change || type_change || readwrite_change
+ FieldChange.new(new_field.name, visibility_change, static_change, type_change, readwrite_change)
+ else
+ nil
+ end
+ end
+
+ def diff_method(old_method, new_method)
+ visibility_change, static_change = diff_access(old_method.access, new_method.access)
+ type_change = diff_typesig(old_method.return_type, new_method.return_type)
+ args_change = diff_args(old_method.arguments, new_method.arguments)
+ if visibility_change || static_change || type_change || args_change
+ MethodChange.new(new_method.name, visibility_change, static_change, type_change, args_change)
+ else
+ nil
+ end
+ end
+
+ def diff_access(old_access, new_access)
+ visibility_change = diff_visibility(old_access.visibility, new_access.visibility)
+ static_change = diff_static(old_access.is_static, new_access.is_static)
+ [visibility_change, static_change]
+ end
+
+ def diff_visibility(old_visibility, new_visibility)
+ old_vis = old_visibility.body
+ new_vis = new_visibility.body
+ if old_vis != new_vis
+ VisibilityChange.new(old_vis, new_vis)
+ else
+ nil
+ end
+ end
+
+ def diff_static(old_flag, new_flag)
+ if old_flag != new_flag
+ StaticChange.new(old_flag, new_flag)
+ else
+ nil
+ end
+ end
+
+ def diff_field_readwrite(old_field, new_field)
<a name="task2" />+ # <span class="task">TODO</span>: smells like an enumeration (RO, WO, RW) is needed,
+ if old_field.read? != new_field.read? || old_field.write? != new_field.write?
+ ReadWriteChange.new(old_field.read?, new_field.read?, old_field.write?, new_field.write?)
+ else
+ nil
+ end
+ end
+
+ def diff_typesig(old_type, new_type)
+ if old_type.nil?
+ old_type_name = nil
+ else
+ old_type_name = old_type.resolved_type.qualified_name
+ end
+ if new_type.nil?
+ new_type_name = nil
+ else
+ new_type_name = new_type.resolved_type.qualified_name
+ end
+ if old_type_name != new_type_name
+ TypeSigChange.new(old_type_name, new_type_name)
+ end
+ end
+
+ def args_differ?(old_args, new_args)
+ return true if old_args.length != new_args.length
+
+ old_args.each_with_index do |arg, i|
+ return true unless arg.name == new_args[i].name && arg_type_name(arg.arg_type) == arg_type_name(new_args[i].arg_type)
+ end
+
+ false
+ end
+
+ def arg_type_name(arg_type)
+ return nil if arg_type.nil?
+ arg_type.resolved_type.qualified_name
+ end
+
+ def diff_args(old_args, new_args)
+ if args_differ?(old_args, new_args)
+ ArgumentChange.new(old_args, new_args)
+ else
+ nil
+ end
+ end
+end
+
+
+class APIChanges
+ def initialize(added_packages, removed_packages, modified_packages)
+ @added_packages = added_packages
+ @removed_packages = removed_packages
+ @modified_packages = modified_packages
+ end
+
+ attr_accessor :added_packages, :removed_packages, :modified_packages
+end
+
+
+class PackageChanges
+ def initialize(name, added_types, removed_types, modified_types)
+ @name = name
+ @added_types = added_types
+ @removed_types = removed_types
+ @modified_types = modified_types
+ end
+
+ attr_accessor :name, :added_types, :removed_types, :modified_types
+end
+
+class TypeChanges
+ def initialize(new_type, added_methods, removed_methods, modified_methods, added_fields, removed_fields, modified_fields)
+ @new_type = new_type
+ @added_methods = added_methods
+ @removed_methods = removed_methods
+ @modified_methods = modified_methods
+ @added_fields = added_fields
+ @removed_fields = removed_fields
+ @modified_fields = modified_fields
+ end
+
+ attr_accessor :new_type, :added_methods, :removed_methods, :modified_methods, :added_fields, :removed_fields, :modified_fields
+end
+
+class VisibilityChange
+ def initialize(old_vis, new_vis)
+ @old_vis = old_vis
+ @new_vis = new_vis
+ end
+
+ attr_accessor :old_vis, :new_vis
+end
+
+
+class FieldChange
+ def initialize(name, visibility_change, static_change, type_change, readwrite_change)
+ @name = name
+ @visibility_change = visibility_change
+ @static_change = static_change
+ @type_change = type_change
+ @readwrite_change = readwrite_change
+ end
+
+ attr_accessor :name, :visibility_change, :static_change, :type_change, :readwrite_change
+end
+
+class MethodChange
+ def initialize(name, visibility_change, static_change, type_change, args_change)
+ @name = name
+ @visibility_change = visibility_change
+ @static_change = static_change
+ @type_change = type_change
+ @args_change = args_change
+ end
+
+ attr_accessor :name, :visibility_change, :static_change, :type_change, :args_change
+end
+
+class StaticChange
+ def initialize(old_flag, new_flag)
+ @old_flag = old_flag
+ @new_flag = new_flag
+ end
+
+ attr_accessor :old_flag, :new_flag
+end
+
+
+class ReadWriteChange
+ def initialize(old_read, new_read, old_write, new_write)
+ @old_read = old_read
+ @new_read = new_read
+ @old_write = old_write
+ @new_write = new_write
+ end
+
+ attr_accessor :old_read, :new_read, :old_write, :new_write
+end
+
+class TypeSigChange
<a name="task3" />+ # <span class="task">TODO</span>: pass the ASTypes instead
+ def initialize(old_type_name, new_type_name)
+ @old_type_name = old_type_name
+ @new_type_name = new_type_name
+ end
+
+ attr_accessor :old_type_name, :new_type_name
+end
+
+ArgumentChange = Struct.new("ArgumentChange", :old_args, :new_args)
+
+# vim:shiftwidth=2:softtabstop=2
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname"><a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk">trunk</a>/<a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api">as2api</a></span><br />
<div class="fileheader"><big><b>api_model.rb</b></big> <small id="info"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_model.rb?rev=217&content-type=text/vnd.viewcvs-markup">217</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_model.rb.diff?r1=217&r2=218">-></a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/api_model.rb?rev=218&content-type=text/vnd.viewcvs-markup">218</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/api_model.rb        2005-08-06 16:58:08 UTC (rev 217)
+++ trunk/as2api/api_model.rb        2005-08-07 16:38:28 UTC (rev 218)
@@ -396,6 +396,10 @@
</small></pre><pre class="diff" id="context"> @types << type
end
</pre><pre class="diff" id="added">+ def types
+ @types
+ end
+
</pre><pre class="diff" id="context"> def each_type
@types.each do |type|
yield type
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname" id="added"><a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk">trunk</a>/<a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api">as2api</a></span><br />
<div class="fileheader" id="added"><big><b>html_diff_output.rb</b></big> <small id="info">added at <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/html_diff_output.rb?rev=218&content-type=text/vnd.viewcvs-markup">218</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/html_diff_output.rb        2005-08-06 16:58:08 UTC (rev 217)
+++ trunk/as2api/html_diff_output.rb        2005-08-07 16:38:28 UTC (rev 218)
@@ -0,0 +1,282 @@
</small></pre><pre class="diff" id="added">+
+require 'html_output'
+
+class BasicDiffPage < BasicPage
+
+ def summary_table(rows, caption)
+ summary_table_tr(rows, caption) do |row|
+ html_td do
+        yield row
+ end
+ end
+ end
+
+ def summary_table_tr(rows, caption)
+ unless rows.nil? || rows.empty?
+ html_table("class"=>"summary_list", "summary"=>"") do
+        html_caption(caption)
+        rows.each do |row|
+         html_tr do
+         yield row
+         end
+        end
+ end
+ end
+ end
+
+end
+
+class DiffOverviewPage < BasicDiffPage
+ def initialize(conf, api_changes)
+ super(conf, "change-summary", "changes")
+ @title = "API Change Overview"
+ @api_changes = api_changes
+ end
+
+ def generate_body_content
+ html_h1("API Change Overview")
+
+ unless @api_changes
+ html_p("No changes")
+ return
+ end
+
+ summary_table(@api_changes.added_packages, "Added Packages") do |as_package|
+ name = package_display_name_for(as_package)
+ href = File.join("..", package_link_for(as_package, "package-summary.html"))
+ html_a(name, {"href"=>href})
+ end
+
+ summary_table(@api_changes.modified_packages, "Modified Packages") do |as_package|
+ name = package_display_name_for(as_package)
+ href = package_link_for(as_package, "change-summary.html")
+ html_a(name, {"href", href})
+ end
+
+ summary_table(@api_changes.removed_packages, "Removed Packages") do |as_package|
+ name = package_display_name_for(as_package)
+ pcdata(name)
+ end
+ end
+
+ def navigation
+ html_ul("class"=>"main_nav") do
<a name="task4" />+ # <span class="task">TODO</span>
+ end
+ end
+end
+
+
+class PackageDiffIndexPage < BasicDiffPage
+ def initialize(conf, package_changes)
+ dir = File.join("changes", package_dir_for(package_changes))
+ super(conf, "change-summary", dir)
+ @title = "Package #{package_display_name_for(package_changes)} API Change Overview"
+ @package_changes = package_changes
+ end
+
+ def generate_body_content
+ html_h1(@title)
+
+ summary_table(@package_changes.added_types, "Added Types") do |as_type|
+ name = as_type.unqualified_name
+ pcdata(name)
+ end
+
+ summary_table(@package_changes.modified_types, "Modified Types") do |as_type|
+ name = as_type.new_type.unqualified_name
+ href = "#{name}.html"
+ html_a(name, {"href", href})
+ end
+
+ summary_table(@package_changes.removed_types, "Removed Types") do |as_type|
+ name = as_type.unqualified_name
+ pcdata(name)
+ end
+ end
+
+ def navigation
+ html_ul("class"=>"main_nav") do
<a name="task5" />+ # <span class="task">TODO</span>
+ end
+ end
+end
+
+
+class TypeDiffPage < BasicDiffPage
+ def initialize(conf, type_changes)
+ dir = File.join("changes", type_changes.new_type.package_name.gsub(/\./, "/"))
+ super(conf, type_changes.new_type.unqualified_name, dir)
+ @title = "#{type_changes.new_type.unqualified_name} API Change Overview"
+ @type_changes = type_changes
+ end
+
+ def generate_body_content
+ html_h1(@title)
+
+ summary_table(@type_changes.added_fields, "Added Fields") do |as_field|
+ pcdata(as_field.name)
+ end
+
+ summary_table_tr(@type_changes.modified_fields, "Modified Fields") do |field_changes|
+ html_td do
+        pcdata(field_changes.name)
+ end
+ html_td do
+        generate_visibility_change(field_changes)
+        generate_static_change(field_changes)
+        generate_type_change("Field", field_changes)
+        generate_readwrite_change(field_changes)
+ end
+ end
+
+ summary_table(@type_changes.removed_fields, "Removed Fields") do |as_field|
+ pcdata(as_field.name)
+ end
+
+ summary_table(@type_changes.added_methods, "Added Methods") do |as_method|
+ pcdata(as_method.name)
+ end
+
+ summary_table_tr(@type_changes.modified_methods, "Modified Methods") do |method_changes|
+ html_td do
+        pcdata(method_changes.name)
+ end
+ html_td do
+        generate_visibility_change(method_changes)
+        generate_static_change(method_changes)
+        generate_type_change("Return", method_changes)
+        generate_args_change(method_changes)
+ end
+ end
+
+ summary_table(@type_changes.removed_methods, "Removed Methods") do |as_method|
+ pcdata(as_method.name)
+ end
+ end
+
+ def generate_visibility_change(field_changes)
+ if field_changes.visibility_change
+ pcdata("Visibility changed from ")
+ html_code(field_changes.visibility_change.old_vis)
+ pcdata(" to ")
+ html_code(field_changes.visibility_change.new_vis)
+ pcdata(". ")
+ end
+ end
+
+ def generate_static_change(field_changes)
+ if field_changes.static_change
+ if field_changes.static_change.new_flag
+        pcdata("Is now ")
+ else
+        pcdata("Is no longer ")
+ end
+ html_code("static")
+ pcdata(". ")
+ end
+ end
+
+ def generate_type_name(name)
+ if name
+        html_code(name)
+ else
+        pcdata("unspecified")
+ end
+ end
+
+ def generate_type_change(kind, field_changes)
+ if field_changes.type_change
+ pcdata(kind)
+ pcdata(" type changed from ")
+ generate_type_name(field_changes.type_change.old_type_name)
+ pcdata(" to ")
+ generate_type_name(field_changes.type_change.new_type_name)
+ pcdata(". ")
+ end
+ end
+
+ def generate_readwrite_change(field_changes)
+ change = field_changes.readwrite_change
+ if change
+ if change.old_read != change.new_read
+        if change.new_read
+         pcdata("Is now readable")
+        else
+         pcdata("Is no longer readable")
+        end
+ end
+ if change.old_write != change.new_write
+        if change.new_write
+         pcdata("Is now writeable")
+        else
+         pcdata("Is no longer writeable")
+        end
+ end
+ end
+ end
+
+ def generate_args_change(method_changes)
+ changes = method_changes.args_change
+ if changes
+ pcdata("Argument list changed from ")
+ list_args(changes.old_args)
+ pcdata(" to ")
+ list_args(changes.new_args)
+ pcdata(".")
+ end
+ end
+
+ def list_args(args)
+ html_code do
+ pcdata("(")
+ first = true
+ args.each do |arg|
+        if first
+         first = false
+        else
+         pcdata(", ")
+        end
+        pcdata(arg.name)
+        if arg.arg_type
+         pcdata(":")
+         pcdata(arg.arg_type.name)
+        end
+ end
+ pcdata(")")
+ end
+ end
+
+ def navigation
+ html_ul("class"=>"main_nav") do
<a name="task6" />+ # <span class="task">TODO</span>
+ end
+ end
+end
+
+
+def make_diff_pages(conf, api_changes)
+ list = []
+
+ list << DiffOverviewPage.new(conf, api_changes)
+
+ if api_changes
+ api_changes.modified_packages.each do |package_changes|
+ list << PackageDiffIndexPage.new(conf, package_changes)
+
+ package_changes.modified_types.each do |type_changes|
+        list << TypeDiffPage.new(conf, type_changes)
+ end
+ end
+ end
+
+ list
+end
+
+def generate_diffs(conf, api_changes)
+ list = make_diff_pages(conf, api_changes)
+ create_all_pages(conf, list)
+end
+
+
+# vim:softtabstop=2:shiftwidth=2
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname"><a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk">trunk</a>/<a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api">as2api</a>/<a
href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/ui">ui</a></span><br />
<div class="fileheader"><big><b>cli.rb</b></big> <small id="info"><a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/ui/cli.rb?rev=217&content-type=text/vnd.viewcvs-markup">217</a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/ui/cli.rb.diff?r1=217&r2=218">-></a> <a href="http://svn.badgers-in-foil.co.uk/viewcvs.cgi/as2api/trunk/as2api/ui/cli.rb?rev=218&content-type=text/vnd.viewcvs-markup">218</a></small></div>
<pre class="diff"><small id="info">--- trunk/as2api/ui/cli.rb        2005-08-06 16:58:08 UTC (rev 217)
+++ trunk/as2api/ui/cli.rb        2005-08-07 16:38:28 UTC (rev 218)
@@ -3,9 +3,12 @@
</small></pre><pre class="diff" id="context"> require 'getoptlong'
require 'html_output'
require 'set'
</pre><pre class="diff" id="added">+require 'api_diff'
+require 'html_diff_output'
</pre><pre class="diff" id="context">
Conf = Struct.new(:output_dir,
:classpath,
</pre><pre class="diff" id="added">+ :oldrev_classpath,
</pre><pre class="diff" id="context">                  :package_filters,
                 :title,
                 :progress_listener,
</pre><pre class="diff"><small id="info">@@ -87,6 +90,7 @@
</small></pre><pre class="diff" id="context"> [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
[ "--output-dir", "-d", GetoptLong::REQUIRED_ARGUMENT ],
[ "--classpath", GetoptLong::REQUIRED_ARGUMENT ],
</pre><pre class="diff" id="added">+ [ "--oldrev-classpath", GetoptLong::REQUIRED_ARGUMENT ],
</pre><pre class="diff" id="context"> [ "--title", GetoptLong::REQUIRED_ARGUMENT ],
[ "--progress", GetoptLong::NO_ARGUMENT ],
[ "--encoding", GetoptLong::REQUIRED_ARGUMENT ],
</pre><pre class="diff"><small id="info">@@ -97,6 +101,7 @@
</small></pre><pre class="diff" id="context">
conf = Conf.new
conf.classpath = []
</pre><pre class="diff" id="added">+ conf.oldrev_classpath = []
</pre><pre class="diff" id="context"> conf.package_filters = []
conf.draw_diagrams = false
conf.dot_exe = "dot" # i.e. assume 'dot' is in our PATH
</pre><pre class="diff"><small id="info">@@ -107,6 +112,8 @@
</small></pre><pre class="diff" id="context">          conf.output_dir = File.expand_path(arg)
        when "--classpath"
         conf.classpath.concat(arg.split(File::PATH_SEPARATOR))
</pre><pre class="diff" id="added">+        when "--oldrev-classpath"
+         conf.oldrev_classpath.concat(arg.split(File::PATH_SEPARATOR))
</pre><pre class="diff" id="context">         when "--title"
         conf.title = arg
        when "--help"
</pre><pre class="diff"><small id="info">@@ -157,10 +164,10 @@
</small></pre><pre class="diff" id="context"> false
end
</pre><pre class="diff" id="removed">- def find_sources
</pre><pre class="diff" id="added">+ def find_sources(classpath)
</pre><pre class="diff" id="context"> result = []
ignored_packages = Set.new
</pre><pre class="diff" id="removed">- <span id="removedchars">@conf.</span>classpath.each do |path|
</pre><pre class="diff" id="added">+ classpath.each do |path|
</pre><pre class="diff" id="context"> found_sources = false
each_source(File.expand_path(path)) do |source|
        if process_file?(source)
</pre><pre class="diff"><small id="info">@@ -194,8 +201,8 @@
</small></pre><pre class="diff" id="context"> end
end
</pre><pre class="diff" id="removed">- def parse_all(files)
- type_agregator = GlobalTypeAggregator.new(@conf.classpath)
</pre><pre class="diff" id="added">+ def parse_all(files, classpath)
+ type_agregator = GlobalTypeAggregator.new(classpath)
</pre><pre class="diff" id="context"> @conf.progress_listener.parsing_sources(files.length) do
files.each_with_index do |file, index|
        @conf.progress_listener.parse_source(index, file)
</pre><pre class="diff"><small id="info">@@ -207,11 +214,22 @@
</small></pre><pre class="diff" id="context">
def main
@conf = parse_opts
</pre><pre class="diff" id="removed">- files = find_sources
</pre><pre class="diff" id="added">+ files = find_sources(@conf.classpath)
</pre><pre class="diff" id="context"> error("No source files matching specified packages") if files.empty?
</pre><pre class="diff" id="removed">- type_agregator = parse_all(files)
</pre><pre class="diff" id="added">+ type_agregator = parse_all(files<span id="addedchars">, @conf.classpath</span>)
</pre><pre class="diff" id="context"> type_agregator.resolve_types
document_types(@conf, type_agregator)
</pre><pre class="diff" id="added">+
+ unless @conf.oldrev_classpath.empty?
+ old_files = find_sources(@conf.oldrev_classpath)
+ error("No source files matching specified packages in oldrev-classpath") if old_files.empty?
+ old_type_agregator = parse_all(old_files, @conf.oldrev_classpath)
+ old_type_agregator.resolve_types
+ diff = APIDiff.new
+ api_changes = diff.diff(old_type_agregator, type_agregator)
+
+ generate_diffs(@conf, api_changes)
+ end
</pre><pre class="diff" id="context"> end
def usage
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.11</small></center>
</body></html>