[m-rev.] For review: Implement mmake library installation for the Java grade

James Goddard goddardjames at yahoo.com
Thu Feb 19 12:01:34 AEDT 2004


> In particular for the moment I think list_class_files_for_jar
> should go in modules.m, along with create_java_shell_script.
...
> /`.so/`.so'/

I've applied these changes and committed the files.  Here's the relative
diff:

-------------------------------------------------------------------------------
diff -u modules.m modules.m
--- modules.m	18 Feb 2004 02:24:40 -0000
+++ modules.m	19 Feb 2004 00:30:39 -0000
@@ -788,6 +788,9 @@
 :- pred check_for_no_exports(item_list, module_name, io__state, io__state).
 :- mode check_for_no_exports(in, in, di, uo) is det.
 
+%-----------------------------------------------------------------------------%
+	% Java command-line tools utilities.
+
 	% create_java_shell_script:
 	%	Create a shell script with the same name as the given module
 	%	to invoke Java with the appropriate options on the class of the
@@ -796,6 +799,12 @@
 :- pred create_java_shell_script(module_name::in, bool::out,
 		io__state::di, io__state::uo) is det.
 
+	% list_class_files_for_jar:
+	%	Strip away the path prefix for a list of .class files.
+
+:- pred list_class_files_for_jar(module_name::in, string::in, string::out,
+		io__state::di, io__state::uo) is det.
+
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 
@@ -808,7 +817,6 @@
 :- import_module libs__handle_options.
 :- import_module libs__options.
 :- import_module make. 				% XXX undesirable dependency
-:- import_module make__util.
 :- import_module parse_tree__mercury_to_mercury.
 :- import_module parse_tree__module_qual.
 :- import_module parse_tree__prog_io_util.
@@ -7197,6 +7205,8 @@
 	).
 
 %-----------------------------------------------------------------------------%
+%
+% Java command-line utilities.
 
 create_java_shell_script(MainModuleName, Succeeded) -->
 	% XXX Extension should be ".bat" on Windows
@@ -7251,2 +7261,26 @@
 
+
+list_class_files_for_jar(ModuleName, ClassFiles, ListClassFiles) -->
+	globals__io_lookup_bool_option(use_subdirs, UseSubdirs),
+	globals__io_lookup_bool_option(use_grade_subdirs, UseGradeSubdirs),
+	{ AnySubdirs = UseSubdirs `or` UseGradeSubdirs },
+	(
+		{ AnySubdirs = yes },
+		module_name_to_file_name(ModuleName, ".class", no, ClassFile),
+		{ ClassSubdir = dir.dirname(ClassFile) },
+		% Here we use the `-C' option of jar to change directory during
+		% execution, then use sed to strip away the Mercury/classs/
+		% prefix to the class files.
+		% Otherwise, the class files would be stored as
+		%	Mercury/classs/*.class
+		% within the jar file, which is not what we want.
+		% XXX It would be nice to avoid this dependency on sed.
+		{ ListClassFiles = "-C " ++ ClassSubdir ++ " \\\n" ++
+				"\t\t`echo "" " ++ ClassFiles ++ """" ++
+				" | sed 's| '" ++ ClassSubdir ++ "/| |'`" }
+	;
+		{ AnySubdirs = no },
+		{ ListClassFiles = ClassFiles }
+	).
+
 %-----------------------------------------------------------------------------%
diff -u compile_target_code.m compile_target_code.m
--- compile_target_code.m	17 Feb 2004 06:30:10 -0000
+++ compile_target_code.m	19 Feb 2004 00:33:48 -0000
@@ -180,8 +180,6 @@
 :- import_module libs__handle_options.
 :- import_module libs__options.
 :- import_module libs__trace_params.
-:- import_module make.
-:- import_module make__util.
 :- import_module parse_tree__prog_out.
 
 :- import_module char, dir, getopt, int, require, string.
diff -u make.util.m make.util.m
--- make.util.m	17 Feb 2004 06:22:11 -0000
+++ make.util.m	19 Feb 2004 00:28:23 -0000
@@ -184,13 +184,6 @@
 :- pred target_is_grade_or_arch_dependent(module_target_type::in) is semidet.
 
 %-----------------------------------------------------------------------------%
-	% Java command-line tools utilities.
-
-	% Strip away the path prefix for a list of .class files.
-:- pred list_class_files_for_jar(module_name::in, string::in, string::out,
-		io__state::di, io__state::uo) is det.
-
-%-----------------------------------------------------------------------------%
 	% Debugging, verbose and error messages.
 
 	% Apply the given predicate if `--debug-make' is set.
@@ -838,30 +831,2 @@
 %-----------------------------------------------------------------------------%
-%
-% Java command-line utilities.
-
-	% Strip away the path prefix for a list of .class files.
-list_class_files_for_jar(ModuleName, ClassFiles, ListClassFiles) -->
-	globals__io_lookup_bool_option(use_subdirs, UseSubdirs),
-	globals__io_lookup_bool_option(use_grade_subdirs, UseGradeSubdirs),
-	{ AnySubdirs = UseSubdirs `or` UseGradeSubdirs },
-	(
-		{ AnySubdirs = yes },
-		module_name_to_file_name(ModuleName, ".class", no, ClassFile),
-		{ ClassSubdir = dir.dirname(ClassFile) },
-		% Here we use the `-C' option of jar to change directory during
-		% execution, then use sed to strip away the Mercury/classs/
-		% prefix to the class files.
-		% Otherwise, the class files would be stored as
-		%	Mercury/classs/*.class
-		% within the jar file, which is not what we want.
-		% XXX It would be nice to avoid this dependency on sed.
-		{ ListClassFiles = "-C " ++ ClassSubdir ++ " \\\n" ++
-				"\t\t`echo "" " ++ ClassFiles ++ """" ++
-				" | sed 's| '" ++ ClassSubdir ++ "/| |'`" }
-	;
-		{ AnySubdirs = no },
-		{ ListClassFiles = ClassFiles }
-	).
-
-%-----------------------------------------------------------------------------%
 
diff -u make.program_target.m make.program_target.m
--- make.program_target.m	18 Feb 2004 02:14:12 -0000
+++ make.program_target.m	19 Feb 2004 00:24:23 -0000
@@ -735,7 +735,7 @@
 	),
 	globals__io_set_globals(unsafe_promise_unique(Globals)).
 
-	% Install the `.a', `.so, `.jar', `.opt' and `.mih' files
+	% Install the `.a', `.so', `.jar', `.opt' and `.mih' files
 	% for the current grade.
 :- pred install_library_grade_files(bool::in, string::in, module_name::in,
 	list(module_name)::in, bool::out, make_info::in, make_info::out,
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list