IlRepack and obfuscation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-12-12 01:10:11 +01:00
parent 5da013ad15
commit 5d1906abfa
13 changed files with 63 additions and 15 deletions

View File

@@ -5,8 +5,30 @@ steps:
- name: build
image: mcr.microsoft.com/dotnet/sdk:9.0
commands:
# HACK Waiting for "Assembly strong name Linux compatibility" (https://github.com/gluck/il-repack/pull/366) to propagate to the ILRepack.Lib.MSBuild.Task nuget package
- dotnet restore CinemaJellyfin/CinemaJellyfin.csproj
- wget https://www.ivasoft.cz/share/ILRepack.Lib.MSBuild.Task.dll -O /root/.nuget/packages/ilrepack.lib.msbuild.task/2.0.34.2/build/ILRepack.Lib.MSBuild.Task.dll
# END HACK
- dotnet build --configuration Release CinemaJellyfin/CinemaJellyfin.csproj
- dotnet publish -c Release -o out
- name: obfuscate
image: git.ivasoft.cz/sw/docker-wine-dotnet
commands:
- wine Eazfuscator.NET.exe CinemaJellyfin/bin/Release/net8.0/CinemaJellyfin.dll -k key.snk -n --newline-flush
#when:
# event: tag
- name: gitea_release
image: plugins/gitea-release
settings:
api_key:
from_secret: drone_release
base_url: https://git.exprojekt.cz
files: 'CinemaJellyfin/bin/Release/net8.0/CinemaJellyfin.dll'
when:
event: tag
- name: docker
image: plugins/docker
settings:

View File

@@ -0,0 +1,5 @@
using System.Reflection;
[assembly: Obfuscation(Feature = "encrypt symbol names with password 458310E8B81C11EFACB6071FE769D992", Exclude = false)]
[assembly: Obfuscation(Feature = "2. Apply to type CinemaLib.API.Metadata: apply to member * when method or property or constructor: virtualization", Exclude = false)]
[assembly: Obfuscation(Feature = "2. Apply to type CinemaLib.Webshare.*: apply to member * when method or property or constructor: virtualization", Exclude = false)]

View File

@@ -1,9 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyOriginatorKeyFile>..\key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<Type>library</Type>
</PropertyGroup>
<ItemGroup>
@@ -12,6 +15,8 @@
<!--ProjectReference Include="..\..\..\jellyfin/MediaBrowser.Controller\MediaBrowser.Controller.csproj" /-->
<PackageReference Include="Jellyfin.Model" Version="10.10.3" />
<!--ProjectReference Include="..\..\..\jellyfin\MediaBrowser.Model\MediaBrowser.Model.csproj" /-->
<PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.34.2" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>

View File

@@ -18,12 +18,9 @@ using Microsoft.Extensions.Primitives;
using CinemaLib.API;
using MediaBrowser.Controller;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna;
using System.Runtime.CompilerServices;
using LinkGenerator = Cinema.Webshare.LinkGenerator;
using MediaBrowser.Common.Net;
using LinkGenerator = CinemaLib.Webshare.LinkGenerator;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Common.Configuration;
namespace Jellyfin.Plugin.Cinema;

View File

@@ -0,0 +1,23 @@
<Project>
<Target Name="ILRepackCustom" AfterTargets="Build" Condition="$(Configuration.Contains('Release'))">
<ItemGroup>
<AssembliesToMerge Include="$(OutputPath)CinemaLib.dll"/>
<InputAssemblies Include="$(OutputPath)$(TargetName)$(TargetExt)"/>
<InputAssemblies Include="@(AssembliesToMerge)"/>
</ItemGroup>
<ILRepack
Parallel="true"
DebugInfo="true"
AllowDuplicateResources="false"
Internalize="true"
InputAssemblies="@(InputAssemblies)"
TargetKind="SameAsPrimaryAssembly"
KeyFile="$(AssemblyOriginatorKeyFile)"
OutputFile="$(OutputPath)$(TargetName)$(TargetExt)"
LibraryPath="$(MSBuildExtensionsPath)..\..\shared\Microsoft.AspNetCore.App\9.0.0"
/>
<Delete Files="@(AssembliesToMerge)"/>
</Target>
</Project>

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<!--OutputType>Exe</OutputType-->
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@@ -1,5 +1,5 @@
using System;
using Cinema.Webshare;
using CinemaLib.Webshare;
class Program
{

View File

@@ -2,7 +2,7 @@ using System.Security.Cryptography;
using System.Text;
using System.Xml;
namespace Cinema.Webshare;
namespace CinemaLib.Webshare;
static class ApiExtensions {
private static readonly BaseEncoding UnixMD5 = new BaseEncoding("./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", false);

View File

@@ -1,7 +1,7 @@
using System;
using System.Text;
namespace Cinema.Webshare;
namespace CinemaLib.Webshare;
/// <summary>
/// Performs generic binary-to-text encoding.

View File

@@ -2,9 +2,8 @@ using System;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using CinemaLib.Webshare;
namespace Cinema.Webshare;
namespace CinemaLib.Webshare;
public static class LinkGenerator
{

View File

@@ -1,7 +1,6 @@
using System;
using System.Globalization;
using System.Xml;
using Cinema.Webshare;
namespace CinemaLib.Webshare;

View File

@@ -1,10 +1,8 @@
using System;
using System.Web;
using Microsoft.Extensions.Primitives;
using Cinema.Webshare;
using CinemaLib.API;
using CinemaWeb.Layouts;
using LinkGenerator = Cinema.Webshare.LinkGenerator;
using LinkGenerator = CinemaLib.Webshare.LinkGenerator;
namespace CinemaWeb.Pages;

BIN
key.snk Normal file

Binary file not shown.