jtreg6/make/jtreg.gmk

461 lines
14 KiB
Plaintext

#
# Copyright (c) 1999, 2018, 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.
#
#----------------------------------------------------------------------
#
# compile com.sun.javatest.regtest
### The following files are required to run othervm tests
REGTEST-OTHERVM-CLASSES = AppletWrapper GetSystemProperty MainWrapper AStatus StringArray
JAVAFILES.com.sun.javatest.regtest-othervm = \
$(REGTEST-OTHERVM-CLASSES:%=$(JAVADIR)/com/sun/javatest/regtest/agent/%.java)
# TODO: set -bootclasspath to JDK 1.1 classes?
$(BUILDDIR)/classes.com.sun.javatest.regtest-othervm.ok: \
$(JAVAFILES.com.sun.javatest.regtest-othervm) \
$(call PosixPath,$(JAVATEST_JAR))
$(MKDIR) -p $(CLASSDIR)
CLASSPATH="$(CLASSDIR)$(PS)$(JAVATEST_JAR)" \
$(REGTEST_OLD_JAVAC) $(REGTEST_OLD_JAVAC_OPTIONS) \
-d $(CLASSDIR) \
-encoding ISO8859-1 \
$(JAVAFILES.com.sun.javatest.regtest-othervm)
echo "classes built at `date`" > $@
### The following files are required to run agentvm tests, as far back as JDK 1.5
JAVAFILES.com.sun.javatest.regtest-agentvm := \
$(filter-out $(JAVAFILES.com.sun.javatest.regtest-othervm), $(shell $(FIND) $(JAVADIR)/com/sun/javatest/regtest/agent -name \*.java ))
$(BUILDDIR)/classes.com.sun.javatest.regtest.agent.ok: \
$(JAVAFILES.com.sun.javatest.regtest-agentvm) \
$(BUILDDIR)/classes.com.sun.javatest.regtest-othervm.ok
CLASSPATH="$(CLASSDIR)$(PS)$(JAVATEST_JAR)$(PS)$(JUNIT_JAR)$(PS)$(TESTNG_JAR)" \
$(REGTEST_AGENT_JAVAC) $(REGTEST_AGENT_JAVAC_OPTIONS) \
-d $(CLASSDIR) \
-encoding ISO8859-1 \
$(JAVAFILES.com.sun.javatest.regtest-agentvm)
echo "classes built at `date`" > $@
### The following files are for the jtreg and jtdiff tools
JAVAFILES.com.sun.javatest.regtest-tools := \
$(shell $(FIND) $(JAVADIR)/com/sun/javatest/regtest -name agent -prune -o -name \*.java -print )
$(BUILDDIR)/classes.com.sun.javatest.regtest.ok: \
$(JAVAFILES.com.sun.javatest.regtest-tools) \
$(BUILDDIR)/classes.com.sun.javatest.regtest.agent.ok
CLASSPATH="$(CLASSDIR)$(PS)$(ANT_JAR)$(PS)$(JAVATEST_JAR)$(PS)$(JUNIT_JAR)$(PS)$(TESTNG_JAR)" \
$(REGTEST_TOOL_JAVAC) $(REGTEST_TOOL_JAVAC_OPTIONS) \
-d $(CLASSDIR) \
-encoding ISO8859-1 \
$(JAVAFILES.com.sun.javatest.regtest-tools)
echo "classes built at `date`" > $@
TARGETS.com.sun.javatest.regtest += $(BUILDDIR)/classes.com.sun.javatest.regtest.ok
JAVAFILES.java.lang := \
$(JAVADIR)/java/lang/JTRegModuleHelper.java
$(BUILDDIR)/classes.java.lang.ok: \
$(JAVAFILES.java.lang)
CLASSPATH= \
$(REGTEST_TOOL_JAVAC) $(REGTEST_TOOL_JAVAC_OPTIONS) $(REGTEST_TOOL_PATCH_JAVA_BASE_OPTIONS) \
-d $(CLASSDIR) \
-encoding ISO8859-1 \
$(JAVAFILES.java.lang)
echo "classes built at `date`" > $@
TARGETS.com.sun.javatest.regtest += $(BUILDDIR)/classes.java.lang.ok
#----------------------------------------------------------------------
#
# resources required for com.sun.javatest.regtest
RESOURCES.com.sun.javatest.regtest = \
$(CLASSDIR)/com/sun/javatest/regtest/i18n.properties \
$(CLASSDIR)/com/sun/javatest/regtest/config/i18n.properties \
$(CLASSDIR)/com/sun/javatest/regtest/report/i18n.properties \
$(CLASSDIR)/com/sun/javatest/regtest/tool/i18n.properties \
$(CLASSDIR)/com/sun/javatest/regtest/tool/jtlogo.png
TARGETS.com.sun.javatest.regtest += $(RESOURCES.com.sun.javatest.regtest)
#----------------------------------------------------------------------
#
# Misc. doc files
JTREG_COPYRIGHT = $(JTREG_IMAGEDIR)/COPYRIGHT
JTREG_LICENSE = $(JTREG_IMAGEDIR)/LICENSE
JTREG_README = $(JTREG_IMAGEDIR)/README
JTREG_FAQ = $(JTREG_IMAGEDIR)/doc/jtreg/faq.html
JTREG_TAGSPEC = $(JTREG_IMAGEDIR)/doc/jtreg/tag-spec.html
JTREG_USAGE = $(JTREG_IMAGEDIR)/doc/jtreg/usage.txt
JTREG_DOCS = \
$(JTREG_COPYRIGHT) \
$(JTREG_FAQ) \
$(JTREG_LICENSE) \
$(JTREG_README) \
$(JTREG_TAGSPEC) \
$(JTREG_USAGE)
$(JTREG_COPYRIGHT): $(TOPDIR)/COPYRIGHT
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(JTREG_FAQ): $(SRCJTREGDOCDIR)/faq.md \
$(SRCJTREGDOCDIR)/faq-local-style.html \
$(SRCJTREGDOCDIR)/faq-intro.html
$(MKDIR) -p $(@D)
$(ECHO) '/<header>/{;:a;N;/<\/header>/!ba;};/<h1 class="title">/d' | tr ';' '\n' > $(BUILDDIR)/fixupheader
$(PANDOC) \
--standalone \
--include-in-header $(SRCJTREGDOCDIR)/faq-local-style.html \
--include-before $(SRCJTREGDOCDIR)/faq-intro.html \
--toc \
--to html5 \
--number-sections \
$(SRCJTREGDOCDIR)/faq.md | \
$(SED) \
-e 's/^code > span\.\([a-z][a-z] .*\)/code span.\1/' \
-e 's/-section-number">0./-section-number">/' \
-e 's/…/\&hellip;/g' \
-e 's/™/\&trade;/g' \
-f $(BUILDDIR)/fixupheader \
> $(JTREG_FAQ)
$(JTREG_README): $(SRCJTREGDOCDIR)/README
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(JTREG_TAGSPEC): $(JTREG_IMAGEDIR)/doc/jtreg/%: $(SRCJTREGDOCDIR)/%
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $^ $@
$(JTREG_USAGE): $(BUILDDIR)/jtreg-usage.txt
$(CP) $^ $@
$(JTREG_LICENSE): $(TOPDIR)/LICENSE
$(MKDIR) -p $(@D)
$(CP) $^ $@
$(BUILDDIR)/jtreg-usage.txt: \
$(BUILDDIR)/classes.com.sun.javatest.regtest.ok \
$(BUILDDIR)/classes/com/sun/javatest/regtest/tool/i18n.properties
$(JDKJAVA) -cp "$(CLASSDIR)$(PS)$(JAVATEST_JAR)" \
-Dprogram=jtreg com.sun.javatest.regtest.Main -help all > $@
TARGETS.ZIP.jtreg += $(JTREG_DOCS)
#----------------------------------------------------------------------
ifdef JAVATEST_SRCDIR
JAVATEST_SRCFILES= \
$(JAVATEST_SRCDIR)/com/sun/javatest/InterviewParameters.java \
$(JAVATEST_SRCDIR)/com/sun/javatest/Parameters.java \
$(JAVATEST_SRCDIR)/com/sun/javatest/Status.java \
$(JAVATEST_SRCDIR)/com/sun/javatest/TestDescription.java \
$(JAVATEST_SRCDIR)/com/sun/javatest/TestResult.java \
$(JAVATEST_SRCDIR)/com/sun/javatest/TestResultTable.java \
$(JAVATEST_SRCDIR)/com/sun/javatest/WorkDirectory.java
endif
$(JTREG_IMAGEDIR)/doc/api/index.html: \
$(JAVAFILES.com.sun.javatest.regtest-tools) \
$(JAVATEST_SRCFILES)
$(JDKHOME)/bin/javadoc -d $(@D) \
-encoding iso-8859-1 \
-sourcepath "$(JAVADIR)$(PS)$(JAVATEST_SRCDIR)" \
-classpath "$(ANT_JAR)$(PS)$(JAVATEST_JAR)$(PS)$(JUNIT_JAR)$(PS)$(TESTNG_JAR)" \
com.sun.javatest.regtest \
$(JAVATEST_SRCFILES)
$(JTREG_IMAGEDIR)/doc/devapi/index.html: \
$(JAVAFILES.com.sun.javatest.regtest-tools) \
$(JAVATEST_SRCFILES)
$(JDKHOME)/bin/javadoc -d $(@D) \
-encoding iso-8859-1 \
-sourcepath "$(JAVADIR)$(PS)$(JAVATEST_SRCDIR)" \
-classpath "$(ANT_JAR)$(PS)$(JAVATEST_JAR)$(PS)$(JUNIT_JAR)$(PS)$(TESTNG_JAR)" \
-subpackages com.sun.javatest.regtest \
-tag "implNote:a:Implementation Note:" \
$(JAVATEST_SRCFILES)
#----------------------------------------------------------------------
#
# create jtreg.jar
PKGS.JAR.jtreg += \
com.sun.javatest.regtest \
com.sun.javatest.regtest.agent \
com.sun.javatest.regtest.config \
com.sun.javatest.regtest.exec \
com.sun.javatest.regtest.report \
com.sun.javatest.regtest.tool \
com.sun.javatest.regtest.util \
java.lang
TARGETS.JAR.jtreg += $(TARGETS.com.sun.javatest.regtest)
$(JTREG_IMAGEDIR)/lib/jtreg.jar: JAR_MAINCLASS = com.sun.javatest.regtest.Main
$(JTREG_IMAGEDIR)/lib/jtreg.jar: JAR_CLASSPATH = javatest.jar asmtools.jar
$(JTREG_IMAGEJARDIR)/jtreg.jar: \
$(JTREG_IMAGEDIR)/lib/javatest.jar \
$(TARGETS.JAR.jtreg)
ifdef JAVAHELP_JAR
$(JTREG_IMAGEJARDIR)/jtreg.jar: \
$(JTREG_IMAGEJARDIR)/jh.jar
endif
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/jtreg.jar
#----------------------------------------------------------------------
#
# import JavaTest or JT Harness
TARGETS.com.sun.javatest.regtest += $(RESOURCES.com.sun.javatest.regtest)
$(JTREG_IMAGEDIR)/lib/javatest.jar: $(call PosixPath,$(JAVATEST_JAR))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/javatest.jar
$(JTREG_IMAGEDIR)/legal/jtharness/license.txt: $(call PosixPath,$(JTHARNESS_LICENSE))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JTHARNESS_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/jtharness/license.txt
endif
$(JTREG_IMAGEDIR)/legal/jtharness/copyright.txt: $(call PosixPath,$(JTHARNESS_COPYRIGHT))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JTHARNESS_COPYRIGHT
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/jtharness/copyright.txt
endif
#----------------------------------------------------------------------
#
# import JUnit
$(JTREG_IMAGEDIR)/lib/junit.jar: $(call PosixPath,$(JUNIT_JAR))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/junit.jar
ifdef JUNIT_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/junit/LICENSE
endif
$(JTREG_IMAGEDIR)/legal/junit/LICENSE: $(call PosixPath,$(JUNIT_LICENSE))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
#----------------------------------------------------------------------
#
# import TestNG
$(JTREG_IMAGEDIR)/lib/testng.jar: $(call PosixPath,$(TESTNG_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $(TESTNG_JAR) $@
jquery=`$(JAR) tf $@ | $(GREP) 'jquery.*.js'` ; \
if [ -n "$$jquery" ]; then \
$(RM) $(BUILDDIR)/$$jquery ; $(MKDIR) -p `dirname $(BUILDDIR)/$$jquery` ; $(TOUCH) $(BUILDDIR)/$$jquery ; \
$(JAR) uf $@ -C $(BUILDDIR) $$jquery ; \
fi
- $(ZIP) -d $@ Version.java
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/testng.jar
$(JTREG_IMAGEDIR)/lib/jcommander.jar: $(call PosixPath,$(JCOMMANDER_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $(JCOMMANDER_JAR) $@
ifdef JCOMMANDER_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/jcommander.jar
endif
$(JTREG_IMAGEDIR)/lib/guice.jar: $(call PosixPath,$(GOOGLE_GUICE_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $(GOOGLE_GUICE_JAR) $@
ifdef GOOGLE_GUICE_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/guice.jar
endif
$(JTREG_IMAGEDIR)/lib/hamcrest.jar: $(call PosixPath,$(HAMCREST_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $(HAMCREST_JAR) $@
ifdef HAMCREST_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEJARDIR)/hamcrest.jar
endif
$(JTREG_IMAGEDIR)/legal/testng/LICENSE: $(call PosixPath,$(TESTNG_LICENSE))
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef TESTNG_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/testng/LICENSE
endif
#----------------------------------------------------------------------
#
# import JCov
$(JTREG_IMAGEDIR)/lib/jcov.jar: $(call PosixPath,$(JCOV_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JCOV_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/lib/jcov.jar
endif
$(JTREG_IMAGEDIR)/lib/jcov_network_saver.jar: $(call PosixPath,$(JCOV_NETWORK_SAVER_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JCOV_NETWORK_SAVER_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/lib/jcov_network_saver.jar
endif
$(JTREG_IMAGEDIR)/legal/jcov/LICENSE: $(call PosixPath,$(JCOV_LICENSE))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef JCOV_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/jcov/LICENSE
endif
#----------------------------------------------------------------------
#
# import AsmTools
$(JTREG_IMAGEDIR)/lib/asmtools.jar: $(call PosixPath,$(ASMTOOLS_JAR))
$(RM) $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef ASMTOOLS_JAR
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/lib/asmtools.jar
$(JTREG_IMAGEDIR)/lib/jtreg.jar: $(JTREG_IMAGEDIR)/lib/asmtools.jar
endif
$(JTREG_IMAGEDIR)/legal/asmtools/LICENSE: $(call PosixPath,$(ASMTOOLS_LICENSE))
$(RM) -f $@
$(MKDIR) -p $(@D)
$(CP) $< $@
ifdef ASMTOOLS_LICENSE
TARGETS.ZIP.jtreg += $(JTREG_IMAGEDIR)/legal/asmtools/LICENSE
endif
#----------------------------------------------------------------------
#
# executable scripts
$(JTREG_IMAGEDIR)/bin/jtreg: $(SRCSHAREBINDIR)/jtreg.sh
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
$(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/bin/jtreg
#----------------------------------------------------------------------
#
# release info
# based on code in OpenJDK make/SourceRevision.gmk
ID_COMMAND := $(PRINTF) "git:%s%s\n" \
"$$(git log -n1 --format=%H | cut -c1-12)" \
"$$(if test -n "$$(git status --porcelain)"; then printf '+'; fi)"
$(JTREG_IMAGEDIR)/release:
echo "JTREG_VERSION=$(BUILD_VERSION) $(BUILD_NUMBER)" > $@
echo "BUILD_DATE=`/bin/date +'%B %d, %Y'`" >> $@
if [ -r $(TOPDIR)/.git ]; then \
echo "SOURCE=$$($(ID_COMMAND))" >> $@ ; \
elif [ -r $(TOPDIR)/.src-rev ]; then \
echo "SOURCE=\"$$($(CAT) $(TOPDIR)/.src-rev | $(SED) -e 's/:/:git:/' -e 's/ *$$//')\"" >> $@ ; \
fi
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/release
#----------------------------------------------------------------------
#
# create jtreg.zip bundles
JTREG_ZIP = $(IMAGES_DIR)/jtreg.zip
$(JTREG_ZIP): $(TARGETS.ZIP.jtreg)
$(RM) $@
cd $(IMAGES_DIR); $(ZIP) -rq $@ $(@F:%.zip=%)
JTREG_ZIPFILES = $(JTREG_ZIP)
#----------------------------------------------------------------------
BUILDFILES += $(JTREG_ZIPFILES)
VERBOSEZIPFILES += $(JTREG_ZIPFILES:%.zip=%-$(VERBOSE_ZIP_SUFFIX).zip)
NEWVERBOSEZIPFILES += $(JTREG_ZIPFILES:%.zip=%-$(NEW_VERBOSE_ZIP_SUFFIX).zip)
#JTREG_JAVA_OPTS = -Ddebug.com.sun.javatest.TestResultCache=98
#JTREG_OPTS = $(JTREG_JAVA_OPTS:%=-J%)
TESTS += $(TESTS.jtreg)