Bug 946083 - Part 1: Delete .class files when (re-)building a Java JAR. r=glandium
☠☠ backed out by e52a4ab158ee ☠ ☠
authorNick Alexander <nalexander@mozilla.com>
Mon, 10 Feb 2014 21:43:00 -0800
changeset 167997 d9a099b06911ba8ff2d88c9a2a5b8b317d3959c1
parent 167996 1e038f308b8da2e04fdafe5bf06931d8c0d919b5
child 167998 6948901b128fbbd9a1d68f116031e0f4cf7240fa
push id39621
push usernalexander@mozilla.com
push dateTue, 11 Feb 2014 05:43:44 +0000
treeherdermozilla-inbound@6948901b128f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs946083
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 946083 - Part 1: Delete .class files when (re-)building a Java JAR. r=glandium This cleans up stale .class files, so they don't get packaged into the .jar files that Proguard consumes.
config/makefiles/java-build.mk
--- a/config/makefiles/java-build.mk
+++ b/config/makefiles/java-build.mk
@@ -78,19 +78,27 @@ endif #} ANDROID_APK_NAME
 ifdef JAVA_JAR_TARGETS #{
 # Arg 1: Output target name with .jar suffix, like jars/jarfile.jar.
 #        Intermediate class files are generated in jars/jarfile-classes.
 # Arg 2: Java sources list.  We use VPATH and $^ so sources can be
 #        relative to $(srcdir) or $(CURDIR).
 # Arg 3: List of extra jars to link against.  We do not use VPATH so
 #        jars must be relative to $(CURDIR).
 # Arg 4: Additional JAVAC_FLAGS.
+
+# Note: Proguard fails when stale .class files corresponding to
+# removed inner classes are present in the object directory.  These
+# stale class files get packaged into the .jar file, which then gets
+# processed by Proguard.  To work around this, we always delete any
+# existing jarfile-classes directory and start fresh.
+
 define java_jar_template
 $(1): $(2) $(3)
 	$$(REPORT_BUILD)
+	@$$(RM) -rf $(1:.jar=)-classes
 	@$$(NSINSTALL) -D $(1:.jar=)-classes
 	@$$(if $$(filter-out .,$$(@D)),$$(NSINSTALL) -D $$(@D))
 	$$(JAVAC) $$(JAVAC_FLAGS)\
     $(4)\
 		-d $(1:.jar=)-classes\
 		$(if $(strip $(3)),-classpath $(subst $(NULL) ,:,$(strip $(3))))\
 		$$(filter %.java,$$^)
 	$$(JAR) cMf $$@ -C $(1:.jar=)-classes .