CreateJars.gmk 29.5 KB
Newer Older
1
#
G
guangyu.zgy 已提交
2
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include Setup.gmk

default: all

33
# Prepare the find cache. Only used if running on windows.
34
$(eval $(call FillCacheFind, $(JDK_OUTPUTDIR)/classes))
35

36 37
include Tools.gmk

38 39
include Profiles.gmk

40 41 42
#
# This makefile...so that altering will trigger rebuilding include/exclude-lists => jars
#
I
ihse 已提交
43
MAKEFILE = $(JDK_TOPDIR)/make/CreateJars.gmk
44 45
#
# And similarly for the Profiles
I
ihse 已提交
46
PROFILE_MAKEFILES = $(JDK_TOPDIR)/make/Profiles.gmk $(JDK_TOPDIR)/make/profile-rtjar-includes.txt
47

I
ihse 已提交
48 49
MAINMANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf
BEANMANIFEST := $(JDK_TOPDIR)/make/data/swingbeaninfo/manifest.mf
50

51
$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/lib))
52

O
ohair 已提交
53
##########################################################################################
54

55 56 57 58 59 60 61
$(eval $(call SetupArchive,BUILD_JCONSOLE_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    SUFFIXES := .class .gif .png .properties, \
    INCLUDES := sun/tools/jconsole com/sun/tools/jconsole, \
    JARMAIN := sun.tools.jconsole.JConsole, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/jconsole.jar, \
    SKIP_METAINF := true))
62 63 64 65


##########################################################################################

66 67 68 69 70 71
$(eval $(call SetupArchive,BUILD_DNS_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    INCLUDES := sun/net/spi/nameservice/dns, \
    EXTRA_FILES := META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/ext/dnsns.jar, \
    SKIP_METAINF := true))
72 73 74 75


##########################################################################################

76
LOCALEDATA_INCLUDE_LOCALES := ar be bg ca cs da de el es et fi fr ga hi hr hu in is it \
77 78
    iw ja ko lt lv mk ms mt nl no pl pt ro ru sk sl sq sr sv \
    th tr uk vi zh
79

80 81
LOCALEDATA_INCLUDES := $(addprefix sun/text/resources/, $(LOCALEDATA_INCLUDE_LOCALES)) \
    $(addprefix sun/util/resources/, $(LOCALEDATA_INCLUDE_LOCALES))
82

83 84 85 86 87 88 89
$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    SUFFIXES := .class _dict _th, \
    INCLUDES := $(LOCALEDATA_INCLUDES), \
    EXCLUDES := sun/text/resources/th/BreakIteratorRules_th.class, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/ext/localedata.jar, \
    SKIP_METAINF := true))
90 91

##########################################################################################
92 93 94 95 96 97 98 99
#
# Different variants of rt.jar are built based on the current profile. The output
# directory is augmented with the profile name so that the final jar file and all the
# intermediary list files will be in directory. This has the form lib$PROFILE rather than
# lib/$PROFILE so that it won't get copied as part of the image generation process.
# Each profile customizes the RT_JAR_EXCLUDES variable.
#
##########################################################################################
100

