8025758: Enhance Naming management
Summary: Enforce package access control with current context. Also reviewed by Alexander Fomin <alexander.fomin@oracle.com>
Reviewed-by: weijun, ahgross
#
# Copyright (c) 2001, 2011, 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.
#
################################################################
# SANITY
################################################################
sanity:: pre-sanity settings insane environment
ifeq ($(BUILD_HOTSPOT), true)
sanity:: hotspot-sanity
endif
ifeq ($(BUILD_DEPLOY), true)
sanity:: deploy-sanity
endif
ifeq ($(BUILD_JDK), true)
sanity:: jdk-sanity
endif
# Only need these sanity rules when not doing a debug build
ifeq ($(DEBUG_NAME),)
ifeq ($(BUILD_INSTALL), true)
sanity:: install-sanity
endif
ifeq ($(BUILD_SPONSORS), true)
sanity:: sponsors-sanity
endif
endif
sanity:: post-sanity
source-sanity : pre-sanity post-sanity
$(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE):
@$(prep-target)
purge-sanity: $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE)
-@$(RM) $(ERROR_FILE) $(WARNING_FILE) $(MESSAGE_FILE)
pre-sanity: purge-sanity
# this should be the last rule in any target's sanity rule.
post-sanity post-sanity-hotspot post-sanity-jdk post-sanity-install post-sanity-deploy:
@if [ -r $(MESSAGE_FILE) ]; then \
$(ECHO) "" ; \
$(CAT) $(MESSAGE_FILE) ; \
fi
@if [ -r $(WARNING_FILE) ]; then \
$(CAT) $(WARNING_FILE) ; \
fi
@if [ "x$(INSANE)" != x ]; then \
$(ECHO) "INSANE mode requested. \n" \
"Sanity will not force a build termination, even with errors.\n" \
"" >> $(ERROR_FILE); \
fi
@if [ -r $(ERROR_FILE) ]; then \
if [ "x$(INSANE)" = x ]; then \
$(ECHO) "Exiting because of the above error(s). \n" \
"">> $(ERROR_FILE); \
fi ; \
$(CAT) $(ERROR_FILE) ; \
if [ "x$(INSANE)" = x ]; then \
exit 1 ; \
fi ; \
fi
ifdef PEDANTIC
@if [ -r $(WARNING_FILE) ]; then \
$(ECHO) "PEDANTIC mode requested. \n" \
"Exiting because of the above warning(s). \n" \
"" >> $(ERROR_FILE); \
$(CAT) $(ERROR_FILE) ; \
exit 1 ; \
fi
endif
@if [ ! -r $(ERROR_FILE) ]; then \
$(ECHO) "Sanity check passed." ; \
fi
insane:
ifdef INSANE
@$(ECHO) "WARNING: You are building in 'INSANE' mode. You \n" \
" should not use this mode, and in fact, \n" \
" it may be removed at any time. If you \n" \
" have build problems as a result of using \n" \
" INSANE mode, then you should not expect \n" \
" assistance from anyone with the problems \n" \
" or consequences you experience. \n" \
"" >> $(WARNING_FILE)
endif
# Get list of environment variables set that we do not want set
ifdef ALT_HOTSPOT_SERVER_PATH
DO_NOT_SET_LIST += ALT_HOTSPOT_SERVER_PATH
endif
ifdef ALT_HOTSPOT_CLIENT_PATH
DO_NOT_SET_LIST += ALT_HOTSPOT_CLIENT_PATH
endif
ifdef ALT_HOTSPOT_LIB_PATH
DO_NOT_SET_LIST += ALT_HOTSPOT_LIB_PATH
endif
# Error message for environment variable set that should not be
%.do_not_set:
@$(ECHO) "ERROR: Your build environment has the variable\n" \
" $* defined. Please unset it and restart your build. \n" \
"" >> $(ERROR_FILE)
# Check the environment variables
environment: $(DO_NOT_SET_LIST:%=%.do_not_set)
ifeq ($(LANGTOOLS_SRC_AVAILABLE), true)
ifneq ($(BUILD_LANGTOOLS), true)
@$(ECHO) "WARNING: You are not building the LANGTOOLS sources.\n" \
" Lang tools (javac) will be obtained from \n" \
" the location set in ALT_JDK_IMPORT_PATH. \n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(JAXP_SRC_AVAILABLE), true)
ifneq ($(BUILD_JAXP), true)
@$(ECHO) "WARNING: You are not building the JAXP sources.\n" \
" The jaxp files will be obtained from \n" \
" the location set in ALT_JDK_IMPORT_PATH. \n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(JAXWS_SRC_AVAILABLE), true)
ifneq ($(BUILD_JAXWS), true)
@$(ECHO) "WARNING: You are not building the JAXWS sources.\n" \
" The jaxws files will be obtained from \n" \
" the location set in ALT_JDK_IMPORT_PATH. \n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(CORBA_SRC_AVAILABLE), true)
ifneq ($(BUILD_CORBA), true)
@$(ECHO) "WARNING: You are not building the CORBA sources.\n" \
" The corba files will be obtained from \n" \
" the location set in ALT_JDK_IMPORT_PATH. \n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(HOTSPOT_SRC_AVAILABLE), true)
ifneq ($(BUILD_HOTSPOT), true)
@$(ECHO) "WARNING: You are not building the HOTSPOT sources.\n" \
" Hotspot libs will be obtained from \n" \
" the location set in ALT_HOTSPOT_IMPORT_PATH. \n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(JDK_SRC_AVAILABLE), true)
ifneq ($(BUILD_JDK), true)
@$(ECHO) "WARNING: You are not building the JDK sources.\n" \
" This will result in a development-only\n" \
" build of the JDK , lacking the jdk binaries.\n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(NASHORN_SRC_AVAILABLE), true)
ifneq ($(BUILD_NASHORN), true)
@$(ECHO) "WARNING: You are not building the NASHORN sources.\n" \
" The nashorn files will be obtained from \n" \
" the location set in ALT_JDK_IMPORT_PATH. \n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(DEPLOY_SRC_AVAILABLE), true)
ifneq ($(BUILD_DEPLOY), true)
@$(ECHO) "WARNING: You are not building the DEPLOY sources.\n" \
" This will result in a development-only\n" \
" build of the JDK, lacking the plugin and javaws binaries.\n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(INSTALL_SRC_AVAILABLE), true)
ifneq ($(BUILD_INSTALL), true)
@$(ECHO) "WARNING: You are not building the INSTALL sources.\n" \
" This will result in a development-only\n" \
" build of the JDK, lacking the installation bundles\n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(SPONSORS_SRC_AVAILABLE), true)
ifneq ($(BUILD_SPONSORS), true)
@$(ECHO) "WARNING: You are not building the SPONSORS sources.\n" \
"" >> $(WARNING_FILE)
endif
endif
ifeq ($(GENERATE_DOCS),false)
@$(ECHO) "WARNING: This build does not include generating javadoc.\n" \
"" >> $(WARNING_FILE)
endif
ifdef NO_DEMOS
@$(ECHO) "WARNING: This build and any install images will not include demos.\n" \
"" >> $(WARNING_FILE)
endif
ifdef NO_SAMPLES
@$(ECHO) "WARNING: This build and any install images will not include samples.\n" \
"" >> $(WARNING_FILE)
endif
ifdef NO_IMAGES
@$(ECHO) "WARNING: Your build environment has the variable NO_IMAGES\n" \
" defined. This will result in a development-only\n" \
" build of the JDK, lacking the install images\n" \
" and bundles.\n" \
"" >> $(WARNING_FILE)
endif
ifdef DEV_ONLY
@$(ECHO) "WARNING: Your build environment has the variable DEV_ONLY\n" \
" defined. This will result in a development-only\n" \
" build of the JDK, lacking the documentation\n" \
" build and installation bundles.\n" \
"" >> $(WARNING_FILE)
endif
######################################################
# dump out the variable settings...
######################################################
ifneq ($(PLATFORM), windows)
ifndef HOSTNAME
HOSTNAME := $(shell hostname)
endif
endif
settings::
@$(ECHO) "Build Machine Information:" >> $(MESSAGE_FILE)
ifeq ($(PLATFORM), windows)
@$(ECHO) " build machine = $(COMPUTERNAME)" >> $(MESSAGE_FILE)
else
@$(ECHO) " build machine = $(HOSTNAME)" >> $(MESSAGE_FILE)
endif
@$(ECHO) "" >> $(MESSAGE_FILE)
@$(ECHO) "Build Directory Structure:" >> $(MESSAGE_FILE)
@$(ECHO) " CWD = `$(PWD)`" >> $(MESSAGE_FILE)
@$(ECHO) " TOPDIR = $(TOPDIR)" >> $(MESSAGE_FILE)
ifeq ($(LANGTOOLS_SRC_AVAILABLE), true)
@$(ECHO) " LANGTOOLS_TOPDIR = $(LANGTOOLS_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(JAXP_SRC_AVAILABLE), true)
@$(ECHO) " JAXP_TOPDIR = $(JAXP_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(JAXWS_SRC_AVAILABLE), true)
@$(ECHO) " JAXWS_TOPDIR = $(JAXWS_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(CORBA_SRC_AVAILABLE), true)
@$(ECHO) " CORBA_TOPDIR = $(CORBA_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(HOTSPOT_SRC_AVAILABLE), true)
@$(ECHO) " HOTSPOT_TOPDIR = $(HOTSPOT_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(JDK_SRC_AVAILABLE), true)
@$(ECHO) " JDK_TOPDIR = $(JDK_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(NASHORN_SRC_AVAILABLE), true)
@$(ECHO) " NASHORN_TOPDIR = $(NASHORN_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(DEPLOY_SRC_AVAILABLE), true)
@$(ECHO) " DEPLOY_TOPDIR = $(DEPLOY_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(INSTALL_SRC_AVAILABLE), true)
@$(ECHO) " INSTALL_TOPDIR = $(INSTALL_TOPDIR)" >> $(MESSAGE_FILE)
endif
ifeq ($(SPONSORS_SRC_AVAILABLE), true)
@$(ECHO) " SPONSORS_TOPDIR = $(SPONSORS_TOPDIR)" >> $(MESSAGE_FILE)
endif
@$(ECHO) "" >> $(MESSAGE_FILE)
ifneq ($(SKIP_COMPARE_IMAGES), true)
@$(ECHO) "External File/Binary Locations:" >> $(MESSAGE_FILE)
@$(ECHO) " PREVIOUS_JRE_BUNDLE = $(PREVIOUS_JRE_BUNDLE) " >> $(MESSAGE_FILE)
@$(ECHO) " PREVIOUS_JDK_BUNDLE = $(PREVIOUS_JDK_BUNDLE) " >> $(MESSAGE_FILE)
@$(ECHO) "" >> $(MESSAGE_FILE)
endif
@$(ECHO) "Build Directives:" >> $(MESSAGE_FILE)
ifeq ($(LANGTOOLS_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_LANGTOOLS = $(BUILD_LANGTOOLS) " >> $(MESSAGE_FILE)
endif
ifeq ($(JAXP_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_JAXP = $(BUILD_JAXP) " >> $(MESSAGE_FILE)
endif
ifeq ($(JAXWS_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_JAXWS = $(BUILD_JAXWS) " >> $(MESSAGE_FILE)
endif
ifeq ($(CORBA_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_CORBA = $(BUILD_CORBA) " >> $(MESSAGE_FILE)
endif
ifeq ($(HOTSPOT_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_HOTSPOT = $(BUILD_HOTSPOT) " >> $(MESSAGE_FILE)
endif
ifeq ($(JDK_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_JDK = $(BUILD_JDK) " >> $(MESSAGE_FILE)
endif
ifeq ($(NASHORN_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_NASHORN = $(BUILD_NASHORN) " >> $(MESSAGE_FILE)
endif
ifeq ($(DEPLOY_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_DEPLOY = $(BUILD_DEPLOY) " >> $(MESSAGE_FILE)
endif
ifeq ($(INSTALL_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_INSTALL = $(BUILD_INSTALL) " >> $(MESSAGE_FILE)
endif
ifeq ($(SPONSORS_SRC_AVAILABLE), true)
@$(ECHO) " BUILD_SPONSORS = $(BUILD_SPONSORS) " >> $(MESSAGE_FILE)
endif
@$(ECHO) " DEBUG_CLASSFILES = $(DEBUG_CLASSFILES) " >> $(MESSAGE_FILE)
@$(ECHO) " DEBUG_BINARIES = $(DEBUG_BINARIES) " >> $(MESSAGE_FILE)
@$(ECHO) "" >> $(MESSAGE_FILE)
.PHONY: sanity settings pre-sanity insane \
post-sanity post-sanity-hotspot post-sanity-jdk \
post-sanity-install post-sanity-deploy \
environment