changeset 22426:f45c8b5add13

Ignore projects in jvmci.make, when optional JRE/JDK library dependencies are not present
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Mon, 17 Aug 2015 11:21:37 +0200
parents dc8493dd5a15
children 9c55f608b79e
files make/jvmci.make mx.jvmci/mx_jvmci_makefile.py
diffstat 2 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/make/jvmci.make	Fri Aug 14 09:56:23 2015 +0200
+++ b/make/jvmci.make	Mon Aug 17 11:21:37 2015 +0200
@@ -120,26 +120,26 @@
 
 JDK_BOOTCLASSPATH = $(ABS_BOOTDIR)/jre/lib/resources.jar:$(ABS_BOOTDIR)/jre/lib/rt.jar:$(ABS_BOOTDIR)/jre/lib/jsse.jar:$(ABS_BOOTDIR)/jre/lib/jce.jar:$(ABS_BOOTDIR)/jre/lib/charsets.jar:$(ABS_BOOTDIR)/jre/lib/jfr.jar
 
-JVMCI_SERVICE_SRC = $(shell find jvmci/jdk.internal.jvmci.service/src -type f 2> /dev/null)
+JVMCI_SERVICE_SRC += $(shell find jvmci/jdk.internal.jvmci.service/src -type f 2> /dev/null)
 
 JVMCI_SERVICE_JAR = $(TARGET)/jvmci-service.jar
 
 EXPORTED_FILES += $(JVMCI_SERVICE_JAR)
 
-JVMCI_OPTIONS_SRC = $(shell find jvmci/jdk.internal.jvmci.inittimer/src -type f 2> /dev/null)
+JVMCI_OPTIONS_SRC += $(shell find jvmci/jdk.internal.jvmci.inittimer/src -type f 2> /dev/null)
 JVMCI_OPTIONS_SRC += $(shell find jvmci/jdk.internal.jvmci.options/src -type f 2> /dev/null)
 
 JVMCI_OPTIONS_JAR = $(TARGET)/jvmci-options.jar
 
 EXPORTED_FILES += $(JVMCI_OPTIONS_JAR)
 
-JVMCI_OPTIONS_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.options.processor/src -type f 2> /dev/null)
+JVMCI_OPTIONS_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.options.processor/src -type f 2> /dev/null)
 
 JVMCI_OPTIONS_PROCESSOR_JAR = $(TARGET)/jvmci-options-processor.jar
 
 JVMCI_OPTIONS_PROCESSOR_DEP_JARS = $(TARGET)/jvmci-options.jar
 
-JVMCI_API_SRC = $(shell find jvmci/jdk.internal.jvmci.meta/src -type f 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/jdk.internal.jvmci.meta/src -type f 2> /dev/null)
 JVMCI_API_SRC += $(shell find jvmci/jdk.internal.jvmci.code/src -type f 2> /dev/null)
 JVMCI_API_SRC += $(shell find jvmci/jdk.internal.jvmci.runtime/src -type f 2> /dev/null)
 JVMCI_API_SRC += $(shell find jvmci/jdk.internal.jvmci.common/src -type f 2> /dev/null)
@@ -151,30 +151,32 @@
 
 EXPORTED_FILES += $(JVMCI_API_JAR)
 
-JVMCI_SERVICE_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.service.processor/src -type f 2> /dev/null)
+JVMCI_SERVICE_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.service.processor/src -type f 2> /dev/null)
 
 JVMCI_SERVICE_PROCESSOR_JAR = $(TARGET)/jvmci-service-processor.jar
 
 JVMCI_SERVICE_PROCESSOR_DEP_JARS = $(TARGET)/jvmci-service.jar
 
-JVMCI_HOTSPOTVMCONFIG_SRC = $(shell find jvmci/jdk.internal.jvmci.hotspotvmconfig/src -type f 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_SRC += $(shell find jvmci/jdk.internal.jvmci.hotspotvmconfig/src -type f 2> /dev/null)
 
 JVMCI_HOTSPOTVMCONFIG_JAR = $(TARGET)/jvmci-hotspotvmconfig.jar
 
 EXPORTED_FILES += $(JVMCI_HOTSPOTVMCONFIG_JAR)
 
-JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.hotspotvmconfig.processor/src -type f 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.hotspotvmconfig.processor/src -type f 2> /dev/null)
 
 JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR = $(TARGET)/jvmci-hotspotvmconfig-processor.jar
 
 JVMCI_HOTSPOTVMCONFIG_PROCESSOR_DEP_JARS = $(TARGET)/jvmci-options.jar $(TARGET)/jvmci-service.jar $(TARGET)/jvmci-api.jar $(TARGET)/jvmci-hotspotvmconfig.jar
 
