Skip to content

Commit

Permalink
Runtime upgrade to .NET Core 2.1 (#804)
Browse files Browse the repository at this point in the history
* Initial bump to .NET Core 2.1

* Add workaround for dotnet/linker#286

* Deprecate BackgroundGCPeriod

* Websockets updates

* Misc

* Check if travis works with 2.1

* Not yet

* Fix travis for now

* Test

* Whatever, travis is broken right now

* Schema update

* Update travis

* Test travis

* Check OSX

* Correct CI versions

* Misc

* Misc
  • Loading branch information
JustArchi committed Jun 3, 2018
1 parent 5a024a2 commit 9a30277
Show file tree
Hide file tree
Showing 14 changed files with 550 additions and 48 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ branches:
group: travis_latest

# ASF is based on .NET Core platform
dotnet: 2.1.105
dotnet: 2.1.300
mono: none

env:
global:
- CONFIGURATION: Release
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
- NET_CORE_VERSION: netcoreapp2.0
- NET_CORE_VERSION: netcoreapp2.1
- VARIANTS="generic linux-arm linux-x64 osx-x64 win-x64" # NOTE: When modifying variants, don't forget to update ASF_VARIANT definitions in SharedInfo.cs!

before_script:
Expand All @@ -46,7 +46,8 @@ script:
publish() {
if [ "$1" = 'generic' ]; then
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" /nologo "/p:ASFVariant=$1"
# TODO: Workaround https://github.com/mono/linker/issues/286 until it's resolved
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" /nologo "/p:ASFVariant=$1" "/p:LinkDuringPublish=false"
else
dotnet publish ArchiSteamFarm -c "$CONFIGURATION" -f "$NET_CORE_VERSION" -o "out/${1}" -r "$1" /nologo "/p:ASFVariant=$1" "/p:CrossGenDuringPublish=false"
fi
Expand All @@ -60,6 +61,7 @@ script:
for variant in $VARIANTS; do
publish "$variant" &
done
wait
matrix:
Expand Down
2 changes: 1 addition & 1 deletion ArchiSteamFarm.Tests/ArchiSteamFarm.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageProjectUrl>https://github.com/JustArchi/ArchiSteamFarm</PackageProjectUrl>
<RepositoryType>Git</RepositoryType>
<RepositoryUrl>https://github.com/JustArchi/ArchiSteamFarm.git</RepositoryUrl>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
8 changes: 4 additions & 4 deletions ArchiSteamFarm/ArchiSteamFarm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<PropertyGroup>
<ApplicationIcon>ASF.ico</ApplicationIcon>
<AssemblyVersion>3.1.3.5</AssemblyVersion>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<Authors>JustArchi</Authors>
<Company>JustArchi</Company>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
<Copyright>Copyright © ArchiSteamFarm 2015-2018</Copyright>
<Description>ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously.</Description>
<ErrorReport>none</ErrorReport>
<FileVersion>3.1.3.5</FileVersion>
<FileVersion>3.2.0.0</FileVersion>
<LangVersion>latest</LangVersion>
<NoWarn />
<OutputType>Exe</OutputType>
Expand All @@ -20,7 +20,7 @@
<RepositoryUrl>https://github.com/JustArchi/ArchiSteamFarm.git</RepositoryUrl>
<RuntimeIdentifiers>linux-arm;linux-x64;osx-x64;win-x64</RuntimeIdentifiers>
<ServerGarbageCollection>false</ServerGarbageCollection>
<TargetFrameworks>netcoreapp2.0;net472</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;net472</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
Expand All @@ -43,7 +43,7 @@
<PackageReference Include="SteamKit2" Version="2.1.0-Beta.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="ILLink.Tasks" Version="0.1.5-preview-1461378" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.5.0" />
</ItemGroup>
Expand Down
13 changes: 2 additions & 11 deletions ArchiSteamFarm/GlobalConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ internal sealed class GlobalConfig {
internal const ushort DefaultIPCPort = 1242;
internal const byte DefaultLoginLimiterDelay = 10;

private const ProtocolTypes DefaultSteamProtocols = ProtocolTypes.Tcp | ProtocolTypes.Udp;

internal static readonly HashSet<uint> SalesBlacklist = new HashSet<uint> { 267420, 303700, 335590, 368020, 425280, 480730, 566020, 639900, 762800 }; // Steam Summer/Winter sales

private static readonly SemaphoreSlim WriteSemaphore = new SemaphoreSlim(1, 1);
Expand Down Expand Up @@ -119,7 +117,7 @@ internal sealed class GlobalConfig {
internal ulong SteamOwnerID { get; private set; }

[JsonProperty(Required = Required.DisallowNull)]
internal ProtocolTypes SteamProtocols { get; private set; } = DefaultSteamProtocols;
internal ProtocolTypes SteamProtocols { get; private set; } = ProtocolTypes.All;

internal WebProxy WebProxy { get; private set; }

Expand Down Expand Up @@ -287,18 +285,11 @@ internal sealed class GlobalConfig {
return null;
}

if (globalConfig.SteamProtocols == 0) {
if ((globalConfig.SteamProtocols == 0) || (globalConfig.SteamProtocols > ProtocolTypes.All)) {
ASF.ArchiLogger.LogGenericError(string.Format(Strings.ErrorConfigPropertyInvalid, nameof(globalConfig.SteamProtocols), globalConfig.SteamProtocols));
return null;
}

if (globalConfig.SteamProtocols.HasFlag(ProtocolTypes.WebSocket) && !OS.SupportsWebSockets()) {
globalConfig.SteamProtocols &= ~ProtocolTypes.WebSocket;
if (globalConfig.SteamProtocols == 0) {
globalConfig.SteamProtocols = DefaultSteamProtocols;
}
}

return globalConfig;
}

Expand Down
12 changes: 0 additions & 12 deletions ArchiSteamFarm/OS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

using System;
using System.IO;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using ArchiSteamFarm.Localization;

Expand All @@ -39,17 +38,6 @@ internal static class OS {
}
}

// TODO: We should really get rid of this once https://github.com/SteamRE/SteamKit/issues/455 or https://github.com/dotnet/corefx/issues/9503 is solved
internal static bool SupportsWebSockets() {
try {
using (new ClientWebSocket()) {
return true;
}
} catch (PlatformNotSupportedException) {
return false;
}
}

internal static void UnixSetFileAccessExecutable(string path) {
if (string.IsNullOrEmpty(path) || !File.Exists(path)) {
ASF.ArchiLogger.LogNullError(nameof(path));
Expand Down
1 change: 1 addition & 0 deletions ArchiSteamFarm/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ internal static class Program {
}

if (GlobalConfig.BackgroundGCPeriod > 0) {
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(GlobalConfig.BackgroundGCPeriod), "COMPlus_GCLatencyLevel=0"));
Hacks.EnableBackgroundGC(GlobalConfig.BackgroundGCPeriod);
}

Expand Down
2 changes: 1 addition & 1 deletion ArchiSteamFarm/config/ASF.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"OptimizationMode": 0,
"Statistics": true,
"SteamOwnerID": 0,
"SteamProtocols": 3,
"SteamProtocols": 7,
"UpdateChannel": 1,
"UpdatePeriod": 24,
"WebLimiterDelay": 200,
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.Service.arm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM microsoft/dotnet:2.0-sdk AS build-env
ENV NET_CORE_VERSION netcoreapp2.0
FROM microsoft/dotnet:2.1-sdk AS build-env
ENV NET_CORE_VERSION netcoreapp2.1
WORKDIR /app
COPY . ./
RUN dotnet --info && \
dotnet publish ArchiSteamFarm -c Release -f "$NET_CORE_VERSION" -o out /nologo /p:ASFVariant=generic && \
cp "ArchiSteamFarm/scripts/generic/ArchiSteamFarm-Service.sh" "ArchiSteamFarm/out/ArchiSteamFarm-Service.sh"

FROM microsoft/dotnet:2.0-runtime-stretch-arm32v7
FROM microsoft/dotnet:2.1-runtime-stretch-slim-arm32v7
LABEL maintainer="JustArchi <JustArchi@JustArchi.net>"
EXPOSE 1242
WORKDIR /app
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.Service.x64
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM microsoft/dotnet:2.0-sdk AS build-env
ENV NET_CORE_VERSION netcoreapp2.0
FROM microsoft/dotnet:2.1-sdk AS build-env
ENV NET_CORE_VERSION netcoreapp2.1
WORKDIR /app
COPY . ./
RUN dotnet --info && \
dotnet publish ArchiSteamFarm -c Release -f "$NET_CORE_VERSION" -o out /nologo /p:ASFVariant=generic && \
cp "ArchiSteamFarm/scripts/generic/ArchiSteamFarm-Service.sh" "ArchiSteamFarm/out/ArchiSteamFarm-Service.sh"

FROM microsoft/dotnet:2.0-runtime
FROM microsoft/dotnet:2.1-runtime-stretch-slim
LABEL maintainer="JustArchi <JustArchi@JustArchi.net>"
EXPOSE 1242
WORKDIR /app
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM microsoft/dotnet:2.0-sdk AS build-env
ENV NET_CORE_VERSION netcoreapp2.0
FROM microsoft/dotnet:2.1-sdk AS build-env
ENV NET_CORE_VERSION netcoreapp2.1
WORKDIR /app
COPY . ./
RUN dotnet --info && \
dotnet publish ArchiSteamFarm -c Release -f "$NET_CORE_VERSION" -o out /nologo /p:ASFVariant=docker && \
cp "ArchiSteamFarm/scripts/generic/ArchiSteamFarm.sh" "ArchiSteamFarm/out/ArchiSteamFarm.sh"

FROM microsoft/dotnet:2.0-runtime-stretch-arm32v7
FROM microsoft/dotnet:2.1-runtime-stretch-slim-arm32v7
LABEL maintainer="JustArchi <JustArchi@JustArchi.net>"
EXPOSE 1242
WORKDIR /app
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.x64
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM microsoft/dotnet:2.0-sdk AS build-env
ENV NET_CORE_VERSION netcoreapp2.0
FROM microsoft/dotnet:2.1-sdk AS build-env
ENV NET_CORE_VERSION netcoreapp2.1
WORKDIR /app
COPY . ./
RUN dotnet --info && \
dotnet publish ArchiSteamFarm -c Release -f "$NET_CORE_VERSION" -o out /nologo /p:ASFVariant=docker && \
cp "ArchiSteamFarm/scripts/generic/ArchiSteamFarm.sh" "ArchiSteamFarm/out/ArchiSteamFarm.sh"

FROM microsoft/dotnet:2.0-runtime
FROM microsoft/dotnet:2.1-runtime-stretch-slim
LABEL maintainer="JustArchi <JustArchi@JustArchi.net>"
EXPOSE 1242
WORKDIR /app
Expand Down

0 comments on commit 9a30277

Please sign in to comment.