Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Brainarr.Plugin/Brainarr.Plugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>

<!-- Assembly and build configuration -->
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Company>RicherTunes</Company>
<Product>Brainarr</Product>
<Description>AI-powered music recommendation plugin for Lidarr</Description>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

Expand Down Expand Up @@ -156,6 +159,14 @@
<Message Condition="'$(LidarrPath)' != ''" Text="Using Lidarr from: $(LidarrPath)" Importance="high" />
</Target>

<!-- CRITICAL: Brainarr MUST NOT use NuGet FluentValidation - it causes type-identity mismatch.
This guard prevents accidental builds without host FluentValidation.dll.
See: https://github.com/RicherTunes/Brainarr/pull/346 -->
<Target Name="ValidateFluentValidationFromHost" BeforeTargets="Build" Condition="'$(LidarrPath)' != ''">
<Error Condition="!Exists('$(LidarrPath)\FluentValidation.dll')"
Text="CRITICAL: FluentValidation.dll not found in $(LidarrPath). Brainarr MUST use host's FluentValidation to avoid type-identity mismatch (override signature for Test method). Extract Lidarr assemblies with './build.ps1 -ExtractAssemblies' or use a complete Lidarr installation." />
</Target>

<!-- Copy plugin manifest to output -->
<ItemGroup>
<Content Include="..\plugin.json" Condition="Exists('..\plugin.json')">
Expand Down
20 changes: 0 additions & 20 deletions Brainarr.Plugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly
[assembly: AssemblyTitle("Brainarr.Plugin")]
[assembly: AssemblyDescription("AI-powered music recommendation plugin for Lidarr")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RicherTunes")]
[assembly: AssemblyProduct("Brainarr")]
[assembly: AssemblyCopyright("Copyright © RicherTunes 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("A4C7B8AA-7F67-4C38-9A5E-7CA4E2C5D827")]

// Version information
[assembly: AssemblyVersion("1.3.2.0")]
[assembly: AssemblyFileVersion("1.3.2.0")]

// Mark as Lidarr plugin
[assembly: AssemblyMetadata("PluginType", "ImportList")]
[assembly: AssemblyMetadata("PluginName", "Brainarr")]
19 changes: 15 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,32 @@

<!-- Version Management -->
<PropertyGroup>
<!-- Read version from VERSION file if it exists -->
<!-- Plugin version is sourced from plugin.json (single source of truth). -->
<PluginJsonPath Condition="'$(PluginJsonPath)' == '' And Exists('$(MSBuildThisFileDirectory)plugin.json')">$(MSBuildThisFileDirectory)plugin.json</PluginJsonPath>
<PluginJsonText Condition="'$(PluginJsonText)' == '' And '$(PluginJsonPath)' != ''">$([System.IO.File]::ReadAllText('$(PluginJsonPath)'))</PluginJsonText>
<PluginJsonVersion Condition="'$(PluginJsonVersion)' == '' And '$(PluginJsonText)' != ''">$([System.Text.RegularExpressions.Regex]::Match('$(PluginJsonText)', '&quot;version&quot;\s*:\s*&quot;([^&quot;]+)&quot;').Groups[1].Value)</PluginJsonVersion>

<!-- Legacy fallback: VERSION file (kept for compatibility with older tooling) -->
<VersionFromFile Condition="'$(VersionFromFile)' == '' And Exists('$(MSBuildThisFileDirectory)VERSION')">$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)VERSION').Trim())</VersionFromFile>

<Version Condition="'$(Version)' == '' And '$(PluginJsonVersion)' != ''">$(PluginJsonVersion)</Version>
<Version Condition="'$(Version)' == '' And '$(VersionFromFile)' != ''">$(VersionFromFile)</Version>
<Version Condition="'$(Version)' == ''">0.1.0-dev</Version>

<!-- Extract prefix for assembly versioning (e.g., 1.2.3 from 1.2.3-beta) -->
<VersionPrefix Condition="'$(VersionPrefix)' == '' And '$(VersionFromFile)' != ''">$([System.Text.RegularExpressions.Regex]::Match('$(VersionFromFile)', '^\d+\.\d+\.\d+').Value)</VersionPrefix>
<AssemblyVersion Condition="'$(AssemblyVersion)' == '' And '$(VersionPrefix)' != ''">$(VersionPrefix).0</AssemblyVersion>
<!-- For Windows file versioning and stable binding:
- AssemblyVersion is stable across patch releases: MAJOR.MINOR.0.0
- FileVersion is full numeric: MAJOR.MINOR.PATCH.0 -->
<VersionMajorMinor Condition="'$(VersionMajorMinor)' == ''">$([System.Text.RegularExpressions.Regex]::Match('$(Version)', '^(\d+\.\d+)').Groups[1].Value)</VersionMajorMinor>
<VersionPrefix Condition="'$(VersionPrefix)' == ''">$([System.Text.RegularExpressions.Regex]::Match('$(Version)', '^\d+\.\d+\.\d+').Value)</VersionPrefix>
<AssemblyVersion Condition="'$(AssemblyVersion)' == '' And '$(VersionMajorMinor)' != ''">$(VersionMajorMinor).0.0</AssemblyVersion>
<FileVersion Condition="'$(FileVersion)' == '' And '$(VersionPrefix)' != ''">$(VersionPrefix).0</FileVersion>
</PropertyGroup>

<!-- SourceLink + Deterministic Builds -->
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSourceRevisionInInformationalVersion>true</IncludeSourceRevisionInInformationalVersion>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
<!-- Map project directories to a stable root to avoid leaking developer paths in PDBs -->
Expand Down
10 changes: 10 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,15 @@
the ILRepack task with the correct LibraryPath that includes Lidarr assemblies.
The package's automatic target doesn't have Lidarr in its LibraryPath and fails.
-->
<Target Name="WarnOnVersionFileMismatch"
BeforeTargets="PrepareForBuild"
Condition="Exists('$(MSBuildThisFileDirectory)plugin.json')
And Exists('$(MSBuildThisFileDirectory)VERSION')
And '$(PluginJsonVersion)' != ''
And '$(VersionFromFile)' != ''
And '$(PluginJsonVersion)' != '$(VersionFromFile)'">
<Warning Text="VERSION file ('$(VersionFromFile)') does not match plugin.json version ('$(PluginJsonVersion)'). plugin.json is the source of truth; update/remove VERSION to avoid drift." />
</Target>

<Target Name="ILRepack" />
</Project>
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
},
{
"path": "Lidarr.Plugin.Brainarr.dll",
"sha256": "f9cce5ad263663590a18cf67f16521fcb8b51cdf7215d7c563083386db252caa"
"sha256": "dcaeff67da4c57affe105725dfe6d31c9f2024a5408766cc4140bc859823cbbd"
},
{
"path": "manifest.json",
"sha256": "150901d2b7912e391c736219e853e102a0fc9325d64c61a4a35b23b71da2fc58"
"sha256": "b687a0647e9d33cc60c656c04373b33bcd25a086350a5c4cec1336e43905f074"
},
{
"path": "Microsoft.Extensions.DependencyInjection.Abstractions.dll",
Expand Down
Loading