jdk/make/CopyIntoClasses.gmk
author katleman
Thu, 21 Aug 2014 14:16:14 -0700
changeset 25878 6d561031123e
parent 25782 5a832643a534
child 26009 682a3a6d43a7
permissions -rw-r--r--
Added tag jdk9-b27 for changeset 98ce0879ab4c

#
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# 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.
#

# Copy icu and _dict files used by the text break iterator

COPY_PATTERNS := .icu _dict .dat _options .js aliasmap .spp .wav .css \
    .png .gif .xml .dtd .txt oqlhelp.html content-types.properties

# These directories should not be copied at all
EXCLUDES += \
    java/awt/doc-files \
    java/lang/doc-files \
    javax/swing/doc-files \
    javax/swing/text/doc-files \
    javax/swing/plaf/synth/doc-files \
    javax/swing/undo/doc-files \
    sun/awt/X11/doc-files \
    sun/util/cldr/resources \
    #

# These files should never be included
EXFILES += build.xml README.txt version.txt

# These icons are handled in GensrcIcons.gmk
EXFILES += \
    sun/awt/X11/java-icon16.png \
    sun/awt/X11/java-icon24.png \
    sun/awt/X11/java-icon32.png \
    sun/awt/X11/java-icon48.png \
    $(wildcard $(JDK_TOPDIR)/src/share/classes/sun/awt/resources/*.png) \
    #

ifndef OPENJDK
  # Theses icons have closed replacements
  SWING_PLAF_MOTIF_RESOURCES_DIR := $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif
  EXFILES += \
      $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/icons/JavaCup32.png \
      $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/basic/icons/JavaCup16.png \
      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.gif) \
      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.png) \
      #

  EXFILES += mib_core.txt
endif

ifeq ($(ENABLE_JFR), true)
  JFR_CONFIGURATION_DIR_CLOSED := $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
  COPY_FILES += \
      $(JFR_CONFIGURATION_DIR_CLOSED)/jfc.xsd
endif

SWING_BEANINFO_RESOURCES_SRC_DIR = $(JDK_TOPDIR)/make/data/swingbeaninfo/images
SWING_BEANINFO_RESOURCES_SRC = $(wildcard $(SWING_BEANINFO_RESOURCES_SRC_DIR)/*.gif)
OUT_BEANINFO_RESOURCES = $(patsubst $(SWING_BEANINFO_RESOURCES_SRC_DIR)%, \
    $(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%, \
    $(SWING_BEANINFO_RESOURCES_SRC))

COPY_EXTRA += $(OUT_BEANINFO_RESOURCES)

# The exception handling of swing beaninfo
# These resources violates the convention of having code and resources together under
# $(JDK_TOPDIR)/src/.../classes directories
$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: \
    $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
	$(call install-file)

##########################################################################################
#
# Copy the META-INF/services configuration files that are scattered around the source tree
# into classes/META-INF/services. Be aware that META-INF directories that are located at a
# source root (.../classes/META-INF) are automatically copied verbatim by the
# SetupJavaCompilation macro.
#
# Any other META-INF/services configuration file is found here and platform specific comments
# are uncommented and the configuration file is stored in the output META-INF directory.

# Make sure the output directory is created.
$(eval $(call MakeDir, $(JDK_OUTPUTDIR)/classes/META-INF/services))
# Find all META-INF/services/* files
ALL_META-INF_DIRS_share := $(shell $(FIND) $(JDK_TOPDIR)/src/share/classes -type d -a -name META-INF)
ALL_META-INF_DIRS_targetapi := $(shell $(FIND) $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes -type d -a -name META-INF)
# Platform specific overrides shared
ifneq ($(ALL_META-INF_DIRS_targetapi), )
  ALL_META-INF_DIRS := $(ALL_META-INF_DIRS_targetapi) \
      $(filter-out %$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes%,%,$(ALL_META-INF_DIRS_targetapi)), \
      $(ALL_META-INF_DIRS_share))
else
  ALL_META-INF_DIRS := $(ALL_META-INF_DIRS_share)
endif

SRC_SERVICES_FILES := $(wildcard $(addsuffix /services/*, $(ALL_META-INF_DIRS)))

# The number of services files are relatively few. If the increase in numbers, then
# we have to use ListPathsSafelyNow here.
# Change $(JDK_TOPDIR)/src/.../META-INF/services/yyyy into $(JDK_OUTPUTDIR)/classes/META-INF/services/yyyy
# The \n in the printf command is needed to make sed work on Solaris.
OUT_SERVICES_FILES := $(addprefix $(JDK_OUTPUTDIR)/classes/META-INF/services/, \
    $(shell $(PRINTF) "$(SRC_SERVICES_FILES)\n" | $(SED) -e 's|/[^ ]*/META-INF/services/||g'))
OUT_SERVICES_FILES_COLON := $(addsuffix :, $(OUT_SERVICES_FILES))
# Exception handling for print services with no META-INF directory
SRC_SERVICES_FILES_PRINT = $(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/print/services/*)
OUT_SERVICES_FILES_PRINT = $(addprefix $(JDK_OUTPUTDIR)/classes/META-INF/services/, \
    $(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/print/services/%, %, \
    $(SRC_SERVICES_FILES_PRINT)))
OUT_SERVICES_FILES_PRINT_COLON = $(addsuffix :, $(OUT_SERVICES_FILES_PRINT))
RULES_SERVICES_PRINT = $(join $(OUT_SERVICES_FILES_PRINT_COLON), $(SRC_SERVICES_FILES_PRINT))

# Now setup the dependency rules to generate a META-INF/services/... from the correct source.
META-INF_RULES_SERVICES := $(RULES_SERVICES_PRINT) $(join $(OUT_SERVICES_FILES_COLON), $(SRC_SERVICES_FILES))
# Eval the newly created rules to incorporate them into the make tree.
define addto_meta-inf_services
  $1
	echo $(LOG_INFO) Installing META-INF/services/$$(@F)
	$(CAT) $$< | $(SED) -e "s/^#\[$(OPENJDK_TARGET_OS)\]//" > $$@
endef
$(foreach i, $(META-INF_RULES_SERVICES), $(eval $(call addto_meta-inf_services, $i)))
# Here is the generic rule, whose receipt the above rules will trigger.

COPY_EXTRA += $(OUT_SERVICES_FILES)
COPY_EXTRA += $(OUT_SERVICES_FILES_PRINT)

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

JAVAX_SOUND_SRC := $(JDK_TOPDIR)/src/share/classes/com/sun/media/sound/services

JAVAX_SOUND_SRC_FILES := \
    javax.sound.midi.spi.MidiDeviceProvider \
    javax.sound.midi.spi.MidiFileReader \
    javax.sound.midi.spi.MidiFileWriter \
    javax.sound.midi.spi.SoundbankReader \
    javax.sound.sampled.spi.AudioFileReader \
    javax.sound.sampled.spi.AudioFileWriter \
    javax.sound.sampled.spi.FormatConversionProvider \
    javax.sound.sampled.spi.MixerProvider

COPY_EXTRA += $(addprefix $(JDK_OUTPUTDIR)/classes/META-INF/services/, $(JAVAX_SOUND_SRC_FILES))

JAVAX_SOUND_RULES := $(foreach F, $(JAVAX_SOUND_SRC_FILES), $(JDK_OUTPUTDIR)/classes/META-INF/services/$(notdir $F):$(JAVAX_SOUND_SRC)/$F)

$(foreach R, $(JAVAX_SOUND_RULES), $(eval $(call addto_meta-inf_services, $R)))

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

ifneq ($(OPENJDK_TARGET_OS), macosx)
  OPENJDK_TARGET_OS_FLAVORMAP_PROPERTIES = $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/sun/awt/datatransfer/flavormap.properties
else
  OPENJDK_TARGET_OS_FLAVORMAP_PROPERTIES = $(JDK_TOPDIR)/src/macosx/classes/sun/awt/datatransfer/flavormap.properties
endif

$(JDK_OUTPUTDIR)/classes/sun/awt/datatransfer/flavormap.properties: $(OPENJDK_TARGET_OS_FLAVORMAP_PROPERTIES)
	$(install-file)

COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/sun/awt/datatransfer/flavormap.properties

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

CLEAN_FILES := $(wildcard \
    $(JDK_TOPDIR)/src/share/classes/com/sun/imageio/plugins/common/*.properties \
    $(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/*.properties \
    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties \
    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/ldap/jndiprovider.properties \
    $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource/*.properties \
    $(JDK_TOPDIR)/src/share/classes/com/sun/rowset/*.properties \
    $(JDK_TOPDIR)/src/share/classes/com/sun/tools/script/shell/*.properties \
    $(JDK_TOPDIR)/src/share/classes/javax/sql/rowset/*.properties \
    $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources/*.properties \
    $(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources/*.properties \
    $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources/*.properties \
    $(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources/*.properties \
    $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources/*.properties \
    $(JDK_TOPDIR)/src/share/classes/sun/tools/serialver/resources/*.properties \
    )

# Copy zh_HK files from zh_TW

$(JDK_OUTPUTDIR)/classes/%_zh_HK.properties: $(JDK_OUTPUTDIR)/classes/%_zh_TW.properties
	$(install-file)

COPY_EXTRA += $(patsubst $(JDK_TOPDIR)/src/share/classes/%, $(JDK_OUTPUTDIR)/classes/%, \
    $(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $(CLEAN_FILES))))