101
# Full JRE exclude list for rt.jar and resources.jar
102
# This value should exclude types destined for jars other than rt.jar and resources.jar.
103 104
# When building a Profile this value augments the profile specific exclusions
RT_JAR_EXCLUDES += \
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
    com/sun/codemodel \
    com/sun/crypto/provider \
    com/sun/istack/internal/tools \
    com/sun/jarsigner \
    com/sun/java/accessibility \
    com/sun/javadoc \
    com/sun/jdi \
    com/sun/net/ssl/internal/ssl \
    com/sun/source \
    com/sun/tools \
    com/sun/xml/internal/dtdparser \
    com/sun/xml/internal/rngom \
    com/sun/xml/internal/xsom \
    javax/crypto \
    javax/swing/AbstractButtonBeanInfo.class \
    javax/swing/beaninfo \
    javax/swing/BoxBeanInfo.class \
    javax/swing/JAppletBeanInfo.class \
    javax/swing/JButtonBeanInfo.class \
    javax/swing/JCheckBoxBeanInfo.class \
    javax/swing/JCheckBoxMenuItemBeanInfo.class \
    javax/swing/JColorChooserBeanInfo.class \
    javax/swing/JComboBoxBeanInfo.class \
    javax/swing/JComponentBeanInfo.class \
    javax/swing/JDesktopPaneBeanInfo.class \
    javax/swing/JDialogBeanInfo.class \
    javax/swing/JEditorPaneBeanInfo.class \
    javax/swing/JFileChooserBeanInfo.class \
    javax/swing/JFormattedTextFieldBeanInfo.class \
    javax/swing/JFrameBeanInfo.class \
    javax/swing/JInternalFrameBeanInfo.class \
    javax/swing/JLabelBeanInfo.class \
    javax/swing/JLayeredPaneBeanInfo.class \
    javax/swing/JListBeanInfo.class \
    javax/swing/JMenuBarBeanInfo.class \
    javax/swing/JMenuBeanInfo.class \
    javax/swing/JMenuItemBeanInfo.class \
    javax/swing/JOptionPaneBeanInfo.class \
    javax/swing/JPanelBeanInfo.class \
    javax/swing/JPasswordFieldBeanInfo.class \
    javax/swing/JPopupMenuBeanInfo.class \
    javax/swing/JProgressBarBeanInfo.class \
    javax/swing/JRadioButtonBeanInfo.class \
    javax/swing/JRadioButtonMenuItemBeanInfo.class \
    javax/swing/JScrollBarBeanInfo.class \
    javax/swing/JScrollPaneBeanInfo.class \
    javax/swing/JSeparatorBeanInfo.class \
    javax/swing/JSliderBeanInfo.class \
    javax/swing/JSpinnerBeanInfo.class \
    javax/swing/JSplitPaneBeanInfo.class \
    javax/swing/JTabbedPaneBeanInfo.class \
    javax/swing/JTableBeanInfo.class \
    javax/swing/JTextAreaBeanInfo.class \
    javax/swing/JTextFieldBeanInfo.class \
    javax/swing/JTextPaneBeanInfo.class \
    javax/swing/JToggleButtonBeanInfo.class \
    javax/swing/JToolBarBeanInfo.class \
    javax/swing/JTreeBeanInfo.class \
    javax/swing/JWindowBeanInfo.class \
    javax/swing/SwingBeanInfoBase.class \
    javax/swing/text/JTextComponentBeanInfo.class \
    META-INF/services/com.sun.jdi.connect.Connector \
    META-INF/services/com.sun.jdi.connect.spi.TransportService \
    META-INF/services/com.sun.tools.attach.spi.AttachProvider \
    META-INF/services/com.sun.tools.xjc.Plugin \
    META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor \
    org/relaxng/datatype \
    sun/awt/HKSCS.class \
    sun/awt/motif/X11GB2312.class \
    sun/awt/motif/X11GB2312\$$$$Decoder.class \
    sun/awt/motif/X11GB2312\$$$$Encoder.class \
    sun/awt/motif/X11GBK.class \
    sun/awt/motif/X11GBK\$$$$Encoder.class \
    sun/awt/motif/X11KSC5601.class \
    sun/awt/motif/X11KSC5601\$$$$Decoder.class \
    sun/awt/motif/X11KSC5601\$$$$Encoder.class \
    sun/jvmstat \
    sun/net/spi/nameservice/dns \
    sun/nio/cs/ext \
    sun/rmi/rmic \
    sun/security/ec \
    sun/security/internal \
    sun/security/mscapi \
    sun/security/pkcs11 \
    sun/security/provider/Sun.class \
    sun/security/rsa/SunRsaSign.class \
    sun/security/ssl \
    sun/security/tools/jarsigner \
    sun/swing/BeanInfoUtils.class \
    sun/text/resources/cldr \
    sun/tools/asm \
    sun/tools/attach \
    sun/tools/java \
    sun/tools/javac \
    sun/tools/jcmd \
    sun/tools/jconsole \
    sun/tools/jinfo \
    sun/tools/jmap \
    sun/tools/jps \
    sun/tools/jstack \
    sun/tools/jstat \
    sun/tools/jstatd \
    sun/tools/native2ascii \
    sun/tools/serialver \
    sun/tools/tree \
    sun/tools/util \
    sun/util/cldr/CLDRLocaleDataMetaInfo.class \
    sun/util/resources/cldr \
    $(LOCALEDATA_INCLUDES) \
    com/oracle/jrockit/jfr \
    oracle/jrockit/jfr \
    jdk/jfr
