-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GR-52605] Extract a batch of build system contents into separate sub…
…package PullRequest: mx/1703
- Loading branch information
Showing
30 changed files
with
2,144 additions
and
1,269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# ---------------------------------------------------------------------------------------------------- | ||
# | ||
# Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. | ||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
# | ||
# This code is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License version 2 only, as | ||
# published by the Free Software Foundation. | ||
# | ||
# This code is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# version 2 for more details (a copy is included in the LICENSE file that | ||
# accompanied this code). | ||
# | ||
# You should have received a copy of the GNU General Public License version | ||
# 2 along with this work; if not, write to the Free Software Foundation, | ||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
# or visit www.oracle.com if you need additional information or have any | ||
# questions. | ||
# | ||
# ---------------------------------------------------------------------------------------------------- | ||
# | ||
|
||
from argparse import Namespace | ||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
@dataclass(repr = False) | ||
class ArgsNamespace(Namespace): | ||
verbose: bool = False | ||
very_verbose: bool = False | ||
warn: bool = True | ||
quiet: bool = False | ||
answer: Optional[str] = None | ||
"""Answer all questions with 'y' or 'n'""" | ||
java_dbg_port: Optional[int] = None | ||
clean: bool = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ---------------------------------------------------------------------------------------------------- | ||
# | ||
# Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. | ||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
# | ||
# This code is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License version 2 only, as | ||
# published by the Free Software Foundation. | ||
# | ||
# This code is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# version 2 for more details (a copy is included in the LICENSE file that | ||
# accompanied this code). | ||
# | ||
# You should have received a copy of the GNU General Public License version | ||
# 2 along with this work; if not, write to the Free Software Foundation, | ||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
# or visit www.oracle.com if you need additional information or have any | ||
# questions. | ||
# | ||
# ---------------------------------------------------------------------------------------------------- | ||
# | ||
|
||
class Daemon: | ||
""" | ||
Daemons are background processes used during the build process and | ||
should be terminated once the build is finished. | ||
""" | ||
def shutdown(self) -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# ---------------------------------------------------------------------------------------------------- | ||
# | ||
# Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. | ||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
# | ||
# This code is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License version 2 only, as | ||
# published by the Free Software Foundation. | ||
# | ||
# This code is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# version 2 for more details (a copy is included in the LICENSE file that | ||
# accompanied this code). | ||
# | ||
# You should have received a copy of the GNU General Public License version | ||
# 2 along with this work; if not, write to the Free Software Foundation, | ||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
# or visit www.oracle.com if you need additional information or have any | ||
# questions. | ||
# | ||
# ---------------------------------------------------------------------------------------------------- | ||
# | ||
|
||
__all__ = [ | ||
"Dependency", | ||
"SuiteConstituent", | ||
] | ||
|
||
from .dependency import Dependency | ||
from .constituent import SuiteConstituent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# | ||
# ---------------------------------------------------------------------------------------------------- | ||
# | ||
# Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. | ||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
# | ||
# This code is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License version 2 only, as | ||
# published by the Free Software Foundation. | ||
# | ||
# This code is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# version 2 for more details (a copy is included in the LICENSE file that | ||
# accompanied this code). | ||
# | ||
# You should have received a copy of the GNU General Public License version | ||
# 2 along with this work; if not, write to the Free Software Foundation, | ||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
# or visit www.oracle.com if you need additional information or have any | ||
# questions. | ||
# | ||
# ---------------------------------------------------------------------------------------------------- | ||
# | ||
|
||
from __future__ import annotations | ||
from abc import ABCMeta | ||
import os.path | ||
from typing import Any, Optional | ||
|
||
from ...support.comparable import ComparisonResult, compare, Comparable | ||
|
||
# TODO: Replace with actual type | ||
Suite = Any | ||
|
||
class SuiteConstituent(Comparable, metaclass=ABCMeta): | ||
name: str | ||
suite: Suite | ||
build_time: int | ||
"""Expected build time in minutes (Used to schedule parallel jobs efficiently)""" | ||
|
||
internal: bool | ||
"""Should this constituent be visible outside its suite""" | ||
|
||
def __init__(self, suite: Suite, name: str, build_time: int = 1): | ||
self.name = name | ||
self.suite = suite | ||
self.build_time = build_time | ||
self.internal = False | ||
|
||
def origin(self) -> Optional[tuple[Suite, int]]: | ||
""" | ||
Gets a 2-tuple (file, line) describing the source file where this constituent | ||
is defined or None if the location cannot be determined. | ||
""" | ||
suitepy = self.suite.suite_py() | ||
if os.path.exists(suitepy): | ||
import tokenize | ||
with open(suitepy) as fp: | ||
candidate = None | ||
for t in tokenize.generate_tokens(fp.readline): | ||
_, tval, (srow, _), _, _ = t | ||
if candidate is None: | ||
if tval in ('"' + self.name + '"', "'" + self.name + "'"): | ||
candidate = srow | ||
else: | ||
if tval == ':': | ||
return (suitepy, srow) | ||
else: | ||
candidate = None | ||
|
||
def __abort_context__(self) -> str: | ||
""" | ||
Gets a description of where this constituent was defined in terms of source file | ||
and line number. If no such description can be generated, None is returned. | ||
""" | ||
loc = self.origin() | ||
if loc: | ||
path, lineNo = loc | ||
return f' File "{path}", line {lineNo} in definition of {self.name}' | ||
return f' {self.name}' | ||
|
||
def _comparison_key(self) -> tuple[str, Suite]: | ||
return self.name, self.suite | ||
|
||
def __cmp__(self, other) -> ComparisonResult: | ||
if not isinstance(other, self.__class__): | ||
return NotImplemented | ||
return compare(self._comparison_key(), other._comparison_key()) | ||
|
||
def __eq__(self, other): | ||
if not isinstance(other, self.__class__): | ||
return NotImplemented | ||
return self._comparison_key() == other._comparison_key() | ||
|
||
def __ne__(self, other): | ||
if not isinstance(other, self.__class__): | ||
return NotImplemented | ||
return self._comparison_key() != other._comparison_key() | ||
|
||
def __hash__(self): | ||
return hash(self._comparison_key()) | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
def __repr__(self): | ||
return self.name |
Oops, something went wrong.