Skip to content

Commit

Permalink
Fixlet + register scan results
Browse files Browse the repository at this point in the history
  • Loading branch information
grendello committed Jun 27, 2024
1 parent 482159f commit 9fc5594
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,12 @@ void Run (bool useMarshalMethods)
return;
}

(success, List<PinvokeScanner.PinvokeEntryInfo> pinfos) = ScanForUsedPinvokes (scanner, arch, state.Resolver);
if (!success) {
return;
if (EnableNativeRuntimeLinking) {
(success, List<PinvokeScanner.PinvokeEntryInfo> pinfos) = ScanForUsedPinvokes (scanner, arch, state.Resolver);
if (!success) {
return;
}
BuildEngine4.RegisterTaskObjectAssemblyLocal (ProjectSpecificTaskObjectKey (PinvokeScanner.PinvokesInfoRegisterTaskKey), pinfos, RegisteredTaskObjectLifetime.Build);
}

if (generateJavaCode) {
Expand Down Expand Up @@ -357,10 +360,10 @@ IList<string> MergeManifest (NativeCodeGenState codeGenState, Dictionary<string,
return additionalProviders;
}

(bool success, List<PinvokeScanner.PinvokeEntryInfo> pinfos) ScanForUsedPinvokes (PinvokeScanner scanner, AndroidTargetArch arch, XAAssemblyResolver resolver)
(bool success, List<PinvokeScanner.PinvokeEntryInfo>? pinfos) ScanForUsedPinvokes (PinvokeScanner scanner, AndroidTargetArch arch, XAAssemblyResolver resolver)
{
if (!EnableNativeRuntimeLinking) {
return;
return (true, null);
}

var frameworkAssemblies = new List<ITaskItem> ();
Expand Down
2 changes: 2 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Utilities/PinvokeScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace Xamarin.Android.Tasks;

class PinvokeScanner
{
public const string PinvokesInfoRegisterTaskKey = ".:!PreservePinvokesTaskKey!:.";

public sealed class PinvokeEntryInfo
{
public readonly string LibraryName;
Expand Down

0 comments on commit 9fc5594

Please sign in to comment.