diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index a2d14165..08a8c7fd 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -26,13 +26,13 @@ jobs: - name: Style dependencies run: | cat common.json | - jq -r '.deps.common.packages | to_entries[] | select(.key | startswith("pip:")) | (.key | split(":")[1]) + .value' | + jq -r '.pip | to_entries[] | .key + .value' | xargs pip install - run: pylint --version - name: Download and set up Eclipse dependency run: | - ECLIPSE_ORG_VERSION=$(cat common.json | jq -r '.downloads.eclipse.eclipse_org.version') - ECLIPSE_ORG_TIMESTAMP=$(cat common.json | jq -r '.downloads.eclipse.eclipse_org.timestamp') + ECLIPSE_ORG_VERSION=$(cat common.json | jq -r '.eclipse.short_version') + ECLIPSE_ORG_TIMESTAMP=$(cat common.json | jq -r '.eclipse.timestamp') wget --no-verbose https://archive.eclipse.org/eclipse/downloads/drops4/R-${ECLIPSE_ORG_VERSION}-${ECLIPSE_ORG_TIMESTAMP}/eclipse-SDK-${ECLIPSE_ORG_VERSION}-linux-gtk-x86_64.tar.gz -O $ECLIPSE_TAR tar -C ${{ github.workspace }}/.. -xf $ECLIPSE_TAR - name: mx gate diff --git a/ci/common.jsonnet b/ci/common.jsonnet index c15b0a8b..e4bddde2 100644 --- a/ci/common.jsonnet +++ b/ci/common.jsonnet @@ -9,6 +9,17 @@ local common_json = import "../common.json"; # JDK definitions # *************** local variants(name) = [name, name + "Debug", name + "-llvm"], + # gets the JDK major version from a labsjdk version string (e.g., "ce-21+35-jvmci-23.1-b15" -> 21) + local parse_labsjdk_version(version) = + assert std.startsWith(version, "ce-") || std.startsWith(version, "ee-") : "Unsupported labsjdk version: " + version; + local number_prefix(str) = + if std.length(str) == 0 || std.length(std.findSubstr(str[0], "0123456789")) == 0 then + "" + else + str[0] + number_prefix(str[1:]) + ; + std.parseInt(number_prefix(version[3:])) + , local jdks_data = { oraclejdk11: common_json.jdks["oraclejdk11"] + { jdk_version:: 11 }, } + { @@ -24,8 +35,8 @@ local common_json = import "../common.json"; [name]: common_json.jdks[name] + { jdk_version:: 21 } for name in ["oraclejdk21"] + variants("labsjdk-ce-21") + variants("labsjdk-ee-21") } + { - [name]: common_json.jdks[name] + { jdk_version:: 22 } - for name in variants("labsjdk-ce-22") + variants("labsjdk-ee-22") + [name]: common_json.jdks[name] + { jdk_version:: parse_labsjdk_version(self.version)} + for name in variants("labsjdk-ce-latest") + variants("labsjdk-ee-latest") }, assert std.assertEqual(std.objectFields(common_json.jdks), std.objectFields(jdks_data)), diff --git a/common.json b/common.json index 3a6f83fd..8e1b5c9a 100644 --- a/common.json +++ b/common.json @@ -4,7 +4,7 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "6.46.1", + "mx_version": "6.49.1", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { @@ -42,12 +42,12 @@ "labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-debug", "platformspecific": true }, "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-sulong", "platformspecific": true }, - "labsjdk-ce-22": {"name": "labsjdk", "version": "ce-22+13-jvmci-b01", "platformspecific": true }, - "labsjdk-ce-22Debug": {"name": "labsjdk", "version": "ce-22+13-jvmci-b01-debug", "platformspecific": true }, - "labsjdk-ce-22-llvm": {"name": "labsjdk", "version": "ce-22+13-jvmci-b01-sulong", "platformspecific": true }, - "labsjdk-ee-22": {"name": "labsjdk", "version": "ee-22+13-jvmci-b01", "platformspecific": true }, - "labsjdk-ee-22Debug": {"name": "labsjdk", "version": "ee-22+13-jvmci-b01-debug", "platformspecific": true }, - "labsjdk-ee-22-llvm": {"name": "labsjdk", "version": "ee-22+13-jvmci-b01-sulong", "platformspecific": true } + "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+13-jvmci-b01", "platformspecific": true }, + "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+13-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+13-jvmci-b01-sulong", "platformspecific": true }, + "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+13-jvmci-b01", "platformspecific": true }, + "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+13-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+13-jvmci-b01-sulong", "platformspecific": true } }, "eclipse": { diff --git a/mx.py b/mx.py index 4697ee17..91e4e143 100755 --- a/mx.py +++ b/mx.py @@ -18789,7 +18789,7 @@ def alarm_handler(signum, frame): abort(1, killsig=signal.SIGINT) # The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue -version = VersionSpec("6.50.0") # GR-48667 Scan SuiteClasses for @AddExports +version = VersionSpec("6.50.1") # GR-47930 - Improve SDK lookup in intellijinit. _mx_start_datetime = datetime.utcnow() _last_timestamp = _mx_start_datetime diff --git a/mx_ide_intellij.py b/mx_ide_intellij.py index 6cab7b34..bf26ba21 100644 --- a/mx_ide_intellij.py +++ b/mx_ide_intellij.py @@ -106,7 +106,8 @@ def intellijinit(args, refreshOnly=False, doFsckProjects=True, mx_python_modules def intellij_read_sdks(): sdks = dict() - if mx.is_linux() or mx.is_openbsd() or mx.is_sunos() or mx.is_windows(): + # https://www.jetbrains.com/help/idea/2023.2/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html + if mx.is_linux() or mx.is_openbsd() or mx.is_sunos(): xmlSdks = glob.glob(os.path.expanduser("~/.IdeaIC*/config/options/jdk.table.xml")) + \ glob.glob(os.path.expanduser("~/.IntelliJIdea*/config/options/jdk.table.xml")) + \ glob.glob(os.path.expanduser("~/.config/JetBrains/IdeaIC*/options/jdk.table.xml")) + \ @@ -117,6 +118,12 @@ def intellij_read_sdks(): glob.glob(os.path.expanduser("~/Library/Application Support/JetBrains/IntelliJIdea*/options/jdk.table.xml")) + \ glob.glob(os.path.expanduser("~/Library/Preferences/IdeaIC*/options/jdk.table.xml")) + \ glob.glob(os.path.expanduser("~/Library/Preferences/IntelliJIdea*/options/jdk.table.xml")) + elif mx.is_windows(): + xmlSdks = \ + glob.glob(os.path.expandvars("%APPDATA%/JetBrains/IdeaIC*/options/jdk.table.xml")) + \ + glob.glob(os.path.expandvars("%APPDATA%/JetBrains/IntelliJIdea*/options/jdk.table.xml")) + \ + glob.glob(os.path.expandvars("%LOCALAPPDATA%/JetBrains/IdeaIC*/options/jdk.table.xml")) + \ + glob.glob(os.path.expandvars("%LOCALAPPDATA%/JetBrains/IntelliJIdea*/options/jdk.table.xml")) else: mx.warn(f"Location of IntelliJ SDK definitions on {mx.get_os()} is unknown") return sdks @@ -132,7 +139,12 @@ def verSort(path): xmlSdks.sort(key=verSort, reverse=True) sdk_version_regexes = { - intellij_java_sdk_type: re.compile(r'^java\s+version\s+"([^"]+)"$|^(Oracle OpenJDK )?version\s+(.+)$|^([\d._]+)$'), + # Examples: + # java version "21" + # GraalVM version 21 (vendor name may change) + intellij_java_sdk_type: re.compile(r'^java\s+version\s+"([^"]+)"$|' + r'^(?:.+ )?version\s+(.+)$|' + r'^([\d._]+)$'), intellij_python_sdk_type: re.compile(r'^Python\s+(.+)$'), # Examples: @@ -170,7 +182,7 @@ def verSort(path): sdk_version = sdk.find("version").get("value") match = version_re.match(sdk_version) if match: - version = match.group(1) + version = next(filter(None, match.groups()), None) lang = sdk_languages[kind] if kind == intellij_python_sdk_type: import mx_enter