217

218
# Find all files in the classes dir to use as dependencies. This could be more fine granular.
219 220
ALL_FILES_IN_CLASSES := $(call not-containing, _the., $(filter-out %javac_state, \
    $(call CacheFind, $(JDK_OUTPUTDIR)/classes)))
221

222 223
RT_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar_manifest
RESOURCE_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar_manifest
224 225 226

$(RT_JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
	$(MKDIR) -p $(@D)
227
	$(RM) $@ $@.tmp
228 229 230
	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
	    -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
	    $(MAINMANIFEST) >> $@.tmp
231 232 233
	$(ECHO) >> $@.tmp
	$(CAT) $(BEANMANIFEST) >> $@.tmp
	$(MV) $@.tmp $@
234 235 236

$(RESOURCE_JAR_MANIFEST_FILE): $(MAINMANIFEST)
	$(MKDIR) -p $(@D)
237
	$(RM) $@ $@.tmp
238 239 240
	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
	    -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
	    $(MAINMANIFEST) >> $@.tmp
241
	$(MV) $@.tmp $@
242

243
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude: $(MAKEFILE) $(PROFILE_MAKEFILES)
244
	$(MKDIR) -p $(@D)
245 246 247
	$(RM) $@ $@.tmp
	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@.tmp)
	$(MV) $@.tmp $@
248

I
ihse 已提交
249
$(IMAGES_OUTPUTDIR)/lib/classlist: $(JDK_TOPDIR)/make/data/classlist/classlist.$(OPENJDK_TARGET_OS) \
250
    $(MAKEFILE)
251
	$(MKDIR) -p $(@D)
252 253 254
	$(RM) $@ $@.tmp
	$(TOOL_ADDJSUM) $< $@.tmp
	$(MV) $@.tmp $@
255

256
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents: $(BUILD_TOOLS) $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude \
257
    $(ALL_FILES_IN_CLASSES) $(IMAGES_OUTPUTDIR)/lib/classlist
258
	$(MKDIR) -p $(@D)
259
	$(RM) $@ $@.tmp
260
	($(CD) $(JDK_OUTPUTDIR)/classes && \
261 262
	$(TOOL_JARREORDER) \
	    -o $@.tmp $(IMAGES_OUTPUTDIR)/lib/classlist $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude . )
263
	$(MV) $@.tmp $@
264

265
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
266 267
	$(MKDIR) -p $(@D)
	$(RM) $@ $@.tmp
268 269 270 271
	# Cygwin grep does not match $ as end of line if there are windows line
	# endings in the input.
	$(TR) -d '\r' < $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents \
	       | $(GREP) -e '\.class$$' > $@.tmp
272
        ifneq ($(PROFILE), )
273 274 275 276 277 278
          ifneq ($(strip $(RT_JAR_INCLUDE_TYPES)), )
           # Add back classes from excluded packages (fixing the $ substitution in the process)
	    for type in $(subst \$$,\, $(RT_JAR_INCLUDE_TYPES)) ; do \
	      $(ECHO) $$type >> $@.tmp ; \
	    done
          endif
279
        endif
280
	$(MV) $@.tmp $@
281

282
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
283 284
	$(MKDIR) -p $(@D)
	$(RM) $@ $@.tmp
285 286 287 288 289
	# Cygwin grep does not match $ as end of line if there are windows line
	# endings in the input.
	$(TR) -d '\r' < $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents \
	        | $(GREP) -v -e '\.class$$' \
	              -e '/_the\.*' -e '^_the\.*' -e '\\_the\.*' -e 'javac_state' > $@.tmp
290
        ifneq ($(PROFILE), )
291 292
	  # Strip out all META-INF/services/ entries
	  $(GREP) -v -e 'META-INF/services/' $@.tmp > $@.tmp2
293 294 295 296 297 298
          ifneq ($(strip $(PROFILE_INCLUDE_METAINF_SERVICES)), )
	    # Add back the required services
	    for service in $(PROFILE_INCLUDE_METAINF_SERVICES) ; do \
	      $(ECHO) $$service >> $@.tmp2; \
	    done
          endif
299
	  $(MV) $@.tmp2 $@.tmp
300
        endif
301
	$(MV) $@.tmp $@
