Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Xamarin.Android.Build.Tasks] Aapt task needs to ignore fakeLogOpen #1035

Merged
merged 1 commit into from
Nov 17, 2017

Conversation

jonathanpeppers
Copy link
Member

Context: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=1137183
(search for APT0000 in Xamarin.Android-Tests.sln output)

Our Windows builds on VSTS are randomly failing with:

2017-11-14T00:49:35.1654201Z   Executing package -f -m -M
E:\A\_work\_temp\lrwwmk1i.il2\manifest\AndroidManifest.xml -J
E:\A\_work\_temp\lrwwmk1i.il2 --custom-package mono.android_tests -F
E:\A\_work\_temp\lrwwmk1i.il2\resources.apk.bk -S obj\Debug\res -S
E:\A\_work\2\s\src\Mono.Android\Test\obj\Debug\lp\1\jl\res -I
C:\Users\dlab\android-toolchain\sdk\platforms\android-26\android.jar
--auto-add-overlay --max-res-version 26 (TaskId:87)
2017-11-14T00:49:35.2324246Z
E:\A\_work\2\s\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2):
error APT0000: fakeLogOpen(/dev/log_crash, O_WRONLY) failed
[E:\A\_work\2\s\src\Mono.Android\Test\Mono.Android-Tests.csproj]
2017-11-14T00:49:35.2324246Z
E:\A\_work\2\s\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2):
error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed
[E:\A\_work\2\s\src\Mono.Android\Test\Mono.Android-Tests.csproj]
2017-11-14T00:49:35.2324246Z
E:\A\_work\2\s\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2):
error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed
[E:\A\_work\2\s\src\Mono.Android\Test\Mono.Android-Tests.csproj]
2017-11-14T00:49:35.2324246Z
E:\A\_work\2\s\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2):
error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed
[E:\A\_work\2\s\src\Mono.Android\Test\Mono.Android-Tests.csproj]
2017-11-14T00:49:35.2333825Z Done executing task "Aapt" -- FAILED.
(TaskId:87)

I was able to repro this locally with the following 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 pass 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.

@dnfclas
Copy link

dnfclas commented Nov 16, 2017

@jonathanpeppers,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@jonathanpeppers
Copy link
Member Author

jonathanpeppers commented Nov 16, 2017

Also if anyone would like to test the Regex we are using to look for errors: https://dotnetfiddle.net/bkhhcQ

@jonpryor
Copy link
Member

I think this regex test is more useful: https://dotnetfiddle.net/Zppyb8

@@ -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 (singleLine.Contains ("fakeLogOpen") || level.Contains ("warning")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of singleLine.Contains ("fakeLogOpen") we should use message.Contains ("fakeLogOpen"), so that if we wind up with e.g. a filename of fakeLogOpen we don't inadvertently grab it and mishandle things.

Context: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=1137183
(search for APT0000 in Xamarin.Android-Tests.sln output)

Our Windows builds on VSTS are randomly failing with:
```
2017-11-14T00:49:35.1654201Z   Executing package -f -m -M
E:\A\_work\_temp\lrwwmk1i.il2\manifest\AndroidManifest.xml -J
E:\A\_work\_temp\lrwwmk1i.il2 --custom-package mono.android_tests -F
E:\A\_work\_temp\lrwwmk1i.il2\resources.apk.bk -S obj\Debug\res -S
E:\A\_work\2\s\src\Mono.Android\Test\obj\Debug\lp\1\jl\res -I
C:\Users\dlab\android-toolchain\sdk\platforms\android-26\android.jar
--auto-add-overlay --max-res-version 26 (TaskId:87)
2017-11-14T00:49:35.2324246Z
E:\A\_work\2\s\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2):
error APT0000: fakeLogOpen(/dev/log_crash, O_WRONLY) failed
[E:\A\_work\2\s\src\Mono.Android\Test\Mono.Android-Tests.csproj]
2017-11-14T00:49:35.2324246Z
E:\A\_work\2\s\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2):
error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed
[E:\A\_work\2\s\src\Mono.Android\Test\Mono.Android-Tests.csproj]
2017-11-14T00:49:35.2324246Z
E:\A\_work\2\s\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2):
error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed
[E:\A\_work\2\s\src\Mono.Android\Test\Mono.Android-Tests.csproj]
2017-11-14T00:49:35.2324246Z
E:\A\_work\2\s\bin\Debug\lib\xamarin.android\xbuild\Xamarin\Android\Xamarin.Android.Common.targets(1373,2):
error APT0000: fakeLogOpen(/dev/log_security, O_WRONLY) failed
[E:\A\_work\2\s\src\Mono.Android\Test\Mono.Android-Tests.csproj]
2017-11-14T00:49:35.2333825Z Done executing task "Aapt" -- FAILED.
(TaskId:87)
```

I was able to repro this locally with the following 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 pass 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.
@jonathanpeppers jonathanpeppers force-pushed the windows-aapt-fakelogopen branch from 94e1649 to 4477f69 Compare November 16, 2017 19:10
@jonpryor jonpryor merged commit 42a4b9b into dotnet:master Nov 17, 2017
@jonpryor
Copy link
Member

You should probably file this upstream. There are no current developer tools bugs that mention fakeLogOpen.

@jonathanpeppers
Copy link
Member Author

@jonathanpeppers jonathanpeppers deleted the windows-aapt-fakelogopen branch November 17, 2017 14:01
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Sep 15, 2022
Fixes: dotnet/java-interop#1031

Changes: dotnet/java-interop@2c8b0a8...fcc33ce

  * dotnet/java-interop@fcc33ce2: [java-source-utils] Add `$schema` to `CGManifest.json` (dotnet#1035)
  * dotnet/java-interop@58de60f2: [generator] Handle Java class with base class set to itself. (dotnet#1032)
jonpryor added a commit that referenced this pull request Sep 16, 2022
Fixes: dotnet/java-interop#1031

Changes: dotnet/java-interop@2c8b0a8...fcc33ce

  * dotnet/java-interop@fcc33ce2: [java-source-utils] Add `$schema` to `CGManifest.json` (#1035)
  * dotnet/java-interop@58de60f2: [generator] Handle Java class with base class set to itself. (#1032)
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants