mirror of
https://github.com/Ellpeck/Contentless.git
synced 2024-11-27 17:28:35 +01:00
Add more true NuGet support.
This commit is contained in:
parent
4879c17252
commit
783fc8683e
3 changed files with 29 additions and 4 deletions
15
Contentless/NuGetHelper.cs
Normal file
15
Contentless/NuGetHelper.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
using NuGet.Configuration;
|
||||||
|
|
||||||
|
namespace Contentless;
|
||||||
|
|
||||||
|
public class NuGetHelper
|
||||||
|
{
|
||||||
|
private readonly ISettings _settings;
|
||||||
|
|
||||||
|
public NuGetHelper(string projectFolder)
|
||||||
|
{
|
||||||
|
_settings = Settings.LoadDefaultSettings(projectFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string PackageFolder => SettingsUtility.GetGlobalPackagesFolder(_settings);
|
||||||
|
}
|
|
@ -7,7 +7,6 @@ using System.Text.RegularExpressions;
|
||||||
using Microsoft.Build.Construction;
|
using Microsoft.Build.Construction;
|
||||||
using Microsoft.Xna.Framework.Content.Pipeline;
|
using Microsoft.Xna.Framework.Content.Pipeline;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NuGet.Configuration;
|
|
||||||
|
|
||||||
namespace Contentless;
|
namespace Contentless;
|
||||||
|
|
||||||
|
@ -48,7 +47,10 @@ public static class Program {
|
||||||
if (config.References.Length > 0)
|
if (config.References.Length > 0)
|
||||||
{
|
{
|
||||||
if (args.Length > 1)
|
if (args.Length > 1)
|
||||||
|
{
|
||||||
ExtractVersions(args[1], referencesVersions);
|
ExtractVersions(args[1], referencesVersions);
|
||||||
|
_nuGetHelper = new NuGetHelper(Path.GetDirectoryName(args[1]));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
Console.Error.WriteLine("You supplied references but there is no project file, this isn't compatible. Please specify the full path of project file, if you want to sync references");
|
Console.Error.WriteLine("You supplied references but there is no project file, this isn't compatible. Please specify the full path of project file, if you want to sync references");
|
||||||
}
|
}
|
||||||
|
@ -233,10 +235,11 @@ public static class Program {
|
||||||
Console.Error.WriteLine($"Unable to find library {library.Key} in .csproj");
|
Console.Error.WriteLine($"Unable to find library {library.Key} in .csproj");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static NuGetHelper _nuGetHelper;
|
||||||
|
|
||||||
private static string CalculateFullPathToLibrary(string libraryName, string referencesVersion)
|
private static string CalculateFullPathToLibrary(string libraryName, string referencesVersion)
|
||||||
{
|
{
|
||||||
var settings = Settings.LoadDefaultSettings(null);
|
return Path.Combine(_nuGetHelper.PackageFolder, libraryName.ToLower(), referencesVersion, "tools", libraryName + ".dll");
|
||||||
return Path.Combine(SettingsUtility.GetGlobalPackagesFolder(settings), libraryName.ToLower(), referencesVersion, "tools", libraryName + ".dll");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static (List<ImporterInfo>, List<string>) GetContentData() {
|
private static (List<ImporterInfo>, List<string>) GetContentData() {
|
||||||
|
|
7
Test/NuGet.Config
Normal file
7
Test/NuGet.Config
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||||
|
<add key="lithiumtoast" value="https://www.myget.org/F/lithiumtoast/api/v3/index.json" />
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
Loading…
Reference in a new issue