302

303
# This is a hack but I don't know how to make this fit into the existing scheme
304
$(PROFILE_VERSION_CLASS_TARGETS): $(PROFILE_VERSION_JAVA_TARGETS)
305 306 307 308
	@$(JAVAC) -d $(@D)/../../ $(@D)/$(VERSION_JAVA_FILE)


# Support for removing the addPropertyChangeListener and removePropertyChangeListener
309
# methods from classes that only go into the profile builds.
310 311
BEANLESS_CLASSES = $(IMAGES_OUTPUTDIR)/beanless

312 313 314
# When there are $ characters in filenames we have some very subtle interactions between
# make expansion and shell expansion. In this particular case $< will contain a single $ while
# $@ will contain \$. So we have to pass $< in single-quotes to avoid shell expansion
315 316
$(BEANLESS_CLASSES)/%: $(JDK_OUTPUTDIR)/classes/%
	$(MKDIR) -p $(@D)
317
	$(TOOL_REMOVEMETHODS) '$<' $@ addPropertyChangeListener removePropertyChangeListener
318

319 320 321 322 323 324 325 326 327
# Code these targets explicitly because the target "%" expansion does
# not work with the inline "$" in the file name.
$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Packer.class: $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200$$Packer.class
	$(MKDIR) -p $(@D)
	$(TOOL_REMOVEMETHODS) '$<' $@ addPropertyChangeListener removePropertyChangeListener
$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Unpacker.class: $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200$$Unpacker.class
	$(MKDIR) -p $(@D)
	$(TOOL_REMOVEMETHODS) '$<' $@ addPropertyChangeListener removePropertyChangeListener

328 329
CLASSES_TO_DEBEAN = \
    java/util/logging/LogManager.class \
330 331
    java/util/jar/Pack200\$$Packer.class \
    java/util/jar/Pack200\$$Unpacker.class \
332
    com/sun/java/util/jar/pack/PackerImpl.class \
333
    com/sun/java/util/jar/pack/UnpackerImpl.class
334

335 336
ifneq ($(PROFILE), )
  BEANLESS_CLASSES_TARGETS := $(addprefix $(BEANLESS_CLASSES)/, $(CLASSES_TO_DEBEAN))
337 338 339
endif


340
RT_JAR_CREATE_OPTIONS := c0fm
341
RT_JAR_UPDATE_OPTIONS := u0f
342
ifeq ($(COMPRESS_JARS), true)
343 344
  RT_JAR_CREATE_OPTIONS := cfm
  RT_JAR_UPDATE_OPTIONS := uf
345 346
endif

347 348 349
# This defines a target-specific variables to make the shell logic easier to see.
# We need to find the Version.class file for the profile currently being built
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: \
350
    CLASS_FILE = $(if $(PROFILE), $(strip $(foreach class, $(PROFILE_VERSION_CLASS_TARGETS), $(if $(findstring $(PROFILE), $(class)), $(class)))), NO_SUCH_FILE)
351 352 353
# This is the real target
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE) $(PROFILE_VERSION_CLASS_TARGETS) $(BEANLESS_CLASSES_TARGETS)
	$(ECHO) Creating rt.jar $(PROFILE) Compressed=$(COMPRESS_JARS)
354 355
	$(MKDIR) -p $(@D)
	$(RM) $@ $@.tmp
356
	$(CD) $(JDK_OUTPUTDIR)/classes && \
357 358 359 360 361 362 363 364 365
	$(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RT_JAR_MANIFEST_FILE) \
	    @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents && \
	if [ -f $(CLASS_FILE) ]; then \
	  $(ECHO) Updating rt.jar $(PROFILE) && \
	  $(CD) $(patsubst %$(VERSION_CLASS_PATH), %, $(CLASS_FILE)) && \
	  $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(VERSION_CLASS_PATH); \
	  $(CD) $(BEANLESS_CLASSES) && \
	  $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(CLASSES_TO_DEBEAN); \
	fi
366
	$(MV) $@.tmp $@
367

368
$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/resources.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents \
369
    $(RESOURCE_JAR_MANIFEST_FILE)
370
	$(ECHO) Creating resources.jar
371 372
	$(MKDIR) -p $(@D)
	$(RM) $@ $@.tmp
373
	$(CD) $(JDK_OUTPUTDIR)/classes && \
374 375
	$(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RESOURCE_JAR_MANIFEST_FILE) \
	    @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents
376
	$(MV) $@.tmp $@
377 378 379

##########################################################################################

380
ifneq ($(OPENJDK_TARGET_OS), windows)
381 382 383 384 385 386 387 388
  CHARSETS_EXTRA_FILES := sun/awt/motif/X11GBK.class \
      sun/awt/motif/X11GB2312\$$$$Decoder.class \
      sun/awt/motif/X11GB2312.class \
      sun/awt/motif/X11KSC5601\$$$$Decoder.class \
      sun/awt/motif/X11KSC5601\$$$$Encoder.class \
      sun/awt/motif/X11GB2312\$$$$Encoder.class \
      sun/awt/motif/X11GBK\$$$$Encoder.class \
      sun/awt/motif/X11KSC5601.class
389 390
endif

391 392 393 394 395 396 397 398 399
$(eval $(call SetupArchive,BUILD_CHARSETS_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    SUFFIXES := .class .dat, \
    INCLUDES := sun/nio/cs/ext, \
    EXTRA_FILES := sun/awt/HKSCS.class \
        $(CHARSETS_EXTRA_FILES), \
    JAR := $(IMAGES_OUTPUTDIR)/lib/charsets.jar, \
    SKIP_METAINF := true, \
    CHECK_COMPRESS_JAR := true))
400 401 402

##########################################################################################

403
ifeq ($(OPENJDK_TARGET_OS), linux)
G
guangyu.zgy 已提交
404 405 406 407 408 409 410 411 412 413
$(eval $(call SetupArchive,BUILD_JFR_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    SUFFIXES := .class .jfc .xsd .xml .dtd, \
    INCLUDES := jdk/jfr, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/jfr.jar, \
    SKIP_METAINF := true, \
    MANIFEST := $(MAINMANIFEST), \
    CHECK_COMPRESS_JAR := true))

JARS += $(IMAGES_OUTPUTDIR)/lib/jfr.jar
414
endif # linux
415 416 417

##########################################################################################

418 419 420 421 422 423 424 425 426 427
$(eval $(call SetupArchive,BUILD_JSSE_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    INCLUDES := sun/security/provider/Sun.class \
        sun/security/rsa/SunRsaSign.class \
        sun/security/ssl \
        com/sun/net/ssl/internal/ssl, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/jsse.jar, \
    SKIP_METAINF := true, \
    MANIFEST := $(MAINMANIFEST), \
    CHECK_COMPRESS_JAR := true))
428 429 430

##########################################################################################

431 432 433 434 435 436 437 438
$(eval $(call SetupArchive,BUILD_SWINGBEANS_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    SUFFIXES := BeanInfo.class .gif, \
    INCLUDES := javax/swing sun/swing, \
    EXCLUDES := javax/swing/plaf, \
    EXTRA_FILES := javax/swing/SwingBeanInfoBase.class sun/swing/BeanInfoUtils.class, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/dt.jar, \
    SKIP_METAINF := true))
439 440 441

##########################################################################################

442
# Get the CLDRVERSION
443
include gensrc/GensrcCLDR.gmk
444

O
ohair 已提交
445
CLDRDATA_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/cldrdata.jar
446

447 448 449 450 451 452 453 454 455 456
$(eval $(call SetupArchive,BUILD_CLDRDATA_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    SUFFIXES := .class, \
    INCLUDES := sun/text/resources/cldr \
        sun/util/cldr \
        sun/util/resources/cldr, \
    EXCLUDES := sun/util/cldr/CLDRLocaleProviderAdapter, \
    JAR := $(CLDRDATA_JAR_DST), \
    EXTRA_MANIFEST_ATTR := CLDR-Version: $(CLDRVERSION), \
    SKIP_METAINF := true))
457 458 459

##########################################################################################

