changeset 22176:fb1a9390cdcf

fixed mx_jvmci_makefile.py
author Doug Simon <doug.simon@oracle.com>
date Tue, 21 Jul 2015 01:53:46 +0200
parents c09467f52cf7
children 64d8d749715f
files make/jvmci.make mx.jvmci/mx_jvmci_makefile.py
diffstat 2 files changed, 69 insertions(+), 105 deletions(-) [+]
line wrap: on
line diff
--- a/make/jvmci.make	Mon Jul 20 12:50:10 2015 +0200
+++ b/make/jvmci.make	Tue Jul 21 01:53:46 2015 +0200
@@ -122,21 +122,16 @@
 
 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
 
-JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.options/src -type f 2> /dev/null)
-JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.options.processor/src -type f 2> /dev/null)
+JVMCI_SERVICE_SRC = $(shell find jvmci/jdk.internal.jvmci.service/src -type f 2> /dev/null)
 
-JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_JAR = $(TARGET)/jdk.internal.jvmci.options.processor.jar
+JVMCI_SERVICE_JAR = $(TARGET)/jvmci-service.jar
 
-JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.hotspotvmconfig/src -type f 2> /dev/null)
-JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.common/src -type f 2> /dev/null)
-JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.hotspotvmconfig.processor/src -type f 2> /dev/null)
+EXPORTED_FILES += $(JVMCI_SERVICE_JAR)
 
-JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR = $(TARGET)/jdk.internal.jvmci.hotspotvmconfig.processor.jar
+JVMCI_OPTIONS_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.options/src -type f 2> /dev/null)
+JVMCI_OPTIONS_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.options.processor/src -type f 2> /dev/null)
 
-JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.service/src -type f 2> /dev/null)
-JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.service.processor/src -type f 2> /dev/null)
-
-JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR_JAR = $(TARGET)/jdk.internal.jvmci.service.processor.jar
+JVMCI_OPTIONS_PROCESSOR_JAR = $(TARGET)/jvmci-options-processor.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.code/src -type f 2> /dev/null)
@@ -151,14 +146,20 @@
 
 EXPORTED_FILES += $(JVMCI_API_JAR)
 
-JVMCI_SERVICE_SRC = $(shell find jvmci/jdk.internal.jvmci.service/src -type f 2> /dev/null)
+JVMCI_SERVICE_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.service/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_JAR = $(TARGET)/jvmci-service.jar
+JVMCI_SERVICE_PROCESSOR_JAR = $(TARGET)/jvmci-service-processor.jar
 
