Skip to content

Commit

Permalink
[GR-57817] Fix JDK restricted access warnings and other warnings
Browse files Browse the repository at this point in the history
PullRequest: truffleruby/4385
  • Loading branch information
eregon committed Nov 4, 2024
2 parents 07b978e + 07e41d2 commit 422b155
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# https://github.com/google/jsonnet/releases and compiled.

# CONFIGURATION
local overlay = "5f8343f15cac08e5b60c54a08bde56b8d88b0aa0";
local overlay = "86462312c58551adf8993c7fbced4963751230d3";

# For debugging: generated builds will be restricted to those listed in
# the array. No restriction is applied when it is empty.
Expand Down
16 changes: 8 additions & 8 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
"jdks": {
"galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+19-2105", "platformspecific": true, "extrabundles": ["static-libs"]},
"galahad-jdk": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+21-2436", "platformspecific": true, "extrabundles": ["static-libs"]},

"oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "jdk-17.0.7+8", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.7+4-jvmci-23.1-b02", "platformspecific": true },
Expand Down Expand Up @@ -45,13 +45,13 @@

"oraclejdk23": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+37", "platformspecific": true, "extrabundles": ["static-libs"]},

"oraclejdk-latest": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+19", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-24+19-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-24+19-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-24+19-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-24+19-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-24+19-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-24+19-jvmci-b01-sulong", "platformspecific": true }
"oraclejdk-latest": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24+21", "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-24+21-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-24+21-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-24+21-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-24+21-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-24+21-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-24+21-jvmci-b01-sulong", "platformspecific": true }
},

"eclipse": {
Expand Down
15 changes: 15 additions & 0 deletions mx.truffleruby/mx_truffleruby.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import mx_sdk_vm_impl
import mx_subst
import mx_spotbugs
import mx_truffle
import mx_unittest

# re-export custom mx project classes, so they can be used from suite.py
from mx_sdk_shaded import ShadedLibraryProject # pylint: disable=unused-import
Expand Down Expand Up @@ -74,6 +76,17 @@ def get_truffleruby_abi_version():

mx_subst.results_substitutions.register_no_arg('truffleruby_abi_version', get_truffleruby_abi_version)

class TruffleRubyUnittestConfig(mx_unittest.MxUnittestConfig):
def __init__(self):
super(TruffleRubyUnittestConfig, self).__init__('truffleruby')

def apply(self, config):
vmArgs, mainClass, mainClassArgs = config
mx_truffle.enable_truffle_native_access(vmArgs)
return (vmArgs, mainClass, mainClassArgs)

mx_unittest.register_unittest_config(TruffleRubyUnittestConfig())

# Utilities

class VerboseMx:
Expand Down Expand Up @@ -138,6 +151,7 @@ def clean(self, forBuild=False):
def contents(self, result):
classpath_deps = [dep for dep in self.subject.buildDependencies if isinstance(dep, mx.ClasspathDependency)]
jvm_args = [shlex.quote(arg) for arg in mx.get_runtime_jvm_args(classpath_deps)]
mx_truffle.enable_truffle_native_access(jvm_args)

debug_args = mx.java_debug_args()
jvm_args.extend(debug_args)
Expand Down Expand Up @@ -191,6 +205,7 @@ def ruby_check_heap_dump(input_args, out=None):
args.insert(0, "--experimental-options")
vm_args, truffleruby_args = mx.extract_VM_args(args, useDoubleDash=True, defaultAllVMArgs=False)
vm_args += mx.get_runtime_jvm_args(dists)
mx_truffle.enable_truffle_native_access(vm_args)
# vm_args.append("-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y")
vm_args.append("org.truffleruby.test.internal.LeakTest")
out = mx.OutputCapture() if out is None else out
Expand Down
10 changes: 6 additions & 4 deletions mx.truffleruby/suite.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
suite = {
"mxversion": "7.27.0",
"name": "truffleruby",
"version": "24.2.0",
"release": False,
"groupId": "org.graalvm.ruby",
"url": "https://www.graalvm.org/ruby/",
"developer": {
Expand All @@ -20,7 +22,7 @@
{
"name": "regex",
"subdir": True,
"version": "ce344dd45cc746790b06bc572086a922b2ae328c",
"version": "1e8adf83a2a21aa517c64913b41f00ab93e08819",
"urls": [
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},
Expand All @@ -29,7 +31,7 @@
{
"name": "sulong",
"subdir": True,
"version": "ce344dd45cc746790b06bc572086a922b2ae328c",
"version": "1e8adf83a2a21aa517c64913b41f00ab93e08819",
"urls": [
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},
Expand Down Expand Up @@ -846,7 +848,7 @@
"mx:HAMCREST",
"mx:JUNIT",
],
"unittestConfig": "none",
"unittestConfig": "truffleruby",
"javaProperties": {
"polyglot.engine.WarnInterpreterOnly": "false",
},
Expand All @@ -870,7 +872,7 @@
"mx:JUNIT",
"truffleruby:NETBEANS-LIB-PROFILER",
],
"unittestConfig": "none",
"unittestConfig": "truffleruby",
"javaProperties": {
"polyglot.engine.WarnInterpreterOnly": "false",
"polyglotimpl.DisableClassPathIsolation": "true",
Expand Down
1 change: 1 addition & 0 deletions src/signal/java/org/truffleruby/signal/LibRubySignal.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

public abstract class LibRubySignal {

@SuppressWarnings("restricted")
public static void loadLibrary(String rubyHome, String libSuffix) {
final String path = rubyHome + "/lib/cext/librubysignal" + libSuffix;
System.load(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
public final class TruffleRubyEngineFactory implements ScriptEngineFactory {
private static final String LANGUAGE_ID = "ruby";

/***********************************************************/
/*-*********************************************************/
/* Everything below is generic and does not need to change */
/***********************************************************/
/*-*********************************************************/

private final Engine polyglotEngine = Engine.newBuilder().build();
private final Language language = polyglotEngine.getLanguages().get(LANGUAGE_ID);
Expand Down
1 change: 1 addition & 0 deletions src/yarp/java/org/prism/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public abstract class Parser {

@SuppressWarnings("restricted")
public static void loadLibrary(String path) {
System.load(path);
}
Expand Down

0 comments on commit 422b155

Please sign in to comment.