-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tests] Switch over to use the latest Nuget. #566
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
| Directories="$(_NuGetPath)" | ||
| /> | ||
| <DownloadUri | ||
| ContinueOnError="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.
Do we actually want to continue on error? If the URL can't be downloaded, will tests actually execute? Will things "work"?
| } | ||
| var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT; | ||
| var psi = new ProcessStartInfo (isWindows ? "NuGet.exe" : "mono"); | ||
| psi.Arguments = $"{(isWindows ? "" : Path.Combine (Root,"NuGet.exe"))} restore -PackagesDirectory {Path.Combine (Root, directory, "..", "packages")} {Path.Combine (Root, directory, "packages.config")}"; |
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.
Quote paths! :-)
I'd also suggest making this an initializer expression:
var psi = new ProcessStartInfo (...) {
Arguments = ...,
};We are starting to see Nuget packages only be available from the v3 repositories. Our tests are using Nuget.Core v2. But Nuget v3 does not have the same API as v2 if you want to manually restore packages. In fact the api is "unstable" and it not simple to use. What was a couple of lines of code now has to be a mess of subclasses and other support files. The Nuget for those have also exploded into a mass of 24+ packages. So easiest solution is to download the latest nuget.exe client from nuget.org. This means it is (or should be) up to date and will work with both v2 and v3. Rather than calling the API manually for the unit tests we just shell out to restore the packages.
Context: dotnet/java-interop@8f30933 Changes: dotnet/java-interop@3226a4b...8f30933 * dotnet/java-interop@8f30933: [generator] Mark some Obsolete fields as errors (#568) * dotnet/java-interop@47201c4: [generator] Change protected members in final class to private (#569) * dotnet/java-interop@c5815fb: [generator] Be smarter about when members with same names need "new" (#567) * dotnet/java-interop@bfc0273: [generator] Ensure property setter parameter name is "value" (#566) This Java.Interop bump includes two changes which "break" API: * Certain fields are changed from `[Obsolete]` to `[Obsolete(error:true)]`, turning *use* of the field within C# code into a CS0619 error. * The C# compiler has long warned about the presence of `protected` members within `sealed` types, as they cannot be used. However, they were still emitted, resulting in CS0628 warnings when compiling `Mono.Android.dll`. We consider changing `[Obsolete]` to `[Obsolete(error:true)]` to be acceptable because this is being done to `const` fields, so this won't break ABI, as there are no IL references to `const` fields, and because (1) there are "replacement" members which can be used, and (2) these fields have been obsolete for *years*. The "problem" here is that `Microsoft.DotNet.ApiCompat.exe`, which the `<CheckApiCompatibility/>` task uses from `src/Mono.Android/Mono.Android.targets`, sees every such change as an API break. This in and of itself is plausibly sensible, but the error message *itself* is bananas, e.g.: namespace Android.AccessibilityServices { public abstract partial class AccessibilityService : Android.App.Service { [Register ("GESTURE_SWIPE_DOWN", ApiSince = 16)] [Obsolete ("This constant will be removed in the future version. Use Android.AccessibilityServices.AccessibilityGesture enum directly instead of this field.", error: true)] public const Android.AccessibilityServices.AccessibilityGesture GestureSwipeDown = (Android.AccessibilityServices.AccessibilityGesture) 2; } } results in: CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'Android.AccessibilityServices.AccessibilityGesture Android.AccessibilityServices.AccessibilityService.GestureSwipeDown' in the contract but not the implementation. The message implies that `[Obsolete]` was removed, which isn't strictly true! `[Obsolete]` is still there! It's just that the constructor parameters have changed. This results in a ginormous change to `tests/api-compatibility/acceptable-breakages-vReference.txt`. The "`protected` members within `sealed` types" fix for CS0628 also resulted in errors from the Tests > API Compatibility job, which runs via `external/xamarin-android-api-compatibility`. Given that commit 07e7477 was intended to *replace* the Tests > API Compatibility job, *remove* the `external/xamarin-android-api-compatibility` submodule reference. We will no longer be using that submodule for API compat checks. Co-authored-by: Jonathan Pobst <monkey@jpobst.com>
Context: dotnet/java-interop@8f30933 Changes: dotnet/java-interop@423e27f...fefe0ca * dotnet/java-interop@fefe0ca: [generator] Mark some Obsolete fields as errors (#568) * dotnet/java-interop@d969a0c: [generator] Change protected members in final class to private (#569) * dotnet/java-interop@3c4accf: [generator] Be smarter about when members with same names need "new" (#567) * dotnet/java-interop@41b87d0: [generator] Ensure property setter parameter name is "value" (#566) This Java.Interop bump includes two changes which "break" API: * Certain fields are changed from `[Obsolete]` to `[Obsolete(error:true)]`, turning *use* of the field within C# code into a CS0619 error. * The C# compiler has long warned about the presence of `protected` members within `sealed` types, as they cannot be used. However, they were still emitted, resulting in CS0628 warnings when compiling `Mono.Android.dll`. We consider changing `[Obsolete]` to `[Obsolete(error:true)]` to be acceptable because this is being done to `const` fields, so this won't break ABI, as there are no IL references to `const` fields, and because (1) there are "replacement" members which can be used, and (2) these fields have been obsolete for *years*. The "problem" here is that `Microsoft.DotNet.ApiCompat.exe`, which the `<CheckApiCompatibility/>` task uses from `src/Mono.Android/Mono.Android.targets`, sees every such change as an API break. This in and of itself is plausibly sensible, but the error message *itself* is bananas, e.g.: namespace Android.AccessibilityServices { public abstract partial class AccessibilityService : Android.App.Service { [Register ("GESTURE_SWIPE_DOWN", ApiSince = 16)] [Obsolete ("This constant will be removed in the future version. Use Android.AccessibilityServices.AccessibilityGesture enum directly instead of this field.", error: true)] public const Android.AccessibilityServices.AccessibilityGesture GestureSwipeDown = (Android.AccessibilityServices.AccessibilityGesture) 2; } } results in: CannotRemoveAttribute : Attribute 'System.ObsoleteAttribute' exists on 'Android.AccessibilityServices.AccessibilityGesture Android.AccessibilityServices.AccessibilityService.GestureSwipeDown' in the contract but not the implementation. The message implies that `[Obsolete]` was removed, which isn't strictly true! `[Obsolete]` is still there! It's just that the constructor parameters have changed. This results in a ginormous change to `tests/api-compatibility/acceptable-breakages-vReference.txt`. The "`protected` members within `sealed` types" fix for CS0628 also resulted in errors from the Tests > API Compatibility job, which runs via `external/xamarin-android-api-compatibility`. Given that commit 07e7477 was intended to *replace* the Tests > API Compatibility job, *remove* the `external/xamarin-android-api-compatibility` submodule reference. We will no longer be using that submodule for API compat checks. Co-authored-by: Jonathan Pobst <monkey@jpobst.com>
We are starting to see Nuget packages only be available
from the v3 repositories. Our tests are using Nuget.Core v2.
But Nuget v3 does not have the same API as v2 if you want to
manually restore packages. In fact the api is "unstable" and it
not simple to use. What was a couple of lines of code now has to
be a mess of subclasses and other support files. The Nuget for
those have also exploded into a mass of 24+ packages.
So easiest solution is to download the latest nuget.exe client
from nuget.org. This means it is (or should be) up to date
and will work with both v2 and v3. Rather than calling the API
manually for the unit tests we just shell out to restore the
packages.