-EXPORTED_FILES += $(JVMCI_SERVICE_JAR)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC = $(shell find jvmci/jdk.internal.jvmci.hotspotvmconfig/src -type f 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/jdk.internal.jvmci.common/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_HOTSPOT_SRC = $(shell find jvmci/jdk.internal.jvmci.hotspotvmconfig/src -type f 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.amd64/src -type f 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR = $(TARGET)/jvmci-hotspotvmconfig-processor.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.hotspotvmconfig/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.service/src -type f 2> /dev/null)
 JVMCI_HOTSPOT_SRC += $(shell find jvmci/jdk.internal.jvmci.compiler/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)
@@ -168,35 +169,35 @@
 
 JVMCI_HOTSPOT_JAR = $(TARGET)/jvmci-hotspot.jar
 
-JVMCI_HOTSPOT_DEP_JARS = $(TARGET)/jvmci-api.jar $(TARGET)/jvmci-service.jar
+JVMCI_HOTSPOT_DEP_JARS = $(TARGET)/jvmci-api.jar
 
 EXPORTED_FILES += $(JVMCI_HOTSPOT_JAR)
 
-DISTRIBUTIONS = JVMCI_API JVMCI_SERVICE JVMCI_HOTSPOT JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR
-
-$(JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_JAR): $(JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_SRC)  
-	$(call build_and_jar,,$(subst  $(space),:,),jvmci/jdk.internal.jvmci.options.processor/src/META-INF,$(JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_JAR))
-
-
-$(JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR): $(JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC)  
-	$(call build_and_jar,,$(subst  $(space),:,),jvmci/jdk.internal.jvmci.hotspotvmconfig.processor/src/META-INF,$(JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR))
-
-
-$(JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR_JAR): $(JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR_SRC)  
-	$(call build_and_jar,,$(subst  $(space),:,),jvmci/jdk.internal.jvmci.service.processor/src/META-INF,$(JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR_JAR))
-
-
-$(JVMCI_API_JAR): $(JVMCI_API_SRC) $(JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_JAR) $(JVMCI_API_DEP_JARS)
-	$(call build_and_jar,$(JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_JAR),$(subst  $(space),:,$(JVMCI_API_DEP_JARS)),,$(JVMCI_API_JAR))
-
+DISTRIBUTIONS = JVMCI_SERVICE JVMCI_OPTIONS_PROCESSOR JVMCI_API JVMCI_SERVICE_PROCESSOR JVMCI_HOTSPOTVMCONFIG_PROCESSOR JVMCI_HOTSPOT
 
 $(JVMCI_SERVICE_JAR): $(JVMCI_SERVICE_SRC)  
 	$(call build_and_jar,,$(subst  $(space),:,),,$(JVMCI_SERVICE_JAR))
 
 
-$(JVMCI_HOTSPOT_JAR): $(JVMCI_HOTSPOT_SRC) $(JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) $(JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_JAR) $(JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR_JAR) $(JVMCI_HOTSPOT_DEP_JARS)
-	$(call build_and_jar,$(JDK_INTERNAL_JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR):$(JDK_INTERNAL_JVMCI_OPTIONS_PROCESSOR_JAR):$(JDK_INTERNAL_JVMCI_SERVICE_PROCESSOR_JAR),$(subst  $(space),:,$(JVMCI_HOTSPOT_DEP_JARS)),,$(JVMCI_HOTSPOT_JAR))
+$(JVMCI_OPTIONS_PROCESSOR_JAR): $(JVMCI_OPTIONS_PROCESSOR_SRC)  
+	$(call build_and_jar,,$(subst  $(space),:,),jvmci/jdk.internal.jvmci.options.processor/src/META-INF,$(JVMCI_OPTIONS_PROCESSOR_JAR))
+
+
+$(JVMCI_API_JAR): $(JVMCI_API_SRC) $(JVMCI_OPTIONS_PROCESSOR_JAR) $(JVMCI_API_DEP_JARS)
+	$(call build_and_jar,$(JVMCI_OPTIONS_PROCESSOR_JAR),$(subst  $(space),:,$(JVMCI_API_DEP_JARS)),,$(JVMCI_API_JAR))
 
 
-default: $(JVMCI_API_JAR) $(JVMCI_SERVICE_JAR) $(JVMCI_HOTSPOT_JAR)
+$(JVMCI_SERVICE_PROCESSOR_JAR): $(JVMCI_SERVICE_PROCESSOR_SRC)  
+	$(call build_and_jar,,$(subst  $(space),:,),jvmci/jdk.internal.jvmci.service.processor/src/META-INF,$(JVMCI_SERVICE_PROCESSOR_JAR))
+
+
+$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR): $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC)  
+	$(call build_and_jar,,$(subst  $(space),:,),jvmci/jdk.internal.jvmci.hotspotvmconfig.processor/src/META-INF,$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR))
+
+
+$(JVMCI_HOTSPOT_JAR): $(JVMCI_HOTSPOT_SRC) $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) $(JVMCI_OPTIONS_PROCESSOR_JAR) $(JVMCI_SERVICE_PROCESSOR_JAR) $(JVMCI_HOTSPOT_DEP_JARS)
+	$(call build_and_jar,$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR):$(JVMCI_OPTIONS_PROCESSOR_JAR):$(JVMCI_SERVICE_PROCESSOR_JAR),$(subst  $(space),:,$(JVMCI_HOTSPOT_DEP_JARS)),,$(JVMCI_HOTSPOT_JAR))
+
+
+default: $(JVMCI_SERVICE_JAR) $(JVMCI_API_JAR) $(JVMCI_HOTSPOT_JAR)
 .PHONY: default
--- a/mx.jvmci/mx_jvmci_makefile.py	Mon Jul 20 12:50:10 2015 +0200
+++ b/mx.jvmci/mx_jvmci_makefile.py	Tue Jul 21 01:53:46 2015 +0200
@@ -52,7 +52,7 @@
     parser.add_argument('selectedDists', help="Selected distribution names which are going to be built with make.", nargs=REMAINDER)
     opts = parser.parse_args(args)
 
-    if opts.selectedDists == None or len(opts.selectedDists) == 0:
+    if not opts.selectedDists:
         opts.selectedDists = [d.name for d in mx_jvmci.jdkDeployedDists if d.partOfHotSpot]
     mf = Makefile()
     commandline = " ".join(["mx.sh", "makefile"] + args)
@@ -65,72 +65,47 @@
                 return 1
     return 0
 
-def short_dist_name(name):
-    return name.replace("COM_ORACLE_", "")
-
-def filter_projects(deps, t):
-    def typeFilter(project): # filters
-        if isinstance(project, str):
-            project = mx.dependency(project, True)
-        return isinstance(project, t)
-    return [d for d in deps if typeFilter(d)]
-
 def get_jdk_deployed_dists():
     return [d.name for d in mx_jvmci.jdkDeployedDists]
 
-def update_list(li, elements):
-    for e in elements:
-        if e not in li:
-            li.append(e)
-
 def make_dist_rule(dist, mf):
     def path_dist_relative(p):
         return os.path.relpath(p, dist.suite.dir)
-    shortName = short_dist_name(dist.name)
     jdkDeployedDists = get_jdk_deployed_dists()
     jarName = os.path.basename(dist.path)
-    sourcesVariableName = shortName + "_SRC"
-    depJarVariableName = shortName + "_DEP_JARS"
+    sourcesVariableName = dist.name + "_SRC"
+    depJarVariableName = dist.name + "_DEP_JARS"
     sources = []
     resources = []
