From ec10fbc6aabfde4a329982c9ae8ae43c95ca8089 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Mon, 13 Nov 2023 20:41:47 +0100 Subject: [PATCH] chore: Remove Batect as it has become unmaintained See [1]. [1]: https://batect.dev/blog/2023/10/22/batect-is-no-longer-maintained/ Signed-off-by: Sebastian Schuberth --- .dockerignore | 1 - .gitattributes | 1 - .github/workflows/wrapper-validation.yml | 7 - .gitignore | 1 - .reuse/dep5 | 4 - batect | 205 ---------- batect.cmd | 473 ----------------------- batect.yml | 91 ----- buildSrc/src/main/kotlin/LicenseUtils.kt | 1 - renovate.json | 3 - 10 files changed, 787 deletions(-) delete mode 100755 batect delete mode 100644 batect.cmd delete mode 100644 batect.yml diff --git a/.dockerignore b/.dockerignore index 6f04f902f065d..4c1a02e3f5c82 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,4 @@ # Ignore Docker-related files to avoid the cache being invalidated if the files are changed during development. -.batect/ .dockerignore Dockerfile* scripts/docker_*.sh diff --git a/.gitattributes b/.gitattributes index 6c2d57e0937a6..6699ac63faeac 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,7 +7,6 @@ gradlew text eol=lf # Always use Windows line endings for Windows batch scripts. *.bat text eol=crlf -*.cmd text eol=crlf # Use Unix line endings for expected test results for consistency across platforms. **/src/*/assets/**/*expected*.txt text eol=lf diff --git a/.github/workflows/wrapper-validation.yml b/.github/workflows/wrapper-validation.yml index 5691c0d3e6199..1c3137bdbd7f0 100644 --- a/.github/workflows/wrapper-validation.yml +++ b/.github/workflows/wrapper-validation.yml @@ -9,13 +9,6 @@ on: - main jobs: - batect-wrapper: - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - name: Validate Wrapper - uses: batect/batect-wrapper-validation-action@v0.4 gradle-wrapper: runs-on: ubuntu-22.04 steps: diff --git a/.gitignore b/.gitignore index a7071979d01d1..d605ef07cb9d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -.batect/ .gradle/ .idea/ !.idea/icon*.png diff --git a/.reuse/dep5 b/.reuse/dep5 index ca7539bd84e82..507566f08208d 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -90,10 +90,6 @@ License: Apache-2.0 # Third-party files. -Files: batect* -Copyright: 2017-2021 Charles Korn -License: Apache-2.0 - Files: gradlew* Copyright: 2007-2020 The original author or authors License: Apache-2.0 diff --git a/batect b/batect deleted file mode 100755 index 3fc8809071225..0000000000000 --- a/batect +++ /dev/null @@ -1,205 +0,0 @@ -#!/usr/bin/env bash - -{ - set -euo pipefail - - # This file is part of Batect. - # Do not modify this file. It will be overwritten next time you upgrade Batect. - # You should commit this file to version control alongside the rest of your project. It should not be installed globally. - # For more information, visit https://github.com/batect/batect. - - VERSION="0.85.0" - CHECKSUM="${BATECT_DOWNLOAD_CHECKSUM:-901ed73295be75d295cec1d06315f7026b36ccb1666660b8af432cfbbc7feae8}" - DOWNLOAD_URL_ROOT=${BATECT_DOWNLOAD_URL_ROOT:-"https://updates.batect.dev/v1/files"} - DOWNLOAD_URL=${BATECT_DOWNLOAD_URL:-"$DOWNLOAD_URL_ROOT/$VERSION/batect-$VERSION.jar"} - QUIET_DOWNLOAD=${BATECT_QUIET_DOWNLOAD:-false} - - BATECT_WRAPPER_CACHE_DIR=${BATECT_CACHE_DIR:-"$HOME/.batect/cache"} - VERSION_CACHE_DIR="$BATECT_WRAPPER_CACHE_DIR/$VERSION" - JAR_PATH="$VERSION_CACHE_DIR/batect-$VERSION.jar" - BATECT_WRAPPER_DID_DOWNLOAD=false - - SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - - function main() { - if ! haveVersionCachedLocally; then - download - BATECT_WRAPPER_DID_DOWNLOAD=true - fi - - checkChecksum - runApplication "$@" - } - - function haveVersionCachedLocally() { - [ -f "$JAR_PATH" ] - } - - function download() { - checkForCurl - - mkdir -p "$VERSION_CACHE_DIR" - temp_file=$(mktemp) - - if [[ $QUIET_DOWNLOAD == 'true' ]]; then - curl --silent --fail --show-error --location --output "$temp_file" --retry 3 --retry-connrefused "$DOWNLOAD_URL" - else - echo "Downloading Batect version $VERSION from $DOWNLOAD_URL..." - curl -# --fail --show-error --location --output "$temp_file" --retry 3 --retry-connrefused "$DOWNLOAD_URL" - fi - - mv "$temp_file" "$JAR_PATH" - } - - function checkChecksum() { - local_checksum=$(getLocalChecksum) - - if [[ "$local_checksum" != "$CHECKSUM" ]]; then - echo "The downloaded version of Batect does not have the expected checksum. Delete '$JAR_PATH' and then re-run this script to download it again." - exit 1 - fi - } - - function getLocalChecksum() { - if [[ "$(uname)" == "Darwin" ]]; then - shasum -a 256 "$JAR_PATH" | cut -d' ' -f1 - else - sha256sum "$JAR_PATH" | cut -d' ' -f1 - fi - } - - function runApplication() { - java_path=$(getPathToJava) - checkForJava "$java_path" - - java_version_info=$(getJavaVersionInfo "$java_path") - checkJavaVersion "$java_version_info" - - java_version=$(extractJavaVersion "$java_version_info") - java_version_major=$(extractJavaMajorVersion "$java_version") - - if (( java_version_major >= 9 )); then - JAVA_OPTS=(--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED) - else - JAVA_OPTS=() - fi - - if [[ "$(uname -o 2>&1)" == "Msys" ]] && hash winpty 2>/dev/null && [ -t /dev/stdin ]; then - GIT_BASH_PTY_WORKAROUND=(winpty) - else - GIT_BASH_PTY_WORKAROUND=() - fi - - BATECT_WRAPPER_SCRIPT_DIR="$SCRIPT_PATH" \ - BATECT_WRAPPER_CACHE_DIR="$BATECT_WRAPPER_CACHE_DIR" \ - BATECT_WRAPPER_DID_DOWNLOAD="$BATECT_WRAPPER_DID_DOWNLOAD" \ - HOSTNAME="$HOSTNAME" \ - exec \ - ${GIT_BASH_PTY_WORKAROUND[@]+"${GIT_BASH_PTY_WORKAROUND[@]}"} \ - "$java_path" \ - -Djava.net.useSystemProxies=true \ - ${JAVA_OPTS[@]+"${JAVA_OPTS[@]}"} \ - -jar "$JAR_PATH" \ - "$@" - } - - function checkForCurl() { - if ! hash curl 2>/dev/null; then - echo "curl is not installed or not on your PATH. Please install it and try again." >&2 - exit 1 - fi - } - - function getPathToJava() { - if useJavaHome; then - echo "$JAVA_HOME/bin/java" - else - echo "java" - fi - } - - function useJavaHome() { - test -n "${JAVA_HOME+x}" - } - - function checkForJava() { - local java_path="$1" - - if ! hash "$java_path" 2>/dev/null; then - showJavaNotInstalledError - fi - } - - function showJavaNotInstalledError() { - if useJavaHome; then - echo "JAVA_HOME is set to '$JAVA_HOME', but there is no Java executable at '$JAVA_HOME/bin/java'." >&2 - else - echo "Java is not installed or not on your PATH. Please install it and try again." >&2 - fi - - exit 1 - } - - function checkJavaVersion() { - java_version_info="$1" - java_version=$(extractJavaVersion "$java_version_info") - java_version_major=$(extractJavaMajorVersion "$java_version") - java_version_minor=$(extractJavaMinorVersion "$java_version") - - if (( java_version_major < 1 || ( java_version_major == 1 && java_version_minor <= 7 ) )); then - if useJavaHome; then - echo "The version of Java that is available in JAVA_HOME is version $java_version, but version 1.8 or greater is required." >&2 - echo "If you have a newer version of Java installed, please make sure JAVA_HOME is set correctly." >&2 - echo "JAVA_HOME takes precedence over any versions of Java available on your PATH." >&2 - else - echo "The version of Java that is available on your PATH is version $java_version, but version 1.8 or greater is required." >&2 - echo "If you have a newer version of Java installed, please make sure your PATH is set correctly." >&2 - fi - - exit 1 - fi - - if ! javaIs64Bit "$java_version_info"; then - if useJavaHome; then - echo "The version of Java that is available in JAVA_HOME is a 32-bit version, but Batect requires a 64-bit Java runtime." >&2 - echo "If you have a 64-bit version of Java installed, please make sure JAVA_HOME is set correctly." >&2 - echo "JAVA_HOME takes precedence over any versions of Java available on your PATH." >&2 - else - echo "The version of Java that is available on your PATH is a 32-bit version, but Batect requires a 64-bit Java runtime." >&2 - echo "If you have a 64-bit version of Java installed, please make sure your PATH is set correctly." >&2 - fi - - exit 1 - fi - } - - function getJavaVersionInfo() { - local java_path="$1" - - "$java_path" -version 2>&1 || showJavaNotInstalledError - } - - function extractJavaVersion() { - echo "$1" | grep version | sed -En ';s/.* version "([0-9]+)(\.([0-9]+))?.*".*/\1.\3/p;' - } - - function extractJavaMajorVersion() { - java_version=$1 - - echo "${java_version%.*}" - } - - function extractJavaMinorVersion() { - java_version=$1 - java_version_minor="${java_version#*.}" - - echo "${java_version_minor:-0}" - } - - function javaIs64Bit() { - echo "$1" | grep -q '64-[Bb]it' - } - - main "$@" - exit $? -} diff --git a/batect.cmd b/batect.cmd deleted file mode 100644 index 0cd2a06cba6db..0000000000000 --- a/batect.cmd +++ /dev/null @@ -1,473 +0,0 @@ -@echo off -rem This file is part of Batect. -rem Do not modify this file. It will be overwritten next time you upgrade Batect. -rem You should commit this file to version control alongside the rest of your project. It should not be installed globally. -rem For more information, visit https://github.com/batect/batect. - -setlocal EnableDelayedExpansion - -set "version=0.85.0" - -if "%BATECT_CACHE_DIR%" == "" ( - set "BATECT_CACHE_DIR=%USERPROFILE%\.batect\cache" -) - -set "rootCacheDir=!BATECT_CACHE_DIR!" -set "cacheDir=%rootCacheDir%\%version%" -set "ps1Path=%cacheDir%\batect-%version%.ps1" - -set script=Set-StrictMode -Version 2.0^ - -$ErrorActionPreference = 'Stop'^ - -^ - -$Version='0.85.0'^ - -^ - -function getValueOrDefault($value, $default) {^ - - if ($value -eq $null) {^ - - $default^ - - } else {^ - - $value^ - - }^ - -}^ - -^ - -$DownloadUrlRoot = getValueOrDefault $env:BATECT_DOWNLOAD_URL_ROOT "https://updates.batect.dev/v1/files"^ - -$UrlEncodedVersion = [Uri]::EscapeDataString($Version)^ - -$DownloadUrl = getValueOrDefault $env:BATECT_DOWNLOAD_URL "$DownloadUrlRoot/$UrlEncodedVersion/batect-$UrlEncodedVersion.jar"^ - -$ExpectedChecksum = getValueOrDefault $env:BATECT_DOWNLOAD_CHECKSUM '901ed73295be75d295cec1d06315f7026b36ccb1666660b8af432cfbbc7feae8'^ - -^ - -$RootCacheDir = getValueOrDefault $env:BATECT_CACHE_DIR "$env:USERPROFILE\.batect\cache"^ - -$VersionCacheDir = "$RootCacheDir\$Version"^ - -$JarPath = "$VersionCacheDir\batect-$Version.jar"^ - -$DidDownload = 'false'^ - -^ - -function main() {^ - - if (-not (haveVersionCachedLocally)) {^ - - download^ - - $DidDownload = 'true'^ - - }^ - -^ - - checkChecksum^ - - runApplication @args^ - -}^ - -^ - -function haveVersionCachedLocally() {^ - - Test-Path $JarPath^ - -}^ - -^ - -function download() {^ - - Write-Output "Downloading Batect version $Version from $DownloadUrl..."^ - -^ - - createCacheDir^ - -^ - - $oldProgressPreference = $ProgressPreference^ - -^ - - try {^ - - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12^ - -^ - - # Turn off the progress bar to significantly reduce download times - see https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251165868^ - - $ProgressPreference = 'SilentlyContinue'^ - -^ - - Invoke-WebRequest -Uri $DownloadUrl -OutFile $JarPath ^| Out-Null^ - - } catch {^ - - $Message = $_.Exception.Message^ - -^ - - Write-Host -ForegroundColor Red "Downloading failed with error: $Message"^ - - exit 1^ - - } finally {^ - - $ProgressPreference = $oldProgressPreference^ - - }^ - -}^ - -^ - -function checkChecksum() {^ - - $localChecksum = (Get-FileHash -Algorithm 'SHA256' $JarPath).Hash.ToLower()^ - -^ - - if ($localChecksum -ne $expectedChecksum) {^ - - Write-Host -ForegroundColor Red "The downloaded version of Batect does not have the expected checksum. Delete '$JarPath' and then re-run this script to download it again."^ - - exit 1^ - - }^ - -}^ - -^ - -function createCacheDir() {^ - - if (-not (Test-Path $VersionCacheDir)) {^ - - New-Item -ItemType Directory -Path $VersionCacheDir ^| Out-Null^ - - }^ - -}^ - -^ - -function runApplication() {^ - - $java = findJava^ - - $javaVersion = checkJavaVersion $java^ - -^ - - if ($javaVersion.Major -ge 9) {^ - - $javaArgs = @("--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens", "java.base/java.io=ALL-UNNAMED")^ - - } else {^ - - $javaArgs = @()^ - - }^ - -^ - - $combinedArgs = $javaArgs + @("-Djava.net.useSystemProxies=true", "-jar", $JarPath) + $args^ - - $env:HOSTNAME = $env:COMPUTERNAME^ - - $env:BATECT_WRAPPER_CACHE_DIR = $RootCacheDir^ - - $env:BATECT_WRAPPER_DID_DOWNLOAD = $DidDownload^ - -^ - - $info = New-Object System.Diagnostics.ProcessStartInfo^ - - $info.FileName = $java.Source^ - - $info.Arguments = combineArgumentsToString($combinedArgs)^ - - $info.RedirectStandardError = $false^ - - $info.RedirectStandardOutput = $false^ - - $info.UseShellExecute = $false^ - -^ - - $process = New-Object System.Diagnostics.Process^ - - $process.StartInfo = $info^ - - $process.Start() ^| Out-Null^ - - $process.WaitForExit()^ - -^ - - exit $process.ExitCode^ - -}^ - -^ - -function useJavaHome() {^ - - return ($env:JAVA_HOME -ne $null)^ - -}^ - -^ - -function findJava() {^ - - if (useJavaHome) {^ - - $java = Get-Command "$env:JAVA_HOME\bin\java" -ErrorAction SilentlyContinue^ - -^ - - if ($java -eq $null) {^ - - Write-Host -ForegroundColor Red "JAVA_HOME is set to '$env:JAVA_HOME', but there is no Java executable at '$env:JAVA_HOME\bin\java.exe'."^ - - exit 1^ - - }^ - -^ - - return $java^ - - }^ - -^ - - $java = Get-Command "java" -ErrorAction SilentlyContinue^ - -^ - - if ($java -eq $null) {^ - - Write-Host -ForegroundColor Red "Java is not installed or not on your PATH. Please install it and try again."^ - - exit 1^ - - }^ - -^ - - return $java^ - -}^ - -^ - -function checkJavaVersion([System.Management.Automation.CommandInfo]$java) {^ - - $versionInfo = getJavaVersionInfo $java^ - - $rawVersion = getJavaVersion $versionInfo^ - - $parsedVersion = New-Object Version -ArgumentList $rawVersion^ - - $minimumVersion = "1.8"^ - -^ - - if ($parsedVersion -lt (New-Object Version -ArgumentList $minimumVersion)) {^ - - if (useJavaHome) {^ - - Write-Host -ForegroundColor Red "The version of Java that is available in JAVA_HOME is version $rawVersion, but version $minimumVersion or greater is required."^ - - Write-Host -ForegroundColor Red "If you have a newer version of Java installed, please make sure JAVA_HOME is set correctly."^ - - Write-Host -ForegroundColor Red "JAVA_HOME takes precedence over any versions of Java available on your PATH."^ - - } else {^ - - Write-Host -ForegroundColor Red "The version of Java that is available on your PATH is version $rawVersion, but version $minimumVersion or greater is required."^ - - Write-Host -ForegroundColor Red "If you have a newer version of Java installed, please make sure your PATH is set correctly."^ - - }^ - -^ - - exit 1^ - - }^ - -^ - - if (-not ($versionInfo -match "64\-[bB]it")) {^ - - if (useJavaHome) {^ - - Write-Host -ForegroundColor Red "The version of Java that is available in JAVA_HOME is a 32-bit version, but Batect requires a 64-bit Java runtime."^ - - Write-Host -ForegroundColor Red "If you have a 64-bit version of Java installed, please make sure JAVA_HOME is set correctly."^ - - Write-Host -ForegroundColor Red "JAVA_HOME takes precedence over any versions of Java available on your PATH."^ - - } else {^ - - Write-Host -ForegroundColor Red "The version of Java that is available on your PATH is a 32-bit version, but Batect requires a 64-bit Java runtime."^ - - Write-Host -ForegroundColor Red "If you have a 64-bit version of Java installed, please make sure your PATH is set correctly."^ - - }^ - -^ - - exit 1^ - - }^ - -^ - - return $parsedVersion^ - -}^ - -^ - -function getJavaVersionInfo([System.Management.Automation.CommandInfo]$java) {^ - - $info = New-Object System.Diagnostics.ProcessStartInfo^ - - $info.FileName = $java.Source^ - - $info.Arguments = "-version"^ - - $info.RedirectStandardError = $true^ - - $info.RedirectStandardOutput = $true^ - - $info.UseShellExecute = $false^ - -^ - - $process = New-Object System.Diagnostics.Process^ - - $process.StartInfo = $info^ - - $process.Start() ^| Out-Null^ - - $process.WaitForExit()^ - -^ - - $stderr = $process.StandardError.ReadToEnd()^ - - return $stderr^ - -}^ - -^ - -function getJavaVersion([String]$versionInfo) {^ - - $versionLine = ($versionInfo -split [Environment]::NewLine)[0]^ - -^ - - if (-not ($versionLine -match "version `"([0-9]+)(\.([0-9]+))?.*`"")) {^ - - Write-Error "Java reported a version that does not match the expected format: $versionLine"^ - - }^ - -^ - - $major = $Matches.1^ - -^ - - if ($Matches.Count -ge 3) {^ - - $minor = $Matches.3^ - - } else {^ - - $minor = "0"^ - - }^ - -^ - - return "$major.$minor"^ - -}^ - -^ - -function combineArgumentsToString([Object[]]$arguments) {^ - - $combined = @()^ - -^ - - $arguments ^| %% { $combined += escapeArgument($_) }^ - -^ - - return $combined -join " "^ - -}^ - -^ - -function escapeArgument([String]$argument) {^ - - return '"' + $argument.Replace('"', '"""') + '"'^ - -}^ - -^ - -main @args^ - - - -if not exist "%cacheDir%" ( - mkdir "%cacheDir%" -) - -echo !script! > "%ps1Path%" - -set BATECT_WRAPPER_SCRIPT_DIR=%~dp0 - -rem Why do we explicitly exit? -rem cmd.exe appears to read this script one line at a time and then executes it. -rem If we modify the script while it is still running (eg. because we're updating it), then cmd.exe does all kinds of odd things -rem because it continues execution from the next byte (which was previously the end of the line). -rem By explicitly exiting on the same line as starting the application, we avoid these issues as cmd.exe has already read the entire -rem line before we start the application and therefore will always exit. - -rem Why do we set PSModulePath? -rem See issue #627 -set "PSModulePath=" -powershell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -File "%ps1Path%" %* && exit /b 0 || exit /b !ERRORLEVEL! - -rem What's this for? -rem This is so the tests for the wrapper has a way to ensure that the line above terminates the script correctly. -echo WARNING: you should never see this, and if you do, then Batect's wrapper script has a bug diff --git a/batect.yml b/batect.yml deleted file mode 100644 index f087f31d43ee5..0000000000000 --- a/batect.yml +++ /dev/null @@ -1,91 +0,0 @@ -# This is a configuration file for Batect, a tool to Build And Testing Environments as Code, see -# https://batect.dev/docs/reference/config/. - -config_variables: - docker_build_user_id: - description: The id to use for the user running ORT - default: 1000 - gradle_build_scan: - description: Enabling of Gradle build scans - # Supported values: "true", "false" - default: false - gradle_console: - description: Gradle console mode - # Supported values: "auto", "plain", "rich", "verbose" - default: rich - kotest_diff: - description: Kotest multi-line string assertion mode - # Supported values: "simple", "unified", or anything different for "condensed" output - default: unified - -.common-container-config: &common-container-config - run_as_current_user: - enabled: true - home_directory: /home/ort - privileged: true - environment: - GRADLE_OPTS: -Dorg.gradle.console=- - A generic task that "forwards" task arguments to Gradle. Use it like - `./batect gradle -- installDist`. - run: - container: build - command: ./gradlew --stacktrace - buildCli: - description: >- - A convenience task to build (but not run) ORT's command line interface. - run: - container: build - command: ./gradlew --stacktrace :cli:installDist - buildFunTest: - description: >- - A convenience task to build (but not run) ORT's functional tests. - run: - container: build - command: ./gradlew --stacktrace jar funTestClasses - requirements: - description: >- - A task to check ORT's requirements against the runtime container. - prerequisites: - - buildCli - run: - container: run - command: ./cli/build/install/ort/bin/ort requirements - runFunTest: - description: >- - A task to execute ORT's functional tests that require external tools in the runtime container. - prerequisites: - - buildFunTest - run: - container: run - command: "'./gradlew funTest jacocoFunTestReport -Ptests.include=org.ossreviewtoolkit.cli.*,org.ossreviewtoolkit.analyzer.*,org.ossreviewtoolkit.plugins.packagemanagers.* $(sed \"s/true/--scan/;s/false//\" <<< \"$GRADLE_BUILD_SCAN\")'" - entrypoint: /bin/bash --login -c diff --git a/buildSrc/src/main/kotlin/LicenseUtils.kt b/buildSrc/src/main/kotlin/LicenseUtils.kt index c98f1eee88d16..7632faa67d3e6 100644 --- a/buildSrc/src/main/kotlin/LicenseUtils.kt +++ b/buildSrc/src/main/kotlin/LicenseUtils.kt @@ -25,7 +25,6 @@ object CopyrightableFiles { private val excludedPaths = listOf( "LICENSE", "NOTICE", - "batect", "website/babel.config.js", "website/docusaurus.config.js", "website/docs/configuration/_category_.yml", diff --git a/renovate.json b/renovate.json index 5aa29c3274d7d..919d537b076de 100644 --- a/renovate.json +++ b/renovate.json @@ -7,9 +7,6 @@ ":semanticCommitTypeAll(deps)" ], "dependencyDashboard": false, - "batect": { - "enabled": false - }, "ignoreDeps": [ "org.eclipse.sw360:client" ],