11#
2- # Copyright (c) 2011, 2021 , Oracle and/or its affiliates. All rights reserved.
2+ # Copyright (c) 2011, 2022 , Oracle and/or its affiliates. All rights reserved.
33# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44#
55# This code is free software; you can redistribute it and/or modify it
@@ -193,7 +193,8 @@ define SetupJarArchiveBody
193193 $1_UPDATE_CONTENTS=\
194194 if [ "`$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
195195 $(ECHO) " updating" `$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
196- $$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents; \
196+ $(SORT) $$($1_BIN)/_the.$$($1_JARNAME)_contents > $$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted && \
197+ $$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted; \
197198 fi $$(NEWLINE)
198199 # The s-variants of the above macros are used when the jar is created from scratch.
199200 # NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
@@ -212,7 +213,9 @@ define SetupJarArchiveBody
212213 | $(SED) 's|$$(src)/|-C $$(src) |g' >> \
213214 $$($1_BIN)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
214215 endif
215- $1_SUPDATE_CONTENTS=$$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)
216+ $1_SUPDATE_CONTENTS=\
217+ $(SORT) $$($1_BIN)/_the.$$($1_JARNAME)_contents > $$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted && \
218+ $$($1_JAR_CMD) --update $$($1_JAR_OPTIONS) --file $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents_sorted $$(NEWLINE)
216219
217220 # Use a slightly shorter name for logging, but with enough path to identify this jar.
218221 $1_NAME:=$$(subst $$(OUTPUTDIR)/,,$$($1_JAR))
0 commit comments