You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/12/06 15:17:03 UTC

[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2575: Open GraalVM sources out of the box

JaroslavTulach commented on a change in pull request #2575:
URL: https://github.com/apache/netbeans/pull/2575#discussion_r537058419



##########
File path: java/java.mx.project/src/org/netbeans/modules/java/mx/project/CoreSuite.java
##########
@@ -0,0 +1,732 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.mx.project;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.netbeans.modules.java.mx.project.suitepy.MxDistribution;
+import org.netbeans.modules.java.mx.project.suitepy.MxImports;
+import org.netbeans.modules.java.mx.project.suitepy.MxLibrary;
+import org.netbeans.modules.java.mx.project.suitepy.MxLibrary.Arch;
+import org.netbeans.modules.java.mx.project.suitepy.MxProject;
+import org.netbeans.modules.java.mx.project.suitepy.MxSuite;
+
+final class CoreSuite {
+    private static final class MapOf<K,V> {
+        private final Map<K,V> map = new HashMap<>();
+
+        MapOf<K, V> of(K k, V v) {
+            map.put(k, v);
+            return this;
+        }
+
+
+        Map<K,V> build() {
+            return map;
+        }
+    }
+
+    private static <K,V> MapOf<K,V> mapOf(Class<K> keyClass, Class<V> valueClass) {
+        return new MapOf<>();
+    }
+
+    private static MxSuite createMxSuite(
+        String defaultLicense,
+        Map<String, MxDistribution> distributions,
+        MxImports imports,
+        Map<String, MxLibrary> jdkLibraries,
+        Map<String, MxLibrary> libraries,
+        String mxversion,
+        String name,
+        Map<String, MxProject> projects
+    ) {
+        return new MxSuite() {
+            @Override
+            public String mxversion() {
+                return mxversion;
+            }
+
+            @Override
+            public String name() {
+                return name;
+            }
+
+            @Override
+            public String defaultLicense() {
+                return defaultLicense;
+            }
+
+            @Override
+            public Map<String, MxLibrary> libraries() {
+                return libraries;
+            }
+
+            @Override
+            public Map<String, MxLibrary> jdklibraries() {
+                return jdkLibraries;
+            }
+
+            @Override
+            public MxImports imports() {
+                return imports;
+            }
+
+            @Override
+            public Map<String, MxProject> projects() {
+                return projects;
+            }
+
+            @Override
+            public Map<String, MxDistribution> distributions() {
+                return distributions;
+            }
+        };
+    }
+
+    private static MxDistribution createMxDistribution(
+        List<String> dependencies,
+        List<String> distDependencies,
+        List<String> exclude,
+        List<String> strip
+    ) {
+        return new MxDistribution() {
+            @Override
+            public List<String> dependencies() {
+                return dependencies;
+            }
+
+            @Override
+            public List<String> distDependencies() {
+                return distDependencies;
+            }
+
+            @Override
+            public List<String> exclude() {
+                return exclude;
+            }
+
+            @Override
+            public List<String> strip() {
+                return strip;
+            }
+        };
+    }
+
+    private static MxProject createMxProject(
+        List<String> annotationProcessors,
+        List<String> dependencies,
+        String dir,
+        String javaCompliance,
+        List<String> sourceDirs,
+        String subDir
+    ) {
+        return new MxProject() {
+            @Override
+            public String dir() {
+                return dir;
+            }
+
+            @Override
+            public String subDir() {
+                return subDir;
+            }
+
+            @Override
+            public List<String> sourceDirs() {
+                return sourceDirs;
+            }
+
+            @Override
+            public List<String> dependencies() {
+                return dependencies;
+            }
+
+            @Override
+            public List<String> annotationProcessors() {
+                return annotationProcessors;
+            }
+
+            @Override
+            public String javaCompliance() {
+                return javaCompliance;
+            }
+        };
+    }
+
+    private static MxLibrary createMxLibrary(
+        List<String> dependencies,
+        Map<String, MxLibrary.Arch> osArch,
+        String path,
+        String sha1,
+        List<String> urls
+    ) {
+        return new MxLibrary() {
+            @Override
+            public String sha1() {
+                return sha1;
+            }
+
+            @Override
+            public List<String> urls() {
+                return urls;
+            }
+
+            @Override
+            public Map<String, MxLibrary.Arch> os_arch() {
+                return osArch;
+            }
+
+            @Override
+            public List<String> dependencies() {
+                return dependencies;
+            }
+
+            @Override
+            public String path() {
+                return path;
+            }
+
+        };
+    }
+
+    private static MxLibrary.Arch createArch(MxLibrary amd64) {
+        return new MxLibrary.Arch() {
+            @Override
+            public MxLibrary amd64() {
+                return amd64;
+            }
+        };
+    }
+
+    static final MxSuite CORE_5_279_0;
+    static {

Review comment:
       That would require `mx.mx/suite.py` being around. While `mx` is needed for execution/debugging of tests, it is not needed for opening the projects and navigating the sources right now. However, to properly resolve "standard mx libraries" we need to have information about them. That is what this file provides.
   
   Having the information here improves out of box experience. One can `git clone https://github.com/oracle/graal` and immediately open and inspect the sources.
   
   Of course, when new version of `mx` introduces new "standard libraries", we might need to release an update to this `CoreSuite` data. Possibly we could use this as default/fallback. Once `mx` is found/specified we could switch to its `mx.mx/suite.py` definitions.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists