Skip to content
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

[build] fixes for failing Windows build #2368

Merged
merged 1 commit into from
Nov 2, 2018

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Nov 1, 2018

Context: #2019
Context: http://build.devdiv.io/2168276
Context: http://build.devdiv.io/2169681

Since 4bb4b2e, our builds have been failing on VSTS on Windows.
Jenkins is green, however.

Currently getting a failure in
Xamarin.Android.LibraryProjectZip-LibBinding.csproj such as:

2018-10-31T14:02:28.8336608Z    .\gradlew assembleDebug --stacktrace --no-daemon
2018-10-31T14:02:40.7122197Z   NDK is missing a "platforms" directory.
2018-10-31T14:02:40.7122937Z   If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to C:\Users\dlab14\android-toolchain\sdk\ndk-bundle.
2018-10-31T14:02:40.7124870Z   If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

It doesn't really make sense to me why this started happening with
d8/r8 support... The ~\android-toolchain\sdk\ndk-bundle path seems
completely wrong.

However, it looks like we should be setting
ANDROID_NDK_HOME=$(AndroidNdkDirectory).

After that change, we got a new error:

2018-10-31T17:19:30.1558223Z   Checking the license for package Android SDK Build-Tools 25.0.2 in C:\Users\dlab14\android-toolchain\sdk\licenses
2018-10-31T17:19:30.1562674Z EXEC : warning : License for package Android SDK Build-Tools 25.0.2 not accepted. [E:\A\_work\14\s\tests\CodeGen-Binding\Xamarin.Android.LibraryProjectZip-LibBinding\Xamarin.Android.LibraryProjectZip-LibBinding.csproj]

So this is the actual problem!

In fa57aa8, I changed android-toolchain to not run
<AcceptAndroidSdkLicense/> all the time. That was actually making
this .\gradlew command successfully install Android SDK Build-Tools
25.0.2 and use it without a license prompt. We started seeing the
problem since 4bb4b2e, because it caused a new
~\android-toolchain\sdk directory to get setup.

The fix here is to just use Build-Tools 28.0.0, since that is the
version we boostrap and install during our build.

But we would never actually remember to update this value... So we
should make a build.gradle.in file, and replace with our existing
property from Configuration.props:

<XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">28.0.0</XABuildToolsFolder>

Other changes:

  • Added --stacktrace to the gradle calls in r8.targets, so we get
    better error messages. It also matches the gradle command in
    Xamarin.Android.LibraryProjectZip-LibBinding.csproj.

@jonathanpeppers
Copy link
Member Author

This looks good, the Windows build has two Xamarin.Android.Build.Tests.BuildTest.BuildAotApplication* tests failing on master for a while and that is what is red here.

Xamarin.Android-Tests.sln built successfully, and that is what was broken.

Context: dotnet#2019
Context: http://build.devdiv.io/2168276
Context: http://build.devdiv.io/2169681

Since 4bb4b2e, our builds have been failing on VSTS on Windows.
Jenkins is green, however.

Currently getting a failure in
`Xamarin.Android.LibraryProjectZip-LibBinding.csproj` such as:

    2018-10-31T14:02:28.8336608Z    .\gradlew assembleDebug --stacktrace --no-daemon
    2018-10-31T14:02:40.7122197Z   NDK is missing a "platforms" directory.
    2018-10-31T14:02:40.7122937Z   If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to C:\Users\dlab14\android-toolchain\sdk\ndk-bundle.
    2018-10-31T14:02:40.7124870Z   If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

It doesn't really make sense to me why this started happening with
d8/r8 support... The `~\android-toolchain\sdk\ndk-bundle` path seems
completely wrong.

However, it looks like we should be setting
`ANDROID_NDK_HOME=$(AndroidNdkDirectory)`.

After that change, we got a new error:

    2018-10-31T17:19:30.1558223Z   Checking the license for package Android SDK Build-Tools 25.0.2 in C:\Users\dlab14\android-toolchain\sdk\licenses
    2018-10-31T17:19:30.1562674Z EXEC : warning : License for package Android SDK Build-Tools 25.0.2 not accepted. [E:\A\_work\14\s\tests\CodeGen-Binding\Xamarin.Android.LibraryProjectZip-LibBinding\Xamarin.Android.LibraryProjectZip-LibBinding.csproj]

So this is the actual problem!

In fa57aa8, I changed `android-toolchain` to not run
`<AcceptAndroidSdkLicense/>` all the time. That was actually making
this `.\gradlew` command successfully install Android SDK Build-Tools
25.0.2 and use it without a license prompt. We started seeing the
problem since 4bb4b2e, because it caused a new
`~\android-toolchain\sdk` directory to get setup.

The fix here is to just use Build-Tools 28.0.0, since that is the
version we boostrap and install during our build.

But we would never actually remember to update this value... So we
should make a `build.gradle.in` file, and replace with our existing
property from `Configuration.props`:

    <XABuildToolsFolder Condition="'$(XABuildToolsFolder)' == ''">28.0.0</XABuildToolsFolder>

Other changes:
- Added `--stacktrace` to the gradle calls in `r8.targets`, so we get
  better error messages. It also matches the gradle command in
  `Xamarin.Android.LibraryProjectZip-LibBinding.csproj`.
@jonathanpeppers
Copy link
Member Author

jonathanpeppers commented Nov 2, 2018

macOS test failure was network-related:

