mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 14:30:31 +00:00
Re-enable trimming and single file publishing (#1542)
* Trimming tests * More tests * Final touches
This commit is contained in:
committed by
GitHub
parent
02c8cf294d
commit
2eb9067a91
11
.travis.yml
11
.travis.yml
@@ -31,16 +31,16 @@ script:
|
||||
npm ci --no-progress --prefix ASF-ui
|
||||
npm run-script deploy --no-progress --prefix ASF-ui
|
||||
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo
|
||||
dotnet build ArchiSteamFarm.CustomPlugins.ExamplePlugin -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo
|
||||
dotnet build ArchiSteamFarm.CustomPlugins.ExamplePlugin -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo
|
||||
|
||||
publish() {
|
||||
if [ "$1" = 'generic' ]; then
|
||||
# TODO: Workaround https://github.com/mono/linker/issues/286 (don't forget to remove it from docker files too)
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" --no-restore /nologo "/p:ASFVariant=$1" "/p:PublishTrimmed=false" "/p:UseAppHost=false"
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" --no-restore --nologo "/p:ASFVariant=$1" "/p:UseAppHost=false"
|
||||
else
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" -r "$1" --no-restore /nologo "/p:ASFVariant=$1" "/p:LinkDuringPublish=false"
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" -r "$1" --no-restore --nologo "/p:ASFVariant=$1" "/p:PublishTrimmed=true" "/p:PublishSingleFile=true"
|
||||
fi
|
||||
|
||||
# If we include any overlay for this variant, copy it to output directory
|
||||
@@ -49,6 +49,7 @@ script:
|
||||
fi
|
||||
}
|
||||
|
||||
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo
|
||||
dotnet restore ArchiSteamFarm
|
||||
|
||||
jobs=""
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
||||
<Copyright>Copyright © ArchiSteamFarm 2015-2019</Copyright>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);config/**;debug/**;out/**;overlay/**</DefaultItemExcludes>
|
||||
<Description>ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously.</Description>
|
||||
<Description>ASF is a C# application with primary purpose of idling Steam cards from multiple accounts simultaneously.</Description>
|
||||
<ErrorReport>none</ErrorReport>
|
||||
<FileVersion>4.1.0.9</FileVersion>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
@@ -19,7 +19,6 @@
|
||||
<PackageIcon>../resources/ASF.ico</PackageIcon>
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://github.com/JustArchiNET/ArchiSteamFarm</PackageProjectUrl>
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
<RepositoryType>Git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/JustArchiNET/ArchiSteamFarm.git</RepositoryUrl>
|
||||
<RuntimeIdentifiers>linux-arm;linux-x64;osx-x64;win-x64</RuntimeIdentifiers>
|
||||
@@ -110,12 +109,13 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="overlay\all\**\*.*">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
</Content>
|
||||
<Content Include="..\ASF-ui\dist\**\*.*" Exclude="**\README.md">
|
||||
<Link>www\%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Link>www\%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using ArchiSteamFarm.Plugins;
|
||||
@@ -61,7 +62,34 @@ namespace ArchiSteamFarm {
|
||||
internal const string UpdateDirectory = "_old";
|
||||
internal const string WebsiteDirectory = "www";
|
||||
|
||||
internal static string HomeDirectory => Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location ?? throw new ArgumentNullException(nameof(HomeDirectory)));
|
||||
internal static string HomeDirectory {
|
||||
get {
|
||||
// We're aiming to handle two possible cases here, classic publish and single-file publish
|
||||
// Firstly, we'll get the path to the binary that is running our code
|
||||
string binaryPath;
|
||||
|
||||
using (Process process = Process.GetCurrentProcess()) {
|
||||
binaryPath = process.MainModule?.FileName;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(binaryPath)) {
|
||||
throw new ArgumentNullException(nameof(binaryPath));
|
||||
}
|
||||
|
||||
// Now we need to check what that binary actually is
|
||||
return Path.GetFileNameWithoutExtension(binaryPath) switch {
|
||||
// This path goes to our own binary, so the user is using OS-specific build, single-file or not, we'll return path to location of that binary then
|
||||
AssemblyName => Path.GetDirectoryName(binaryPath),
|
||||
|
||||
// This path goes to third-party binary, so the user is using our generic build, we'll return our base directory then
|
||||
"dotnet" => AppContext.BaseDirectory,
|
||||
"mono" => AppContext.BaseDirectory,
|
||||
|
||||
// Unhandled case
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(binaryPath))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[NotNull]
|
||||
internal static string ProgramIdentifier => PublicIdentifier + " V" + Version + " (" + BuildInfo.Variant + "/" + ModuleVersion + " | " + OS.Variant + ")";
|
||||
|
||||
@@ -17,9 +17,10 @@ RUN dotnet --info && \
|
||||
# TODO: Remove workaround for https://github.com/microsoft/msbuild/issues/3897 when it's no longer needed
|
||||
if [ -f "ArchiSteamFarm/Localization/Strings.zh-CN.resx" ]; then ln -s "Strings.zh-CN.resx" "ArchiSteamFarm/Localization/Strings.zh-Hans.resx"; fi && \
|
||||
if [ -f "ArchiSteamFarm/Localization/Strings.zh-TW.resx" ]; then ln -s "Strings.zh-TW.resx" "ArchiSteamFarm/Localization/Strings.zh-Hant.resx"; fi && \
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo && \
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo && \
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o 'out' /nologo /p:ASFVariant=generic /p:PublishTrimmed=false /p:UseAppHost=false && \
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o 'out' --nologo /p:ASFVariant=generic /p:UseAppHost=false && \
|
||||
cp "ArchiSteamFarm/overlay/generic/ArchiSteamFarm-Service.sh" "out/ArchiSteamFarm-Service.sh"
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim-arm32v7 AS runtime
|
||||
|
||||
@@ -17,9 +17,10 @@ RUN dotnet --info && \
|
||||
# TODO: Remove workaround for https://github.com/microsoft/msbuild/issues/3897 when it's no longer needed
|
||||
if [ -f "ArchiSteamFarm/Localization/Strings.zh-CN.resx" ]; then ln -s "Strings.zh-CN.resx" "ArchiSteamFarm/Localization/Strings.zh-Hans.resx"; fi && \
|
||||
if [ -f "ArchiSteamFarm/Localization/Strings.zh-TW.resx" ]; then ln -s "Strings.zh-TW.resx" "ArchiSteamFarm/Localization/Strings.zh-Hant.resx"; fi && \
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo && \
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo && \
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o 'out' /nologo /p:ASFVariant=generic /p:PublishTrimmed=false /p:UseAppHost=false && \
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o 'out' --nologo /p:ASFVariant=generic /p:UseAppHost=false && \
|
||||
cp "ArchiSteamFarm/overlay/generic/ArchiSteamFarm-Service.sh" "out/ArchiSteamFarm-Service.sh"
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS runtime
|
||||
|
||||
@@ -17,9 +17,10 @@ RUN dotnet --info && \
|
||||
# TODO: Remove workaround for https://github.com/microsoft/msbuild/issues/3897 when it's no longer needed
|
||||
if [ -f "ArchiSteamFarm/Localization/Strings.zh-CN.resx" ]; then ln -s "Strings.zh-CN.resx" "ArchiSteamFarm/Localization/Strings.zh-Hans.resx"; fi && \
|
||||
if [ -f "ArchiSteamFarm/Localization/Strings.zh-TW.resx" ]; then ln -s "Strings.zh-TW.resx" "ArchiSteamFarm/Localization/Strings.zh-Hant.resx"; fi && \
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo && \
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo && \
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o 'out' /nologo /p:ASFVariant=docker /p:PublishTrimmed=false /p:UseAppHost=false && \
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o 'out' --nologo /p:ASFVariant=docker /p:UseAppHost=false && \
|
||||
cp "ArchiSteamFarm/overlay/generic/ArchiSteamFarm.sh" "out/ArchiSteamFarm.sh"
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim-arm32v7 AS runtime
|
||||
|
||||
@@ -17,9 +17,10 @@ RUN dotnet --info && \
|
||||
# TODO: Remove workaround for https://github.com/microsoft/msbuild/issues/3897 when it's no longer needed
|
||||
if [ -f "ArchiSteamFarm/Localization/Strings.zh-CN.resx" ]; then ln -s "Strings.zh-CN.resx" "ArchiSteamFarm/Localization/Strings.zh-Hans.resx"; fi && \
|
||||
if [ -f "ArchiSteamFarm/Localization/Strings.zh-TW.resx" ]; then ln -s "Strings.zh-TW.resx" "ArchiSteamFarm/Localization/Strings.zh-Hant.resx"; fi && \
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo && \
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" /nologo && \
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o 'out' /nologo /p:ASFVariant=docker /p:PublishTrimmed=false /p:UseAppHost=false && \
|
||||
dotnet build ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet test ArchiSteamFarm.Tests -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet clean ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" --nologo && \
|
||||
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o 'out' --nologo /p:ASFVariant=docker /p:UseAppHost=false && \
|
||||
cp "ArchiSteamFarm/overlay/generic/ArchiSteamFarm.sh" "out/ArchiSteamFarm.sh"
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS runtime
|
||||
|
||||
23
appveyor.yml
23
appveyor.yml
@@ -98,7 +98,7 @@ build_script:
|
||||
}
|
||||
|
||||
|
||||
dotnet build ArchiSteamFarm -c "$env:CONFIGURATION" -f "$env:NET_CORE_VERSION" /nologo
|
||||
dotnet build ArchiSteamFarm -c "$env:CONFIGURATION" -f "$env:NET_CORE_VERSION" --nologo
|
||||
|
||||
|
||||
if ($LastExitCode -ne 0) {
|
||||
@@ -106,7 +106,7 @@ build_script:
|
||||
}
|
||||
|
||||
|
||||
dotnet build ArchiSteamFarm.CustomPlugins.ExamplePlugin -c "$env:CONFIGURATION" -f "$env:NET_CORE_VERSION" /nologo
|
||||
dotnet build ArchiSteamFarm.CustomPlugins.ExamplePlugin -c "$env:CONFIGURATION" -f "$env:NET_CORE_VERSION" --nologo
|
||||
|
||||
|
||||
if ($LastExitCode -ne 0) {
|
||||
@@ -121,7 +121,7 @@ test_script:
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
|
||||
dotnet test ArchiSteamFarm.Tests -c "$env:CONFIGURATION" -f "$env:NET_CORE_VERSION" /nologo
|
||||
dotnet test ArchiSteamFarm.Tests -c "$env:CONFIGURATION" -f "$env:NET_CORE_VERSION" --nologo
|
||||
|
||||
|
||||
if ($LastExitCode -ne 0) {
|
||||
@@ -155,9 +155,9 @@ after_test:
|
||||
|
||||
if ($variant -like 'generic*') {
|
||||
# TODO: Workaround https://github.com/mono/linker/issues/286 (don't forget to remove it from docker files too)
|
||||
dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -f "$targetFramework" -o "out\$variant" --no-restore /nologo "/p:ASFVariant=$variant" "/p:PublishTrimmed=false" "/p:UseAppHost=false"
|
||||
dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -f "$targetFramework" -o "out\$variant" --no-restore --nologo "/p:ASFVariant=$variant" "/p:UseAppHost=false"
|
||||
} else {
|
||||
dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -f "$targetFramework" -o "out\$variant" -r "$variant" --no-restore /nologo "/p:ASFVariant=$variant" "/p:LinkDuringPublish=false"
|
||||
dotnet publish ArchiSteamFarm -c "$env:CONFIGURATION" -f "$targetFramework" -o "out\$variant" -r "$variant" --no-restore --nologo "/p:ASFVariant=$variant" "/p:PublishTrimmed=true" "/p:PublishSingleFile=true"
|
||||
}
|
||||
|
||||
if ($LastExitCode -ne 0) {
|
||||
@@ -209,9 +209,22 @@ after_test:
|
||||
}
|
||||
|
||||
|
||||
dotnet clean ArchiSteamFarm -c "$env:CONFIGURATION" -f "$env:NET_CORE_VERSION" --nologo
|
||||
|
||||
|
||||
if ($LastExitCode -ne 0) {
|
||||
throw "Last command failed."
|
||||
}
|
||||
|
||||
|
||||
dotnet restore ArchiSteamFarm
|
||||
|
||||
|
||||
if ($LastExitCode -ne 0) {
|
||||
throw "Last command failed."
|
||||
}
|
||||
|
||||
|
||||
foreach ($variant in $env:VARIANTS.Split([char[]] $null, [System.StringSplitOptions]::RemoveEmptyEntries)) {
|
||||
Start-Job -Name "$variant" $PublishBlock -ArgumentList "$variant"
|
||||
}
|
||||
|
||||
9
cc.sh
9
cc.sh
@@ -11,13 +11,12 @@ OUT="out"
|
||||
|
||||
ASF_UI=1
|
||||
CLEAN=0
|
||||
PUBLISH_TRIMMED=0
|
||||
PULL=1
|
||||
SHARED_COMPILATION=1
|
||||
TEST=1
|
||||
|
||||
PRINT_USAGE() {
|
||||
echo "Usage: $0 [--clean] [--publish-trimmed] [--no-asf-ui] [--no-pull] [--no-shared-compilation] [--no-test] [debug/release]"
|
||||
echo "Usage: $0 [--clean] [--no-asf-ui] [--no-pull] [--no-shared-compilation] [--no-test] [debug/release]"
|
||||
}
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
@@ -30,8 +29,6 @@ for ARG in "$@"; do
|
||||
--no-asf-ui) ASF_UI=0 ;;
|
||||
--clean) CLEAN=1 ;;
|
||||
--no-clean) CLEAN=0 ;;
|
||||
--publish-trimmed) PUBLISH_TRIMMED=1 ;;
|
||||
--no-publish-trimmed) PUBLISH_TRIMMED=0 ;;
|
||||
--pull) PULL=1 ;;
|
||||
--no-pull) PULL=0 ;;
|
||||
--shared-compilation) SHARED_COMPILATION=1 ;;
|
||||
@@ -83,10 +80,6 @@ fi
|
||||
|
||||
DOTNET_FLAGS="-c $CONFIGURATION -f $TARGET_FRAMEWORK /nologo"
|
||||
|
||||
if [ "$PUBLISH_TRIMMED" -eq 0 ]; then
|
||||
DOTNET_FLAGS="$DOTNET_FLAGS /p:PublishTrimmed=false"
|
||||
fi
|
||||
|
||||
if [ "$SHARED_COMPILATION" -eq 0 ]; then
|
||||
DOTNET_FLAGS="$DOTNET_FLAGS /p:UseSharedCompilation=false"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user