Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] Aapt ignores fakeLogOpen (#1035)
Browse files Browse the repository at this point in the history
Context: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=1137183

Our Windows builds on VSTS are randomly failing with:

	  Executing package -f -m -M …\AndroidManifest.xml -J … --custom-package mono.android_tests ^
		-F …\resources.apk.bk -S obj\Debug\res -S …\src\Mono.Android\Test\obj\Debug\lp\1\jl\res ^
		-I …\android-toolchain\sdk\platforms\android-26\android.jar --auto-add-overlay ^
		--max-res-version 26 (TaskId:87)
	…\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2): error APT0000: fakeLogOpen(/dev/log_crash, O_WRONLY) failed […\src\Mono.Android\Test\Mono.Android-Tests.csproj]
	…\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2): error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed […\src\Mono.Android\Test\Mono.Android-Tests.csproj]
	…\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2): error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed […\src\Mono.Android\Test\Mono.Android-Tests.csproj]
	…\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2): error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed […\src\Mono.Android\Test\Mono.Android-Tests.csproj]
	Done executing task "Aapt" -- FAILED. (TaskId:87)

I was able to repro this locally with this PowerShell script:

	$successful='0'
	while ($successful -eq '0')
	{
	    & git clean -dxf .\src\ .\bin\TestDebug\
	    & .\bin\Debug\bin\xabuild.exe .\src\Mono.Android\Test\Mono.Android-Tests.csproj /t:SignAndroidPackage /bl /noconsolelogger
	    $successful = $lastExitCode
	}

Merely cleaning stuff and rebuilding over and over would cause the
issue to crop up.

What is also odd about the failure:

  * Running the `aapt.exe` command manually after the failure works
  * The exit code is 0
  * If I change the `<Aapt/>` task to ignore errors, the `.apk` seems
    to be valid.

    Mono.Android-Tests still passes when I deploy and run them.

So what I *think* should be done here is to just check for
`fakeLogOpen` in the output, and treat this as a warning. This allows
the build to go on, which seems to produce a valid `.apk`. We may not
know this is resolved until merged into master and we see a few
builds succeed on VSTS.
  • Loading branch information
jonathanpeppers authored and jonpryor committed Nov 17, 2017
1 parent 1b3c419 commit 42a4b9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ protected void LogEventsFromTextOutput (string singleLine, MessageImportance mes
line = int.Parse (match.Groups["line"].Value) + 1;
var level = match.Groups["level"].Value;
var message = match.Groups ["message"].Value;
if (level.Contains ("warning")) {
if (message.Contains ("fakeLogOpen") || level.Contains ("warning")) {
LogWarning (singleLine);
return;
}
Expand Down

0 comments on commit 42a4b9b

Please # to comment.