mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 18:07:24 +01:00
dep_freshness: read every *.versions.toml catalog, not only libs
Some checks failed
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
crdt-sync pre-commit / pre-commit (push) Has been cancelled
crdt-sync tests / test (push) Has been cancelled
music_theory tests / test (push) Has been cancelled
Some checks failed
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
crdt-sync pre-commit / pre-commit (push) Has been cancelled
crdt-sync tests / test (push) Has been cancelled
music_theory tests / test (push) Has been cancelled
settings.gradle.kts can declare any number of catalogs via from(files()); TachiyomiSY has mihon.versions.toml and sy.versions.toml beside libs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Yc4TiPjhbQLfH35QBPfrbP
This commit is contained in:
parent
a4ea305164
commit
8274a3e918
@ -93,7 +93,6 @@ MANIFEST_GLOBS: Final = (
|
||||
".fvmrc",
|
||||
".nvmrc",
|
||||
".python-version",
|
||||
"libs.versions.toml",
|
||||
"gradle-wrapper.properties",
|
||||
)
|
||||
REQUIREMENTS_PATTERN: Final = r"^requirements.*\.txt$"
|
||||
|
||||
@ -36,7 +36,6 @@ _BY_NAME = {
|
||||
".fvmrc": fvm.parse,
|
||||
".nvmrc": javascript.parse_nvmrc,
|
||||
".python-version": python.parse_python_version,
|
||||
gradle.CATALOG_NAME: gradle.parse_catalog,
|
||||
gradle.WRAPPER_NAME: gradle.parse_wrapper,
|
||||
}
|
||||
|
||||
@ -46,6 +45,7 @@ def is_manifest(path: Path) -> bool:
|
||||
path.name in MANIFEST_GLOBS
|
||||
or bool(_REQUIREMENTS.match(path.name))
|
||||
or workflow.is_workflow(path)
|
||||
or gradle.is_catalog(path)
|
||||
)
|
||||
|
||||
|
||||
@ -58,6 +58,8 @@ def parse_manifest(path: Path) -> list[Dep]:
|
||||
return python.parse_requirements(path)
|
||||
if workflow.is_workflow(path):
|
||||
return workflow.parse(path)
|
||||
if gradle.is_catalog(path):
|
||||
return gradle.parse_catalog(path)
|
||||
return []
|
||||
|
||||
|
||||
@ -68,7 +70,9 @@ def _git_ignored(paths: list[Path], root: Path) -> set[Path]:
|
||||
result = subprocess.run(
|
||||
["git", "-C", str(root), "check-ignore", "--stdin"],
|
||||
input="\n".join(str(p) for p in paths),
|
||||
capture_output=True, text=True, check=False,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
except OSError:
|
||||
return set()
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
The version catalog is the one place a Gradle build should declare versions,
|
||||
which makes it a manifest the gate can read without evaluating Kotlin DSL.
|
||||
A build may have several (`settings.gradle.kts` can `from(files(...))` any
|
||||
`*.versions.toml`; TachiyomiSY has three), so the suffix is what is matched.
|
||||
Three shapes appear in `[libraries]` and `[plugins]`:
|
||||
|
||||
foo = "group:artifact:1.2.3" # inline string
|
||||
@ -36,7 +38,7 @@ from dep_freshness.models import Dep
|
||||
from dep_freshness.parsers._lines import index
|
||||
from dep_freshness.versions import exact_pin
|
||||
|
||||
CATALOG_NAME = "libs.versions.toml"
|
||||
CATALOG_SUFFIX = ".versions.toml" # libs.versions.toml, but also sy.versions.toml
|
||||
WRAPPER_NAME = "gradle-wrapper.properties"
|
||||
_DISTRIBUTION = re.compile(
|
||||
r"gradle-(?P<version>\d+(?:\.\d+)*(?:-[0-9A-Za-z.-]+?)?)-(?:bin|all)\.zip"
|
||||
@ -137,3 +139,8 @@ def parse_wrapper(path: Path) -> list[Dep]:
|
||||
)
|
||||
]
|
||||
return []
|
||||
|
||||
|
||||
def is_catalog(path: Path) -> bool:
|
||||
"""True for `libs.versions.toml` and any sibling catalog a build declares."""
|
||||
return path.name.endswith(CATALOG_SUFFIX)
|
||||
|
||||
@ -18,5 +18,5 @@
|
||||
|package\.json|package-lock\.json|pnpm-lock\.yaml
|
||||
|Cargo\.(toml|lock)|go\.(mod|sum)
|
||||
|\.fvmrc|\.nvmrc|\.python-version
|
||||
|libs\.versions\.toml|gradle-wrapper\.properties
|
||||
|\.versions\.toml|gradle-wrapper\.properties
|
||||
|\.github/workflows/.*\.ya?ml)$
|
||||
|
||||
@ -57,7 +57,7 @@ jobs:
|
||||
key:
|
||||
dep-freshness-${{ hashFiles('**/pubspec.yaml', '**/pyproject.toml',
|
||||
'**/requirements*.txt', '**/package.json', '**/Cargo.toml', '**/go.mod',
|
||||
'**/libs.versions.toml') }}
|
||||
'**/*.versions.toml') }}
|
||||
restore-keys: dep-freshness-
|
||||
|
||||
- name: Every dependency is on newest stable
|
||||
|
||||
@ -15,7 +15,8 @@ PUBSPEC = "name: demo\ndependencies:\n http: 1.6.0\n"
|
||||
@pytest.mark.parametrize("name", [
|
||||
"pubspec.yaml", "pyproject.toml", "package.json", "Cargo.toml", "go.mod",
|
||||
".fvmrc", ".nvmrc", ".python-version", "requirements.txt",
|
||||
"requirements-dev.txt", "libs.versions.toml", "gradle-wrapper.properties",
|
||||
"requirements-dev.txt", "libs.versions.toml", "sy.versions.toml",
|
||||
"gradle-wrapper.properties",
|
||||
])
|
||||
def test_manifest_names_are_recognised(name):
|
||||
assert is_manifest(Path(name))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user