New issue
Advanced search Search tips

Issue 785618 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Robolectric crash when dependencies try and use resources

Project Member Reported by agrieve@chromium.org, Nov 16 2017

Issue description

Ran into this in https://chromium-review.googlesource.com/c/chromium/src/+/769348

Robolectric assumes that all R.java files that define a resource define it with the same ID. This is true for android_apk() targets because they run a final process_resources() step. Currently though, junit_binary is just pulling in the intermediary R.java files, which define different values for the same resources.

To fix this, we can either pass robolectric the list of all R class files, and have it rewrite all of them at runtime (tested that this works, but it's a bit slow and not how the problem is solved in any other build system), or we can add a call to process_resources() to junit_binary (we should do it this way to be consistent).
 
Project Member

Comment 1 by bugdroid1@chromium.org, Nov 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/630e7db4ea00439798ce30f535aa14a910c8395a

commit 630e7db4ea00439798ce30f535aa14a910c8395a
Author: Andrew Grieve <agrieve@chromium.org>
Date: Thu Nov 16 22:52:18 2017

junit_binary(): Fix resource IDs for dependent libararies

Robolectric assumes that all R.java files that define a resource define
it with the same ID. This is true for android_apk() targets because they
run a final process_resources() step. However, junit_binary() targets
currently just pull in the intermediary R.java files, which define different
values for same resources.

This change makes junit_binary act more like android_apk, in that it
adds a dedicated call to process_resources() in order to generate
consistent R.java files.

Bug:  785618 
Change-Id: I62f8c3d30a626ec63ad22f9759adb9ad66f94b88
Reviewed-on: https://chromium-review.googlesource.com/773978
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517215}
[modify] https://crrev.com/630e7db4ea00439798ce30f535aa14a910c8395a/build/android/gyp/process_resources.py
[modify] https://crrev.com/630e7db4ea00439798ce30f535aa14a910c8395a/build/android/gyp/write_build_config.py
[modify] https://crrev.com/630e7db4ea00439798ce30f535aa14a910c8395a/build/config/android/internal_rules.gni
[modify] https://crrev.com/630e7db4ea00439798ce30f535aa14a910c8395a/build/config/android/rules.gni

Status: Fixed (was: Started)

Sign in to add a comment