Skip to content

Commit

Permalink
fix: fix targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Dec 24, 2023
1 parent e704870 commit 2a7c35c
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 57 deletions.
2 changes: 0 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
<SourceRoot Include="$(MSBuildThisFileDirectory)/" />
</ItemGroup>
<PropertyGroup>
<!--<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/DisCatSharp.Tools/DisCatSharp.ruleset</CodeAnalysisRuleSet>-->
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
</PropertyGroup>
</Project>
7 changes: 7 additions & 0 deletions DisCatSharp.Targets/Library.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
<OutputType>Library</OutputType>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<CodeAnalysisRuleSet>$(MSBuildProjectDirectory)/../DisCatSharp.Tools/DisCatSharp.ruleset</CodeAnalysisRuleSet>
<NoWarn>1591;NU5128;DV2001;NETSDK1188;CS8600;CS8625;CS8601;CS8604;CS0219;CS8618;CS8619;CS8597;CS8603;CS8602;CS8765;CS8632;CS8633;CS8714;CS8629;CS8767;CS8620</NoWarn>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions DisCatSharp.Targets/Package.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<PropertyGroup>
<NoWarn>1591;NU5128;DV2001;NETSDK1188;CS8600;CS8625;CS8601;CS8604;CS0219;CS8618;CS8619;CS8597;CS8603;CS8602;CS8765;CS8632;CS8633;CS8714;CS8629;CS8767;CS8620</NoWarn>
<LangVersion>latest</LangVersion>
<Optimize>True</Optimize>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<Optimize>True</Optimize>
</PropertyGroup>
</Project>
17 changes: 17 additions & 0 deletions DisCatSharp.Targets/TestProject.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<CodeAnalysisRuleSet>$(MSBuildProjectDirectory)/../../DisCatSharp.Tools/DisCatSharp.ruleset</CodeAnalysisRuleSet>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<NoWarn>1591;NU5128;DV2001;CS0271</NoWarn>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../DisCatSharp.Targets/Library.targets" />
<Import Project="../../DisCatSharp.Targets/TestProject.targets" />
<Import Project="../../DisCatSharp.Targets/InternalsVisibleTo.targets" />
<PropertyGroup>
<Nullable>enable</Nullable>
<NoWarn>1591;NU5128;DV2001;CS0271</NoWarn>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../DisCatSharp.Targets/Library.targets" />
<Import Project="../../DisCatSharp.Targets/TestProject.targets" />
<Import Project="../../DisCatSharp.Targets/InternalsVisibleTo.targets" />

<PropertyGroup>
<Nullable>enable</Nullable>
<NoWarn>1591;NU5128;DV2001;CS0271</NoWarn>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DisCatSharp.Analyzer.Roselyn" Version="6.2.2">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../DisCatSharp.Targets/Library.targets" />
<Import Project="../../DisCatSharp.Targets/TestProject.targets" />
<Import Project="../../DisCatSharp.Targets/InternalsVisibleTo.targets" />
<PropertyGroup>
<Nullable>enable</Nullable>
<NoWarn>1591;NU5128;DV2001;CS0271</NoWarn>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../DisCatSharp.Targets/Library.targets" />
<Import Project="../../DisCatSharp.Targets/TestProject.targets" />
<Import Project="../../DisCatSharp.Targets/InternalsVisibleTo.targets" />

<PropertyGroup>
<Nullable>enable</Nullable>
<NoWarn>1591;NU5128;DV2001;CS0271</NoWarn>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DisCatSharp.Analyzer.Roselyn" Version="6.2.2">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions DisCatSharp.Tests/DisCatSharp.Hosting.Tests/ExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class HostExtensionTests

#endregion

private Dictionary<string, string> DefaultDiscord() =>
private Dictionary<string, string?> DefaultDiscord() =>
new()
{
{ "DisCatSharp:Discord:Token", "1234567890" },
Expand All @@ -44,7 +44,7 @@ private Dictionary<string, string> DefaultDiscord() =>
};

