Skip to content

Commit 689dc7e

Browse files
[tests] enable One .NET tests for F#
Context: xamarin/Xamarin.Android.FSharp.ResourceProvider#6 Xamarin.Android.FSharp.ResourceProvider 1.0.1 is now built for `netstandard2.0` and published to an internal feed. We should be able to enable F# tests under a `dotnet` context now. The `_RemoveLegacyDesigner` MSBuild target was running, when it shouldn't be for F# projects and adding a `Resource.designer.cs` `@(Compile)` item. I needed to add a `$(Language)` check. One workaround is for: dotnet/sdk#12954 We need to set `$(ProduceReferenceAssembly)` to `false` for .NET 5 F# projects at the moment.
1 parent 53ec311 commit 689dc7e

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

build-tools/automation/azure-pipelines.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ variables:
6363
# - This is a non-fork branch with name containing "mono-" (for Mono bumps)
6464
IsMonoBranch: $[and(eq(variables['XA.Commercial.Build'], 'true'), ne(variables['System.PullRequest.IsFork'], 'True'), or(contains(variables['Build.SourceBranchName'], 'mono-'), contains(variables['System.PullRequest.SourceBranch'], 'mono-')))]
6565
RunAllTests: $[or(eq(variables['XA.RunAllTests'], true), eq(variables['IsMonoBranch'], true))]
66-
DotNetNUnitCategories: '& TestCategory != DotNetIgnore & TestCategory != AOT & TestCategory != FSharp & TestCategory != LibraryProjectZip & TestCategory != MkBundle & TestCategory != MonoSymbolicate & TestCategory != PackagesConfig & TestCategory != StaticProject'
66+
DotNetNUnitCategories: '& TestCategory != DotNetIgnore & TestCategory != AOT & TestCategory != LibraryProjectZip & TestCategory != MkBundle & TestCategory != MonoSymbolicate & TestCategory != PackagesConfig & TestCategory != StaticProject'
6767

6868
# Stage and Job "display names" are shortened because they are combined to form the name of the corresponding GitHub check.
6969
stages:

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownPackages.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,13 +426,13 @@ public static void AddDotNetCompatPackages (this IShortFormProject project)
426426
},
427427
}
428428
};
429-
public static Package Xamarin_Android_FSharp_ResourceProvider_Runtime = new Package {
429+
public static Package Xamarin_Android_FSharp_ResourceProvider = new Package {
430430
Id = "Xamarin.Android.FSharp.ResourceProvider",
431-
Version = "1.0.0.28",
432-
TargetFramework = "monoandroid71",
431+
Version = "1.0.1",
432+
TargetFramework = "monoandroid81",
433433
References = {
434434
new BuildItem.Reference ("Xamarin.Android.FSharp.ResourceProvider.Runtime") {
435-
MetadataValues = "HintPath=..\\packages\\Xamarin.Android.FSharp.ResourceProvider.1.0.0.28\\lib\\Xamarin.Android.FSharp.ResourceProvider.Runtime.dll"
435+
MetadataValues = "HintPath=..\\packages\\Xamarin.Android.FSharp.ResourceProvider.1.0.1\\lib\\monoandroid81\\Xamarin.Android.FSharp.ResourceProvider.Runtime.dll"
436436
},
437437
}
438438
};

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XamarinAndroidCommonProject.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,14 @@ public override ProjectLanguage Language {
8686
// add the stuff needed for FSharp
8787
References.Add (new BuildItem.Reference ("System.Numerics"));
8888
PackageReferences.Add (KnownPackages.FSharp_Core_Latest);
89-
PackageReferences.Add (KnownPackages.Xamarin_Android_FSharp_ResourceProvider_Runtime);
89+
PackageReferences.Add (KnownPackages.Xamarin_Android_FSharp_ResourceProvider);
9090
Sources.Remove (resourceDesigner);
9191
OtherBuildItems.Add (new BuildItem.NoActionResource (() => "Resources\\Resource.designer" + Language.DefaultDesignerExtension) { TextContent = () => string.Empty });
92+
93+
// NOTE: workaround for https://github.com/dotnet/sdk/issues/12954
94+
if (Builder.UseDotNet) {
95+
SetProperty ("ProduceReferenceAssembly", "false");
96+
}
9297
}
9398
}
9499
}

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
487487
</Target>
488488

489489
<Target Name="_RemoveLegacyDesigner"
490-
Condition=" '$(AndroidUseIntermediateDesignerFile)' == 'true' and '$(ManagedDesignTimeBuild)' != 'true' ">
490+
Condition=" '$(Language)' == 'C#' and '$(AndroidUseIntermediateDesignerFile)' == 'true' and '$(ManagedDesignTimeBuild)' != 'true' ">
491491
<ItemGroup>
492492
<CorrectCasedItem Include="%(Compile.Identity)" Condition="'%(Compile.Identity)' == '$(AndroidResgenFile)'"/>
493493
<Compile Remove="@(CorrectCasedItem)" Condition=" '$(AndroidResgenFile)' != '' "/>

0 commit comments

Comments
 (0)