Skip to content

Commit

Permalink
Add sample console app with cross-plat building (host sys = mac)
Browse files Browse the repository at this point in the history
  • Loading branch information
Deadpikle committed Sep 22, 2024
1 parent b1bc639 commit 8be7c9a
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/NetSparkle.Samples.SimpleConsoleApp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
appcast-output/*
41 changes: 41 additions & 0 deletions src/NetSparkle.Samples.SimpleConsoleApp/BuildAppCast.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

outputDir="appcast-output"
rm -rf "${outputDir}" # remove any old files
mkdir -p $outputDir
for config in "osx-arm64" "osx-x64" "win-arm64" "win-x64" "linux-x64"; do
if [[ "$config" == osx* ]]; then
ext=""
if [[ "$config" == "osx-arm64" ]]; then
os="macos-arm64"
version=2.0 # since app cast gen doesn't like items with same version right now
else
os="macos-x64"
version=2.1
fi
aot="true"
singlefile="false"
elif [[ "$config" == win* ]]; then
ext=".exe"
if [[ "$config" == "win-arm64" ]]; then
os="windows-arm64"
version=2.2
else
os="windows-x64"
version=2.3
fi
aot="false"
singlefile="true"
else
ext=""
version=2.4
os="linux-x64"
aot="false"
singlefile="true"
fi
filename="${outputDir}/${config}/SimpleNetSparkleConsoleApp${ext}"
filenameNxt="${outputDir}/${config}/SimpleNetSparkleConsoleApp_${os}${ext}"
dotnet publish -c Release --self-contained -r "${config}" -o "${outputDir}/${config}" "-p:PublishAot=${aot}" "-p:PublishSingleFile=${singlefile}"
mv "${filename}" "${filenameNxt}"
netsparkle-generate-appcast -n "Sparkle Console App" --os "${os}" --appcast-output-directory "${outputDir}" --single-file "${filenameNxt}" --reparse-existing --file-version "${version}" -u "https://netsparkleupdater.github.io/NetSparkle/files/console-sample-app"
mv "${filenameNxt}" "${outputDir}/SimpleNetSparkleConsoleApp_${os}${ext}"
done
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsTrimmable>true</IsTrimmable>
<PublishTrimmed>true</PublishTrimmed>
<!-- <PublishSingleFile>true</PublishSingleFile> -->
<TrimMode>full</TrimMode>
<IsAotCompatible>true</IsAotCompatible>
<Nullable>enable</Nullable>
<!-- <PublishAot>true</PublishAot> -->
<IlcOptimizationPreference>Size</IlcOptimizationPreference>
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
<IlcTrimMetadata>true</IlcTrimMetadata>
<IlcDisableReflection>true</IlcDisableReflection>
<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>

<Version>1.0</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<AssemblyTitle>My Simple Console App - NetSparkle</AssemblyTitle>
<AssemblyName>SimpleNetSparkleConsoleApp</AssemblyName>
<Copyright>NetSparkleUpdater</Copyright>
<Company>NetSparkleUpdater</Company>
<Product>NetSparkleUpdater</Product>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
</PropertyGroup>
</Project>
13 changes: 13 additions & 0 deletions src/NetSparkle.Samples.SimpleConsoleApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("~~~~~~~~~~~~~~~~~ NetSparkle ~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("Hello, World! This is the app downloaded by NetSparkle — usually the downloaded file would be your installer or DMG or other app you need for your updates~");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
Console.WriteLine("");
Console.WriteLine("");

0 comments on commit 8be7c9a

Please sign in to comment.