mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
Better build script
This commit is contained in:
+34
-39
@@ -4,9 +4,9 @@
|
|||||||
# Clone the repo first from github:
|
# Clone the repo first from github:
|
||||||
# git clone https://github.com/sn4k3/UVtools
|
# git clone https://github.com/sn4k3/UVtools
|
||||||
# Then run this script
|
# Then run this script
|
||||||
# usage 1: ./CreateRelease.sh clean
|
# usage 1: ./createRelease.sh clean
|
||||||
# usage 2: ./CreateRelease.sh -b osx-x64
|
# usage 2: ./createRelease.sh -b osx-x64
|
||||||
# usage 3: ./CreateRelease.sh -b -z osx-x64
|
# usage 3: ./createRelease.sh -b -z osx-x64
|
||||||
#
|
#
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
cd ..
|
cd ..
|
||||||
@@ -15,18 +15,21 @@ cd ..
|
|||||||
#runtime=$1
|
#runtime=$1
|
||||||
for runtime in $@; do :; done # Get last argument
|
for runtime in $@; do :; done # Get last argument
|
||||||
rootDir="$(pwd)"
|
rootDir="$(pwd)"
|
||||||
coreDir="$(pwd)/UVtools.Core"
|
toolsDir="$rootDir/build/tools"
|
||||||
|
coreDir="$rootDir/UVtools.Core"
|
||||||
version="$(grep -oP '<Version>\K(\d\.\d\.\d)(?=<\/Version>)' $coreDir/UVtools.Core.csproj)"
|
version="$(grep -oP '<Version>\K(\d\.\d\.\d)(?=<\/Version>)' $coreDir/UVtools.Core.csproj)"
|
||||||
platformsDir="$(pwd)/UVtools.Platforms"
|
platformsDir="$rootDir/UVtools.Platforms"
|
||||||
runtimePlatformDir="$platformsDir/$runtime"
|
runtimePlatformDir="$platformsDir/$runtime"
|
||||||
publishName="UVtools_${runtime}_v$version"
|
publishName="UVtools_${runtime}_v$version"
|
||||||
publishDir="$(pwd)/publish"
|
publishDir="$rootDir/publish"
|
||||||
publishRuntimeDir="$publishDir/$publishName"
|
publishRuntimeDir="$publishDir/$publishName"
|
||||||
buildProject="UVtools.WPF"
|
buildProject="UVtools.WPF"
|
||||||
buildWith="Release"
|
buildWith="Release"
|
||||||
projectDir="$(pwd)/$buildProject"
|
projectDir="$rootDir/$buildProject"
|
||||||
netVersion="6.0"
|
netVersion="6.0"
|
||||||
|
|
||||||
|
toolAppImage="$toolsDir/appimagetool-x86_64/AppRun"
|
||||||
|
|
||||||
if [[ $runtime = "clean" ]]; then
|
if [[ $runtime = "clean" ]]; then
|
||||||
echo "Cleaning publish directory"
|
echo "Cleaning publish directory"
|
||||||
rm -rf "$publishDir" 2>/dev/null
|
rm -rf "$publishDir" 2>/dev/null
|
||||||
@@ -50,7 +53,6 @@ while getopts 'bzk' flag; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Checks
|
# Checks
|
||||||
if ! command -v dotnet &> /dev/null
|
if ! command -v dotnet &> /dev/null
|
||||||
then
|
then
|
||||||
@@ -137,45 +139,38 @@ elif [[ $runtime = win-* ]]; then
|
|||||||
else
|
else
|
||||||
if [[ $bundlePublish = true ]]; then
|
if [[ $bundlePublish = true ]]; then
|
||||||
echo "6. Linux: Creating AppImage bundle"
|
echo "6. Linux: Creating AppImage bundle"
|
||||||
linuxApp="$publishDir/$publishName.AppDir"
|
linuxAppDir="$publishDir/$publishName.AppDir"
|
||||||
linuxAppImage="$publishDir/$publishName.AppImage"
|
linuxAppImage="$publishDir/$publishName.AppImage"
|
||||||
rm -f "$linuxAppImage" 2>/dev/null
|
rm -f "$linuxAppImage" 2>/dev/null
|
||||||
rm -rf "$linuxApp" 2>/dev/null
|
rm -rf "$linuxAppDir" 2>/dev/null
|
||||||
|
|
||||||
cp -rf "$platformsDir/AppImage/." "$linuxApp"
|
cp -rf "$platformsDir/AppImage/." "$linuxAppDir"
|
||||||
cp -f "$rootDir/UVtools.CAD/UVtools.png" "$linuxApp/"
|
cp -f "$rootDir/UVtools.CAD/UVtools.png" "$linuxAppDir/"
|
||||||
mkdir -p "$linuxApp/usr/bin"
|
mkdir -p "$linuxAppDir/usr/bin"
|
||||||
cp -a "$publishRuntimeDir/." "$linuxApp/usr/bin"
|
cp -a "$publishRuntimeDir/." "$linuxAppDir/usr/bin"
|
||||||
|
|
||||||
# Download the AppImage creation tool and make it executable
|
|
||||||
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
|
|
||||||
chmod a+x "appimagetool-x86_64.AppImage"
|
|
||||||
# Extract AppImage so it can be run in Docker containers and on machines that don't have FUSE installed
|
|
||||||
# Note: Extracting requires libglib2.0-0 to be installed
|
|
||||||
./appimagetool-x86_64.AppImage --appimage-extract
|
|
||||||
|
|
||||||
# Create the AppImage
|
# Create the AppImage
|
||||||
ARCH=x86_64 ./squashfs-root/AppRun "$linuxApp" "$linuxAppImage"
|
chmod a+x "$toolAppImage"
|
||||||
|
ARCH=x86_64 "$toolAppImage" "$linuxAppDir" "$linuxAppImage"
|
||||||
chmod a+x "$linuxAppImage"
|
chmod a+x "$linuxAppImage"
|
||||||
|
|
||||||
# Remove the tool
|
|
||||||
rm -f "appimagetool-x86_64.AppImage"
|
|
||||||
rm -rf "./squashfs-root"
|
|
||||||
|
|
||||||
# Remove the base publish if able
|
# Remove the base publish if able
|
||||||
[ "$keepNetPublish" = false ] && rm -rf "$publishRuntimeDir" 2>/dev/null
|
#[ "$keepNetPublish" = false ] && rm -rf "$publishRuntimeDir" 2>/dev/null
|
||||||
|
#
|
||||||
# Packing AppImage
|
# Packing AppImage
|
||||||
if [ "$zipPackage" = true -a -f "$linuxAppImage" ] ; then
|
#if [ "$zipPackage" = true -a -f "$linuxAppImage" ] ; then
|
||||||
echo "7. Compressing '$publishName.AppImage' to '$publishName.zip'"
|
# echo "7. Compressing '$publishName.AppImage' to '$publishName.zip'"
|
||||||
cd "$publishDir"
|
# cd "$publishDir"
|
||||||
zip "$publishDir/$publishName.zip" "$publishName.AppImage"
|
# zip "$publishDir/$publishName.zip" "$publishName.AppImage"
|
||||||
printf "@ $publishName.AppImage\n@=UVtools.AppImage\n" | zipnote -w "$publishDir/$publishName.zip"
|
# printf "@ $publishName.AppImage\n@=UVtools.AppImage\n" | zipnote -w "$publishDir/$publishName.zip"
|
||||||
cd "$rootDir"
|
# cd "$rootDir"
|
||||||
zipPackage=false
|
# zipPackage=false
|
||||||
else
|
#else
|
||||||
echo "7. Skipping Zip"
|
# echo "7. Skipping Zip"
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
|
# Remove the tool & cleanup
|
||||||
|
rm -rf "$linuxAppDir" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
@echo off
|
||||||
|
REM
|
||||||
|
REM This script just builds and runs UVtools on your current system with default configuration
|
||||||
|
REM If you want to see the compilation output, go to: UVtools.WPF/bin/
|
||||||
|
REM
|
||||||
|
SET DIR=%~dp0
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
REM if exist "%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" SET MSBUILD_PATH="%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
|
||||||
|
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" SET MSBUILD_PATH="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
|
||||||
|
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" SET MSBUILD_PATH="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
|
||||||
|
if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" SET MSBUILD_PATH="%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
|
||||||
|
|
||||||
|
IF [%MSBUILD_PATH%] == [] GOTO noMSBuild
|
||||||
|
|
||||||
|
echo UVtools.sln Compile
|
||||||
|
echo %MSBUILD_PATH%
|
||||||
|
%MSBUILD_PATH% -p:Configuration=Release UVtools.sln
|
||||||
|
GOTO end
|
||||||
|
|
||||||
|
|
||||||
|
:noMSBuild
|
||||||
|
echo MSBuild.exe path not found! trying 'dotnet' instead
|
||||||
|
dotnet build
|
||||||
|
|
||||||
|
:end
|
||||||
|
pause
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script just builds UVtools on your current system with default configuration
|
||||||
|
# If you want to see the compilation output, go to: UVtools.WPF/bin/
|
||||||
|
#
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
cd ..
|
||||||
|
dotnet build
|
||||||
@@ -0,0 +1,473 @@
|
|||||||
|
# When using System.IO.Compression.ZipFile.CreateFromDirectory in PowerShell, it still uses backslashes in the zip paths
|
||||||
|
# despite this https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/mitigation-ziparchiveentry-fullname-path-separator
|
||||||
|
|
||||||
|
# Based upon post by Seth Jackson https://sethjackson.github.io/2016/12/17/path-separators/
|
||||||
|
|
||||||
|
#
|
||||||
|
# PowerShell 5 (WMF5) & 6
|
||||||
|
# Using class Keyword https://msdn.microsoft.com/powershell/reference/5.1/Microsoft.PowerShell.Core/about/about_Classes
|
||||||
|
#
|
||||||
|
# https://gist.github.com/lantrix/738ebfa616d5222a8b1db947793bc3fc
|
||||||
|
#
|
||||||
|
|
||||||
|
####################################
|
||||||
|
### Fix Zip slash ###
|
||||||
|
####################################
|
||||||
|
Add-Type -AssemblyName System.Text.Encoding
|
||||||
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
|
||||||
|
class FixedEncoder : System.Text.UTF8Encoding {
|
||||||
|
FixedEncoder() : base($true) { }
|
||||||
|
|
||||||
|
[byte[]] GetBytes([string] $s)
|
||||||
|
{
|
||||||
|
$s = $s.Replace("\", "/");
|
||||||
|
return ([System.Text.UTF8Encoding]$this).GetBytes($s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function wixCleanUpElement([System.Xml.XmlElement]$element, [string]$rootPath)
|
||||||
|
{
|
||||||
|
$files = Get-ChildItem -Path $rootPath -File -Force -ErrorAction SilentlyContinue
|
||||||
|
$folders = Get-ChildItem -Path $rootPath -Directory -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
# Removing not existant files
|
||||||
|
foreach($e in $element.Component)
|
||||||
|
{
|
||||||
|
$found = $false
|
||||||
|
foreach($file in $files)
|
||||||
|
{
|
||||||
|
if($e.File.Source.EndsWith("\$($file.Name)")){
|
||||||
|
$found = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found -eq $false){
|
||||||
|
# File not found on this directory, remove element
|
||||||
|
Write-Host("WIX: File '$($e.File.Source)' does not exist anymore, removing...")
|
||||||
|
$e.ParentNode.RemoveChild($e) | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Adding not existant files
|
||||||
|
foreach($file in $files)
|
||||||
|
{
|
||||||
|
$found = $false
|
||||||
|
foreach($e in $element.Component)
|
||||||
|
{
|
||||||
|
if($null -ne $e.File.Source -and $e.File.Source.EndsWith("\$($file.Name)")){
|
||||||
|
$found = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found -eq $false){
|
||||||
|
# File not found on manifest, add element
|
||||||
|
$guid = [guid]::NewGuid().ToString().ToUpper()
|
||||||
|
$guidNoSeparator = $guid.Replace('-', '')
|
||||||
|
$filePath = $file.FullName.Substring($msiSourceFiles.Length)
|
||||||
|
while ($filePath.StartsWith('\'))
|
||||||
|
{
|
||||||
|
$filePath = $filePath.Remove(0, 1)
|
||||||
|
}
|
||||||
|
Write-Host("WIX: File '$filePath' does not exist on manifest, adding with GUID: $guid")
|
||||||
|
$xmlComponent = $element.OwnerDocument.CreateElement("Component", $element.OwnerDocument.DocumentElement.NamespaceURI)
|
||||||
|
$xmlComponent.SetAttribute("Id", "owc$guidNoSeparator")
|
||||||
|
$xmlComponent.SetAttribute("Guid", $guid)
|
||||||
|
|
||||||
|
$xmlFile = $element.OwnerDocument.CreateElement("File", $element.OwnerDocument.DocumentElement.NamespaceURI)
|
||||||
|
$xmlFile.SetAttribute("Id", "owf$guidNoSeparator")
|
||||||
|
$xmlFile.SetAttribute("Source", "`$(var.SourceDir)\$filePath")
|
||||||
|
$xmlFile.SetAttribute("KeyPath", 'yes')
|
||||||
|
|
||||||
|
$xmlComponent.AppendChild($xmlFile) | Out-Null
|
||||||
|
$element.AppendChild($xmlComponent) | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Removing not existant folters
|
||||||
|
foreach($e in $element.Directory)
|
||||||
|
{
|
||||||
|
$found = $false
|
||||||
|
foreach($folder in $folders)
|
||||||
|
{
|
||||||
|
if($e.Name -eq $folder.Name){
|
||||||
|
$found = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($found -eq $false){
|
||||||
|
# Directory not found on this directory, remove element
|
||||||
|
Write-Host("WIX: Directory '$($e.Name)' does not exist anymore, removing...")
|
||||||
|
$e.ParentNode.RemoveChild($e) | Out-Null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Adding not existant directories
|
||||||
|
foreach($folder in $folders)
|
||||||
|
{
|
||||||
|
$foundDirectoryElement = $null
|
||||||
|
foreach($e in $element.Directory)
|
||||||
|
{
|
||||||
|
#Write-Host("$($e.Name) == $($folder.Name)")
|
||||||
|
if($null -ne $e.Name -and $e.Name -eq $folder.Name){
|
||||||
|
$foundDirectoryElement = $e
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($null -eq $foundDirectoryElement){
|
||||||
|
# Folder not found on manifest, add element
|
||||||
|
$guid = [guid]::NewGuid().ToString().ToUpper()
|
||||||
|
$guidNoSeparator = $guid.Replace('-', '')
|
||||||
|
|
||||||
|
$directoryRelativePath = $folder.FullName.Substring($msiSourceFiles.Length)
|
||||||
|
while ($directoryRelativePath.StartsWith('\'))
|
||||||
|
{
|
||||||
|
$directoryRelativePath = $directoryRelativePath.Remove(0, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host("WIX: Directory '$directoryRelativePath' does not exist on manifest, adding with GUID: $guid")
|
||||||
|
$xmlDirectory = $element.OwnerDocument.CreateElement("Directory", $element.OwnerDocument.DocumentElement.NamespaceURI)
|
||||||
|
$xmlDirectory.SetAttribute("Id", "owd$guidNoSeparator")
|
||||||
|
$xmlDirectory.SetAttribute("Name", $folder.Name)
|
||||||
|
$element.AppendChild($xmlDirectory) | Out-Null
|
||||||
|
|
||||||
|
wixCleanUpElement $xmlDirectory $folder.FullName
|
||||||
|
}else{
|
||||||
|
# Folder found on manifest, recursive from this folder
|
||||||
|
wixCleanUpElement $foundDirectoryElement $folder.FullName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<#
|
||||||
|
$msiComponentsXml = [Xml] (Get-Content $msiComponentsFile)
|
||||||
|
foreach($element in $msiComponentsXml.Wix.Module.Directory.Directory)
|
||||||
|
{
|
||||||
|
if($element.Id -eq 'MergeRedirectFolder')
|
||||||
|
{
|
||||||
|
wixCleanUpElement $element $msiSourceFiles
|
||||||
|
#WriteXmlToScreen($msiComponentsXml);
|
||||||
|
#$msiComponentsXml.Save("$rootFolder\$publishFolder\test.xml")
|
||||||
|
return
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#>
|
||||||
|
|
||||||
|
function WriteXmlToScreen([xml]$xml)
|
||||||
|
{
|
||||||
|
$StringWriter = New-Object System.IO.StringWriter;
|
||||||
|
$XmlWriter = New-Object System.Xml.XmlTextWriter $StringWriter;
|
||||||
|
$XmlWriter.Formatting = "indented";
|
||||||
|
$xml.WriteTo($XmlWriter);
|
||||||
|
$XmlWriter.Flush();
|
||||||
|
$StringWriter.Flush();
|
||||||
|
Write-Output $StringWriter.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
# Script working directory
|
||||||
|
Set-Location $PSScriptRoot\..
|
||||||
|
|
||||||
|
####################################
|
||||||
|
### Configuration ###
|
||||||
|
####################################
|
||||||
|
$enableMSI = $true
|
||||||
|
#$buildOnly = 'win-x64'
|
||||||
|
#$buildOnly = 'linux-x64'
|
||||||
|
#$buildOnly = 'osx-x64'
|
||||||
|
#$buildOnly = 'osx-arm64'
|
||||||
|
$zipPackages = $true
|
||||||
|
$enableNugetPublish = $true
|
||||||
|
|
||||||
|
# Profilling
|
||||||
|
$stopWatch = New-Object -TypeName System.Diagnostics.Stopwatch
|
||||||
|
$deployStopWatch = New-Object -TypeName System.Diagnostics.Stopwatch
|
||||||
|
$stopWatch.Start()
|
||||||
|
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
$software = "UVtools"
|
||||||
|
$project = "UVtools.WPF"
|
||||||
|
$buildWith = "Release"
|
||||||
|
$netFolder = "net6.0"
|
||||||
|
$rootFolder = $(Get-Location)
|
||||||
|
$releaseFolder = "$project\bin\$buildWith\$netFolder"
|
||||||
|
$objFolder = "$project\obj\$buildWith\$netFolder"
|
||||||
|
$publishFolder = "publish"
|
||||||
|
$platformsFolder = "UVtools.Platforms"
|
||||||
|
|
||||||
|
# Not supported yet! No fuse on WSL
|
||||||
|
$appImageFile = 'appimagetool-x86_64.AppImage'
|
||||||
|
$appImageFilePath = "$platformsFolder/AppImage/$appImageFile"
|
||||||
|
$appImageUrl = "https://github.com/AppImage/AppImageKit/releases/download/continuous/$appImageFile"
|
||||||
|
|
||||||
|
$macIcns = "UVtools.CAD/UVtools.icns"
|
||||||
|
|
||||||
|
#$version = (Get-Command "$releaseFolder\UVtools.dll").FileVersionInfo.ProductVersion
|
||||||
|
$projectXml = [Xml] (Get-Content "$project\$project.csproj")
|
||||||
|
$version = "$($projectXml.Project.PropertyGroup.Version)".Trim();
|
||||||
|
if([string]::IsNullOrWhiteSpace($version)){
|
||||||
|
Write-Error "Can not detect the UVtools version, does $project\$project.csproj exists?"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# MSI Variables
|
||||||
|
$installers = @("UVtools.InstallerMM", "UVtools.Installer")
|
||||||
|
$msiOutputFile = "$rootFolder\UVtools.Installer\bin\x64\Release\UVtools.msi"
|
||||||
|
$msiComponentsFile = "$rootFolder\UVtools.InstallerMM\UVtools.InstallerMM.wxs"
|
||||||
|
$msiSourceFiles = "$rootFolder\$publishFolder\win-x64"
|
||||||
|
$msbuild = "`"${env:ProgramFiles}\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe`" /t:Build /p:Configuration=$buildWith /p:MSIProductVersion=$version"
|
||||||
|
|
||||||
|
Write-Output "
|
||||||
|
####################################
|
||||||
|
### UVtools builder & deployer ###
|
||||||
|
####################################
|
||||||
|
Version: $version [$buildWith]
|
||||||
|
"
|
||||||
|
|
||||||
|
####################################
|
||||||
|
### Clean up previous publish ###
|
||||||
|
####################################
|
||||||
|
# Clean up previous publish
|
||||||
|
Remove-Item $publishFolder -Recurse -ErrorAction Ignore # Clean
|
||||||
|
|
||||||
|
####################################
|
||||||
|
### Self-contained runtimes ###
|
||||||
|
####################################
|
||||||
|
$runtimes =
|
||||||
|
@{
|
||||||
|
"win-x64" = @{
|
||||||
|
"extraCmd" = ""
|
||||||
|
"exclude" = @("UVtools.sh")
|
||||||
|
"include" = @()
|
||||||
|
}
|
||||||
|
"linux-x64" = @{
|
||||||
|
"extraCmd" = ""
|
||||||
|
"exclude" = @()
|
||||||
|
"include" = @("libcvextern.so")
|
||||||
|
}
|
||||||
|
"arch-x64" = @{
|
||||||
|
"extraCmd" = ""
|
||||||
|
"exclude" = @()
|
||||||
|
"include" = @("libcvextern.so")
|
||||||
|
}
|
||||||
|
"rhel-x64" = @{
|
||||||
|
"extraCmd" = ""
|
||||||
|
"exclude" = @()
|
||||||
|
"include" = @("libcvextern.so")
|
||||||
|
}
|
||||||
|
#"linux-arm64" = @{
|
||||||
|
# "extraCmd" = ""
|
||||||
|
# "exclude" = @()
|
||||||
|
# "include" = @("libcvextern.so")
|
||||||
|
#}
|
||||||
|
#"unix-x64" = @{
|
||||||
|
# "extraCmd" = ""
|
||||||
|
# "exclude" = @("x86", "x64", "libcvextern.dylib")
|
||||||
|
#}
|
||||||
|
"osx-x64" = @{
|
||||||
|
"extraCmd" = ""
|
||||||
|
"exclude" = @()
|
||||||
|
"include" = @("libcvextern.dylib")
|
||||||
|
}
|
||||||
|
"osx-arm64" = @{
|
||||||
|
"extraCmd" = ""
|
||||||
|
"exclude" = @()
|
||||||
|
"include" = @("libcvextern.dylib")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# https://github.com/AppImage/AppImageKit/wiki/Bundling-.NET-Core-apps
|
||||||
|
#Invoke-WebRequest -Uri $appImageUrl -OutFile $appImageFilePath
|
||||||
|
#wsl chmod a+x $appImageFilePath
|
||||||
|
|
||||||
|
if($null -ne $enableNugetPublish -and $enableNugetPublish)
|
||||||
|
{
|
||||||
|
$nugetApiKeyFile = 'build/secret/nuget_api.key'
|
||||||
|
if (Test-Path -Path $nugetApiKeyFile -PathType Leaf)
|
||||||
|
{
|
||||||
|
Write-Output "Creating nuget package"
|
||||||
|
dotnet pack UVtools.Core --configuration 'Release'
|
||||||
|
|
||||||
|
$nupkg = "UVtools.Core/bin/Release/UVtools.Core.$version.nupkg"
|
||||||
|
|
||||||
|
if (Test-Path -Path $nupkg -PathType Leaf){
|
||||||
|
$nugetApiKeyFile = (Get-Content $nugetApiKeyFile)
|
||||||
|
dotnet nuget push $nupkg --api-key $nugetApiKeyFile --source https://api.nuget.org/v3/index.json
|
||||||
|
#Remove-Item $nupkg
|
||||||
|
}else {
|
||||||
|
Write-Error "Nuget package publish failed!"
|
||||||
|
Write-Error "File '$nupkg' was not found"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($obj in $runtimes.GetEnumerator()) {
|
||||||
|
if(![string]::IsNullOrWhiteSpace($buildOnly) -and !$buildOnly.Equals($obj.Name)) {continue}
|
||||||
|
# Configuration
|
||||||
|
$deployStopWatch.Restart()
|
||||||
|
$runtime = $obj.Name; # runtime name
|
||||||
|
$extraCmd = $obj.extraCmd; # extra cmd to run with dotnet
|
||||||
|
$targetZip = "$publishFolder/${software}_${runtime}_v$version.zip" # Target zip filename
|
||||||
|
|
||||||
|
# Deploy
|
||||||
|
Write-Output "################################
|
||||||
|
Building: $runtime"
|
||||||
|
dotnet publish $project -o "$publishFolder/$runtime" -c $buildWith -r $runtime -p:PublishReadyToRun=true --self-contained $extraCmd
|
||||||
|
|
||||||
|
New-Item "$publishFolder/$runtime/runtime_package.dat" -ItemType File -Value $runtime
|
||||||
|
if(!$runtime.Equals('win-x64'))
|
||||||
|
{
|
||||||
|
# Fix permissions
|
||||||
|
wsl chmod +x "$publishFolder/$runtime/UVtools" `|`| :
|
||||||
|
wsl chmod +x "$publishFolder/$runtime/UVtools.sh" `|`| :
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
Remove-Item "$releaseFolder\$runtime" -Recurse -ErrorAction Ignore
|
||||||
|
Remove-Item "$objFolder\$runtime" -Recurse -ErrorAction Ignore
|
||||||
|
Write-Output "$releaseFolder\$runtime"
|
||||||
|
|
||||||
|
foreach ($excludeObj in $obj.Value.exclude) {
|
||||||
|
Write-Output "Excluding: $excludeObj"
|
||||||
|
Remove-Item "$publishFolder\$runtime\$excludeObj" -Recurse -ErrorAction Ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($includeObj in $obj.Value.include) {
|
||||||
|
Write-Output "Including: $includeObj"
|
||||||
|
Copy-Item "$platformsFolder\$runtime\$includeObj" -Destination "$publishFolder\$runtime" -Recurse -ErrorAction Ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
#if($runtime.Equals('linux-x64')){
|
||||||
|
# $appDirDest = "$publishFolder/AppImage.$runtime/AppDir"
|
||||||
|
# Copy-Item "$platformsFolder/AppImage/AppDir" $appDirDest -Force -Recurse
|
||||||
|
# wsl chmod 755 "$appDirDest/AppRun"
|
||||||
|
# wsl cp -a "$publishFolder/$runtime/." "$appDirDest/usr/bin"
|
||||||
|
# wsl $appImageFilePath $appDirDest
|
||||||
|
#}
|
||||||
|
if($runtime.StartsWith('osx-')){
|
||||||
|
$macAppFolder = "${software}.app"
|
||||||
|
$macPublishFolder = "$publishFolder/${macAppFolder}"
|
||||||
|
$macInfoplist = "$platformsFolder/osx/Info.plist"
|
||||||
|
$macEntitlements = "$platformsFolder/osx/UVtools.entitlements"
|
||||||
|
$macContents = "$macPublishFolder/Contents"
|
||||||
|
$macTargetZipLegacy = "$publishFolder/${software}_${runtime}-legacy_v$version.zip"
|
||||||
|
|
||||||
|
New-Item -ItemType directory -Path $macPublishFolder
|
||||||
|
New-Item -ItemType directory -Path "$macPublishFolder/Contents"
|
||||||
|
New-Item -ItemType directory -Path "$macPublishFolder/Contents/MacOS"
|
||||||
|
New-Item -ItemType directory -Path "$macPublishFolder/Contents/Resources"
|
||||||
|
|
||||||
|
|
||||||
|
Copy-Item $macIcns -Destination "$macPublishFolder/Contents/Resources"
|
||||||
|
((Get-Content -Path $macInfoplist) -replace '#VERSION',"$version") | Set-Content -Path "$macContents/Info.plist"
|
||||||
|
Copy-Item $macEntitlements -Destination $macContents
|
||||||
|
wsl cp -a "$publishFolder/$runtime/." "$macPublishFolder/Contents/MacOS"
|
||||||
|
wsl chmod +x "$macPublishFolder/Contents/MacOS/UVtools"
|
||||||
|
|
||||||
|
if($null -ne $zipPackages -and $zipPackages)
|
||||||
|
{
|
||||||
|
wsl cd "$publishFolder/" `&`& pwd `&`& zip -r "../$targetZip" "$macAppFolder/*"
|
||||||
|
#wsl cd "$publishFolder/$runtime" `&`& pwd `&`& zip -r "../../$macTargetZipLegacy" .
|
||||||
|
}
|
||||||
|
|
||||||
|
Rename-Item -Path $macPublishFolder -NewName "${macAppFolder}_${runtime}"
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if($null -ne $zipPackages -and $zipPackages)
|
||||||
|
{
|
||||||
|
Write-Output "Compressing $runtime to: $targetZip"
|
||||||
|
Write-Output $targetZip "$publishFolder/$runtime"
|
||||||
|
wsl cd "$publishFolder/$runtime" `&`& pwd `&`& zip -r "../../$targetZip" .
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Zip
|
||||||
|
#Write-Output "Compressing $runtime to: $targetZip"
|
||||||
|
#Write-Output $targetZip "$publishFolder/$runtime"
|
||||||
|
#[System.IO.Compression.ZipFile]::CreateFromDirectory("$publishFolder\$runtime", $targetZip, [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new())
|
||||||
|
#wsl cd "$publishFolder/$runtime" `&`& pwd `&`& chmod +x -f "./$software" `|`| : `&`& zip -r "../../$targetZip" "."
|
||||||
|
$deployStopWatch.Stop()
|
||||||
|
Write-Output "Took: $($deployStopWatch.Elapsed)
|
||||||
|
################################
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Universal package
|
||||||
|
<#
|
||||||
|
$deployStopWatch.Restart()
|
||||||
|
$runtime = "universal-x86-x64"
|
||||||
|
$targetZip = "$publishFolder\${software}_${runtime}_v$version.zip"
|
||||||
|
|
||||||
|
Write-Output "################################
|
||||||
|
Building: $runtime"
|
||||||
|
dotnet build $project -c $buildWith
|
||||||
|
|
||||||
|
Write-Output "Compressing $runtime to: $targetZip"
|
||||||
|
[System.IO.Compression.ZipFile]::CreateFromDirectory($releaseFolder, $targetZip, [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new())
|
||||||
|
Write-Output "Took: $($deployStopWatch.Elapsed)
|
||||||
|
################################
|
||||||
|
"
|
||||||
|
$stopWatch.Stop()
|
||||||
|
#>
|
||||||
|
|
||||||
|
# MSI Installer for Windows
|
||||||
|
if($null -ne $enableMSI -and $enableMSI)
|
||||||
|
{
|
||||||
|
$deployStopWatch.Restart()
|
||||||
|
$runtime = 'win-x64'
|
||||||
|
if (Test-Path -Path $msiSourceFiles) {
|
||||||
|
$msiTargetFile = "$publishFolder\${software}_${runtime}_v$version.msi"
|
||||||
|
Write-Output "################################"
|
||||||
|
Write-Output "Clean and build MSI components manifest file"
|
||||||
|
$msiComponentsXml = [Xml] (Get-Content $msiComponentsFile)
|
||||||
|
foreach($element in $msiComponentsXml.Wix.Module.Directory.Directory)
|
||||||
|
{
|
||||||
|
if($element.Id -eq 'MergeRedirectFolder')
|
||||||
|
{
|
||||||
|
wixCleanUpElement $element $msiSourceFiles
|
||||||
|
$msiComponentsXml.Save($msiComponentsFile)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "Building: $runtime MSI Installer"
|
||||||
|
|
||||||
|
foreach($installer in $installers)
|
||||||
|
{
|
||||||
|
# Clean and build MSI
|
||||||
|
Remove-Item "$installer\obj" -Recurse -ErrorAction Ignore
|
||||||
|
Remove-Item "$installer\bin" -Recurse -ErrorAction Ignore
|
||||||
|
Invoke-Expression "& $msbuild $installer\$installer.wixproj"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "Copying $runtime MSI to: $msiTargetFile"
|
||||||
|
Copy-Item $msiOutputFile $msiTargetFile
|
||||||
|
|
||||||
|
Write-Output "Took: $($deployStopWatch.Elapsed)
|
||||||
|
################################
|
||||||
|
"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Error "MSI build is enabled but the runtime '$runtime' is not found."
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Write-Output "
|
||||||
|
####################################
|
||||||
|
### Completed ###
|
||||||
|
####################################
|
||||||
|
In: $($stopWatch.Elapsed)"
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Script to publish and pack UVtools to a platform
|
||||||
|
# Clone the repo first from github:
|
||||||
|
# git clone https://github.com/sn4k3/UVtools
|
||||||
|
# Then run this script
|
||||||
|
# usage 1: ./createRelease.sh clean
|
||||||
|
# usage 2: ./createRelease.sh -b osx-x64
|
||||||
|
# usage 3: ./createRelease.sh -b -z osx-x64
|
||||||
|
#
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
cd ..
|
||||||
|
[ ! -d "UVtools.Core" ] && echo "UVtools.Core not found!" && exit -1
|
||||||
|
|
||||||
|
#runtime=$1
|
||||||
|
for runtime in $@; do :; done # Get last argument
|
||||||
|
rootDir="$(pwd)"
|
||||||
|
toolsDir="$rootDir/build/tools"
|
||||||
|
coreDir="$rootDir/UVtools.Core"
|
||||||
|
version="$(grep -oP '<Version>\K(\d\.\d\.\d)(?=<\/Version>)' $coreDir/UVtools.Core.csproj)"
|
||||||
|
platformsDir="$rootDir/UVtools.Platforms"
|
||||||
|
runtimePlatformDir="$platformsDir/$runtime"
|
||||||
|
publishName="UVtools_${runtime}_v$version"
|
||||||
|
publishDir="$rootDir/publish"
|
||||||
|
publishRuntimeDir="$publishDir/$publishName"
|
||||||
|
buildProject="UVtools.WPF"
|
||||||
|
buildWith="Release"
|
||||||
|
projectDir="$rootDir/$buildProject"
|
||||||
|
netVersion="6.0"
|
||||||
|
|
||||||
|
toolAppImage="$toolsDir/appimagetool-x86_64/AppRun"
|
||||||
|
|
||||||
|
if [[ $runtime = "clean" ]]; then
|
||||||
|
echo "Cleaning publish directory"
|
||||||
|
rm -rf "$publishDir" 2>/dev/null
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
bundlePublish=false
|
||||||
|
keepNetPublish=false
|
||||||
|
zipPackage=false
|
||||||
|
while getopts 'bzk' flag; do
|
||||||
|
case "${flag}" in
|
||||||
|
b) bundlePublish=true ;;
|
||||||
|
k) keepNetPublish=true ;;
|
||||||
|
z) zipPackage=true ;;
|
||||||
|
*) echo "Usage:"
|
||||||
|
echo "clean Cleans the publish folder and it's contents"
|
||||||
|
echo "-b Bundle and wrap the appication into (.App for mac) or (.AppImage for linux)"
|
||||||
|
echo "-k Keeps the publish contents for the packed runtimes when bundling .App and .AppImage (-b)"
|
||||||
|
echo "-z Zip published package"
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Checks
|
||||||
|
if ! command -v dotnet &> /dev/null
|
||||||
|
then
|
||||||
|
echo "dotnet not installed, please install .NET SDK $netVersion.x, dotnet-sdk or dotnet-sdk-$netVersion"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "UVtools version not found, please check path and script"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$runtime" ]; then
|
||||||
|
echo "No runtime selected, please pick one of the following:"
|
||||||
|
ls "$platformsDir"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! $runtime = *-* && ! $runtime = *-arm && ! $runtime = *-x64 && ! $runtime = *-x86 ]]; then
|
||||||
|
echo "The runtime '$runtime' is not valid, please pick one of the following:"
|
||||||
|
ls "$platformsDir"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! $runtime = "win-x64" -a ! -d "$platformsDir/$runtime" ]; then
|
||||||
|
echo "The runtime '$runtime' is not valid, please pick one of the following:"
|
||||||
|
ls "$platformsDir"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "1. Preparing the environment"
|
||||||
|
rm -rf "$publishRuntimeDir" 2>/dev/null
|
||||||
|
[ "$zipPackage" = true ] && rm -f "$publishDir/$publishName.zip" 2>/dev/null
|
||||||
|
|
||||||
|
|
||||||
|
echo "2. Publishing UVtools v$version for: $runtime"
|
||||||
|
dotnet publish $buildProject -o "$publishRuntimeDir" -c $buildWith -r $runtime -p:PublishReadyToRun=true --self-contained
|
||||||
|
|
||||||
|
echo "3. Copying dependencies"
|
||||||
|
echo $runtime > "$publishRuntimeDir/runtime_package.dat"
|
||||||
|
find "$runtimePlatformDir" -type f | grep -i lib | xargs -i cp -fv {} "$publishRuntimeDir/"
|
||||||
|
|
||||||
|
echo "4. Cleaning up"
|
||||||
|
rm -rf "$projectDir/bin/$buildWith/net$netVersion/$runtime" 2>/dev/null
|
||||||
|
rm -rf "$projectDir/obj/$buildWith/net$netVersion/$runtime" 2>/dev/null
|
||||||
|
|
||||||
|
echo "5. Setting Permissions"
|
||||||
|
chmod -fv a+x "$publishRuntimeDir/UVtools"
|
||||||
|
chmod -fv a+x "$publishRuntimeDir/UVtools.sh"
|
||||||
|
|
||||||
|
if [[ $runtime = osx-* ]]; then
|
||||||
|
if [[ $bundlePublish = true ]]; then
|
||||||
|
echo "6. macOS: Creating app bundle"
|
||||||
|
osxApp="$publishDir/$publishName.app"
|
||||||
|
rm -rf "$osxApp" 2>/dev/null
|
||||||
|
mkdir -p "$osxApp/Contents/MacOS"
|
||||||
|
mkdir -p "$osxApp/Contents/Resources"
|
||||||
|
|
||||||
|
cp -f "$rootDir/UVtools.CAD/UVtools.icns" "$osxApp/Contents/Resources/"
|
||||||
|
cp -f "$platformsDir/osx/Info.plist" "$osxApp/Contents/"
|
||||||
|
cp -f "$platformsDir/osx/UVtools.entitlements" "$osxApp/Contents/"
|
||||||
|
cp -a "$publishRuntimeDir/." "$osxApp/Contents/MacOS"
|
||||||
|
sed -i "s/#VERSION/$version/g" "$osxApp/Contents/Info.plist"
|
||||||
|
|
||||||
|
# Remove the base publish if able
|
||||||
|
[ "$keepNetPublish" = false ] && rm -rf "$publishRuntimeDir" 2>/dev/null
|
||||||
|
|
||||||
|
# Packing AppImage
|
||||||
|
if [ "$zipPackage" = true -a -d "$osxApp" ] ; then
|
||||||
|
echo "7. Compressing '$publishName.app' to '$publishName.zip'"
|
||||||
|
cd "$publishDir"
|
||||||
|
mv "$publishName.app" "UVtools.app"
|
||||||
|
zip -r "$publishDir/$publishName.zip" "UVtools.app"
|
||||||
|
mv "UVtools.app" "$publishName.app"
|
||||||
|
cd "$rootDir"
|
||||||
|
zipPackage=false
|
||||||
|
else
|
||||||
|
echo "7. Skipping Zip"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [[ $runtime = win-* ]]; then
|
||||||
|
echo "6. Windows should be published in a windows machine!"
|
||||||
|
else
|
||||||
|
if [[ $bundlePublish = true ]]; then
|
||||||
|
echo "6. Linux: Creating AppImage bundle"
|
||||||
|
linuxAppDir="$publishDir/$publishName.AppDir"
|
||||||
|
linuxAppImage="$publishDir/$publishName.AppImage"
|
||||||
|
rm -f "$linuxAppImage" 2>/dev/null
|
||||||
|
rm -rf "$linuxAppDir" 2>/dev/null
|
||||||
|
|
||||||
|
cp -rf "$platformsDir/AppImage/." "$linuxAppDir"
|
||||||
|
cp -f "$rootDir/UVtools.CAD/UVtools.png" "$linuxAppDir/"
|
||||||
|
mkdir -p "$linuxAppDir/usr/bin"
|
||||||
|
cp -a "$publishRuntimeDir/." "$linuxAppDir/usr/bin"
|
||||||
|
|
||||||
|
# Create the AppImage
|
||||||
|
chmod a+x "$toolAppImage"
|
||||||
|
ARCH=x86_64 "$toolAppImage" "$linuxAppDir" "$linuxAppImage"
|
||||||
|
chmod a+x "$linuxAppImage"
|
||||||
|
|
||||||
|
# Remove the base publish if able
|
||||||
|
#[ "$keepNetPublish" = false ] && rm -rf "$publishRuntimeDir" 2>/dev/null
|
||||||
|
#
|
||||||
|
# Packing AppImage
|
||||||
|
#if [ "$zipPackage" = true -a -f "$linuxAppImage" ] ; then
|
||||||
|
# echo "7. Compressing '$publishName.AppImage' to '$publishName.zip'"
|
||||||
|
# cd "$publishDir"
|
||||||
|
# zip "$publishDir/$publishName.zip" "$publishName.AppImage"
|
||||||
|
# printf "@ $publishName.AppImage\n@=UVtools.AppImage\n" | zipnote -w "$publishDir/$publishName.zip"
|
||||||
|
# cd "$rootDir"
|
||||||
|
# zipPackage=false
|
||||||
|
#else
|
||||||
|
# echo "7. Skipping Zip"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Remove the tool & cleanup
|
||||||
|
rm -rf "$linuxAppDir" 2>/dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Zip generic builds
|
||||||
|
if [ "$zipPackage" = true -a -d "$publishRuntimeDir" ] ; then
|
||||||
|
echo "7. Compressing '$runtime' to '$publishName.zip'"
|
||||||
|
cd "$publishRuntimeDir"
|
||||||
|
zip -r "$publishDir/$publishName.zip" .
|
||||||
|
cd "$rootDir"
|
||||||
|
else
|
||||||
|
echo "7. Skipping Zip"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#while true; do
|
||||||
|
# read -p "6. Would you like to Zip the package? [Y/N] " yn
|
||||||
|
# case $yn in
|
||||||
|
# [Yy]* )
|
||||||
|
# [Nn]* ) echo "Skipping Zip"; break;;
|
||||||
|
# * ) echo "Please answer yes or no.";;
|
||||||
|
# esac
|
||||||
|
#done
|
||||||
|
|
||||||
|
echo "8. Completed"
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
Set-Location $PSScriptRoot\..\..
|
||||||
|
####################################
|
||||||
|
### Configuration ###
|
||||||
|
####################################
|
||||||
|
# Variables
|
||||||
|
$package = "UVtools.AvaloniaControls"
|
||||||
|
$nugetApiKeyFile = 'build/secret/nuget_api.key'
|
||||||
|
$outputFolder = "$package/bin/Release"
|
||||||
|
|
||||||
|
$projectXml = [Xml] (Get-Content "$package\$package.csproj")
|
||||||
|
$version = "$($projectXml.Project.PropertyGroup.Version)".Trim();
|
||||||
|
if([string]::IsNullOrWhiteSpace($version)){
|
||||||
|
Write-Error "Can not detect the $package version, does $project\$project.csproj exists?"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path -Path $nugetApiKeyFile -PathType Leaf)
|
||||||
|
{
|
||||||
|
Write-Output "Creating nuget package for $package $version"
|
||||||
|
#Remove-Item "$outputFolder/*" -Recurse -Include *.nupkg
|
||||||
|
dotnet pack $package --configuration 'Release'
|
||||||
|
|
||||||
|
$nupkg = "$outputFolder/$package.$version.nupkg"
|
||||||
|
|
||||||
|
if (Test-Path -Path $nupkg -PathType Leaf){
|
||||||
|
$nugetApiKeyFile = (Get-Content $nugetApiKeyFile)
|
||||||
|
dotnet nuget push $nupkg --api-key $nugetApiKeyFile --source https://api.nuget.org/v3/index.json
|
||||||
|
#Remove-Item $nupkg
|
||||||
|
}else {
|
||||||
|
Write-Error "Nuget package publish failed!"
|
||||||
|
Write-Error "File '$nupkg' was not found"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Write-Error "The nuget API key was not found. This is private and can only use used by own developer"
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
# Script working directory
|
||||||
|
Set-Location $PSScriptRoot\..\..
|
||||||
|
|
||||||
|
####################################
|
||||||
|
### Configuration ###
|
||||||
|
####################################
|
||||||
|
# Variables
|
||||||
|
$projectAPIUrl = "https://api.github.com/repos/sn4k3/UVtools/releases/latest"
|
||||||
|
$outputFolder = "manifests"
|
||||||
|
$msiUrl = $null
|
||||||
|
|
||||||
|
Write-Output "
|
||||||
|
####################################
|
||||||
|
### UVtools Winget publish ###
|
||||||
|
####################################
|
||||||
|
"
|
||||||
|
|
||||||
|
$wingetTokenKeyFile = 'build/winget_token.key'
|
||||||
|
if (Test-Path -Path $wingetTokenKeyFile -PathType Leaf)
|
||||||
|
{
|
||||||
|
$wingetTokenKeyFile = (Get-Content $wingetTokenKeyFile)
|
||||||
|
}else{
|
||||||
|
Write-Error "Winget manifest publish failed!"
|
||||||
|
Write-Error "Invalid token!"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$headers = @{
|
||||||
|
Authorization = 'Basic {0}' -f $wingetTokenKeyFile
|
||||||
|
};
|
||||||
|
$lastRelease = Invoke-RestMethod -Headers $headers -Uri $projectAPIUrl
|
||||||
|
|
||||||
|
# Parse the version
|
||||||
|
$version = $lastRelease.tag_name.Replace('v', '')
|
||||||
|
if($version.Length -lt 5){
|
||||||
|
Write-Error "The version $version is too short to be correct, expecting at least 5 chars, please verify."
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse the MSI url
|
||||||
|
foreach ($asset in $lastRelease.assets)
|
||||||
|
{
|
||||||
|
if($asset.browser_download_url.EndsWith('.msi')) {
|
||||||
|
$msiUrl = $asset.browser_download_url
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if MSI url is valid
|
||||||
|
if ($null -eq $msiUrl){
|
||||||
|
Write-Error "MSI release URL not detected, exiting now."
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
Write-Host "
|
||||||
|
Version: $version
|
||||||
|
Url: $msiUrl
|
||||||
|
"
|
||||||
|
|
||||||
|
$actionInput = Read-Host -Prompt "Do you want to update the manifest with the current release v$($version)? (Y/Yes or N/No)"
|
||||||
|
if($actionInput -eq "y" || $actionInput -eq "yes")
|
||||||
|
{
|
||||||
|
Remove-Item $outputFolder -Recurse -ErrorAction Ignore # Clean
|
||||||
|
#wingetcreate.exe update PTRTECH.UVtools --interactive
|
||||||
|
wingetcreate.exe update PTRTECH.UVtools --urls "$msiUrl|x64" --version $version --token $wingetTokenKeyFile --submit
|
||||||
|
Remove-Item $outputFolder -Recurse -ErrorAction Ignore # Clean
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "
|
||||||
|
####################################
|
||||||
|
### Completed ###
|
||||||
|
####################################
|
||||||
|
"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
@echo off
|
||||||
|
REM
|
||||||
|
REM This script just builds and runs UVtools on your current system with default configuration
|
||||||
|
REM If you want to see the compilation output, go to: UVtools.WPF/bin/
|
||||||
|
REM
|
||||||
|
SET DIR=%~dp0
|
||||||
|
cd ../UVtools.WPF
|
||||||
|
|
||||||
|
echo Compiling and run UVtools.
|
||||||
|
echo This windows will close once you quit UVtools program.
|
||||||
|
dotnet run
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This script just builds and runs UVtools on your current system with default configuration
|
||||||
|
# If you want to see the compilation output, go to: UVtools.WPF/bin/
|
||||||
|
#
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
cd ../UVtools.WPF
|
||||||
|
dotnet run
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
SELF=$(readlink -f "$0")
|
||||||
|
HERE=${SELF%/*}
|
||||||
|
export PATH="${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"
|
||||||
|
export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||||
|
export PYTHONPATH="${HERE}/usr/share/pyshared/${PYTHONPATH:+:$PYTHONPATH}"
|
||||||
|
export XDG_DATA_DIRS="${HERE}/usr/share/${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
|
||||||
|
export PERLLIB="${HERE}/usr/share/perl5/:${HERE}/usr/lib/perl5/${PERLLIB:+:$PERLLIB}"
|
||||||
|
export GSETTINGS_SCHEMA_DIR="${HERE}/usr/share/glib-2.0/schemas/${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"
|
||||||
|
export QT_PLUGIN_PATH="${HERE}/usr/lib/qt4/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt4/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt4/plugins/:${HERE}/usr/lib32/qt4/plugins/:${HERE}/usr/lib64/qt4/plugins/:${HERE}/usr/lib/qt5/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt5/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt5/plugins/:${HERE}/usr/lib32/qt5/plugins/:${HERE}/usr/lib64/qt5/plugins/${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
|
||||||
|
EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
|
||||||
|
exec "${EXEC}" "$@"
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=appimagetool
|
||||||
|
Exec=appimagetool
|
||||||
|
Comment=Tool to generate AppImages from AppDirs
|
||||||
|
Icon=appimagetool
|
||||||
|
Categories=Development;
|
||||||
|
Terminal=true
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=appimagetool
|
||||||
|
Exec=appimagetool
|
||||||
|
Comment=Tool to generate AppImages from AppDirs
|
||||||
|
Icon=appimagetool
|
||||||
|
Categories=Development;
|
||||||
|
Terminal=true
|
||||||
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<component type="desktop">
|
||||||
|
<id>appimagetool.desktop</id>
|
||||||
|
<metadata_license>MIT</metadata_license>
|
||||||
|
<project_license>MIT</project_license>
|
||||||
|
<name>appimagetool</name>
|
||||||
|
<summary>Create AppImage files</summary>
|
||||||
|
<description>
|
||||||
|
<p>
|
||||||
|
appimagetool is a tool that lets you generate AppImage files. An AppImage
|
||||||
|
is a self-running bundle that contains an application and everything
|
||||||
|
it needs to run that cannot reasonably expected to be part of each target system.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This can include libraries that are not commonly available on target systems,
|
||||||
|
resources such as translations, icons, fonts, and other auxiliary files.
|
||||||
|
appimagetool makes it easy to take an AppDir (e.g., generated by linuxdeployqt)
|
||||||
|
and turn it into an AppImage.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
You can also embed update information so that your users can update the AppImage
|
||||||
|
using binary delta updates with the AppImageUpdate tool.
|
||||||
|
You can also sign the AppImage with GPG.
|
||||||
|
</p>
|
||||||
|
</description>
|
||||||
|
<url type="homepage">https://github.com/AppImage/AppImageKit</url>
|
||||||
|
<project_group>AppImage</project_group>
|
||||||
|
<provides>
|
||||||
|
<binary>appimagetool</binary>
|
||||||
|
</provides>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Script to update tools
|
||||||
|
#
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
toolAppImage="appimagetool-x86_64"
|
||||||
|
|
||||||
|
echo "1. Cleanup"
|
||||||
|
rm -rf "$toolAppImage" 2>/dev/null
|
||||||
|
|
||||||
|
echo "2. Get AppImage toolkit"
|
||||||
|
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/$toolAppImage.AppImage"
|
||||||
|
chmod a+x "$toolAppImage.AppImage"
|
||||||
|
|
||||||
|
"./$toolAppImage.AppImage" --appimage-extract
|
||||||
|
rm -f "$toolAppImage.AppImage"
|
||||||
|
mv -f "squashfs-root" "$toolAppImage"
|
||||||
|
|
||||||
|
echo "3. Complete"
|
||||||
Reference in New Issue
Block a user