public IConfiguration DiscordInteractivityConfiguration() => new ConfigurationBuilder()
.AddInMemoryCollection(new Dictionary<string, string>(this.DefaultDiscord())
.AddInMemoryCollection(new Dictionary<string, string?>(this.DefaultDiscord())
{
{ "DisCatSharp:Using", "[\"DisCatSharp.Interactivity\"]" } // this should be enough to automatically add the extension
})
Expand Down
8 changes: 4 additions & 4 deletions DisCatSharp.Tests/DisCatSharp.Hosting.Tests/HostTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public BotTwoService(IConfiguration config, ILogger<BotTwoService> logger, IServ

public class HostTests
{
private Dictionary<string, string> DefaultDiscord() =>
private Dictionary<string, string?> DefaultDiscord() =>
new()
{
{ "DisCatSharp:Discord:Token", "1234567890" },
Expand All @@ -76,17 +76,17 @@ private Dictionary<string, string> DefaultDiscord() =>
{ "DisCatSharp:Discord:Intents", "AllUnprivileged" }
};

public Dictionary<string, string> DiscordInteractivity() => new(this.DefaultDiscord())
public Dictionary<string, string?> DiscordInteractivity() => new(this.DefaultDiscord())
{
{ "DisCatSharp:Using", "[\"DisCatSharp.Interactivity\"]" }
};

public Dictionary<string, string> DiscordInteractivityAndLavalink() => new(this.DefaultDiscord())
public Dictionary<string, string?> DiscordInteractivityAndLavalink() => new(this.DefaultDiscord())
{
{ "DisCatSharp:Using", "[\"DisCatSharp.Interactivity\", \"DisCatSharp.Lavalink\"]" }
};

private IHostBuilder Create(Dictionary<string, string> configValues) =>
private IHostBuilder Create(Dictionary<string, string?> configValues) =>
Host.CreateDefaultBuilder()
.ConfigureServices(services => services.AddSingleton<IDiscordHostedService, Bot>())
.ConfigureHostConfiguration(builder => builder.AddInMemoryCollection(configValues));
Expand Down
11 changes: 1 addition & 10 deletions DisCatSharp.Tests/SafetyTests/DisCatSharp.SafetyTests.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../DisCatSharp.Targets/Library.targets" />
<Import Project="../../DisCatSharp.Targets/TestProject.targets" />
<Import Project="../../DisCatSharp.Targets/InternalsVisibleTo.targets" />

<PropertyGroup>
<Nullable>enable</Nullable>
<NoWarn>1591;NU5128;DV2001;CS0271</NoWarn>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IsTestProject>true</IsTestProject>
<RootNamespace>DisCatSharp.SafetyTests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
Expand Down
2 changes: 1 addition & 1 deletion DisCatSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
BUILDING.md = BUILDING.md
CONTRIBUTING.md = CONTRIBUTING.md
Directory.Build.props = Directory.Build.props
LICENSE.md = LICENSE.md
README.md = README.md
EndProjectSection
Expand Down Expand Up @@ -79,6 +78,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Targets", "Targets", "{4A7E
DisCatSharp.Targets\Library.targets = DisCatSharp.Targets\Library.targets
DisCatSharp.Targets\NuGet.targets = DisCatSharp.Targets\NuGet.targets
DisCatSharp.Targets\Package.targets = DisCatSharp.Targets\Package.targets
DisCatSharp.Targets\TestProject.targets = DisCatSharp.Targets\TestProject.targets
DisCatSharp.Targets\Version.targets = DisCatSharp.Targets\Version.targets
EndProjectSection
EndProject
Expand Down
2 changes: 1 addition & 1 deletion DisCatSharp/DisCatSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<ItemGroup>
<Content Include="res\discatsharp.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>

Expand Down

0 comments on commit 2a7c35c

Please sign in to comment.