Commit 667abd57 authored by Peter Wen's avatar Peter Wen Committed by Commit Bot

Android: Fix Android Studio native targets

CMake does not like .cc files mixed with .h files in add_library targets
so we filter only for .cc files.

Bug: 827294
Change-Id: I793d39b90d5f38d9c66704b19c39d0cc48ebdf43
Reviewed-on: https://chromium-review.googlesource.com/1062076
Commit-Queue: Peter Wen <wnwen@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559355}
parent 4bed89c3
...@@ -626,7 +626,7 @@ def _GetNative(relative_func, target_names): ...@@ -626,7 +626,7 @@ def _GetNative(relative_func, target_names):
for target_name in target_names: for target_name in target_names:
target = project_targets[target_name] target = project_targets[target_name]
includes.update(target.get('include_dirs', [])) includes.update(target.get('include_dirs', []))
sources = target.get('sources', []) sources = [f for f in target.get('sources', []) if f.endswith('.cc')]
if sources: if sources:
# CMake does not like forward slashes or colons for the target name. # CMake does not like forward slashes or colons for the target name.
filtered_name = target_name.replace('/', '.').replace(':', '-') filtered_name = target_name.replace('/', '.').replace(':', '-')
......
...@@ -92,11 +92,12 @@ includes `R.java`) and to remove some red underlines in java files. ...@@ -92,11 +92,12 @@ includes `R.java`) and to remove some red underlines in java files.
A new experimental option is now available to enable editing native C/C++ files A new experimental option is now available to enable editing native C/C++ files
with Android Studio. Pass in any number of `--native-target [target name]` flags with Android Studio. Pass in any number of `--native-target [target name]` flags
in order to try it out. This will require you to install `cmake` and `ndk` when in order to try it out. The target must be the full path and name of a valid gn
target (no shorthands). This will require you to install `cmake` and `ndk` when
prompted. Accept Android Studio's prompts for these SDK packages. Example: prompted. Accept Android Studio's prompts for these SDK packages. Example:
```shell ```shell
build/android/gradle/generate_gradle.py --native-target //chrome/android:monochrome build/android/gradle/generate_gradle.py --native-target //chrome/browser:browser
``` ```
## Tips ## Tips
...@@ -104,7 +105,7 @@ build/android/gradle/generate_gradle.py --native-target //chrome/android:monochr ...@@ -104,7 +105,7 @@ build/android/gradle/generate_gradle.py --native-target //chrome/android:monochr
* Use environment variables to avoid having to specify `--output-directory`. * Use environment variables to avoid having to specify `--output-directory`.
* Example: Append `export CHROMIUM_OUT_DIR=out; export BUILDTYPE=Debug` to * Example: Append `export CHROMIUM_OUT_DIR=out; export BUILDTYPE=Debug` to
your `~/.bashrc` to always default to `out/Debug`. your `~/.bashrc` to always default to `out/Debug`.
* Using the Java debugger is documented at [android_debugging_instructions.md#android-studio](android_debugging_instructions.md#android-studio). * Using the Java debugger is documented [here](android_debugging_instructions.md#android-studio).
* Configuration instructions can be found * Configuration instructions can be found
[here](http://tools.android.com/tech-docs/configuration). One suggestions: [here](http://tools.android.com/tech-docs/configuration). One suggestions:
* Launch it with more RAM: * Launch it with more RAM:
...@@ -180,6 +181,7 @@ resources, native libraries, etc. ...@@ -180,6 +181,7 @@ resources, native libraries, etc.
* Import resolution and refactoring across java files. * Import resolution and refactoring across java files.
* Correct lint and AndroidManifest when only one target is specified. * Correct lint and AndroidManifest when only one target is specified.
* Emulators (more docs coming soon). * Emulators (more docs coming soon).
* Separate Android SDK for Android Studio.
### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=620034)) ### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=620034))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment