[m-rev.] for review: java packaging
Julien Fischer
juliensf at csse.unimelb.edu.au
Thu May 21 22:54:23 AEST 2009
On Wed, 20 May 2009, Peter Wang wrote:
> Branches: main
>
> Previously, unqualified Mercury modules would result in Java classes which
> were placed in the default (unnamed) package. This is a problem as Java
> doesn't allow packaged classes to import types from the unpackaged classes.
> This patch gives all Java classes generated from Mercury files the "mercury."
> package prefix.
>
> mmake support for Java files is even more broken than before. It expects
> Java files to be placed in the same directory but, due to the "mercury."
> prefix, even classes for non-nested modules are placed in a subdirectory
> called `mercury'. (The standard library can still be built with mmake using
> custom rules.)
So long as the java grade intalls this shouldn't be a problem. mmake
should be considered deprecated as far as users are concerned.
> Fix creation of `.jar' files. It is not enough to package the `.class' files
> that we know will be produced for each module. Nested classes generate
> separate `.class' files which also need to be included.
>
> Fix creation of the shell script that launches Java programs.
>
>
> compiler/java_names.m:
> Add an outermost "mercury" qualifier on all module names.
>
> compiler/compile_target_code.m:
> Fix creation of `.jar' files, as described.
>
> Use a temporary file and @-syntax to pass the list of class files to
> `jar'.
>
> Pass `jar -C <dir> <class> -C <dir> <class> ...' as -C only affects
> the argument immediately following it.
>
> Run `jar i' to add an index to jar files.
>
> compiler/file_names.m:
> Add `get_class_dir_name' to return the directory that contains class
> files.
>
> Make `choose_file_name' work for Java files again (with package
> directories) when `--use-subdirs' is disabled.
>
> compiler/module_cmds.m:
> Make `create_java_shell_script' work correctly when
> `--use-grade-subdirs' is enabled, and when the main module is
> packaged (as it will be).
>
> Make `list_class_files_for_jar' scan the directory containing class
> files, to include nested classes. Return a list of class files.
>
> Make `list_class_files_for_jar_mmake' use `get_class_dir_name'.
>
> library/Mmakefile:
> Update hacks to build the standard library in the java grade.
>
> mdbcomp/prim_data.m:
> Delete `insert_module_qualifier' as `add_outermost_qualifier'
> is equivalent.
>
> compiler/module_qual.m:
> compiler/prog_type.m:
> compiler/write_deps_file.m:
> Conform to changes.
That looks fine -- please ensure that mmc --make still works in hlc
grades before committing though ;-)
Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list