Use gradle to get Tachidesk.jar when required

This commit is contained in:
Syer10
2021-07-09 00:07:17 -04:00
parent 1bc129e1e5
commit 4c5a784b1e
15 changed files with 185 additions and 216 deletions

View File

@@ -1,15 +0,0 @@
#!/bin/bash
if [ "$(basename "$(pwd)")" = "scripts" ]; then
cd ..
fi
if test -f "src/main/resources/Tachidesk.jar"; then
echo "Tachidesk.jar already exists"
else
scripts/SetupUnix.sh
fi
echo "Building Deb package"
./gradlew packageDeb

View File

@@ -1,14 +0,0 @@
#!/bin/bash
if [ "$(basename "$(pwd)")" = "scripts" ]; then
cd ..
fi
if test -f "src/main/resources/Tachidesk.jar"; then
echo "Tachidesk.jar already exists"
else
scripts/SetupUnix.sh
fi
echo "Building Rpm package"
./gradlew packageRpm

View File

@@ -1,13 +0,0 @@
#!/bin/bash
if [ "$(basename "$(pwd)")" = "scripts" ]; then
cd ..
fi
if test -f "src/main/resources/Tachidesk.jar"; then
echo "Tachidesk.jar exists, removing as MacOS installers cannot run it"
rm "src/main/resources/Tachidesk.jar"
fi
echo "Building Dmg package"
./gradlew packageDmg "$@"

View File

@@ -1,14 +0,0 @@
#!/bin/bash
if [ "$(basename "$(pwd)")" = "scripts" ]; then
cd ..
fi
if test -f "src/main/resources/Tachidesk.jar"; then
echo "Tachidesk.jar already exists"
else
scripts/SetupUnix.sh
fi
echo "Building Jar package"
./gradlew packageUberJarForCurrentOS

View File

@@ -1,15 +0,0 @@
if ($(Split-Path -Path (Get-Location) -Leaf) -eq "scripts" ) {
Set-Location ..
}
if (Test-Path "src/main/resources/Tachidesk.jar" -PathType leaf)
{
Write-Output "Tachidesk.jar already exists"
}
else
{
&"./scripts/SetupWindows.ps1"
}
Write-Output "Building Exe package"
&"./gradlew" packageExe

View File

@@ -1,15 +0,0 @@
if ($(Split-Path -Path (Get-Location) -Leaf) -eq "scripts" ) {
Set-Location ..
}
if (Test-Path "src/main/resources/Tachidesk.jar" -PathType leaf)
{
Write-Output "Tachidesk.jar already exists"
}
else
{
&"./scripts/SetupWindows.ps1"
}
Write-Output "Building Jar package"
&"./gradlew" packageUberJarForCurrentOS

View File

@@ -1,15 +0,0 @@
if ($(Split-Path -Path (Get-Location) -Leaf) -eq "scripts" ) {
Set-Location ..
}
if (Test-Path "src/main/resources/Tachidesk.jar" -PathType leaf)
{
Write-Output "Tachidesk.jar already exists"
}
else
{
&"./scripts/SetupWindows.ps1"
}
Write-Output "Building Msi package"
&"./gradlew" packageMsi

View File

@@ -1,41 +0,0 @@
#!/bin/bash
if [ "$(basename "$(pwd)")" = "scripts" ]; then
cd ..
fi
mkdir -p "tmp"
echo "Getting latest Tachidesk build files"
#TARBALL_LINK="$(curl -s "https://api.github.com/repos/Suwayomi/Tachidesk/releases/latest" | grep -o "https.*tarball\/[a-zA-Z0-9.]*")"
#curl -L "$TARBALL_LINK" -o tmp/Tachidesk.tar
curl -L "https://github.com/Suwayomi/Tachidesk/archive/refs/tags/v0.4.3.tar.gz" -o tmp/Tachidesk.tar.gz
tar -xvf tmp/Tachidesk.tar.gz -C tmp
TACHIDESK_FOLDER=$(find tmp -type d -regex ".*Tachidesk-[a-z0-9\.]*")
pushd "$TACHIDESK_FOLDER" || exit
echo "Setting up android.jar"
AndroidCompat/getAndroid.sh
echo "Writing ci gradle.properties"
[ ! -d "/path/to/dir" ] && mkdir ".gradle"
cp ".github/runner-files/ci-gradle.properties" ".gradle/gradle.properties"
echo "Building Tachidesk.jar"
./gradlew :server:shadowJar -x :webUI:copyBuild
TACHIDESK_JAR=$(find server/build -type f -regex ".*\.jar")
popd || exit
echo "Copying Tachidesk.jar to resources folder..."
mv "$TACHIDESK_FOLDER/$TACHIDESK_JAR" src/main/resources/Tachidesk.jar
echo "Cleaning up..."
rm -rf "tmp"
echo "Done!"

View File

@@ -1,43 +0,0 @@
if ($(Split-Path -Path (Get-Location) -Leaf) -eq "scripts" ) {
Set-Location ..
}
Remove-Item -Recurse -Force "tmp" -ErrorAction SilentlyContinue | Out-Null
New-Item -ItemType Directory -Force -Path "tmp"
Write-Output "Getting latest Tachidesk build files"
#$zipball = (Invoke-WebRequest -Uri "https://api.github.com/repos/Suwayomi/Tachidesk/releases/latest" -UseBasicParsing).content | Select-String -Pattern 'https[\.:\/A-Za-z0-9]*zipball\/[a-zA-Z0-9.]*' -CaseSensitive
#Invoke-WebRequest -Uri $zipball.Matches.Value -OutFile tmp/Tachidesk.zip -UseBasicParsing
Invoke-WebRequest -Uri "https://github.com/Suwayomi/Tachidesk/archive/refs/tags/v0.4.3.zip" -OutFile tmp/Tachidesk.zip -UseBasicParsing
Expand-Archive -Path "tmp/Tachidesk.zip" -DestinationPath "tmp"
$tachidesk_folder = Get-ChildItem -Path "tmp" | Where-Object {$_.Name -match ".*Tachidesk-[a-z0-9\.]*"} | Select-Object FullName
Push-Location $tachidesk_folder.FullName
Write-Output "Setting up android.jar"
&"./AndroidCompat/getAndroid.ps1"
Write-Output "Writing ci gradle.properties"
if (!(Test-Path -Path ".gradle")) {
New-Item -ItemType Directory -Force -Path ".gradle" -ErrorAction SilentlyContinue
}
Copy-Item ".github/runner-files/ci-gradle.properties" ".gradle/gradle.properties" -Force
Write-Output "Building Tachidesk.jar"
&"./gradlew" :server:shadowJar -x :webUI:copyBuild
$tachidesk_jar = $(Get-ChildItem "server/build" | Where-Object { $_.Name -match '.*\.jar' })[0].FullName
Pop-Location
Write-Output "Copying Tachidesk.jar to resources folder..."
Move-Item -Force $tachidesk_jar "src/main/resources/Tachidesk.jar" -ErrorAction SilentlyContinue
Write-Output "Cleaning up..."
Remove-Item -Recurse -Force "tmp" -ErrorAction SilentlyContinue | Out-Null
Write-Output "Done!"