diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b4b8b6..967fe23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,15 +9,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Validate gradle wrapper checksum - uses: gradle/actions/wrapper-validation@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 + uses: gradle/actions/wrapper-validation@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 - name: Set up JDK 21 - uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0 + uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 with: distribution: 'temurin' java-version: 21 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dcb45e8..cbcd49f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,10 +23,10 @@ jobs: echo "version=${version}" >> "${GITHUB_OUTPUT}" - name: Check out repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Create release - uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1 + uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 with: tag_name: v${{ steps.get_version.outputs.version }} name: Version ${{ steps.get_version.outputs.version }} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bf2ef73..9a06001 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] -android-gradle-plugin = "9.2.1" -jgit = "7.7.0.202606012155-r" -json = "20260522" +android-gradle-plugin = "9.3.1" +jgit = "7.7.1.202607240634-r" +json = "20260814" [libraries] # Build script diff --git a/gradle/update_verification.py b/gradle/update_verification.py index 516b936..bb4c98b 100755 --- a/gradle/update_verification.py +++ b/gradle/update_verification.py @@ -1,8 +1,10 @@ #!/usr/bin/env python3 -# SPDX-FileCopyrightText: 2023-2024 Andrew Gunnerson +# SPDX-FileCopyrightText: 2023-2026 Andrew Gunnerson # SPDX-License-Identifier: GPL-3.0-only +from collections.abc import Callable, Iterable +import dataclasses import hashlib import io import os @@ -12,12 +14,14 @@ import urllib.request import xml.etree.ElementTree as ET - GOOGLE_MAVEN_REPO = 'https://dl.google.com/android/maven2' -def add_source_exclusions(ns, root): +def add_source_exclusions(ns: str, root: ET.Element): configuration = root.find(f'{{{ns}}}configuration') + if configuration is None: + raise ValueError(' tag not found') + trusted_artifacts = ET.SubElement( configuration, f'{{{ns}}}trusted-artifacts') @@ -32,29 +36,54 @@ def add_source_exclusions(ns, root): }) -def add_missing_aapt2_platforms(ns, root): - components = root.find(f'{{{ns}}}components') - aapt2 = components.find(f'{{{ns}}}component[@name="aapt2"]') +@dataclasses.dataclass +class ArtifactInfo: + group: str + name: str + version: str - for platform in ['linux', 'osx', 'windows']: - group = aapt2.attrib['group'] - name = aapt2.attrib['name'] - version = aapt2.attrib['version'] - filename = f'{name}-{version}-{platform}.jar' - if aapt2.find(f'{{{ns}}}artifact[@name="{filename}"]') is not None: - continue +@dataclasses.dataclass +class ArtifactAssets: + repo: str + files: list[str] + - path = f'{group.replace(".", "/")}/{name}/{version}/{filename}' - url = f'{GOOGLE_MAVEN_REPO}/{path}' +def add_missing_components( + ns: str, + root: ET.Element, + name: str, + assets_for: Callable[[ArtifactInfo], ArtifactAssets], +): + components = root.find(f'{{{ns}}}components') + if components is None: + raise ValueError(' tag not found') + + component = components.find(f'{{{ns}}}component[@name="{name}"]') + if component is None: + raise ValueError(f' tag not found') + + info = ArtifactInfo( + group=component.attrib['group'], + name=component.attrib['name'], + version=component.attrib['version'], + ) + assets = assets_for(info) + + for filename in assets.files: + if component.find(f'{{{ns}}}artifact[@name="{filename}"]') is not None: + continue - with urllib.request.urlopen(url) as r: - if r.status != 200: - raise Exception(f'{url} returned HTTP {r.status}') + path = f'{info.group.replace(".", "/")}/{name}/{info.version}/{filename}' + url = f'{assets.repo}/{path}' - digest = hashlib.file_digest(r, 'sha512') + try: + with urllib.request.urlopen(url) as r: + digest = hashlib.file_digest(r, 'sha512') + except urllib.request.HTTPError as e: + raise Exception(f'Failed to download: {e.url}') from e - artifact = ET.SubElement(aapt2, f'{{{ns}}}artifact', + artifact = ET.SubElement(component, f'{{{ns}}}artifact', attrib={'name': filename}) ET.SubElement(artifact, f'{{{ns}}}sha512', attrib={ @@ -62,10 +91,24 @@ def add_missing_aapt2_platforms(ns, root): 'origin': 'Generated by Gradle', }) - aapt2[:] = sorted(aapt2, key=lambda child: child.attrib['name']) + component[:] = sorted(component, key=lambda child: child.attrib['name']) + + +def add_missing_aapt2_platforms(ns: str, root: ET.Element): + platforms = ['linux', 'osx', 'windows'] + + add_missing_components( + ns, + root, + 'aapt2', + lambda info: ArtifactAssets( + repo=GOOGLE_MAVEN_REPO, + files=[f'{info.name}-{info.version}-{p}.jar' for p in platforms], + ), + ) -def patch_xml(path): +def patch_xml(path: str | os.PathLike[str]): tree = ET.parse(path) root = tree.getroot() @@ -75,8 +118,8 @@ def patch_xml(path): # Add exclusions to allow Android Studio to download sources. add_source_exclusions(ns, root) - # Gradle only adds the aapt2 entry for the host OS. We have to manually add - # the checksums for the other major desktop OSs. + # Gradle only adds entries for the host OS. We have to manually add the + # checksums for the other major desktop OSs. add_missing_aapt2_platforms(ns, root) # Match gradle's formatting exactly. diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 4b58557..1e3baf9 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1,5 +1,5 @@ - + true false @@ -10,207 +10,207 @@ - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -221,44 +221,44 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -277,252 +277,252 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -698,25 +698,17 @@ - - - - - - - - - - - + + + - - + + @@ -739,19 +731,14 @@ - - - - - - - - + + + @@ -787,13 +774,18 @@ - - - + + + + + + + + @@ -809,6 +801,11 @@ + + + + + @@ -1801,25 +1798,25 @@ - - - + + + - - + + - - - + + + - - - + + + - - + + @@ -2038,12 +2035,12 @@ - - - + + + - - + + @@ -2110,12 +2107,12 @@ - - - + + + - - + + @@ -2280,12 +2277,12 @@ - - - + + + - - + + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b1b8ef5..eddabd2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index dbe66e1..760c459 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=9c0f7faeeb306cb14e4279a3e084ca6b596894089a0638e68a07c945a32c9e14 -distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip +distributionSha256Sum=acd53f1edaf02f1a8ff99879f8a34b302661a057d9b063ae9e35b552f804d20a +distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip networkTimeout=10000 retries=0 retryBackOffMs=500