jextract: Evaluate IfConfigDecl and add --static-build-config option#671
jextract: Evaluate IfConfigDecl and add --static-build-config option#671sidepelican wants to merge 13 commits intoswiftlang:mainfrom
Conversation
Sources/JExtractSwiftLib/JExtractDefaultBuildConfiguration.swift
Outdated
Show resolved
Hide resolved
Sources/JExtractSwiftLib/JExtractDefaultBuildConfiguration.swift
Outdated
Show resolved
Hide resolved
| expectedChunks: [ | ||
| "public static void androidFunc()", | ||
| "public final class CannotImport", | ||
| "public final class IsNotDebug", |
There was a problem hiding this comment.
nice, that's what I would expect here
ktoso
left a comment
There was a problem hiding this comment.
Looks great, minor concerns about the big features json... I'd rather we don't have to commit that. We may have to NOT have a .shared at all and just compute this during generation instead
Co-authored-by: Konrad `ktoso` Malawski <konrad.malawski@project13.pl>
|
@ktoso The new BuildToolsPlugin now allows running It uses a global |
|
Is the Android CI having some trouble at the moment? |
|
Yeah we should do a 6.3 job, I'll follow up on it |
|
Great addition! Could we perhaps add some docs about this feature? |
|
Docs would be good about this, it's worth understanding how this works. I'm offline this evening already, can merge in the morning |
IfConfigDeclfor simple patterns #633It seems difficult for the
jextractplugin to reliably execute-print-static-build-config.Instead, this PR embeds a fixed
JExtractDefaultBuildConfiguration.The policy for this fixed configuration is to resolve the widest possible range of
#ifconditions.This approach introduces a risk where
jextractmight generate code for functions that are not actually present in the loaded Swift library, which would result in a runtime error.However, I believe providing access to these functions by default is more useful than having them be completely unavailable.
To support cases where a specific configuration is required, I have added a
--static-build-config <filepath>option tojextract.This allows users to provide their own generated JSON file to customize the
BuildConfiguration.