mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #2052 from wabbajack-tools/3.0.0.6
Lots of small compiler fixes
This commit is contained in:
commit
08e0c215a1
@ -1,5 +1,13 @@
|
||||
### Changelog
|
||||
|
||||
#### Version - 3.0.0.6 -
|
||||
* Upgrade several dependency libraries
|
||||
* Provide a better error message when someone attempts to compile before logging into the Nexus (or installing a list)
|
||||
* Add `Ignore` as another compiler option
|
||||
* Add button to re-infer compiler settings
|
||||
* Show `Selected MO2 Profile` in the compiler settings
|
||||
|
||||
|
||||
#### Version - 3.0.0.5 - 8/22/2022
|
||||
* No longer rehashes files on every compile (faster Add Roots step during compilation)
|
||||
* Editing paths in the install/compile settings won't crash the app
|
||||
|
@ -16,7 +16,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.Modal" Version="6.0.1" />
|
||||
<PackageReference Include="Blazored.Toast" Version="3.2.2" />
|
||||
<PackageReference Include="DynamicData" Version="7.9.7" />
|
||||
<PackageReference Include="DynamicData" Version="7.9.14" />
|
||||
<PackageReference Include="Fizzler.Systems.HtmlAgilityPack" Version="1.2.1" />
|
||||
<PackageReference Include="GitInfo" Version="2.2.0" />
|
||||
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
|
||||
|
@ -87,6 +87,7 @@ namespace Wabbajack
|
||||
[Reactive] public RelativePath[] AlwaysEnabled { get; set; } = Array.Empty<RelativePath>();
|
||||
[Reactive] public RelativePath[] NoMatchInclude { get; set; } = Array.Empty<RelativePath>();
|
||||
[Reactive] public RelativePath[] Include { get; set; } = Array.Empty<RelativePath>();
|
||||
[Reactive] public RelativePath[] Ignore { get; set; } = Array.Empty<RelativePath>();
|
||||
|
||||
[Reactive] public string[] OtherProfiles { get; set; } = Array.Empty<string>();
|
||||
|
||||
@ -96,6 +97,7 @@ namespace Wabbajack
|
||||
|
||||
|
||||
public ReactiveCommand<Unit, Unit> ExecuteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ReInferSettingsCommand { get; set; }
|
||||
|
||||
public LogStream LoggerProvider { get; }
|
||||
public ReadOnlyObservableCollection<CPUDisplayVM> StatusList => _resourceMonitor.Tasks;
|
||||
@ -129,6 +131,14 @@ namespace Wabbajack
|
||||
SubCompilerVM = new MO2CompilerVM(this);
|
||||
|
||||
ExecuteCommand = ReactiveCommand.CreateFromTask(async () => await StartCompilation());
|
||||
ReInferSettingsCommand = ReactiveCommand.CreateFromTask(async () => await ReInferSettings(),
|
||||
this.WhenAnyValue(vm => vm.Source)
|
||||
.ObserveOnGuiThread()
|
||||
.Select(v => v != default)
|
||||
.CombineLatest(this.WhenAnyValue(vm => vm.ModListName)
|
||||
.ObserveOnGuiThread()
|
||||
.Select(p => !string.IsNullOrWhiteSpace(p)))
|
||||
.Select(v => v.First && v.Second));
|
||||
|
||||
ModlistLocation = new FilePickerVM
|
||||
{
|
||||
@ -184,6 +194,26 @@ namespace Wabbajack
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task ReInferSettings()
|
||||
{
|
||||
var newSettings = await _inferencer.InferModListFromLocation(
|
||||
Source.Combine("profiles", SelectedProfile, "modlist.txt"));
|
||||
|
||||
if (newSettings == null)
|
||||
{
|
||||
_logger.LogError("Cannot infer settings");
|
||||
return;
|
||||
}
|
||||
|
||||
Include = newSettings.Include;
|
||||
Ignore = newSettings.Ignore;
|
||||
AlwaysEnabled = newSettings.AlwaysEnabled;
|
||||
NoMatchInclude = newSettings.NoMatchInclude;
|
||||
OtherProfiles = newSettings.AdditionalProfiles;
|
||||
}
|
||||
|
||||
private ErrorResponse Validate()
|
||||
{
|
||||
var errors = new List<ErrorResponse>();
|
||||
@ -236,6 +266,7 @@ namespace Wabbajack
|
||||
AlwaysEnabled = settings.AlwaysEnabled;
|
||||
NoMatchInclude = settings.NoMatchInclude;
|
||||
Include = settings.Include;
|
||||
Ignore = settings.Ignore;
|
||||
}
|
||||
|
||||
|
||||
@ -385,7 +416,8 @@ namespace Wabbajack
|
||||
AlwaysEnabled = AlwaysEnabled,
|
||||
AdditionalProfiles = OtherProfiles,
|
||||
NoMatchInclude = NoMatchInclude,
|
||||
Include = Include
|
||||
Include = Include,
|
||||
Ignore = Ignore
|
||||
};
|
||||
}
|
||||
|
||||
@ -431,6 +463,17 @@ namespace Wabbajack
|
||||
Include = Include.Where(p => p != path).ToArray();
|
||||
}
|
||||
|
||||
|
||||
public void AddIgnore(RelativePath path)
|
||||
{
|
||||
Ignore = (Ignore ?? Array.Empty<RelativePath>()).Append(path).Distinct().ToArray();
|
||||
}
|
||||
|
||||
public void RemoveIgnore(RelativePath path)
|
||||
{
|
||||
Ignore = Ignore.Where(p => p != path).ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +101,9 @@
|
||||
</StackPanel.Resources>
|
||||
<TextBlock Margin="{StaticResource TitleMargin}" Text="ModList Name" />
|
||||
<TextBox x:Name="ModListNameSetting" Style="{StaticResource ValueStyle}" />
|
||||
<TextBlock Margin="{StaticResource TitleMargin}" Text="Selected Profile (if using MO2)" />
|
||||
<TextBox x:Name="SelectedProfile" Style="{StaticResource ValueStyle}" />
|
||||
<Button Margin="5" x:Name="ReInferSettings"> Re-infer Settings </Button>
|
||||
<TextBlock Margin="{StaticResource TitleMargin}" Text="Version" />
|
||||
<TextBox
|
||||
x:Name="VersionSetting"
|
||||
@ -171,6 +174,20 @@
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="AddIgnore">
|
||||
<icon:Material Kind="Plus"></icon:Material>
|
||||
</Button>
|
||||
<Label>Ignore</Label>
|
||||
</StackPanel>
|
||||
<ListBox x:Name="Ignore">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls1:RemovableItemView ViewModel="{Binding}" ></controls1:RemovableItemView>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Name="AddOtherProfile">
|
||||
|
@ -78,6 +78,10 @@ namespace Wabbajack
|
||||
.BindToStrict(this, view => view.BackButton.Command)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
ViewModel.WhenAnyValue(vm => vm.ReInferSettingsCommand)
|
||||
.BindToStrict(this, view => view.ReInferSettings.Command)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
ViewModel.WhenAnyValue(vm => vm.State)
|
||||
.Select(v => v == CompilerState.Configuration ? Visibility.Visible : Visibility.Collapsed)
|
||||
.BindToStrict(this, view => view.BottomCompilerSettingsGrid.Visibility)
|
||||
@ -142,6 +146,9 @@ namespace Wabbajack
|
||||
this.Bind(ViewModel, vm => vm.ModListName, view => view.ModListNameSetting.Text)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.SelectedProfile, view => view.SelectedProfile.Text)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.Author, view => view.AuthorNameSetting.Text)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
@ -212,6 +219,14 @@ namespace Wabbajack
|
||||
.DisposeWith(disposables);
|
||||
|
||||
AddInclude.Command = ReactiveCommand.CreateFromTask(async () => await AddIncludeCommand());
|
||||
|
||||
ViewModel.WhenAnyValue(vm => vm.Ignore)
|
||||
.WhereNotNull()
|
||||
.Select(itms => itms.Select(itm => new RemovableItemViewModel(itm.ToString(), () => ViewModel.RemoveIgnore(itm))).ToArray())
|
||||
.BindToStrict(this, view => view.Ignore.ItemsSource)
|
||||
.DisposeWith(disposables);
|
||||
|
||||
AddIgnore.Command = ReactiveCommand.CreateFromTask(async () => await AddIgnoreCommand());
|
||||
|
||||
|
||||
});
|
||||
@ -322,7 +337,7 @@ namespace Wabbajack
|
||||
{
|
||||
var dlg = new CommonOpenFileDialog
|
||||
{
|
||||
Title = "Please select a",
|
||||
Title = "Please select a file to include",
|
||||
IsFolderPicker = true,
|
||||
InitialDirectory = ViewModel!.Source.ToString(),
|
||||
AddToMostRecentlyUsedList = false,
|
||||
@ -343,5 +358,31 @@ namespace Wabbajack
|
||||
|
||||
ViewModel.AddInclude(selectedPath.RelativeTo(ViewModel!.Source));
|
||||
}
|
||||
|
||||
public async Task AddIgnoreCommand()
|
||||
{
|
||||
var dlg = new CommonOpenFileDialog
|
||||
{
|
||||
Title = "Please select a file to ignore",
|
||||
IsFolderPicker = true,
|
||||
InitialDirectory = ViewModel!.Source.ToString(),
|
||||
AddToMostRecentlyUsedList = false,
|
||||
AllowNonFileSystemItems = false,
|
||||
DefaultDirectory = ViewModel!.Source.ToString(),
|
||||
EnsureFileExists = true,
|
||||
EnsurePathExists = true,
|
||||
EnsureReadOnly = false,
|
||||
EnsureValidNames = true,
|
||||
Multiselect = false,
|
||||
ShowPlacesList = true,
|
||||
};
|
||||
|
||||
if (dlg.ShowDialog() != CommonFileDialogResult.Ok) return;
|
||||
var selectedPath = dlg.FileNames.First().ToAbsolutePath();
|
||||
|
||||
if (!selectedPath.InFolder(ViewModel.Source)) return;
|
||||
|
||||
ViewModel.AddIgnore(selectedPath.RelativeTo(ViewModel!.Source));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,9 @@
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="Modlist Location"
|
||||
Text="Compiler Settings"
|
||||
TextAlignment="Center"
|
||||
ToolTip="The MO2 modlist.txt file you want to use as your source" />
|
||||
ToolTip=".compiler_settings file, or select a modlist.txt to auto-detect the compiler settings" />
|
||||
<local:FilePicker
|
||||
x:Name="ModListLocation"
|
||||
Grid.Row="0" Grid.Column="2"
|
||||
|
@ -59,7 +59,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DynamicData" Version="7.9.7" />
|
||||
<PackageReference Include="DynamicData" Version="7.9.14" />
|
||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.4.0">
|
||||
<NoWarn>NU1701</NoWarn>
|
||||
</PackageReference>
|
||||
|
27
Wabbajack.Compiler/CompilationSteps/IgnoreTaggedFiles.cs
Normal file
27
Wabbajack.Compiler/CompilationSteps/IgnoreTaggedFiles.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.DTOs;
|
||||
using Wabbajack.DTOs.Directives;
|
||||
using Wabbajack.Paths;
|
||||
|
||||
namespace Wabbajack.Compiler.CompilationSteps;
|
||||
|
||||
public class IgnoreTaggedFiles : ACompilationStep
|
||||
{
|
||||
private readonly RelativePath[] _paths;
|
||||
|
||||
public IgnoreTaggedFiles(ACompiler compiler, RelativePath[] paths) : base(compiler)
|
||||
{
|
||||
_paths = paths;
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
if (!_paths.Any(tag => source.Path.InFolder(tag))) return null;
|
||||
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
result.Reason = "Patches ignore path";
|
||||
return result;
|
||||
}
|
||||
}
|
@ -60,6 +60,11 @@ public class CompilerSettings
|
||||
/// These files are inlined into the modlist
|
||||
/// </summary>
|
||||
public RelativePath[] Include { get; set; } = Array.Empty<RelativePath>();
|
||||
|
||||
/// <summary>
|
||||
/// These files are inlined into the modlist
|
||||
/// </summary>
|
||||
public RelativePath[] Ignore { get; set; } = Array.Empty<RelativePath>();
|
||||
|
||||
public RelativePath[] AlwaysEnabled { get; set; } = Array.Empty<RelativePath>();
|
||||
public Version Version { get; set; }
|
||||
|
@ -67,14 +67,14 @@ public class CompilerSettingsInferencer
|
||||
cs.Include = Array.Empty<RelativePath>();
|
||||
foreach (var file in mo2Folder.EnumerateFiles())
|
||||
{
|
||||
if (file.FileName == Consts.WABBAJACK_NOMATCH_INCLUDE_FILES)
|
||||
cs.NoMatchInclude = cs.NoMatchInclude.Add(file.Parent.RelativeTo(mo2Folder));
|
||||
|
||||
if (file.FileName.WithoutExtension().ToString() == Consts.WABBAJACK_INCLUDE)
|
||||
cs.Include = cs.Include.Add(file.Parent.RelativeTo(mo2Folder));
|
||||
|
||||
if (file.FileName.WithoutExtension().ToString() == Consts.WABBAJACK_NOMATCH_INCLUDE)
|
||||
cs.NoMatchInclude = cs.NoMatchInclude.Add(file.Parent.RelativeTo(mo2Folder));
|
||||
|
||||
if (file.FileName.WithoutExtension().ToString() == Consts.WABBAJACK_IGNORE)
|
||||
cs.Ignore = cs.Ignore.Add(file.Parent.RelativeTo(mo2Folder));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Finding Always Enabled mods");
|
||||
@ -99,6 +99,10 @@ public class CompilerSettingsInferencer
|
||||
if ((generalModData["notes"]?.Contains(Consts.WABBAJACK_INCLUDE) ?? false) ||
|
||||
(generalModData["comments"]?.Contains(Consts.WABBAJACK_INCLUDE) ?? false))
|
||||
cs.Include = cs.Include.Append(modFolder.RelativeTo(mo2Folder)).ToArray();
|
||||
|
||||
if ((generalModData["notes"]?.Contains(Consts.WABBAJACK_IGNORE) ?? false) ||
|
||||
(generalModData["comments"]?.Contains(Consts.WABBAJACK_IGNORE) ?? false))
|
||||
cs.Ignore = cs.Ignore.Append(modFolder.RelativeTo(mo2Folder)).ToArray();
|
||||
}
|
||||
|
||||
_logger.LogInformation("Finding other profiles");
|
||||
|
@ -26,8 +26,6 @@ public class Consts
|
||||
public static string WABBAJACK_ALWAYS_DISABLE = "WABBAJACK_ALWAYS_DISABLE";
|
||||
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
|
||||
public static string WABBAJACK_IGNORE = "WABBAJACK_IGNORE";
|
||||
public static RelativePath WABBAJACK_NOMATCH_INCLUDE_FILES = "WABBAJACK_NOMATCH_INCLUDE_FILES.txt".ToRelativePath();
|
||||
public static string WABBAJACK_IGNORE_FILES = "WABBAJACK_IGNORE_FILES.txt";
|
||||
public static string WABBAJACK_INCLUDE_SAVES = "WABBAJACK_INCLUDE_SAVES";
|
||||
|
||||
public static readonly HashSet<Extension> SupportedBSAs = new[] {".bsa", ".ba2"}
|
||||
|
@ -246,6 +246,7 @@ public class MO2Compiler : ACompiler
|
||||
new IgnoreGameFilesIfGameFolderFilesExist(this),
|
||||
//new IncludeSteamWorkshopItems(this),
|
||||
new IgnoreSaveFiles(this),
|
||||
new IgnoreTaggedFiles(this, Settings.Ignore),
|
||||
new IgnoreInPath(this, "logs".ToRelativePath()),
|
||||
new IgnoreInPath(this, "downloads".ToRelativePath()),
|
||||
new IgnoreInPath(this, "webcache".ToRelativePath()),
|
||||
|
@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.43" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.45" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2-mauipre.1.22054.8" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.43" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.45" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.2-mauipre.1.22054.8" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2-mauipre.1.22054.8" />
|
||||
</ItemGroup>
|
||||
|
@ -13,7 +13,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.43" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.45" />
|
||||
<PackageReference Include="MegaApiClient" Version="1.10.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2-mauipre.1.22054.8" />
|
||||
</ItemGroup>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<PackageReference Include="GameFinder.StoreHandlers.Origin" Version="1.8.0" />
|
||||
<PackageReference Include="GameFinder.StoreHandlers.Steam" Version="1.8.0" />
|
||||
<PackageReference Include="ini-parser-netstandard" Version="2.5.2" />
|
||||
<PackageReference Include="Octodiff" Version="1.3.15" />
|
||||
<PackageReference Include="Octodiff" Version="1.3.23" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.18" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.18" />
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="2.0.2" />
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
||||
<PackageReference Include="ReactiveUI.Fody" Version="18.3.1" />
|
||||
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="6.0.0" />
|
||||
|
@ -174,11 +174,16 @@ public class NexusApi
|
||||
var userAgent =
|
||||
$"{_appInfo.ApplicationSlug}/{_appInfo.Version} ({_appInfo.OSVersion}; {_appInfo.Platform})";
|
||||
|
||||
if (!ApiKey.HaveToken())
|
||||
throw new Exception("Please log into the Nexus before attempting to use Wabbajack");
|
||||
|
||||
var token = (await ApiKey.Get())!;
|
||||
|
||||
msg.RequestUri = new Uri($"https://api.nexusmods.com/{string.Format(uri, parameters)}");
|
||||
msg.Headers.Add("User-Agent", userAgent);
|
||||
msg.Headers.Add("Application-Name", _appInfo.ApplicationSlug);
|
||||
msg.Headers.Add("Application-Version", _appInfo.Version);
|
||||
msg.Headers.Add("apikey", (await ApiKey.Get())!.ApiKey);
|
||||
msg.Headers.Add("apikey", token.ApiKey);
|
||||
msg.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
return msg;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public struct RelativePath : IPath, IEquatable<RelativePath>, IComparable<Relati
|
||||
return new AbsolutePath(newArray, basePath.PathFormat);
|
||||
}
|
||||
|
||||
public bool InFolder(RelativePath parent)
|
||||
public readonly bool InFolder(RelativePath parent)
|
||||
{
|
||||
return ArrayExtensions.AreEqualIgnoreCase(parent.Parts, 0, Parts, 0, parent.Parts.Length);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentFTP" Version="39.3.0" />
|
||||
<PackageReference Include="FluentFTP" Version="39.4.0" />
|
||||
<PackageReference Include="Nettle" Version="1.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
<PackageReference Include="Chronic.Core" Version="0.4.0" />
|
||||
<PackageReference Include="Dapper" Version="2.0.123" />
|
||||
<PackageReference Include="Discord.Net.WebSocket" Version="3.7.2" />
|
||||
<PackageReference Include="FluentFTP" Version="39.3.0" />
|
||||
<PackageReference Include="FluentFTP" Version="39.4.0" />
|
||||
<PackageReference Include="GitInfo" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Core" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.8" />
|
||||
|
Loading…
Reference in New Issue
Block a user