Skip to content

Commit c025a42

Browse files
committed
Fixlet + register scan results
1 parent 403e4c4 commit c025a42

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,12 @@ void Run (bool useMarshalMethods)
209209
generateSucceeded = false;
210210
}
211211

212-
(success, List<PinvokeScanner.PinvokeEntryInfo> pinfos) = ScanForUsedPinvokes (scanner, arch, state.Resolver);
213-
if (!success) {
214-
return;
212+
if (EnableNativeRuntimeLinking) {
213+
(success, List<PinvokeScanner.PinvokeEntryInfo> pinfos) = ScanForUsedPinvokes (scanner, arch, state.Resolver);
214+
if (!success) {
215+
return;
216+
}
217+
BuildEngine4.RegisterTaskObjectAssemblyLocal (ProjectSpecificTaskObjectKey (PinvokeScanner.PinvokesInfoRegisterTaskKey), pinfos, RegisteredTaskObjectLifetime.Build);
215218
}
216219

217220
// If this is the first architecture, we need to store the state for later use
@@ -371,10 +374,10 @@ IList<string> MergeManifest (NativeCodeGenState codeGenState, Dictionary<string,
371374
return additionalProviders;
372375
}
373376

374-
(bool success, List<PinvokeScanner.PinvokeEntryInfo> pinfos) ScanForUsedPinvokes (PinvokeScanner scanner, AndroidTargetArch arch, XAAssemblyResolver resolver)
377+
(bool success, List<PinvokeScanner.PinvokeEntryInfo>? pinfos) ScanForUsedPinvokes (PinvokeScanner scanner, AndroidTargetArch arch, XAAssemblyResolver resolver)
375378
{
376379
if (!EnableNativeRuntimeLinking) {
377-
return;
380+
return (true, null);
378381
}
379382

380383
var frameworkAssemblies = new List<ITaskItem> ();

src/Xamarin.Android.Build.Tasks/Utilities/PinvokeScanner.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ namespace Xamarin.Android.Tasks;
1414

1515
class PinvokeScanner
1616
{
17+
public const string PinvokesInfoRegisterTaskKey = ".:!PreservePinvokesTaskKey!:.";
18+
1719
public sealed class PinvokeEntryInfo
1820
{
1921
public readonly string LibraryName;

0 commit comments

Comments
 (0)