comparison mx/mx_graal_makefile.py @ 21911:899d7cadd0a1

Make jvmci.make quiet and use recipe for build and jar
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Wed, 10 Jun 2015 13:22:03 +0200
parents 878786299d2d
children 1a6a520af3b5
comparison
equal deleted inserted replaced
21910:cf7b06489764 21911:899d7cadd0a1
111 if p not in distDepProjects and p not in annotationProcessorDeps: 111 if p not in distDepProjects and p not in annotationProcessorDeps:
112 generatedSource = [path_dist_relative(p.source_gen_dir())] if len(annotationProcessorDeps) > 0 else [] 112 generatedSource = [path_dist_relative(p.source_gen_dir())] if len(annotationProcessorDeps) > 0 else []
113 113
114 for d in p.srcDirs + generatedSource: 114 for d in p.srcDirs + generatedSource:
115 src = projectDir + os.path.sep + d 115 src = projectDir + os.path.sep + d
116 sources.append("$(shell find {} -type f -name '*.java' 2> /dev/null)".format(src)) 116 sources.append("$(shell find {} -type f 2> /dev/null)".format(src))
117 metaInf = src + os.path.sep + "META-INF" 117 metaInf = src + os.path.sep + "META-INF"
118 if os.path.exists(metaInf): 118 if os.path.exists(metaInf):
119 resources.append(metaInf) 119 resources.append(metaInf)
120 120
121 121
137 "depJarsVariable": depJarVariableName, 137 "depJarsVariable": depJarVariableName,
138 "sourceLines": sourceLines, 138 "sourceLines": sourceLines,
139 "sourcesVariableName": sourcesVariableName, 139 "sourcesVariableName": sourcesVariableName,
140 "annotationProcessors": " ".join(apDistVariableNames), 140 "annotationProcessors": " ".join(apDistVariableNames),
141 "cpAnnotationProcessors": "-processorpath " + ":".join(apDistVariableNames) if len(apDistVariableNames) > 0 else "", 141 "cpAnnotationProcessors": "-processorpath " + ":".join(apDistVariableNames) if len(apDistVariableNames) > 0 else "",
142 "cpAnnotationProcessors2": ":".join(apDistVariableNames),
142 "bootCp": ("-bootclasspath " + bootClassPath) if bootClassPath != None else "", 143 "bootCp": ("-bootclasspath " + bootClassPath) if bootClassPath != None else "",
143 "cpDeps": ("-cp $(shell echo $(" + depJarVariableName + ") | tr ' ' ':')") if len(classPath) > 0 else "", 144 "cpDeps": ("-cp $(shell echo $(" + depJarVariableName + ") | tr ' ' ':')") if len(classPath) > 0 else "",
144 "jarDeps": " ".join(classPath), 145 "jarDeps": " ".join(classPath),
145 "copyResources": "cp -r {} $(TMP)".format(" ".join(resources)) if len(resources) > 0 else "", 146 "copyResources": " ".join(resources),
146 "targetPathPrefix": targetPathPrefix, 147 "targetPathPrefix": targetPathPrefix,
147 "shouldExport": shouldExport, 148 "shouldExport": shouldExport,
148 } 149 }
149 150
150 mf.add_definition(sourceLines) 151 mf.add_definition(sourceLines)
151 mf.add_definition("{name}_JAR = {jarPath}".format(**props)) 152 mf.add_definition("{name}_JAR = {jarPath}".format(**props))
152 if len(classPath) > 0: mf.add_definition("{depJarsVariable} = {jarDeps}".format(**props)) 153 if len(classPath) > 0: mf.add_definition("{depJarsVariable} = {jarDeps}".format(**props))
153 if shouldExport: mf.add_definition("EXPORTED_FILES += $({name}_JAR)".format(**props)) 154 if shouldExport: mf.add_definition("EXPORTED_FILES += $({name}_JAR)".format(**props))
154 mf.add_rule("""$({name}_JAR): $({sourcesVariableName}) {annotationProcessors} {depJarsVariableAccess} 155 mf.add_rule("""$({name}_JAR): $({sourcesVariableName}) {annotationProcessors} {depJarsVariableAccess}
155 \t$(eval TMP := $(shell mktemp -d {name}_XXXXX)) 156 \t$(call build_and_jar,{cpAnnotationProcessors2},$(shell echo {depJarsVariableAccess} | tr ' ' ':'),{copyResources},$({name}_JAR))
156 \t$(JAVAC) -d $(TMP) {cpAnnotationProcessors} {bootCp} {cpDeps} $({sourcesVariableName}) 157 """.format(**props))
157 \t{copyResources}
158 \t$(call process_options,$(TMP),{shouldExport})
159 \tmkdir -p $$(dirname $({name}_JAR))
160 \t$(JAR) cf $({name}_JAR) -C $(TMP) .
161 \trm -r $(TMP)""".format(**props))
162 return 158 return
163 159
164 160
165 161
166 def do_build_makefile(mf, selectedDists, commandline): 162 def do_build_makefile(mf, selectedDists, commandline):
188 OPTIONS_INF=/META-INF/options 184 OPTIONS_INF=/META-INF/options
189 185
190 ifeq ($(ABS_BOOTDIR),) 186 ifeq ($(ABS_BOOTDIR),)
191 $(error Variable ABS_BOOTDIR must be set to a JDK installation.) 187 $(error Variable ABS_BOOTDIR must be set to a JDK installation.)
192 endif 188 endif
193 ifneq ($(MAKE_VERBOSE),) 189 ifeq ($(MAKE_VERBOSE),)
194 SHELL=sh -x 190 QUIETLY=@
195 endif 191 endif
196 192
197 define process_options 193 define process_options
198 $(eval providers=$(1)/$(PROVIDERS_INF)) 194 $(eval providers=$(1)/$(PROVIDERS_INF))
199 $(eval services=$(1)/$(SERVICES_INF)) 195 $(eval services=$(1)/$(SERVICES_INF))
200 $(eval options=$(1)/$(OPTIONS_INF)) 196 $(eval options=$(1)/$(OPTIONS_INF))
201 test -d $(services) || mkdir -p $(services) 197 $(QUIETLY) test -d $(services) || mkdir -p $(services)
202 test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done) 198 $(QUIETLY) test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done)
203 199
204 # Since all projects are built together with one javac call we cannot determine 200 @# Since all projects are built together with one javac call we cannot determine
205 # which project contains HotSpotVMConfig.inline.hpp so we hardcode it. 201 @# which project contains HotSpotVMConfig.inline.hpp so we hardcode it.
206 $(eval vmconfig=$(1)/hotspot/HotSpotVMConfig.inline.hpp) 202 $(eval vmconfig=$(1)/hotspot/HotSpotVMConfig.inline.hpp)
207 $(eval vmconfigDest=$(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot) 203 $(eval vmconfigDest=$(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot)
208 test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest)) 204 $(QUIETLY) test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest))
209 endef 205 endef
210 206
211 define extract 207 define extract
212 $(eval TMP := $(shell mktemp -d $(1)_XXXXX)) 208 $(eval TMP := $(shell mktemp -d tmp_XXXXX))
213 mkdir -p $(2); 209 $(QUIETLY) mkdir -p $(2);
214 cd $(TMP) && $(JAR) xf $(abspath $(1)) && \\ 210 $(QUIETLY) cd $(TMP) && $(JAR) xf $(abspath $(1)) && \\
215 ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) && (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2)))); 211 ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) && (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2))));
216 rm -r $(TMP); 212 $(QUIETLY) rm -r $(TMP);
217 cp $(1) $(2); 213 $(QUIETLY) cp $(1) $(2);
218 endef 214 endef
219 215
216 define build_and_jar
217 $(info Building $(4))
218 $(eval TMP := $(shell mktemp -d JVMCI_HOTSPOT_XXXXX))
219 $(QUIETLY) $(JAVAC) -d $(TMP) -processorpath :$(1) -bootclasspath $(JDK_BOOTCLASSPATH) -cp :$(2) $(filter %.java,$?);
220 $(QUIETLY) test "$(3)" = "" || cp -r $(3) $(TMP);
221 $(QUIETLY) $(call process_options,$(TMP));
222 $(QUIETLY) mkdir -p $(shell dirname $(4))
223 $(QUIETLY) $(JAR) cf $(4) -C $(TMP) .
224 $(QUIETLY) rm -r $(TMP);
225 endef
220 226
221 all: default 227 all: default
222 228
223 export: all 229 export: all
224 \tmkdir -p $(EXPORT_DIR) 230 \t$(info Put $(EXPORTED_FILES) into SHARED_DIR $(SHARED_DIR))
225 \t$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(EXPORT_DIR))) 231 \t$(QUIETLY) mkdir -p $(SHARED_DIR)
232 \t$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(SHARED_DIR)))
226 .PHONY: export 233 .PHONY: export
227 234
228 """) 235 """)
229 s = mx.suite("graal") 236 s = mx.suite("graal")
230 dists = [] 237 dists = []