Android: Add missing resources to android studio

Some apk targets directly depend on their resources (e.g.
//android_webview/test:android_webview_apk). These are not picked up by
javac and need to be added to gradle in order to allow editing of all
resources.

BUG=682846

Review-Url: https://codereview.chromium.org/2724093003
Cr-Original-Commit-Position: refs/heads/master@{#456416}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: f37993e1a795b3d8d72bb858a8ccb0a74b82400b
This commit is contained in:
wnwen 2017-03-13 10:36:15 -07:00 коммит произвёл Commit bot
Родитель aa1278561c
Коммит 509f01322c
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -297,7 +297,8 @@ class _ProjectContextGenerator(object):
def _Srcjars(self, entry):
srcjars = _RebasePath(entry.Gradle().get('bundled_srcjars', []))
if not self.use_gradle_process_resources:
srcjars += _RebasePath(entry.BuildConfig()['javac']['srcjars'])
srcjars += _RebasePath(entry.Javac()['srcjars'])
srcjars += _RebasePath(entry.Gradle().get('srcjars'))
return srcjars
def _GetEntries(self, entry):

Просмотреть файл

@ -374,6 +374,7 @@ def main(argv):
direct_library_deps = deps.Direct('java_library')
all_library_deps = deps.All('java_library')
direct_resources_deps = deps.Direct('android_resources')
all_resources_deps = deps.All('android_resources')
# Resources should be ordered with the highest-level dependency first so that
# overrides are done correctly.
@ -478,8 +479,11 @@ def main(argv):
c['package_name'] for c in all_resources_deps if 'package_name' in c]
if options.type == 'android_apk':
# Apks will get their resources srcjar explicitly passed to the java step.
# Apks will get their resources srcjar explicitly passed to the java step
config['javac']['srcjars'] = []
# Gradle may need to generate resources for some apks.
gradle['srcjars'] = [
c['srcjar'] for c in direct_resources_deps if 'srcjar' in c]
if options.type == 'android_assets':
all_asset_sources = []