Skip to content

Commit 4bfaf32

Browse files
committed
[GR-44232] Add a few more type annotations so GraalPy's mx_graalpython.py complains less.
PullRequest: mx/1962
2 parents 8f4ff52 + cabbf07 commit 4bfaf32

File tree

4 files changed

+77
-19
lines changed

4 files changed

+77
-19
lines changed

ci/common.jsonnet

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,15 @@ local common_json = import "../common.json";
366366
# Job frequencies
367367
# ***************
368368
frequencies: {
369+
tier1: {
370+
targets+: ["tier1"],
371+
},
372+
tier2: {
373+
targets+: ["tier2"],
374+
},
375+
tier3: {
376+
targets+: ["tier3"],
377+
},
369378
gate: {
370379
targets+: ["gate"],
371380
},

common.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
1010
"jdks": {
11-
"galahad-jdk": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-26+6-570", "platformspecific": true, "extrabundles": ["static-libs"]},
11+
"galahad-jdk": {"name": "jpg-jdk", "version": "26", "build_id": "jdk-26+7-655", "platformspecific": true, "extrabundles": ["static-libs"]},
1212

1313
"oraclejdk17": {"name": "jpg-jdk", "version": "17.0.7", "build_id": "jdk-17.0.7+8", "platformspecific": true, "extrabundles": ["static-libs"]},
1414
"labsjdk-ce-17": {"name": "labsjdk", "version": "ce-17.0.7+4-jvmci-23.1-b02", "platformspecific": true },
@@ -45,21 +45,21 @@
4545

4646
"oraclejdk24": {"name": "jpg-jdk", "version": "24", "build_id": "jdk-24.0.1+9", "platformspecific": true, "extrabundles": ["static-libs"]},
4747

48-
"oraclejdk25": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+26", "platformspecific": true, "extrabundles": ["static-libs"]},
49-
"labsjdk-ce-25": {"name": "labsjdk", "version": "ce-25+26-jvmci-b01", "platformspecific": true },
50-
"labsjdk-ce-25Debug": {"name": "labsjdk", "version": "ce-25+26-jvmci-b01-debug", "platformspecific": true },
51-
"labsjdk-ce-25-llvm": {"name": "labsjdk", "version": "ce-25+26-jvmci-b01-sulong", "platformspecific": true },
52-
"labsjdk-ee-25": {"name": "labsjdk", "version": "ee-25+26-jvmci-b01", "platformspecific": true },
53-
"labsjdk-ee-25Debug": {"name": "labsjdk", "version": "ee-25+26-jvmci-b01-debug", "platformspecific": true },
54-
"labsjdk-ee-25-llvm": {"name": "labsjdk", "version": "ee-25+26-jvmci-b01-sulong", "platformspecific": true },
48+
"oraclejdk25": {"name": "jpg-jdk", "version": "25", "build_id": "jdk-25+30", "platformspecific": true, "extrabundles": ["static-libs"]},
49+
"labsjdk-ce-25": {"name": "labsjdk", "version": "ce-25+30-jvmci-b01", "platformspecific": true },
50+
"labsjdk-ce-25Debug": {"name": "labsjdk", "version": "ce-25+30-jvmci-b01-debug", "platformspecific": true },
51+
"labsjdk-ce-25-llvm": {"name": "labsjdk", "version": "ce-25+30-jvmci-b01-sulong", "platformspecific": true },
52+
"labsjdk-ee-25": {"name": "labsjdk", "version": "ee-25+30-jvmci-b01", "platformspecific": true },
53+
"labsjdk-ee-25Debug": {"name": "labsjdk", "version": "ee-25+30-jvmci-b01-debug", "platformspecific": true },
54+
"labsjdk-ee-25-llvm": {"name": "labsjdk", "version": "ee-25+30-jvmci-b01-sulong", "platformspecific": true },
5555

56-
"oraclejdk-latest": {"name": "jpg-jdk", "version": "26", "build_id": "jdk-26+6", "platformspecific": true, "extrabundles": ["static-libs"]},
57-
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-26+6-jvmci-b01", "platformspecific": true },
58-
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-26+6-jvmci-b01-debug", "platformspecific": true },
59-
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-26+5-jvmci-b01-sulong", "platformspecific": true },
60-
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-26+6-jvmci-b01", "platformspecific": true },
61-
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-26+6-jvmci-b01-debug", "platformspecific": true },
62-
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-26+5-jvmci-b01-sulong", "platformspecific": true }
56+
"oraclejdk-latest": {"name": "jpg-jdk", "version": "26", "build_id": "jdk-26+8", "platformspecific": true, "extrabundles": ["static-libs"]},
57+
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-26+8-jvmci-b01", "platformspecific": true },
58+
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-26+8-jvmci-b01-debug", "platformspecific": true },
59+
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-26+8-jvmci-b01-sulong", "platformspecific": true },
60+
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-26+8-jvmci-b01", "platformspecific": true },
61+
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-26+8-jvmci-b01-debug", "platformspecific": true },
62+
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-26+8-jvmci-b01-sulong", "platformspecific": true }
6363
},
6464

6565
"eclipse": {

src/mx/_impl/mx.py

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@
320320
import sys
321321
import uuid
322322
from abc import ABCMeta, abstractmethod
323-
from typing import Callable, IO, AnyStr, Union, Iterable, Any, Optional
323+
from typing import Callable, IO, AnyStr, Union, Iterable, Any, Optional, overload, Literal
324324

325325
from mx._impl.support import java_argument_file
326326

@@ -688,6 +688,19 @@ def atomic_file_move_with_fallback(source_path, destination_path):
688688

689689
### ~~~~~~~~~~~~~ command
690690

691+
692+
@overload
693+
def command_function(name: str) -> Callable[[list[str]], Any]: ...
694+
695+
696+
@overload
697+
def command_function(name: str, fatalIfMissing: Literal[True]) -> Callable[[list[str]], Any]: ...
698+
699+
700+
@overload
701+
def command_function(name: str, fatalIfMissing: bool = True) -> Optional[Callable[[list[str]], Any]]: ...
702+
703+
691704
def command_function(name, fatalIfMissing=True):
692705
"""
693706
Return the function for the (possibly overridden) command named `name`.
@@ -1560,6 +1573,9 @@ class Suite(object):
15601573
Command state and methods for all suite subclasses.
15611574
:type dists: list[Distribution]
15621575
"""
1576+
1577+
suiteDict: dict[str, Any]
1578+
15631579
def __init__(self, mxDir, primary, internal, importing_suite, load, vc, vc_dir, dynamicallyImported=False, foreign=False):
15641580
if primary is True and vc_dir is None:
15651581
abort("The primary suite must be in a vcs repository or under a directory containing a file called '.mx_vcs_root' or 'ci.hocon'")
@@ -3177,7 +3193,16 @@ def suites(opt_limit_to_suite=False, includeBinary=True, include_mx=False):
31773193
return res
31783194

31793195

3180-
def suite(name, fatalIfMissing=True, context=None):
3196+
@overload
3197+
def suite(name: str) -> Suite: ...
3198+
3199+
@overload
3200+
def suite(name: str, fatalIfMissing: Literal[True]) -> Suite: ...
3201+
3202+
@overload
3203+
def suite(name: str, fatalIfMissing: bool = True, context = None) -> Optional[Suite]: ...
3204+
3205+
def suite(name: str, fatalIfMissing: bool = True, context = None) -> Optional[Suite]:
31813206
"""
31823207
Get the suite for a given name.
31833208
:rtype: Suite
@@ -5177,7 +5202,7 @@ def __init__(self, suite, name, deps, path, excludedLibs, platformDependent, the
51775202
self.path = _make_absolute(path.replace('/', os.sep) if path else self._default_path(), suite.dir)
51785203
self.output = output
51795204

5180-
def get_output(self):
5205+
def get_output(self) -> Optional[str]:
51815206
if self.output:
51825207
return join(self.suite.dir, self.output)
51835208
return None
@@ -12247,6 +12272,18 @@ def _missing_dep_message(depName, depType):
1224712272
return f'{depType} named {depName} was not found'
1224812273

1224912274

12275+
@overload
12276+
def distribution(name: str) -> AbstractDistribution: ...
12277+
12278+
12279+
@overload
12280+
def distribution(name: str, fatalIfMissing: Literal[True]) -> AbstractDistribution: ...
12281+
12282+
12283+
@overload
12284+
def distribution(name: str, fatalIfMissing: bool = True, context = None) -> Optional[AbstractDistribution]: ...
12285+
12286+
1225012287
def distribution(name, fatalIfMissing=True, context=None):
1225112288
"""
1225212289
Get the distribution for a given name. This will abort if the named distribution does
@@ -12261,6 +12298,18 @@ def distribution(name, fatalIfMissing=True, context=None):
1226112298
return d
1226212299

1226312300

12301+
@overload
12302+
def dependency(name: str) -> Dependency: ...
12303+
12304+
12305+
@overload
12306+
def dependency(name: str, fatalIfMissing: Literal[True]) -> Dependency: ...
12307+
12308+
12309+
@overload
12310+
def dependency(name: str, fatalIfMissing: bool = True, context = None) -> Optional[Dependency]: ...
12311+
12312+
1226412313
def dependency(name, fatalIfMissing=True, context=None):
1226512314
"""
1226612315
Get the project, library or dependency for a given name. This will abort if the dependency

src/mx/mx_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue
2-
version = "7.59.0" # GR-64319 adding the patchModule keyword to mx in order to support the javac command patchModule.
2+
version = "7.59.1" # Add some typing annotations

0 commit comments

Comments
 (0)