test/make/TestJavaCompilation.gmk
author tschatzl
Fri, 29 Nov 2019 10:20:17 +0100
changeset 59321 5775e4825e58
parent 47334 09d386ddaa42
permissions -rw-r--r--
8233998: New young regions registered too early in collection set Reviewed-by: sangheki, sjohanss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     1
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     2
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     4
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    10
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    15
# accompanied this code).
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    16
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    20
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    23
# questions.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    24
#
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    25
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    26
default: all
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    27
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    28
include $(SPEC)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    29
include MakeBase.gmk
33438
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
    30
include JarArchive.gmk
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    31
include JavaCompilation.gmk
47334
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47217
diff changeset
    32
include UtilsForTests.gmk
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    33
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 41875
diff changeset
    34
THIS_FILE := $(TOPDIR)/test/make/TestJavaCompilation.gmk
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    35
DEPS := $(THIS_FILE) \
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 41875
diff changeset
    36
    $(TOPDIR)/make/common/MakeBase.gmk \
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 41875
diff changeset
    37
    $(TOPDIR)/make/common/JavaCompilation.gmk \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    38
    #
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    39
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    40
OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/java-compilation
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    41
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    42
################################################################################
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    43
# Test: jar1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    44
# Creates a simple jar file and unzips it to verify that the files have not
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    45
# changed.
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    46
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    47
JAR1_SRC_ROOT := $(OUTPUT_DIR)/jar1src
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    48
JAR1_UNZIP := $(OUTPUT_DIR)/jar1unzip
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    49
JAR1_FILE := $(OUTPUT_DIR)/jar1.jar
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    50
JAR1_MANIFEST := $(OUTPUT_DIR)/jar1_manifest
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    51
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    52
clean-jar1:
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    53
	$(RM) -r $(OUTPUT_DIR)/_jar1* $(OUTPUT_DIR)/jar1*
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    54
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    55
$(JAR1_MANIFEST): | $(OUTPUT_DIR)/_jar1_created
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    56
	$(ECHO) "Test-Attribute: value" > $(JAR1_MANIFEST)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    57
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    58
$(OUTPUT_DIR)/_jar1_created: $(DEPS)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    59
	$(RM) -r $(JAR1_SRC_ROOT)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    60
	$(RM) $(JAR1_FILE)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    61
	$(RM) -r $(JAR1_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    62
	$(MKDIR) -p $(JAR1_SRC_ROOT)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    63
	$(MKDIR) -p $(JAR1_SRC_ROOT)/dir1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    64
	$(MKDIR) -p $(JAR1_SRC_ROOT)/dir2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    65
	$(MKDIR) -p $(JAR1_SRC_ROOT)/META-INF
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    66
	$(TOUCH) $(JAR1_SRC_ROOT)/dir1/file1.class
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    67
	$(TOUCH) $(JAR1_SRC_ROOT)/dir2/file2.class
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    68
	$(TOUCH) $(JAR1_SRC_ROOT)/META-INF/metafile
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    69
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    70
33438
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
    71
$(eval $(call SetupJarArchive, BUILD_JAR1, \
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28600
diff changeset
    72
    DEPENDENCIES := $(OUTPUT_DIR)/_jar1_created, \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    73
    SRCS := $(JAR1_SRC_ROOT), \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    74
    MANIFEST := $(JAR1_MANIFEST), \
33438
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
    75
    JAR := $(JAR1_FILE), \
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
    76
))
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    77
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    78
$(OUTPUT_DIR)/_jar1_verified: $(BUILD_JAR1)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    79
	$(RM) -r $(JAR1_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    80
	$(MKDIR) -p $(JAR1_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    81
	$(CD) $(JAR1_UNZIP) && $(UNZIP) $(JAR1_FILE) $(LOG_DEBUG)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    82
	$(DIFF) -r $(JAR1_SRC_ROOT)/dir1 $(JAR1_UNZIP)/dir1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    83
	$(DIFF) -r $(JAR1_SRC_ROOT)/dir2 $(JAR1_UNZIP)/dir2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    84
	$(DIFF) -r $(JAR1_SRC_ROOT)/META-INF/metafile $(JAR1_UNZIP)/META-INF/metafile
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    85
	if [ "`$(GREP) 'Test-Attribute: value' $(JAR1_UNZIP)/META-INF/MANIFEST.MF`" = "" ]; then \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    86
	  $(ECHO) "Could not find Test-Attribute in manifest of $(JAR1_FILE)"; \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    87
	  exit 1; \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    88
	fi
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    89
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    90
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    91
create-jar2: $(OUTPUT_DIR)/_jar1_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    92
TEST_TARGETS += $(OUTPUT_DIR)/_jar1_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    93
47334
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47217
diff changeset
    94
# Change a source file and call this makefile again to force the jar to be
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47217
diff changeset
    95
# updated.
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
    96
$(OUTPUT_DIR)/_jar1_updated: $(OUTPUT_DIR)/_jar1_verified
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    97
	$(ECHO) updated > $(JAR1_SRC_ROOT)/dir1/file1.class
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    98
	$(ECHO) updated > $(JAR1_SRC_ROOT)/META-INF/metafile
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
    99
	$(TOUCH) $(OUTPUT_DIR)/_jar1_created
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   100
	+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar1_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   101
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   102
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   103
update-jar1: $(OUTPUT_DIR)_jar1_updated
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   104
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   105
# Change the manifest file and call this makefile again to force the jar
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   106
# to be updated
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   107
$(OUTPUT_DIR)/_jar1_updated_manifest: $(OUTPUT_DIR)/_jar1_updated
47334
09d386ddaa42 8189095: Import JMC from artifactory using Jib and main makefiles
erikj
parents: 47217
diff changeset
   108
	$(SLEEP_ON_MAC)
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   109
	$(ECHO) "Test-Attribute: foobar" > $(JAR1_MANIFEST)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   110
	+$(MAKE) -f $(THIS_FILE) $(BUILD_JAR1)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   111
	$(RM) -r $(JAR1_UNZIP)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   112
	$(MKDIR) -p $(JAR1_UNZIP)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   113
	$(CD) $(JAR1_UNZIP) && $(UNZIP) $(JAR1_FILE) $(LOG_DEBUG)
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   114
	if [ "`$(GREP) 'Test-Attribute: foobar' $(JAR1_UNZIP)/META-INF/MANIFEST.MF`" = "" ]; then \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   115
	  $(ECHO) "Could not find Test-Attribute in manifest of $(JAR1_FILE)"; \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   116
	  exit 1; \
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   117
	fi
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   118
	$(TOUCH) $@
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   119
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   120
update-jar1-manifest: $(OUTPUT_DIR)/_jar1_updated_manifest
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   121
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   122
TEST_TARGETS += $(OUTPUT_DIR)/_jar1_updated $(OUTPUT_DIR)/_jar1_updated_manifest
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   123
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   124
.PHONY: clean-jar1 create-jar1 update-jar1 update-jar1-manifest
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   125
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   126
################################################################################
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   127
# Test: jar2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   128
# Creates a jar file based on 2 source roots
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   129
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   130
JAR2_SRC_ROOT1 := $(OUTPUT_DIR)/jar2src1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   131
JAR2_SRC_ROOT2 := $(OUTPUT_DIR)/jar2src2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   132
JAR2_UNZIP := $(OUTPUT_DIR)/jar2unzip
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   133
JAR2_FILE := $(OUTPUT_DIR)/jar2.jar
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   134
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   135
clean-jar2:
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   136
	$(RM) -r $(OUTPUT_DIR)/_jar2* $(OUTPUT_DIR)/jar2*
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   137
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   138
$(OUTPUT_DIR)/_jar2_created: $(DEPS)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   139
	$(RM) -r $(JAR2_SRC_ROOT1)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   140
	$(RM) -r $(JAR2_SRC_ROOT2)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   141
	$(RM) $(JAR2_FILE)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   142
	$(RM) -r $(JAR2_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   143
	$(MKDIR) -p $(JAR2_SRC_ROOT1)/dir1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   144
	$(MKDIR) -p $(JAR2_SRC_ROOT2)/dir2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   145
	$(TOUCH) $(JAR2_SRC_ROOT1)/dir1/file1.class
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   146
	$(TOUCH) $(JAR2_SRC_ROOT2)/dir2/file2.class
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   147
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   148
33438
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
   149
$(eval $(call SetupJarArchive, BUILD_JAR2, \
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28600
diff changeset
   150
    DEPENDENCIES := $(OUTPUT_DIR)/_jar2_created, \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   151
    SRCS := $(JAR2_SRC_ROOT1) $(JAR2_SRC_ROOT2), \
33438
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
   152
    JAR := $(JAR2_FILE), \
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
   153
))
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   154
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   155
$(OUTPUT_DIR)/_jar2_verified: $(BUILD_JAR2)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   156
	$(RM) -r $(JAR2_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   157
	$(MKDIR) -p $(JAR2_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   158
	$(CD) $(JAR2_UNZIP) && $(UNZIP) $(JAR2_FILE) $(LOG_DEBUG)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   159
	$(DIFF) -r $(JAR2_SRC_ROOT1)/dir1 $(JAR2_UNZIP)/dir1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   160
	$(DIFF) -r $(JAR2_SRC_ROOT2)/dir2 $(JAR2_UNZIP)/dir2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   161
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   162
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   163
create-jar2: $(OUTPUT_DIR)/_jar2_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   164
TEST_TARGETS += $(OUTPUT_DIR)/_jar2_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   165
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   166
$(OUTPUT_DIR)/_jar2_updated: $(OUTPUT_DIR)/_jar2_verified
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   167
	$(ECHO) updated > $(JAR2_SRC_ROOT1)/dir1/file1.class
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   168
	$(TOUCH) $(OUTPUT_DIR)/_jar2_created
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   169
	+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar2_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   170
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   171
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   172
update-jar2: $(OUTPUT_DIR)/_jar2_updated
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   173
TEST_TARGETS += $(OUTPUT_DIR)/_jar2_updated
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   174
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   175
.PHONY: clean-jar2 create-jar2 update-jar2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   176
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   177
################################################################################
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   178
# Test: jar3
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   179
# Creates a jar file based on 2 source roots with an extra file
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   180
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   181
JAR3_SRC_ROOT1 := $(OUTPUT_DIR)/jar3src1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   182
JAR3_SRC_ROOT2 := $(OUTPUT_DIR)/jar3src2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   183
JAR3_UNZIP := $(OUTPUT_DIR)/jar3unzip
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   184
JAR3_FILE := $(OUTPUT_DIR)/jar3.jar
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   185
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   186
clean-jar3:
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   187
	$(RM) -r $(OUTPUT_DIR)/_jar3* $(OUTPUT_DIR)/jar3*
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   188
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   189
$(OUTPUT_DIR)/_jar3_created: $(DEPS)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   190
	$(RM) -r $(JAR3_SRC_ROOT1)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   191
	$(RM) -r $(JAR3_SRC_ROOT2)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   192
	$(RM) $(JAR3_FILE)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   193
	$(RM) -r $(JAR3_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   194
	$(MKDIR) -p $(JAR3_SRC_ROOT1)/dir1
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   195
	$(MKDIR) -p $(JAR3_SRC_ROOT2)/dir2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   196
	$(TOUCH) $(JAR3_SRC_ROOT1)/dir1/file1\$$foo.class
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   197
	$(TOUCH) $(JAR3_SRC_ROOT2)/dir2/file2.class
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   198
	$(TOUCH) $(JAR3_SRC_ROOT2)/extra-file
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   199
	$(TOUCH) $(JAR3_SRC_ROOT2)/extra-file-abs
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   200
	$(TOUCH) $(JAR3_SRC_ROOT2)/dir2/file\$$foo.dollar
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   201
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   202
33438
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
   203
$(eval $(call SetupJarArchive, BUILD_JAR3, \
29312
f3f859137ce6 8074988: Reduce boilerplate in Setup* macro definitions
erikj
parents: 28600
diff changeset
   204
    DEPENDENCIES := $(OUTPUT_DIR)/_jar3_created, \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   205
    SRCS := $(JAR3_SRC_ROOT1) $(JAR3_SRC_ROOT2), \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   206
    EXTRA_FILES := extra-file \
41875
854ef5325653 8160491: tar.gz bundles missing files containing $
erikj
parents: 34921
diff changeset
   207
        dir2/file$$foo.dollar \
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   208
        $(JAR3_SRC_ROOT2)/extra-file-abs, \
41875
854ef5325653 8160491: tar.gz bundles missing files containing $
erikj
parents: 34921
diff changeset
   209
    EXCLUDE_FILES := dir1/file1$$foo.class, \
33438
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
   210
    JAR := $(JAR3_FILE), \
35cd6a1619df 8141333: Rename SetupArchive to SetupJarArchive
ihse
parents: 30095
diff changeset
   211
))
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   212
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   213
$(OUTPUT_DIR)/_jar3_verified: $(BUILD_JAR3)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   214
	$(RM) -r $(JAR3_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   215
	$(MKDIR) -p $(JAR3_UNZIP)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   216
	$(CD) $(JAR3_UNZIP) && $(UNZIP) $(JAR3_FILE) $(LOG_DEBUG)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   217
	if [ -d "$(JAR3_UNZIP)/dir1" ]; then \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   218
	  echo Should not be included $(JAR3_UNZIP)/dir1; \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   219
	  exit 1; \
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   220
        fi
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   221
	$(DIFF) -r $(JAR3_SRC_ROOT2)/dir2 $(JAR3_UNZIP)/dir2
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   222
	$(DIFF) -r $(JAR3_SRC_ROOT2)/extra-file $(JAR3_UNZIP)/extra-file
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   223
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   224
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   225
create-jar3: $(OUTPUT_DIR)/_jar3_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   226
TEST_TARGETS += $(OUTPUT_DIR)/_jar3_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   227
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   228
$(OUTPUT_DIR)/_jar3_updated: $(OUTPUT_DIR)/_jar3_verified
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   229
	$(ECHO) updated > $(JAR3_SRC_ROOT2)/extra-file
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   230
	$(TOUCH) $(OUTPUT_DIR)/_jar3_created
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   231
	+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar3_verified
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   232
	$(TOUCH) $@
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   233
28600
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   234
update-jar3: $(OUTPUT_DIR)/_jar3_updated
09dd1740f176 8069261: Create make dependencies on make variable values
erikj
parents: 25854
diff changeset
   235
TEST_TARGETS += $(OUTPUT_DIR)/_jar3_updated
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   236
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   237
.PHONY: clean-jar3 create-jar3 update-jar3
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   238
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   239
################################################################################
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   240
# Test SetupJavaCompilation overrides of java files
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   241
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   242
$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   243
    JAVAC := $(JAVAC), \
34921
ca6c7c325650 8144226: Sjavac's handling of include/exclude patterns is buggy, redundant and inconsistent
alundblad
parents: 33438
diff changeset
   244
    DISABLE_SJAVAC := true, \
30095
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   245
))
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   246
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   247
JAVA_SRC_ROOT1 := $(OUTPUT_DIR)/javaroot1
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   248
JAVA_SRC_ROOT2 := $(OUTPUT_DIR)/javaroot2
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   249
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   250
# Since this makefile calls itself a number of times, protect this macro from
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   251
# being executed more than once.
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   252
# Param 1 - File name
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   253
# Param 2 - Package name
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   254
# Param 3 - Class name
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   255
# Param 4 - Message
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   256
CreateJavaSrc = \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   257
    $(if $(wildcard $1),,$(shell \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   258
        $(MKDIR) -p $(dir $1); \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   259
        $(ECHO) "package $2;" > $1; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   260
        $(ECHO) "public class $3 {" >> $1; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   261
        $(ECHO) "    public static void main(String[] args) {" >> $1; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   262
        $(ECHO) "        System.out.print(\"$4\");" >> $1; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   263
        $(ECHO) "    }" >> $1; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   264
        $(ECHO) "}" >> $1; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   265
    ))
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   266
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   267
# Since this makefile calls itself a number of times, protect this macro from
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   268
# being executed more than once.
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   269
# Param 1 - File name
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   270
# Param 2 - Message
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   271
CreateTextFile = \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   272
    $(if $(wildcard $1),,$(shell \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   273
        $(MKDIR) -p $(dir $1); \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   274
        $(PRINTF) '$2' > $1; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   275
    ))
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   276
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   277
$(call CreateJavaSrc,$(JAVA_SRC_ROOT1)/a/A.java,a,A,javaroot1)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   278
$(call CreateJavaSrc,$(JAVA_SRC_ROOT2)/a/A.java,a,A,javaroot2)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   279
$(call CreateTextFile,$(JAVA_SRC_ROOT1)/a/b.txt,javaroot1\n)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   280
$(call CreateTextFile,$(JAVA_SRC_ROOT2)/a/b.txt,javaroot2\n)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   281
$(call CreateTextFile,$(JAVA_SRC_ROOT1)/a/c.properties,#javaroot1\nname=value1\n)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   282
$(call CreateTextFile,$(JAVA_SRC_ROOT2)/a/c.properties,#javaroot2\nname=value2\n)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   283
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   284
# Due to a bug in gnu make 3.81, need to add the src roots with trailing slash,
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   285
# otherwise $(wildcard ) will not find the directories and the sanity check in
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   286
# SetupJavaCompilation will fail.
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   287
$(eval $(call SetupJavaCompilation, BUILD_ROOT1_FIRST, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   288
    SETUP := BOOT_JAVAC, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   289
    SRC := $(JAVA_SRC_ROOT1)/ $(JAVA_SRC_ROOT2)/, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   290
    COPY := .txt .java, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   291
    CLEAN := .properties, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   292
    BIN := $(OUTPUT_DIR)/root1first/, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   293
))
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   294
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   295
$(BUILD_ROOT1_FIRST):
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   296
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   297
verify-root1-first: $(BUILD_ROOT1_FIRST)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   298
	$(JAVA_SMALL) -cp $(OUTPUT_DIR)/root1first a.A > $(OUTPUT_DIR)/root1first.output
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   299
	if [ "`$(CAT) $(OUTPUT_DIR)/root1first.output`" != "javaroot1" ]; then \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   300
	  $(ECHO) "The wrong class was compiled. Expected >javaroot1<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   301
	  $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first.output`<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   302
	  false; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   303
	fi
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   304
	if [ "`$(CAT) $(OUTPUT_DIR)/root1first/a/b.txt`" != "javaroot1" ]; then \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   305
	  $(ECHO) "The wrong file was copied. Expected >javaroot1<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   306
	  $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first/a/b.txt`<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   307
	  false; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   308
	fi
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   309
	if [ ! -e "$(OUTPUT_DIR)/root1first/a/A.java" ]; then \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   310
	  $(ECHO) "Missed copying $(OUTPUT_DIR)/root1first/a/A.java"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   311
	  false; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   312
	fi
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   313
	if [ "`$(CAT) $(OUTPUT_DIR)/root1first/a/c.properties`" != "name=value1" ]; then \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   314
	  $(ECHO) "The wrong file was cleaned. Expected >name=value1<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   315
	  $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root1first/a/c.properties`<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   316
	  false; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   317
	fi
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   318
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   319
$(eval $(call SetupJavaCompilation, BUILD_ROOT2_FIRST, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   320
    SETUP := BOOT_JAVAC, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   321
    SRC := $(JAVA_SRC_ROOT2)/ $(JAVA_SRC_ROOT1)/, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   322
    COPY := .txt, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   323
    CLEAN := .properties, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   324
    BIN := $(OUTPUT_DIR)/root2first/, \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   325
))
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   326
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   327
$(BUILD_ROOT2_FIRST):
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   328
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   329
verify-root2-first: $(BUILD_ROOT2_FIRST)
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   330
	$(JAVA_SMALL) -cp $(OUTPUT_DIR)/root2first a.A > $(OUTPUT_DIR)/root2first.output
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   331
	if [ "`$(CAT) $(OUTPUT_DIR)/root2first.output`" != "javaroot2" ]; then \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   332
	  $(ECHO) "The wrong class was compiled. Expected >javaroot2<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   333
	  $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first.output`<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   334
	  false; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   335
	fi
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   336
	if [ "`$(CAT) $(OUTPUT_DIR)/root2first/a/b.txt`" != "javaroot2" ]; then \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   337
	  $(ECHO) "The wrong file was cleaned. Expected >javaroot2<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   338
	  $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first/a/b.txt`<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   339
	  false; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   340
	fi
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   341
	if [ "`$(CAT) $(OUTPUT_DIR)/root2first/a/c.properties`" != "name=value2" ]; then \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   342
	  $(ECHO) "The wrong file was cleaned. Expected >name=value2<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   343
	  $(ECHO) "Got >`$(CAT) $(OUTPUT_DIR)/root2first/a/c.properties`<"; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   344
	  false; \
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   345
	fi
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   346
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   347
TEST_TARGETS += verify-root1-first verify-root2-first
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   348
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   349
.PHONY: verify-root1-first verify-root2-first
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   350
0034766ccb09 8079344: Allow custom or platform specific java source to automatically override shared source
erikj
parents: 29312
diff changeset
   351
################################################################################
25854
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   352
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   353
all: $(TEST_TARGETS)
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   354
98ce0879ab4c 8054834: Modular Source Code
chegar
parents:
diff changeset
   355
.PHONY: default all