460
TOOLS_JAR_INCLUDES := \
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
    com/sun/codemodel \
    com/sun/istack/internal/tools \
    com/sun/jarsigner \
    com/sun/javadoc \
    com/sun/jdi \
    com/sun/source \
    com/sun/tools/attach \
    com/sun/tools/classfile \
    com/sun/tools/corba \
    com/sun/tools/doclets \
    com/sun/tools/doclint \
    com/sun/tools/example/debug/expr \
    com/sun/tools/example/debug/tty \
    com/sun/tools/extcheck \
    com/sun/tools/hat \
    com/sun/tools/internal/jxc \
    com/sun/tools/internal/jxc/ap \
    com/sun/tools/internal/ws \
    com/sun/tools/internal/ws/wscompile/plugin/at_generated \
    com/sun/tools/internal/xjc \
    com/sun/tools/javac \
    com/sun/tools/javadoc \
    com/sun/tools/javah \
    com/sun/tools/javap \
    com/sun/tools/jdeps \
    com/sun/tools/jdi \
    com/sun/tools/script/shell \
    com/sun/xml/internal/dtdparser \
    com/sun/xml/internal/rngom \
    com/sun/xml/internal/xsom \
    org/relaxng/datatype \
    sun/applet \
    sun/jvmstat \
    sun/rmi/rmic \
    sun/security/tools/jarsigner \
    sun/tools/asm \
    sun/tools/attach \
    sun/tools/jar \
    sun/tools/java \
    sun/tools/javac \
    sun/tools/jcmd \
    sun/tools/jinfo \
    sun/tools/jmap \
    sun/tools/jps \
    sun/tools/jstack \
    sun/tools/jstat \
    sun/tools/jstatd \
    sun/tools/native2ascii \
    sun/tools/serialver \
    sun/tools/tree \
    sun/tools/util
512

O
ohair 已提交
513
# The sjavac tools is not ready for public consumption.
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
TOOLS_JAR_EXCLUDES = com/sun/tools/sjavac

$(eval $(call SetupArchive,BUILD_TOOLS_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    SUFFIXES := .class .prp .gif .properties .xml .css .xsd .js .html .txt .java \
        Tool aliasmap options, \
    INCLUDES := $(TOOLS_JAR_INCLUDES), \
    EXCLUDES := $(TOOLS_JAR_EXCLUDES), \
    EXTRA_FILES := META-INF/services/com.sun.jdi.connect.Connector \
        META-INF/services/com.sun.jdi.connect.spi.TransportService \
        META-INF/services/com.sun.tools.attach.spi.AttachProvider \
        META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
        META-INF/services/com.sun.tools.internal.xjc.Plugin, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/tools.jar, \
    SKIP_METAINF := true, \
    CHECK_COMPRESS_JAR := true))
530 531 532 533


##########################################################################################

I
ihse 已提交
534 535
include CORE_PKGS.gmk
include NON_CORE_PKGS.gmk
536 537 538 539 540 541 542 543 544 545 546 547 548

# The compiler should not issue a "Proprietary" warning when compiling
# classes in the com.sun.java.swing.plaf packages, since we've always
# allowed, and even advocated, extending them (see bug 6476749).
#
# This approach is NOT to be used as a general purpose way to avoid such
# compiler warnings for non-core packages. The correct way is to document
# the packages in NON_CORE_PKGS.gmk, and include them in the NON_CORE_PKGS
# definition.
#
# Swing has taken this approach only as a temporary measure to avoid
# the compiler warnings until we can properly document these packages.
# This is covered under 6491853.
549 550 551
EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
    com.sun.java.swing.plaf.motif \
    com.sun.java.swing.plaf.gtk
552 553 554 555 556 557

#
# Include the exported private packages in ct.sym.
# This is an interim solution until the ct.sym is replaced
# with a new module system (being discussed for JDK 8).
#
M
mchung 已提交
558
EXPORTED_PRIVATE_PKGS = com.oracle.net \
559 560
    com.oracle.nio \
    com.alibaba.jwarmup
561

