Permalink
Browse files

Cleanups and improvements.

* Add -v/--version flag to print out version
* Add mirah/version.rb to hold version number
* Add --jvm flag to specify target JVM bytecode version
* Replace most Ruby-borne "Duby" constants with Mirah equivalents (Mirah-based code still needs to be fixed)
* Clean up formatting and wording of --help output
  • Loading branch information...
1 parent ab6b3a2 commit 8e357e9d8f7389376eab0133019e85d0ecc79561 @headius headius committed Dec 4, 2010
Showing with 379 additions and 340 deletions.
  1. +2 −2 Rakefile
  2. +1 −1 bin/mirah
  3. +1 −1 bin/mirahc
  4. +1 −1 bin/mirahp
  5. +2 −2 examples/appengine/Rakefile
  6. +4 −4 examples/plugins/appengine/Rakefile
  7. +6 −6 examples/plugins/appengine/lib/com/google/appengine/ext/duby/db/datastore.rb
  8. +1 −1 examples/simple_class.mirah
  9. +2 −2 examples/swing.mirah
  10. +2 −2 examples/wiki/Rakefile
  11. +86 −50 lib/mirah.rb
  12. +2 −2 lib/mirah/appengine_tasks.rb
  13. +9 −9 lib/mirah/ast.rb
  14. +4 −4 lib/mirah/ast/call.rb
  15. +4 −4 lib/mirah/ast/class.rb
  16. +1 −1 lib/mirah/ast/flow.rb
  17. +21 −21 lib/mirah/ast/intrinsics.rb
  18. +1 −1 lib/mirah/ast/literal.rb
  19. +1 −1 lib/mirah/ast/local.rb
  20. +3 −3 lib/mirah/ast/method.rb
  21. +4 −4 lib/mirah/ast/scope.rb
  22. +1 −1 lib/mirah/ast/structure.rb
  23. +9 −9 lib/mirah/ast/type.rb
  24. +1 −1 lib/mirah/compiler.rb
  25. +1 −1 lib/mirah/env.rb
  26. +3 −3 lib/mirah/jvm/base.rb
  27. +20 −21 lib/mirah/jvm/compiler.rb
  28. +1 −1 lib/mirah/jvm/method_lookup.rb
  29. +8 −8 lib/mirah/jvm/source_compiler.rb
  30. +5 −5 lib/mirah/jvm/source_generator/builder.rb
  31. +1 −1 lib/mirah/jvm/source_generator/loops.rb
  32. +2 −2 lib/mirah/jvm/source_generator/precompile.rb
  33. +2 −2 lib/mirah/jvm/source_generator/typer.rb
  34. +4 −4 lib/mirah/jvm/typer.rb
  35. +4 −4 lib/mirah/jvm/types.rb
  36. +1 −1 lib/mirah/jvm/types/basic_types.rb
  37. +2 −2 lib/mirah/jvm/types/boolean.rb
  38. +6 −6 lib/mirah/jvm/types/enumerable.rb
  39. +1 −1 lib/mirah/jvm/types/extensions.rb
  40. +3 −3 lib/mirah/jvm/types/factory.rb
  41. +1 −1 lib/mirah/jvm/types/floats.rb
  42. +7 −7 lib/mirah/jvm/types/integers.rb
  43. +14 −14 lib/mirah/jvm/types/intrinsics.rb
  44. +1 −1 lib/mirah/jvm/types/literals.rb
  45. +9 −9 lib/mirah/jvm/types/methods.rb
  46. +1 −1 lib/mirah/jvm/types/number.rb
  47. +4 −4 lib/mirah/nbcompiler.rb
  48. +3 −3 lib/mirah/plugin/edb.rb
  49. +7 −7 lib/mirah/plugin/gwt.rb
  50. +3 −3 lib/mirah/plugin/java.rb
  51. +19 −19 lib/mirah/transform.rb
  52. +5 −5 lib/mirah/transform2.rb
  53. +8 −8 lib/mirah/typer.rb
  54. +3 −0 lib/mirah/version.rb
  55. +12 −12 lib/mirah_task.rb
  56. +2 −1 mirah.gemspec
  57. +1 −1 test/test_ast.rb
  58. +3 −3 test/test_compilation.rb
  59. +11 −11 test/test_env.rb
  60. +3 −3 test/test_gwt.rb
  61. +12 −12 test/test_java_typer.rb
  62. +2 −2 test/test_javac_compiler.rb
  63. +14 −14 test/test_jvm_compiler.rb
  64. +1 −1 test/test_typer.rb
View
@@ -38,13 +38,13 @@ task :compile => :init do
# build the Mirah sources
puts "Compiling Mirah sources"
Dir.chdir 'src' do
- classpath = Duby::Env.encode_paths([
+ classpath = Mirah::Env.encode_paths([
'javalib/jruby-complete.jar',
'javalib/JRubyParser.jar',
'build',
'/usr/share/ant/lib/ant.jar'
])
- Duby.compile(
+ Mirah.compile(
'-c', classpath,
'-d', '../build',
'org/mirah',
View
@@ -6,4 +6,4 @@ rescue LoadError
require 'mirah'
end
-Duby.run(*ARGV)
+Mirah.run(*ARGV)
View
@@ -6,4 +6,4 @@ rescue LoadError
require 'mirah'
end
-Duby.compile(*ARGV)
+Mirah.compile(*ARGV)
View
@@ -6,4 +6,4 @@ rescue LoadError
require 'mirah'
end
-puts Duby.parse(*ARGV).inspect
+puts Mirah.parse(*ARGV).inspect
@@ -9,8 +9,8 @@ require 'mirah/appengine_tasks'
appengine_app :app
-MIRAH_APP = "#{Duby.dest_path}/org/mirah/MirahApp.class"
-LIST = "#{Duby.source_path}/org/mirah/list.dhtml"
+MIRAH_APP = "#{Mirah.dest_path}/org/mirah/MirahApp.class"
+LIST = "#{Mirah.source_path}/org/mirah/list.dhtml"
# We want to recompile the app if the template gets modified
Rake::Task[MIRAH_APP].enhance([LIST])
@@ -9,7 +9,7 @@ TESTING_JARS = [AppEngine::SDK::API_JAR, AppEngine::SDK::LABS_JAR, JUNIT_JAR] +
AppEngine::SDK::RUNTIME_JARS.reject {|j| j =~ /appengine-local-runtime/}
TESTING_JARS.each {|jar| $CLASSPATH << jar}
-# Duby.compiler_options = ['-V']
+# Mirah.compiler_options = ['-V']
task :default => :test
@@ -24,13 +24,13 @@ task :clean do
end
task :compile => :init do
- # build the Duby sources
- puts "Compiling Duby sources"
+ # build the Mirah sources
+ puts "Compiling Mirah sources"
mirahc 'com/google/appengine', :dir => 'src', :dest => 'build'
end
task :compile_test => :jar do
- puts "Compiling Duby tests"
+ puts "Compiling Mirah tests"
mirahc 'com/google/appengine', :dir => 'test', :dest => 'test',
:options => ['--classpath', Dir.pwd + "/dist/dubydatastore.jar"]
end
@@ -51,7 +51,7 @@ class DubyDatastorePlugin
}
class ModelState
- include Duby::AST
+ include Mirah::AST
attr_reader :kind, :query, :read, :save, :transformer
def initialize(transformer, klass, parent, position, ast)
@@ -109,7 +109,7 @@ def sort(name:String, descending:boolean)
self
end
EOF
- [Duby::AST.type(nil, 'com.google.appengine.ext.duby.db.DQuery'),
+ [Mirah::AST.type(nil, 'com.google.appengine.ext.duby.db.DQuery'),
eval(classdef, queryinit)]
end
ast << @query
@@ -131,7 +131,7 @@ def properties
end
EOF
@get_properties = get_properties.body.children[1] =
- Duby::AST::Body.new(get_properties.body, position)
+ Mirah::AST::Body.new(get_properties.body, position)
ast << get_properties
update = eval(parent, <<-EOF)
def update(properties:Map)
@@ -260,7 +260,7 @@ def extend_save(code)
end
def self.find_class(node)
- node = node.parent until Duby::AST::ClassDefinition === node
+ node = node.parent until Mirah::AST::ClassDefinition === node
node
end
@@ -296,7 +296,7 @@ def self.add_property(name, type, transformer, fcall)
type = type.name
type = 'Long' if type == 'Integer'
- result = Duby::AST::ScopedBody.new(parent, fcall.position) {[]}
+ result = Mirah::AST::ScopedBody.new(parent, fcall.position) {[]}
result.static_scope = fcall.scope.static_scope
klass = find_class(parent)
unless @models[klass]
@@ -371,5 +371,5 @@ def self.reset
@models = {}
end
end
- ::Duby.plugins << DubyDatastorePlugin
+ ::Mirah.plugins << DubyDatastorePlugin
end
@@ -9,4 +9,4 @@ class Foo
end
end
-Foo.new.hello('Duby')
+Foo.new.hello('Mirah')
@@ -4,7 +4,7 @@ import javax.swing.JButton
# FIXME blocks need to be inside a MethodDefinition, but main doesn't
# have one.
def self.run
- frame = JFrame.new "Welcome to Duby"
+ frame = JFrame.new "Welcome to Mirah"
frame.setSize 300, 300
frame.setVisible true
@@ -13,7 +13,7 @@ def self.run
frame.show
button.addActionListener do |event|
- JButton(event.getSource).setText "Duby Rocks!"
+ JButton(event.getSource).setText "Mirah Rocks!"
end
end
@@ -9,8 +9,8 @@ require 'mirah/appengine_tasks'
appengine_app :app
-DUBY_APP = "#{Duby.dest_path}/org/mirah/wiki/MirahWiki.class"
-Templates = Dir.glob("#{Duby.source_path}/org/mirah/wiki/*.eduby.html")
+DUBY_APP = "#{Mirah.dest_path}/org/mirah/wiki/MirahWiki.class"
+Templates = Dir.glob("#{Mirah.source_path}/org/mirah/wiki/*.eduby.html")
Rake::Task[DUBY_APP].enhance(Templates)
Oops, something went wrong.

0 comments on commit 8e357e9

Please sign in to comment.