GetAdditionalResourcesFromAssemblies
    GetAdditionalResourcesFromAssemblies Task
      AndroidSdkDirectory: /Users/builder/android-toolchain/sdk/
      AndroidNdkDirectory: /Users/builder/android-toolchain/ndk/
      CacheFile: obj/Debug/resourcepaths.cache
      Assemblies: 
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/Java.Interop.dll
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Lib1/bin/Debug/Lib1.dll
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v9.0/Mono.Android.dll
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/mscorlib.dll
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/System.Core.dll
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/System.dll
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/Facades/System.Runtime.dll
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/System.Xml.dll
    Making sure we have http://dl-ssl.google.com/android/repository/build-tools_r24-macosx.zip downloaded and extracted  from it...
      Downloading http://dl-ssl.google.com/android/repository/build-tools_r24-macosx.zip into /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/zips
    	(4915410/48747930b), total 10.0%
    	(9823106/48747930b), total 20.0%
    	(14738434/48747930b), total 30.0%
    	(19645026/48747930b), total 40.0%
    	(24567010/48747930b), total 50.0%
    	(29490146/48747930b), total 60.0%
    	(34408114/48747930b), total 70.0%
    	(39327490/48747930b), total 80.0%
    Errors
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(477,3): error XA5208: Download succeeded but the zip file was not valid. Please do a clean build and try again. [/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/UnnamedProject/UnnamedProject.csproj]
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(477,3): error XA5209: Unzipping failed. Please download http://dl-ssl.google.com/android/repository/build-tools_r24-macosx.zip and extract it to the /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/Lib1/1/content directory. [/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/UnnamedProject/UnnamedProject.csproj]
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(477,3): error XA5209: Reason: There was an error opening /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/zips/5861EDAEF0DBBD53741DEC5BAF1CE67E.zip. The file is probably corrupt. Try deleting it and building again. File /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/zips/5861EDAEF0DBBD53741DEC5BAF1CE67E.zip is not a ZIP archive [/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/UnnamedProject/UnnamedProject.csproj]
        /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(477,3): Directory /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/zips is not empty
  at System.IO.Directory.Delete (System.String path) [0x0006f] in <9e4df56871b74651838be0f6a9e1bc80>:0 
  at Xamarin.Android.Tasks.GetAdditionalResourcesFromAssemblies.MakeSureLibraryIsInPlace (System.String destinationBase, System.String url, System.String version, System.String embeddedArchive, System.String sha1) [0x0041f] in <14dd2c914fc7484e849267d9aeb6a46e>:0 
  at Xamarin.Android.Tasks.GetAdditionalResourcesFromAssemblies.AddAttributeValue (System.Collections.Generic.ICollection`1[T] items, Mono.Cecil.CustomAttribute attr, System.String errorCode, System.String errorFmt, System.Boolean isDirectory, System.String fullPath) [0x0030c] in <14dd2c914fc7484e849267d9aeb6a46e>:0 
  at Xamarin.Android.Tasks.GetAdditionalResourcesFromAssemblies+<>c__DisplayClass37_0.<DoExecute>b__1 () [0x001e7] in <14dd2c914fc7484e849267d9aeb6a46e>:0 
  at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <9e4df56871b74651838be0f6a9e1bc80>:0 
  at System.Threading.Tasks.Task.Execute () [0x00000] in <9e4df56871b74651838be0f6a9e1bc80>:0  [/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/UnnamedProject/UnnamedProject.csproj]
    Extracting /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/zips/5861EDAEF0DBBD53741DEC5BAF1CE67E.zip to /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/Lib1/1/content
    Xamarin.Tools.Zip.ZipIOException: There was an error opening /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/zips/5861EDAEF0DBBD53741DEC5BAF1CE67E.zip. The file is probably corrupt. Try deleting it and building again. File /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/zips/5861EDAEF0DBBD53741DEC5BAF1CE67E.zip is not a ZIP archive ---> Xamarin.Tools.Zip.ZipIOException: File /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/DesignTimeBuild_False_False_True/Cache/zips/5861EDAEF0DBBD53741DEC5BAF1CE67E.zip is not a ZIP archive
  at Xamarin.Tools.Zip.ZipArchive.Open (System.String path, System.IO.FileMode mode, System.String defaultExtractionDir, System.Boolean strictConsistencyChecks, Xamarin.Tools.Zip.IPlatformOptions options) [0x00169] in <c9a35481046e4e1489f512d9d9694f2b>:0 
  at Xamarin.Android.Tools.Files.ReadZipFile (System.String filename, System.Boolean strictConsistencyChecks) [0x00001] in <14dd2c914fc7484e849267d9aeb6a46e>:0 
  at Xamarin.Android.Tasks.MonoAndroidHelper.ReadZipFile (System.String filename) [0x00002] in <14dd2c914fc7484e849267d9aeb6a46e>:0 
   --- End of inner exception stack trace ---
  at Xamarin.Android.Tasks.MonoAndroidHelper.ReadZipFile (System.String filename) [0x00025] in <14dd2c914fc7484e849267d9aeb6a46e>:0 
  at Xamarin.Android.Tasks.GetAdditionalResourcesFromAssemblies.ExtractArchive (System.String url, System.String file, System.String contentDir) [0x00049] in <14dd2c914fc7484e849267d9aeb6a46e>:0 

So this looks good?

Windows also looks good, only the 2 known BuildAotApplication* test failures.

@jonpryor jonpryor merged commit dded210 into dotnet:master Nov 2, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants