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

Resource directories missed in incremental builds with AndroidAarLibrary items #2408

Closed
Redth opened this issue Nov 8, 2018 · 3 comments · Fixed by #2424
Closed

Resource directories missed in incremental builds with AndroidAarLibrary items #2408

Redth opened this issue Nov 8, 2018 · 3 comments · Fixed by #2424
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. bug Component does not function as intended. vs-sync For internal use only; creates a VSTS "mirror" issue.
Milestone

Comments

@Redth
Copy link
Member

Redth commented Nov 8, 2018

Steps to Reproduce

  1. Clone https://github.com/xamarin/Xamarin.Forms.git and switch to the branch visual-preview6
  2. nuget.exe restore Xamarin.Forms.sln
  3. msbuild Xamarin.Forms.ControlGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj /bl /t:rebuild which builds successfully
  4. msbuild Xamarin.Forms.ControlGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj /bl which now fails:
"C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj" (default target) (1) ->
(_UpdateAndroidResgen target) ->
  Resources\values\styles.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.MaterialComponents.Light'.
[C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj]
  Resources\values\styles.xml(3): error APT0000: No resource found that matches the given name: attr 'colorAccent'. [C:\xamarin\Xamarin.Forms\Xamarin.Forms.Control
Gallery.Android\Xamarin.Forms.ControlGallery.Android.csproj]
  Resources\values\styles.xml(2): error APT0000: No resource found that matches the given name: attr 'colorPrimary'. [C:\xamarin\Xamarin.Forms\Xamarin.Forms.Contro
lGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj]
  Resources\values\styles.xml(2): error APT0000: No resource found that matches the given name: attr 'windowActionBar'. [C:\xamarin\Xamarin.Forms\Xamarin.Forms.Con
trolGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj]
  Resources\values\styles.xml(4): error APT0000: No resource found that matches the given name: attr 'windowActionModeOverlay'. [C:\xamarin\Xamarin.Forms\Xamarin.F
orms.ControlGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj]
  Resources\values\styles.xml(2): error APT0000: No resource found that matches the given name: attr 'windowNoTitle'. [C:\xamarin\Xamarin.Forms\Xamarin.Forms.Contr
olGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj]
  Resources\values\styles.xml(4): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. [C
:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\Xamarin.Forms.ControlGallery.Android.csproj]
  Resources\values\styles.xml(4): error APT0000: No resource found that matches the given name: attr 'colorAccent'. [C:\xamarin\Xamarin.Forms\Xamarin.Forms.Control
Gallery.Android\Xamarin.Forms.ControlGallery.Android.csproj]

It looks like the number of directories specified in the call to Aapt is missing a bunch of items in the incremental build vs the rebuild:
image

This appears to happen when we use Android Support library nuget packages (in this case 28.0.0-preview6 which have the .aar files directly included in them using the AndroidAarLibrary item group type.

Attaching some binary logs of success/error builds for good measure:

binlogs.zip

VS bug #752035

@grendello grendello added this to the d16-0 milestone Nov 9, 2018
@grendello grendello added bug Component does not function as intended. Area: App+Library Build Issues when building Library projects or Application projects. labels Nov 9, 2018
@jonathanpeppers
Copy link
Member

jonathanpeppers commented Nov 9, 2018

From the logs this, looks weird ResolveLibraryProjectImports, on the working one:

LibraryResourceDirectories
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\2\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\4\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\44\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\51\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\55\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\56\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\57\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\79\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\80\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\87\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\89\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\90\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\91\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\92\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\98\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\103\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\104\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\106\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\108\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\109\jl\res

The broken ResolveLibraryProjectImports:

LibraryResourceDirectories
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\2\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\4\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\44\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\51\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\55\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\56\jl\res
    C:\xamarin\Xamarin.Forms\Xamarin.Forms.ControlGallery.Android\obj\Debug\MonoAndroid90\lp\57\jl\res

The input parameters to this task appear to be identical.

@dellis1972
Copy link
Contributor

@jonathanpeppers @Redth I think we need to investigate the .cache files that ResolveLibraryProjectImports is exporting on the first run. Make sure it has all the right paths

@dellis1972
Copy link
Contributor

dellis1972 added a commit to dellis1972/xamarin-android that referenced this issue Nov 10, 2018
Fixed dotnet#2408

As part of the speed up process when extracting resources
from assemblies and Aar files, we dont re-extract if
the stamp file is newer than the assembly.

The problem with that was in the case of Aar files we
were NOT adding the `res` or `asset` directories to
the list of resolved directories when we skipped extraction.
As a result we got less `res` directories on a second
build.

This commit fixes that.
dellis1972 added a commit that referenced this issue Nov 12, 2018
* [Xamarin.Android.Build.Tasks] Fix Aar directory resolution.

Fixed #2408

As part of the speed up process when extracting resources
from assemblies and Aar files, we dont re-extract if
the stamp file is newer than the assembly.

The problem with that was in the case of Aar files we
were NOT adding the `res` or `asset` directories to
the list of resolved directories when we skipped extraction.
As a result we got less `res` directories on a second
build.

This commit fixes that.

* Add Unit Test

* Fix Compile Error
Redth added a commit to xamarin/AndroidSupportComponents that referenced this issue Nov 13, 2018
@JonDouglas JonDouglas added the vs-sync For internal use only; creates a VSTS "mirror" issue. label Dec 14, 2018
@xamarin-release-manager xamarin-release-manager modified the milestones: d16-0, d15-9 Dec 15, 2018
jonpryor pushed a commit to jonpryor/xamarin-android that referenced this issue Dec 20, 2018
)

* [Xamarin.Android.Build.Tasks] Fix Aar directory resolution.

Fixed dotnet#2408

As part of the speed up process when extracting resources
from assemblies and Aar files, we dont re-extract if
the stamp file is newer than the assembly.

The problem with that was in the case of Aar files we
were NOT adding the `res` or `asset` directories to
the list of resolved directories when we skipped extraction.
As a result we got less `res` directories on a second
build.

This commit fixes that.

* Add Unit Test

* Fix Compile Error
jonpryor added a commit that referenced this issue Dec 20, 2018
…2556)

Fixed #2408

As part of the speed up process when extracting resources
from assemblies and Aar files, we dont re-extract if
the stamp file is newer than the assembly.

The problem with that was in the case of Aar files we
were NOT adding the `res` or `asset` directories to
the list of resolved directories when we skipped extraction.
As a result we got less `res` directories on a second
build.

This commit fixes that.

* Update ResolveLibraryProjectImports.cs

The usage of `ITaskItem` and item metadata isn't needed on d15-9
@ghost ghost locked as resolved and limited conversation to collaborators Jun 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects. bug Component does not function as intended. vs-sync For internal use only; creates a VSTS "mirror" issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants