Re: [mirah] Mirah / Ant compatibility. (#286)

24 views
Skip to first unread message

J. Scott Kasten

unread,
May 29, 2015, 9:46:08 PM5/29/15
to mirah/mirah, mi...@googlegroups.com

Hi,

I did finally finally have a chance to look into this. Seems to work OK
in the quick wash, spin, and dry cycle I put it through. I have no
clear preference between this solution or the one I submitted. Both seem
to work. Take which ever offers the most benefit.

-S-

On Sun, 10 May 2015, ka t wrote:

>
> Here goes (fairly rudimentary) patch I'm using to get the ant task working.
> Ant properly terminates when exception is thrown from the plugin itself
> based on return value. For me, it's pointless to convey error messages
> through the exception as those are spammed to console before anyway. Other
> command line tools seems to not break with this, but I didn't test that
> extensively. YMMV.
>
> diff --git a/src/org/mirah/ant/compile.mirah b/src/org/mirah/ant/compile.mir
> ah
> index bba39f9..f7f6aa4 100644
> --- a/src/org/mirah/ant/compile.mirah
> +++ b/src/org/mirah/ant/compile.mirah
> @@ -61,7 +61,9 @@ class Compile < Task
> args.add(src)
>
> begin
> - MirahCommand.compile(args)
> + if MirahCommand.compile(args)
> + raise "Compilation failed."
> + end
> rescue => ex
> raise BuildException.new(exception)
> end
> diff --git a/src/org/mirah/mirah_command.mirah b/src/org/mirah/mirah_command
> .mirah
> index 8fddb26..4653987 100644
> --- a/src/org/mirah/mirah_command.mirah
> +++ b/src/org/mirah/mirah_command.mirah
> @@ -21,22 +21,24 @@ import org.mirah.tool.Mirahc
> import org.mirah.tool.RunCommand
>
> class MirahCommand
> - def self.compile(args:List):void
> + def self.compile(args:List):int
> argv = String[args.size]
> args.toArray(argv)
> - Mirahc.main(argv)
> + Mirahc.new.compile(argv)
> end
>
> - def self.run(args:List):void
> + def self.run(args:List):int
> argv = String[args.size]
> args.toArray(argv)
> RunCommand.main(argv)
> + 0
> end
>
> - def self.main(args:String[]):void
> + def self.main(args:String[]):int
> list = Arrays.asList(args)
> if list.size > 0 && "run".equals(list.get(0))
> run(list.subList(1, list.size))
> + 0
> elsif list.size > 0 && "compile".equals(list.get(0))
> compile(list.subList(1, list.size))
> else
> diff --git a/src/org/mirah/tool/mirahc.mirah b/src/org/mirah/tool/mirahc.mir
> ah
> index 80f1be3..bf25298 100644
> --- a/src/org/mirah/tool/mirahc.mirah
> +++ b/src/org/mirah/tool/mirahc.mirah
> @@ -34,4 +34,4 @@ class Mirahc < MirahTool
> result = Mirahc.new.compile(args)
> System.exit(result)
> end
> -end
> \ No newline at end of file
> +end
>
> —
> Reply to this email directly or view it on
> GitHub.[AIKxR2VSaQ3YnnwXwpxpBqUQTy0u_7chks5oICLxgaJpZM4Dqi4n.gif]
>
>
>
Reply all
Reply to author
Forward
0 new messages