Skip to content

[Xamarin.Android.Build.Tasks] fix _CompileJava running too often - #2207

Merged
dellis1972 merged 1 commit into
dotnet:masterfrom
jonathanpeppers:fix-compilejava
Sep 21, 2018
Merged

[Xamarin.Android.Build.Tasks] fix _CompileJava running too often#2207
dellis1972 merged 1 commit into
dotnet:masterfrom
jonathanpeppers:fix-compilejava

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Context: #2088
Context: #2129
Context: #2199

In 4deec52, I fixed the #deletebinobj problem we discovered.

However...

I introduced a regression to incremental builds, I noticed that the
_CompileJava target is now running on a second build with no
changes. Third build? oddly it gets skipped...

It seems to be due to our use of flag files:

  1. _UpdateAndroidResgen updates R.cs.flag and uses the file as an
    output
  2. _GenerateJavaDesignerForComponent now uses R.cs.flag as an
    input
  3. _GenerateJavaStubsalso updates the timestamp on R.cs.flag.
    This was added in 970da9e, as a workaround for our two instances
    of ConvertResourcesCases.
  4. _GenerateJavaDesignerForComponent will now run again on the next
    build.

Since 1886e6f eliminated the second call to ConvertResourcesCases,
we don't need to update R.cs.flag in no. 3 any longer.

Removing the call to <Touch />R.cs.flag in _GenerateJavaStubs
fixed the issue, and I added some assertions in relevant tests to
check that the _CompileJava and _GenerateJavaDesignerForComponent
targets aren't running on incremental builds.

Context: dotnet#2088
Context: dotnet#2129
Context: dotnet#2199
In 4deec52, I fixed the #deletebinobj problem we discovered.
However...
I introduced a regression to incremental builds, I noticed that the
`_CompileJava` target is now running on a second build with no
changes. Third build? oddly it gets skipped...
It seems to be due to our use of flag files:
1. `_UpdateAndroidResgen` updates `R.cs.flag` and uses the file as an
output
2. `_GenerateJavaDesignerForComponent` now uses `R.cs.flag` as an
input
3. `_GenerateJavaStubs` *also* updates the timestamp on `R.cs.flag`.
This was added in 970da9e, as a workaround for our two instances
of `ConvertResourcesCases`.
4. `_GenerateJavaDesignerForComponent` will now run again on the next
build.
Since 1886e6f eliminated the second call to `ConvertResourcesCases`,
we don't need to update `R.cs.flag` in no. 3 any longer.
Removing the call to `<Touch />` `R.cs.flag` in `_GenerateJavaStubs`
fixed the issue, and I added some assertions in relevant tests to
check that the `_CompileJava` and `_GenerateJavaDesignerForComponent`
targets aren't running on incremental builds.
@dellis1972

Copy link
Copy Markdown
Contributor

Mac Failure is un related. If the windows build passes I will merge this

@dellis1972
dellis1972 merged commit 647659e into dotnet:masterSep 21, 2018
@jonathanpeppers
jonathanpeppers deleted the fix-compilejava branch September 21, 2018 14:04
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Feb 2, 2024
Sign up for freeto 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

@jonathanpeppers@dellis1972