-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed: Building NMA with System Extractor #1919
Conversation
With respects to building, you can't modify |
src/ArchiveManagement/NexusMods.FileExtractor/Extractors/SevenZipExtractor.cs
Show resolved
Hide resolved
src/ArchiveManagement/NexusMods.FileExtractor/build/NexusMods.FileExtractor.targets
Outdated
Show resolved
Hide resolved
@@ -221,9 +228,24 @@ private static string GetExtractorExecutable(IFileSystem fileSystem) | |||
/// See https://github.com/Nexus-Mods/NexusMods.App/issues/1306 for details. | |||
/// </remarks> | |||
private const bool UseSystemExtractor = | |||
#if USE_SYSTEM_EXTRACTOR | |||
#if NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR || USE_SYSTEM_EXTRACTOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should only be one constant. Either NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR
or USE_SYSTEM_EXTRACTOR
, not both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Speaking as a downstream packager, I'm fine with these kinda changes being done in a breaking way so long as the docs get updated and the change is mentioned in release notes.
Packagers shouldn't be surprised when experimental software has breaking changes 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should've only been one compile constant in the beginning, which is NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR
. I still don't understand what caused #1836.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should've only been one compile constant in the beginning, which is
NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR
.
Ah yes, that's what I was using. I got confused as the diff made it look like NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR
was a new constant replacing USE_SYSTEM_EXTRACTOR
. Should've double checked before commenting!
I don't fully understand the solution, but this seems relevant #1919 (comment):
So we can't do an alias by appending
DefineConstants
in the.csproj
or.targets
file. Instead I alias by checking both define names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erri120 themselves originally added both USE_SYSTEM_EXTRACTOR and NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR.
Due to how they were used in the .targets
file, I assumed it was meant to be an alias.
I kept this alias in the PR; should I not have done that?
AFAIK downstreams only use NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR
and not USE_SYSTEM_EXTRACTOR
, so the latter is safe to remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't understand what caused #1836.
@erri120 Setting DefineConstants
via CLI acts as an 'absolute override', i.e. any changes you make to them, in .csproj
, .targets
or otherwise get discarded. So USE_SYSTEM_EXTRACTOR
was not being applied if conditionally set.
And aside from that _UseSystemExtractor
wasn't even being determined properly, so binaries were always copied to output even when they should not have been.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting
DefineConstants
via CLI acts as an 'absolute override', i.e. any changes you make to them, in.csproj
,.targets
or otherwise get discarded.
Possibly out of scope for this PR, but is that a possible justification for moving to the pattern described in NixOS/nixpkgs#331150 (comment)?
I.e:
<PropertyGroup Condition="$(UseSystemExtractor) == 'true'">
<DefineConstants>$(DefineConstants);NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR</DefineConstants>
</PropertyGroup>
Paired with dotnet build -p:UseSystemExtractor=true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would prefer it that way, after (re)discovering more of the nature in how DefineConstants
interacts with the rest of the build system.
Update: We'll be avoiding static bundling in the future; will check dependencies at runtime and emit a health check/diagnostic. For downstream's convenience, this is merged for now. |
CC @MattSturgeon
I got some time to kill end of sprint.
This fixes the behaviour of
NEXUSMODS_APP_USE_SYSTEM_EXTRACTOR
to correctly function.I can verify the following:
7zz
in output directoryIn addition, I have altered the code to also account for system binaries possibly being called
7z
and7zzs
.(Note: On my Arch system, the AUR package renames it to
7z
from7zz
in original download)The code does a lookup of
$PATH
, and determines the appropriate binary based on whatever it can find first.fixes #1836