fix-java-jar-index.diff (1,733 bytes)
2015-07-10 14:16
diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m
index c710fcf..ec87928 100644
--- a/compiler/compile_target_code.m
+++ b/compiler/compile_target_code.m
@@ -1708,15 +1708,19 @@ file_as_new_as(FileNameA, Rel, FileNameB, !IO) :-
compare_file_timestamps(FileNameA, FileNameB, MaybeCompare, !IO) :-
io.file_modification_time(FileNameA, TimeResultA, !IO),
- io.file_modification_time(FileNameB, TimeResultB, !IO),
- (
- TimeResultA = ok(TimeA),
- TimeResultB = ok(TimeB)
- ->
- compare(Compare, TimeA, TimeB),
- MaybeCompare = yes(Compare)
- ;
- MaybeCompare = no
+ ( if FileNameA = FileNameB then
+ MaybeCompare = ( if TimeResultA = ok(_) then yes((=)) else no )
+ else
+ io.file_modification_time(FileNameB, TimeResultB, !IO),
+ ( if
+ TimeResultA = ok(TimeA),
+ TimeResultB = ok(TimeB)
+ then
+ compare(Compare, TimeA, TimeB),
+ MaybeCompare = yes(Compare)
+ else
+ MaybeCompare = no
+ )
).
%-----------------------------------------------------------------------------%
@@ -3116,11 +3120,7 @@ create_java_exe_or_lib(Globals, ErrorStream, LinkTargetType, MainModuleName,
io.remove_file(TempFileName, _, !IO),
(
- Succeeded0 = yes,
- % Add an index, which is supposed to speed up class loading.
- IndexCmd = string.append_list([Jar, " i ", JarFileName]),
- invoke_system_command(Globals, ErrorStream, cmd_verbose_commands,
- IndexCmd, _, !IO)
+ Succeeded0 = yes
;
Succeeded0 = no,
io.remove_file(JarFileName, _, !IO)