-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tests] Reworks tests to use msbuild. #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2efd5ba to
beb6cbd
Compare
291a049 to
9f9d2ac
Compare
| public string AssemblyIdentityMapFile { get; set; } | ||
|
|
||
| public string CacheFile { get; set;} | ||
| public string CacheFile { get; set;} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace change?
|
What's troubling is that in getting the tests to "use msbuild," what the tests are asserting is changing. ...yet they're still passing, both before and after this change. I am confused. :-/ |
| /* optimize */ true , | ||
| /* embedassebmlies */ true , | ||
| /* expectedResult */ "debug", | ||
| /* expectedResult */ "release", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. here we go from expecting "debug" to "release". How is this related to using msbuild? Why's this still pass under xbuild?
| new object[] { "", false, true, }, | ||
| new object[] { "None", true, false, }, | ||
| new object[] { "None", false, false, }, | ||
| new object[] { "None", false, true, }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess this hits ManifestTest.DebuggerAttribute():
if (!isRelease && debugType == "None" && !builder.RunningMSBuild)
expected = falseThat still seems odd. Why would the presence/absence of DebuggerAttribute depend on xbuild vs. msbuild?
| return Builder.LastBuildOutput.Contains (string.Format ("Target {0} skipped due to ", target)) | ||
| || Builder.LastBuildOutput.Contains (string.Format ("Skipping target \"{0}\" because its outputs are up-to-date", target)) | ||
| || Builder.LastBuildOutput.Contains ($"Skipping target \"{target}\" because all output files are up-to-date"); | ||
| || Builder.LastBuildOutput.Contains (string.Format ("Skipping target \"{0}\" because it has no outputs.", target)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs to be addressed in this PR, but I have to wonder...
Builder.LastBuildOutput is a string which contains the msbuild /v:diag build output, which could be many megabytes in size, right? And this is doing possibly 5 linear searches against that output.
How does that perform?
Would...regular expressions be better?
var toMatch = new[]{
$"Skipping target \"{target}\" because it has no outputs.",
$"Target \"{target}\" skipped, due to",
$"Skipping target \"{target}\" because its outputs are up-to-date",
$"target {target}, skipping",
$"Skipping target \"{target}\" because all output files are up-to-date",
};
var r = new Regex (string.Join ("|", toMatch));
var m = r.Match (Builder.LastBuildOutput);
return m.Success;| if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("USE_MSBUILD"))) { | ||
| RunningMSBuild = true; | ||
| RunningMSBuild = true; | ||
| if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("USE_XBUILD"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we stick with $USE_MSBUILD for now, and when $USE_MSBUILD is unset or 0 we assume xbuild
Eventually we'll make msbuild the default everywhere, and then it might -- might -- make sense to use $USE_XBUILD instead of $USE_MSBUILD...but now?
|
@jonpryor I was going to cover that in the commit message once this works (its broken again since the xabuild.exe updates). The problem is a difference in behaviour between Under However.... under This is because |
430cde4 to
8ea920b
Compare
This commit reworks the tests to work on msbuild by default. xbuild is deprecated, so we should ensure that our system works 100% on msbuild. So allot of changes in the system here. The hightlights are We have to NOT use `BuildingInsideVisualStudio` when building under `msbuild`. Setting this property to `true` has a side effect of telling `msbuild` .. "Dont bother to build ProjectReferences". This is because under VS that is something the IDE takes care of. It turns out that the bug we had to do with `__NonExistantFile__` causing the `csc` task to run ALL the time was fixed. All of the `IsTargetSkipped` checks have been unified to call `IsTargetSkipped` method out BuildOutput. It has also been updated to include more target "skipped" formats which xbuild and msbuild supports. There is also a difference in behaviour between xbuild and msbuild. You may well have noticed that ALL the tests that have had the "debug" -> "release" changes (including the debugger attribute one) are around $(DebugType) == "None" Under xbuild when $(DebugType) == "None" and $(DebugSymbols) == "True" we end up with $(DebugType) == "None" and $(DebugSymbols) == "True". Which results in a debug runtime and apk. However.... under msbuild when $(DebugType) == "None" and $(DebugSymbols) == "True" we end up with $(DebugType) == "portable" and $(DebugSymbols) == "False".. so we get a release runtime and apk. This is because None is NOT a valid value for $(DebugType) in msbuild, so it resets BOTH $(DebugType) and $(DebugSymbols). So we have a difference of behaviour between the two systems. So in this commit we check for $(DebugType) == "None" and change it and $(DebugSymbols) to match the msbuild behaviour. This will probably break some QA tests.. but this is expected and the tests should be updated to reflect this.
c0e66c0 to
5e83e5d
Compare
This commit reworks the tests to pass on MSBuild. xbuild is deprecated, so we should ensure that our system works on MSBuild. Lots of changes. Highlights include: We have to NOT use `$(BuildingInsideVisualStudio)` when building under `msbuild`. Setting this property to `true` has a side effect of telling `msbuild` "Dont bother to build @(ProjectReferences)". This is because under VS that is something the IDE takes care of. It turns out that the bug we had to do with `__NonExistantFile__` causing the `csc` task to run ALL the time was fixed. All of the `IsTargetSkipped` checks have been unified to call the `BuildOutput.IsTargetSkipped()` method. It has also been updated to include more target "skipped" formats which xbuild and MSBuild generate. There is also a difference in behaviour between xbuild and MSBuild. You may well have noticed that ALL the tests that have had the "debug" -> "release" changes (including the debugger attribute one) are around $(DebugType) == "None" Under xbuild when `$(DebugType)` == "None" and `$(DebugSymbols)` == "True", we end up with `$(DebugType)` == "None" and `$(DebugSymbols)` == "True" (no changes). This results in a debug runtime and apk. However, under MSBuild when `$(DebugType)` == "None" and `$(DebugSymbols)` == "True" we end up with `$(DebugType)` == "portable" and `$(DebugSymbols)` == "False" (!). This results in a release runtime and apk. This is because `None` is NOT a valid value for `$(DebugType)` in MSBuild, so it resets BOTH `$(DebugType)` and `$(DebugSymbols)`. This results in difference of behaviour between the two systems. Update `Xamarin.Android.Common.targets` to check for this, and update `$(DebugType)` and `$(DebugSymbols)` so that xbuild behaves like MSBuild. This improves consistency (and our own sanity!). (This may break some QA tests, but this is now expected and the tests should be updated to reflect this.)
Fixes: dotnet/java-interop#857 Changes: dotnet/java-interop@087684a...0293360 * dotnet/java-interop@0293360a: [Xamarin.Android.Tools.Bytecode] NRT Support (dotnet#913) * dotnet/java-interop@e85564c1: [generator] Import NRT data from managed assemblies (dotnet#912) * dotnet/java-interop@c476cc39: [ci] Update to use VS2022 build agents (dotnet#914)
Fixes: dotnet/java-interop#857 Changes: dotnet/java-interop@087684a...0293360 * dotnet/java-interop@0293360a: [Xamarin.Android.Tools.Bytecode] NRT Support (#913) * dotnet/java-interop@e85564c1: [generator] Import NRT data from managed assemblies (#912) * dotnet/java-interop@c476cc39: [ci] Update to use VS2022 build agents (#914)
This commit reworks the tests to work on msbuild by default.
xbuild is deprecated, so we should ensure that our system works
100% on msbuild.
So allot of changes in the system here. The hightlights are
We have to NOT use
BuildingInsideVisualStudiowhen buildingunder
msbuild. Setting this property totruehas a side effectof telling
msbuild.. "Dont bother to build ProjectReferences".This is because under VS that is something the IDE takes care of.
It turns out that the bug we had to do with
__NonExistantFile__causing the
csctask to run ALL the time was fixed.All of the
IsTargetSkippedchecks have been unified to callIsTargetSkippedmethod out BuildOutput. It has also been updatedto include more target "skipped" formats which xbuild and msbuild
supports.
There is also a difference in behaviour between xbuild and msbuild.
You may well have noticed that ALL the tests that have had the
changes (including the debugger attribute one) are around
Under xbuild when$(DebugType) == "None" and $ (DebugSymbols) == "True"$(DebugType) == "None" and $ (DebugSymbols) == "True".
we end up with
Which results in a debug runtime and apk.
However.... under msbuild when $(DebugType) == "None"$(DebugSymbols) == "True" we end up with $ (DebugType) == "portable"
and
and $(DebugSymbols) == "False".. so we get a release runtime and apk.
This is because None is NOT a valid value for $(DebugType) in msbuild,$(DebugType) and $ (DebugSymbols). So we have a
so it resets BOTH
difference of behaviour between the two systems.
So in this commit we check for $(DebugType) == "None" and change it
and $(DebugSymbols) to match the msbuild behaviour. This will probably
break some QA tests.. but this is expected and the tests should be
updated to reflect this.