O
ohair 已提交
562
$(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar
563
	$(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
564
	$(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
565
	$(JAVA) $(NEW_JAVAC) \
566
	    -bootclasspath $(JDK_OUTPUTDIR)/classes \
567 568
	    -XDprocess.packages -proc:only \
	    -processor com.sun.tools.javac.sym.CreateSymbols \
O
ohair 已提交
569
	    -Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \
570
	    -Acom.sun.tools.javac.sym.Dest=$(IMAGES_OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
571
	    -Acom.sun.tools.javac.sym.Profiles=profile-rtjar-includes.txt \
572 573 574
	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
	$(TOUCH) $@

575 576 577 578 579 580
$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/symbols))
$(eval $(call SetupArchive,BUILD_CT_SYM, $(IMAGES_OUTPUTDIR)/symbols/_the.symbols, \
    SRCS := $(IMAGES_OUTPUTDIR)/symbols, \
    INCLUDES := META-INF/sym, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/ct.sym, \
    CHECK_COMPRESS_JAR := true))
581 582 583 584


##########################################################################################

585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
ifdef OPENJDK
    SRC_ZIP_INCLUDES = \
        com \
        java \
        javax \
        jdk \
        org \
        sun \
        #
    SRC_ZIP_EXCLUDES =
else
    SRC_ZIP_INCLUDES = \
        com/sun/corba \
        com/sun/image/codec/jpeg \
        com/sun/imageio \
        com/sun/java_cup \
        com/sun/javadoc \
        com/sun/java/swing \
        com/sun/jmx \
        com/sun/naming \
        com/sun/org/apache \
        com/sun/security/auth \
        com/sun/security/jgss \
        com/sun/source \
        java \
        javax/accessibility \
        javax/annotation \
        javax/imageio \
        javax/lang \
        javax/management \
        javax/naming \
        javax/print \
        javax/rmi \
        javax/script \
        javax/security \
        javax/sound \
        javax/sql \
        javax/swing \
        javax/tools \
        javax/xml \
        org/ietf \
        org/omg \
        org/w3c/dom \
        org/xml/sax \
        #
    SRC_ZIP_EXCLUDES = javax/swing/beaninfo
endif
632

633
SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes
634 635 636 637 638 639 640 641 642 643
SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gensrc
SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/impsrc
SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gendocsrc_rmic
ifndef OPENJDK
  SRC_ZIP_SRCS += $(JDK_TOPDIR)/src/closed/share/classes
endif

# Need to copy launcher src files into desired directory structure
# before zipping the sources.
LAUNCHER_SRC_FILES := $(wildcard $(JDK_TOPDIR)/src/share/bin/*) \
644 645 646 647
    $(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/java_md*)
LAUNCHER_ZIP_SRC := $(patsubst $(JDK_TOPDIR)/src/share/bin/%, $(IMAGES_OUTPUTDIR)/src/launcher/%, \
    $(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%, $(IMAGES_OUTPUTDIR)/src/launcher/%, \
    $(LAUNCHER_SRC_FILES)))
648 649

$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/share/bin/%
650
	$(install-file)
651

652
$(IMAGES_OUTPUTDIR)/src/launcher/%: $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/%
653
	$(install-file)
654 655 656

$(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)

O
ohair 已提交
657
# This dir needs to exist before macro is evaluated to avoid warning from find.
658 659 660 661
$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/src))
$(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
    SRC := $(SRC_ZIP_SRCS) $(IMAGES_OUTPUTDIR)/src, \
    INCLUDES := $(SRC_ZIP_INCLUDES) launcher, \
662
    EXCLUDES := $(SRC_ZIP_EXCLUDES), \
663 664 665
    SUFFIXES := .java .c .h, \
    ZIP := $(IMAGES_OUTPUTDIR)/src.zip, \
    EXTRA_DEPS := $(LAUNCHER_ZIP_SRC)))
666 667 668

##########################################################################################

669 670
ifeq ($(OPENJDK_TARGET_OS), windows)
  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
671 672 673 674 675 676 677 678 679 680 681 682 683 684
      $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_32_JAR, , \
          SRCS := $(JDK_OUTPUTDIR)/classes_ab/32bit, \
          INCLUDES := com/sun/java/accessibility, \
          JAR := $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-32.jar, \
          SKIP_METAINF := true))

      $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_LEGACY_JAR, , \
          SRCS := $(JDK_OUTPUTDIR)/classes_ab/legacy, \
          INCLUDES := com/sun/java/accessibility, \
          JAR := $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge.jar, \
          SKIP_METAINF := true))

      JARS += $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-32.jar \
          $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge.jar
685
  else
686 687 688 689 690
      $(eval $(call SetupArchive,BUILD_ACCESSBRIDGE_64_JAR, , \
          SRCS := $(JDK_OUTPUTDIR)/classes_ab/64bit, \
          INCLUDES := com/sun/java/accessibility, \
          JAR := $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-64.jar, \
          SKIP_METAINF := true))
691

692 693
      JARS += $(IMAGES_OUTPUTDIR)/lib/ext/access-bridge-64.jar
  endif
694 695 696 697 698 699 700 701 702
endif

$(eval $(call SetupArchive,BUILD_JACCESS_JAR, , \
    SRCS := $(JDK_OUTPUTDIR)/classes, \
    INCLUDES := com/sun/java/accessibility/util, \
    JAR := $(IMAGES_OUTPUTDIR)/lib/ext/jaccess.jar, \
    SKIP_METAINF := true))

JARS += $(IMAGES_OUTPUTDIR)/lib/ext/jaccess.jar
703 704 705

##########################################################################################

706 707
#
# This is an empty jar (only contains manifest) and fits poorly into framework...
708
# create simple rule instead
709
#
710
$(IMAGES_OUTPUTDIR)/lib/management-agent.jar: $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
711 712 713 714
	$(JAR) cfm $@ $<

##########################################################################################

715
$(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar: $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
716 717 718 719 720 721 722 723 724 725
	$(install-file)

##########################################################################################

# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that
# all jars can be found in one place when creating images in Images.gmk. It needs to be
# done here so that clean targets can be simple and accurate.
$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(JDK_OUTPUTDIR)/lib/sa-jdi.jar
	$(install-file)

E
erikj 已提交
726 727
##########################################################################################
#
728 729
# sec-bin.zip is used by builds where the corresponding sources are not available
#
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
$(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP, \
    SRC := $(JDK_OUTPUTDIR), \
    INCLUDES := classes/javax/net \
        classes/javax/security/cert \
        classes/com/sun/net/ssl \
        classes/com/sun/security/cert \
        classes/sun/net/www/protocol/https \
        classes/sun/security/pkcs12 \
        classes/sun/security/ssl \
        classes/sun/security/krb5 \
        classes/sun/security/krb5/internal \
        classes/sun/security/krb5/internal/ccache \
        classes/sun/security/krb5/internal/crypto \
        classes/sun/security/krb5/internal/ktab \
        classes/sun/security/krb5/internal/rcache \
        classes/sun/security/krb5/internal/util, \
    INCLUDE_FILES := classes/sun/security/jgss/spi/GSSContextSpi.class, \
    EXCLUDES := classes/sun/security/krb5/internal/tools, \
    ZIP := $(IMAGES_OUTPUTDIR)/sec-bin.zip))
E
erikj 已提交
749 750 751

JARS += $(IMAGES_OUTPUTDIR)/sec-bin.zip

752 753 754 755
##########################################################################################
#
# Windows specific binary security packages.
#
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770
ifeq ($(OPENJDK_TARGET_OS), windows)
  # sec-windows-bin.zip is used by builds where the corresponding sources are not available
  $(eval $(call SetupZipArchive,BUILD_SEC_WINDOWS_BIN_ZIP, \
      SRC := $(JDK_OUTPUTDIR), \
      INCLUDES := classes/sun/security/krb5/internal/tools, \
      ZIP := $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip))

  JARS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip

  # JGSS files contain the native Kerberos library
  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
    JGSS_ZIP_NAME = jgss-windows-x64-bin.zip
  else
    JGSS_ZIP_NAME = jgss-windows-i586-bin.zip
  endif
771

772 773 774 775 776 777
  $(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP, \
      SRC := $(JDK_OUTPUTDIR), \
      INCLUDE_FILES := bin/w2k_lsa_auth.dll \
          bin/w2k_lsa_auth.map \
          bin/w2k_lsa_auth.pdb, \
      ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)))
778

779
  JARS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
780 781
endif

782 783
##########################################################################################

784 785 786 787 788 789 790
# This rule copies all jars from jdk/lib/... to images/lib/... to avoid having to track 
# which jars are where
$(IMAGES_OUTPUTDIR)/lib/%: $(JDK_OUTPUTDIR)/lib/%
	$(install-file)

##########################################################################################

J
jjg 已提交
791 792 793 794 795 796
# Import nashorn.jar from nashorn dist dir.
$(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar: $(NASHORN_DIST)/nashorn.jar
	$(install-file)

##########################################################################################

797 798 799 800
-include $(CUSTOM_MAKE_DIR)/CreateJars.gmk

##########################################################################################

801 802 803
all: $(JARS)

.PHONY: default all