[m-rev.] [for review 1/4] Add mfilterjavac utility

Paul Bone paul at bone.id.au
Sat Apr 20 21:06:46 AEST 2013


On Fri, Apr 19, 2013 at 06:26:23PM +1000, Julien Fischer wrote:
>
> Hi Paul,
>
> On Thu, 18 Apr 2013, Paul Bone wrote:
>
>> --- /dev/null
>> +++ b/mfilterjavac/MFILTERJAVAC_FLAGS.in
>> @@ -0,0 +1,25 @@
>> + at BOOTSTRAP_MC_ARGS@
>> +--no-infer-all
>> +--halt-at-warn
>> +--no-warn-inferred-erroneous
>> +--no-mercury-stdlib-dir
>> +-I../library
>> +-I../browser
>> +-I../ssdb
>> +--c-include-directory ../boehm_gc
>> +--c-include-directory ../boehm_gc/include
>> +--c-include-directory ../runtime
>> +--c-include-directory ../library
>> +--c-include-directory ../library/Mercury/mihs
>> +--c-include-directory ../browser
>> +--c-include-directory ../browser/Mercury/mihs
>> +--c-include-directory ../ssdb
>> +--c-include-directory ../ssdb/Mercury/mihs
>> +--c-include-directory ../trace
>> +--csharp-flag -keyfile:../mercury.snk
>> +--no-java-classpath
>> +--java-classpath ../library/mer_rt.jar
>> +--java-classpath ../library/mer_std.jar
>> +--java-classpath ../browser/mer_browser.jar
>> +--java-classpath ../mdbcomp/mer_mdbcomp.jar
>> +--config-file ../scripts/Mercury.config.bootstrap
>
> There should also be:
>
>     --erlang-include-directory ../library/Mercury/hrls
>

This isn't in some of the other directories, is it an error for it to be
missing from slice/SLICE_FLAGS?

Do I need more --erlang-include-directory options for each of the other
directories such as browser and mdbcomp?

Unfortunatly knowing how to setup a new directory or make other sagnificant
changes to the build system doesn't appear to be documented.   This
encourages cargo-cult programming, so I appologise for my cut-and-paste
errors.  Thanks for helping review my patch :-)

>> +:- pred filter_lines(maybe_error::out, io::di, io::uo) is det.
>> +
>> +filter_lines(MaybeError, !IO) :-
>> +    io.read_line_as_string(Result, !IO),
>> +    (
>> +        Result = ok(Line),
>> +        filter_line(Line, MaybeOutLine, !IO),
>> +        (
>> +            MaybeOutLine = ok(OutLine),
>> +            io.write_string(OutLine, !IO),
>> +            filter_lines(MaybeError, !IO)
>> +        ;
>> +            MaybeOutLine = error(Error),
>> +            MaybeError = error(Error)
>> +        )
>> +    ;
>> +        Result = eof,
>> +        MaybeError = ok
>> +    ;
>> +        Result = error(Error),
>> +        ErrorStr = format("stdin: %s\n", [s(error_message(Error))]),
>> +        MaybeError = error(ErrorStr)
>> +    ).
>
> Should this program be reporting errors and failing?  I don't think
> compilation in the java grade should fail simply because mfilterajvac
> comes across some javac output that it doesn't know how to handle.
>

There are two types of errors that I'm reporting.

    1. An IO error where mfilterjavac cannot read javac's output.  In which
       case javac's output would be lost and the programmer would be unaware
       of it if we didn't report the error.

    2. A problem parsing the markers in the .java file.  I've found this
       useful for debugging.  I'm happy to make this a warning rather than
       an error so that it doesn't fail an otherwise good compilation.

I've fixed everything else following your suggestions.


-- 
Paul Bone
http://www.bone.id.au



More information about the reviews mailing list