[m-rev.] Diff: Get library building to work in grade Java using subdirectories

James Goddard goddardjames at yahoo.com
Tue Feb 17 14:19:09 AEDT 2004


> > Get library building to work in grade Java using subdirectories.
> > 
> > compiler/modules.m:
> > 	Jar files were previously being built with incorrect directory
> > 	structures if --use-subdirs was turned on.  This patch corrects the
> > 	problem.
...
> Given this, there is no need for the mkdir command.
> 
> It would be nice to avoid the dependency on sed, if we could do so easily.
> But I don't see any easy way of doing that, so don't worry about it.
> Still, it's probably worth adding an XXX comment, e.g. "XXX it would be
> nice to avoid this dependency on sed".

Done and done.  I've commited the change.  Here's the relative diff:

-------------------------------------------------------------------------
diff -u modules.m modules.m
--- modules.m	16 Feb 2004 23:45:32 -0000
+++ modules.m	17 Feb 2004 03:11:30 -0000
@@ -4861,27 +4861,24 @@
 	{ AnySubdirs = UseSubdirs `or` UseGradeSubdirs },
 	(
 		{ AnySubdirs = yes },
-		{ JarSubdir = dir.dirname(JarFileName) },
 		module_name_to_file_name(ModuleName, ".class", no, ClassFile),
 		{ ClassSubdir = dir.dirname(ClassFile) },
-		{ MaybeMkJarSubdir = "\t-mkdir " ++ JarSubdir ++ "\n" },
 		% 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 },
-		{ MaybeMkJarSubdir = "" },
 		{ ListClassFiles = ClassFiles }
 	),
 	io__write_strings(DepStream, [
 		JarFileName, " : ", "$(", MakeVarName, ".classes)\n",
-		MaybeMkJarSubdir,
 		"\t$(JAR) $(JAR_CREATE_FLAGS) ", JarFileName, " ",
 		ListClassFiles, "\n\n"
 	]),
--------------------------------------------------------------------------
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