Skip to content

Commit

Permalink
[tests] enable One .NET tests for F#
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonathanpeppers committed Aug 21, 2020
1 parent 53ec311 commit 689dc7e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ variables:
# - This is a non-fork branch with name containing "mono-" (for Mono bumps)
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-')))]
RunAllTests: $[or(eq(variables['XA.RunAllTests'], true), eq(variables['IsMonoBranch'], true))]
DotNetNUnitCategories: '& TestCategory != DotNetIgnore & TestCategory != AOT & TestCategory != FSharp & TestCategory != LibraryProjectZip & TestCategory != MkBundle & TestCategory != MonoSymbolicate & TestCategory != PackagesConfig & TestCategory != StaticProject'
DotNetNUnitCategories: '& TestCategory != DotNetIgnore & TestCategory != AOT & TestCategory != LibraryProjectZip & TestCategory != MkBundle & TestCategory != MonoSymbolicate & TestCategory != PackagesConfig & TestCategory != StaticProject'

# Stage and Job "display names" are shortened because they are combined to form the name of the corresponding GitHub check.
stages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,13 @@ public static void AddDotNetCompatPackages (this IShortFormProject project)
},
}
};
public static Package Xamarin_Android_FSharp_ResourceProvider_Runtime = new Package {
public static Package Xamarin_Android_FSharp_ResourceProvider = new Package {
Id = "Xamarin.Android.FSharp.ResourceProvider",
Version = "1.0.0.28",
TargetFramework = "monoandroid71",
Version = "1.0.1",
TargetFramework = "monoandroid81",
References = {
new BuildItem.Reference ("Xamarin.Android.FSharp.ResourceProvider.Runtime") {
MetadataValues = "HintPath=..\\packages\\Xamarin.Android.FSharp.ResourceProvider.1.0.0.28\\lib\\Xamarin.Android.FSharp.ResourceProvider.Runtime.dll"
MetadataValues = "HintPath=..\\packages\\Xamarin.Android.FSharp.ResourceProvider.1.0.1\\lib\\monoandroid81\\Xamarin.Android.FSharp.ResourceProvider.Runtime.dll"
},
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,14 @@ public override ProjectLanguage Language {
// add the stuff needed for FSharp
References.Add (new BuildItem.Reference ("System.Numerics"));
PackageReferences.Add (KnownPackages.FSharp_Core_Latest);
PackageReferences.Add (KnownPackages.Xamarin_Android_FSharp_ResourceProvider_Runtime);
PackageReferences.Add (KnownPackages.Xamarin_Android_FSharp_ResourceProvider);
Sources.Remove (resourceDesigner);
OtherBuildItems.Add (new BuildItem.NoActionResource (() => "Resources\\Resource.designer" + Language.DefaultDesignerExtension) { TextContent = () => string.Empty });

// NOTE: workaround for https://github.com/dotnet/sdk/issues/12954
if (Builder.UseDotNet) {
SetProperty ("ProduceReferenceAssembly", "false");
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
</Target>

<Target Name="_RemoveLegacyDesigner"
Condition=" '$(AndroidUseIntermediateDesignerFile)' == 'true' and '$(ManagedDesignTimeBuild)' != 'true' ">
Condition=" '$(Language)' == 'C#' and '$(AndroidUseIntermediateDesignerFile)' == 'true' and '$(ManagedDesignTimeBuild)' != 'true' ">
<ItemGroup>
<CorrectCasedItem Include="%(Compile.Identity)" Condition="'%(Compile.Identity)' == '$(AndroidResgenFile)'"/>
<Compile Remove="@(CorrectCasedItem)" Condition=" '$(AndroidResgenFile)' != '' "/>
Expand Down

0 comments on commit 689dc7e

Please sign in to comment.