-    sortedDeps = dist.sorted_deps(True, transitive=False, includeAnnotationProcessors=True)
-    projects = filter_projects(sortedDeps, mx.Project)
+    projects = [p for p in dist.archived_deps() if p.isJavaProject()]
     targetPathPrefix = "$(TARGET)/"
-    libraryDeps = [path_dist_relative(l.get_path(False)) for l in filter_projects(sortedDeps, mx.Library)]
+    libraryDeps = [path_dist_relative(l.get_path(False)) for l in [l for l in dist.archived_deps() if l.isLibrary()]]
 
-    annotationProcessorDeps = []
-    distDeps = dist.get_dist_deps(includeSelf=False, transitive=True)
-    distDepProjects = []
-    for d in distDeps:
-        update_list(distDepProjects, d.sorted_deps(includeLibs=False, transitive=True))
+    annotationProcessorDeps = set()
+    distDeps = [dep for dep in dist.deps if dep.isDistribution()]
 
     classPath = [targetPathPrefix + os.path.basename(d.path) for d in distDeps] + libraryDeps \
-        + [path_dist_relative(mx.dependency(name).path) for name in dist.excludedDependencies]
-    for p in projects:
-        if p.definedAnnotationProcessors != None and p.definedAnnotationProcessorsDist != dist:
-            update_list(annotationProcessorDeps, [p])
+        + [path_dist_relative(exclLib.path) for exclLib in dist.excludedLibs]
     for p in projects:
         projectDir = path_dist_relative(p.dir)
-        if p not in distDepProjects and p not in annotationProcessorDeps:
-            for src in [projectDir + '/' + d for d in p.srcDirs]:
-                sources.append("$(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)
-
+        annotationProcessorDeps.update(p.declaredAnnotationProcessors)
+        for src in [projectDir + '/' + d for d in p.srcDirs]:
+            sources.append("$(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)
 
     sourceLines = sourcesVariableName + " = " + ("\n" + sourcesVariableName + " += ").join(sources)
     apPaths = []
     apDistNames = []
     apDistVariableNames = []
-    for p in annotationProcessorDeps:
-        apPaths.append(path_dist_relative(p.definedAnnotationProcessorsDist.path))
-        name = short_dist_name(p.definedAnnotationProcessorsDist.name)
-        apDistNames.append(name)
-        apDistVariableNames.append("$(" + name + "_JAR)")
+    for apd in sorted(annotationProcessorDeps):
+        apPaths.append(path_dist_relative(apd.path))
+        apDistNames.append(apd.name)
+        apDistVariableNames.append("$(" + apd.name + "_JAR)")
     shouldExport = dist.name in jdkDeployedDists
     props = {
-           "name": shortName,
+           "name": dist.name,
            "jarName": targetPathPrefix + jarName,
            "depJarsVariableAccess": "$(" + depJarVariableName + ")" if len(classPath) > 0 else "",
            "depJarsVariable": depJarVariableName,
@@ -280,30 +255,18 @@
 .PHONY: export clean
 
 """)
-    s = mx_jvmci._suite
+    assert selectedDists
+    selectedDists = [mx.dependency(s) for s in selectedDists]
     dists = []
-    ap = []
-    projects = []
-    for d in s.dists:
-        if d.name in selectedDists:
-            update_list(dists, d.get_dist_deps(True, True))
-            update_list(projects, d.sorted_deps(includeLibs=False, transitive=True))
+
+    def _visit(dep, edge):
+        if dep.isDistribution():
+            dists.append(dep)
 
-    for p in projects:
-        deps = p.all_deps([], False, includeSelf=True, includeJreLibs=False, includeAnnotationProcessors=True)
-        for d in deps:
-            if d.definedAnnotationProcessorsDist is not None:
-                apd = d.definedAnnotationProcessorsDist
-                update_list(ap, [apd])
+    mx.walk_deps(roots=selectedDists, visit=_visit, ignoredEdges=[mx.DEP_EXCLUDED])
 
-    if len(dists) > 0:
-        mf.add_definition(jdkBootClassPathVariableName + " = " + bootClassPath)
-        for d in ap: make_dist_rule(d, mf)
-        for d in dists: make_dist_rule(d, mf)
-        mf.add_definition("DISTRIBUTIONS = " + " ".join([short_dist_name(d.name) for d in dists+ap]))
-        mf.add_rule("default: $({}_JAR)\n.PHONY: default\n".format("_JAR) $(".join([short_dist_name(d.name) for d in dists])))
-        return True
-    else:
-        for d in dists:
-            selectedDists.remove(d.name)
-        print "Distribution(s) '" + "', '".join(selectedDists) + "' does not exist."
+    mf.add_definition(jdkBootClassPathVariableName + " = " + bootClassPath)
+    for dist in dists: make_dist_rule(dist, mf)
+    mf.add_definition("DISTRIBUTIONS = " + ' '.join([dist.name for dist in dists]))
+    mf.add_rule("default: $({}_JAR)\n.PHONY: default\n".format("_JAR) $(".join([d.name for d in selectedDists])))
+    return True