-JVMCI_HOTSPOT_SRC = $(shell find jvmci/jdk.internal.jvmci.amd64/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.amd64/src -type f 2> /dev/null)
 JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.hotspot/src -type f 2> /dev/null)
 JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.hotspot.amd64/src -type f 2> /dev/null)
 JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.sparc/src -type f 2> /dev/null)
 JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.hotspot.sparc/src -type f 2> /dev/null)
+ifeq ($(shell find $(ABS_BOOTDIR)/ -name 'jfr.jar'; echo $$?),'0')
 JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.hotspot.jfr/src -type f 2> /dev/null)
+endif
 
 JVMCI_HOTSPOT_JAR = $(TARGET)/jvmci-hotspot.jar
 
--- a/mx.jvmci/mx_jvmci_makefile.py	Fri Aug 14 09:56:23 2015 +0200
+++ b/mx.jvmci/mx_jvmci_makefile.py	Mon Aug 17 11:21:37 2015 +0200
@@ -69,6 +69,14 @@
 def get_jdk_deployed_dists():
     return [d.dist() for d in mx_jvmci.jdkDeployedDists]
 
+def _get_dependency_check(p):
+    jarFinders = []
+    for dep in p.deps:
+        if (dep.isJreLibrary() or dep.isJdkLibrary()) and dep.optional:
+            jar = dep.classpath_repr(False)
+            jarFinders.append("$(shell find $(ABS_BOOTDIR)/ -name '%s'; echo $$?)" % jar)
+    return "ifeq ({},'{}')".format("".join(jarFinders), "0" * len(jarFinders)) if len(jarFinders) > 0 else None
+
 def make_dist_rule(dist, mf):
     def path_dist_relative(p):
         return os.path.relpath(p, dist.suite.dir)
@@ -86,13 +94,19 @@
     for p in projects:
         projectDir = path_dist_relative(p.dir)
         annotationProcessorDeps.update(p.declaredAnnotationProcessors)
+        depCheck =  _get_dependency_check(p)
+        if depCheck:
+            sources.append(depCheck)
         for src in [projectDir + '/' + d for d in p.srcDirs]:
-            sources.append("$(shell find {} -type f 2> /dev/null)".format(src))
+            sources.append(sourcesVariableName + " += $(shell find {} -type f 2> /dev/null)".format(src))
             metaInf = src + "/META-INF"
             if os.path.exists(os.path.join(dist.suite.dir, metaInf)):
                 resources.append(metaInf)
+        if depCheck:
+            sources.append("endif")
 
-    sourceLines = sourcesVariableName + " = " + ("\n" + sourcesVariableName + " += ").join(sources)
+    mf.add_definition("\n".join(sources))
+
     apDistNames = []
     apDistVariableNames = []
     apDependencies = []
@@ -106,7 +120,6 @@
            "jarName": targetPathPrefix + jarName,
            "depJarsVariableAccess": "$(" + depJarVariableName + ")" if len(classPath) > 0 else "",
            "depJarsVariable": depJarVariableName,
-           "sourceLines": sourceLines,
            "sourcesVariableName": sourcesVariableName,
            "annotationProcessors": " ".join(apDistVariableNames),
            "cpAnnotationProcessors": ":".join(apDistVariableNames + apDependencies),
@@ -114,7 +127,6 @@
            "copyResources": " ".join(resources)
            }
 
-    mf.add_definition(sourceLines)
     mf.add_definition("{name}_JAR = {jarName}".format(**props))
     if len(classPath) > 0: mf.add_definition("{depJarsVariable} = {jarDeps}".format(**props))
     if shouldExport: mf.add_definition("EXPORTED_FILES += $({name}_JAR)".format(**props))