Add Android Studio code style to third_party/android_platform
Makes things like import order work correctly. BUG=620034 Review-Url: https://codereview.chromium.org/2360043002 Cr-Commit-Position: refs/heads/master@{#420234}
This commit is contained in:
docs
third_party/android_platform
@ -13,8 +13,8 @@ This creates a project at `out-gn/Debug/gradle`. To create elsewhere: `--project
|
||||
For first-time Android Studio users:
|
||||
|
||||
* Avoid running the setup wizard.
|
||||
* The wizard will force you to download unwanted SDK componentns to `//third_party/android_tools`.
|
||||
* To skip it. Select "Cancel" when it comes up.
|
||||
* The wizard will force you to download unwanted SDK components to `//third_party/android_tools`.
|
||||
* To skip it, select "Cancel" when it comes up.
|
||||
|
||||
To import the project:
|
||||
|
||||
@ -23,7 +23,7 @@ To import the project:
|
||||
You need to re-run `generate_gradle.py` whenever `BUILD.gn` files change.
|
||||
|
||||
* After regenerating, Android Studio should prompt you to "Sync". If it doesn't, use:
|
||||
* Help->Find Action->Sync Project with Gradle Files
|
||||
* Help -> Find Action -> Sync Project with Gradle Files
|
||||
|
||||
|
||||
## How it Works
|
||||
@ -54,38 +54,14 @@ all to `extracted-srcjars/` subdirectories for each target that contains them.
|
||||
includes `R.java`).
|
||||
***
|
||||
|
||||
### Building with Gradle
|
||||
|
||||
Gradle builds can be done from the command-line after importing the project into
|
||||
Android Studio (importing into the IDE causes the Gradle wrapper to be added).
|
||||
|
||||
cd $GRADLE_PROJECT_DIR && bash gradlew
|
||||
|
||||
The resulting artifacts are not terribly useful. They are missing assets,
|
||||
resources, native libraries, etc.
|
||||
|
||||
## Status (as of Sept 21, 2016)
|
||||
|
||||
### What currently works
|
||||
|
||||
* Tested with Android Studio v2.2.
|
||||
* Basic Java editing and compiling works.
|
||||
|
||||
### Roadmap / what's not yet implemented ([crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=620034))
|
||||
|
||||
* JUnit Test targets
|
||||
* Better support for instrumtation tests (they are treated as non-test .apks right now)
|
||||
* Make gradle aware of resources and assets
|
||||
* Make gradle aware of native code via pointing it at the location of our .so
|
||||
* Add a mode in which gradle is responsible for generating `R.java`
|
||||
* Add support for native code editing
|
||||
* Make the "Make Project" button work correctly
|
||||
|
||||
## Android Studio Tips
|
||||
|
||||
* Configuration instructions can be found [here](http://tools.android.com/tech-docs/configuration). One suggestions:
|
||||
* Launch it with more RAM: `STUDIO_VM_OPTIONS=-Xmx2048m /opt/android-studio-stable/bin/studio-launcher.sh`
|
||||
* If you ever need to reset it: `rm -r ~/.AndroidStudio*/`
|
||||
* Import Android style settings:
|
||||
* Help -> Find Action -> Code Style -> Java -> Manage -> Import
|
||||
* Select `third_party/android_platform/development/ide/intellij/codestyles/AndroidStyle.xml`
|
||||
|
||||
### Useful Shortcuts
|
||||
|
||||
@ -99,3 +75,29 @@ resources, native libraries, etc.
|
||||
* `Ctrl + Alt + O`: Organize imports
|
||||
* `Alt + Enter`: Quick Fix (use on underlined errors)
|
||||
|
||||
### Building from the Command Line
|
||||
|
||||
Gradle builds can be done from the command-line after importing the project into
|
||||
Android Studio (importing into the IDE causes the Gradle wrapper to be added).
|
||||
|
||||
cd $GRADLE_PROJECT_DIR && bash gradlew
|
||||
|
||||
The resulting artifacts are not terribly useful. They are missing assets,
|
||||
resources, native libraries, etc.
|
||||
|
||||
## Status (as of Sept 21, 2016)
|
||||
|
||||
### What works
|
||||
|
||||
* Tested with Android Studio v2.2.
|
||||
* Basic Java editing and compiling works.
|
||||
|
||||
### What doesn't work (yet) ([crbug](https://bugs.chromium.org/p/chromium/issues/detail?id=620034))
|
||||
|
||||
* JUnit Test targets
|
||||
* Better support for instrumtation tests (they are treated as non-test .apks right now)
|
||||
* Make gradle aware of resources and assets
|
||||
* Make gradle aware of native code via pointing it at the location of our .so
|
||||
* Add a mode in which gradle is responsible for generating `R.java`
|
||||
* Add support for native code editing
|
||||
* Make the "Make Project" button work correctly
|
||||
|
1
third_party/android_platform/OWNERS
vendored
1
third_party/android_platform/OWNERS
vendored
@ -1,2 +1,3 @@
|
||||
agrieve@chromium.org
|
||||
rmcilroy@chromium.org
|
||||
sgurun@chromium.org
|
||||
|
20
third_party/android_platform/README.chromium
vendored
20
third_party/android_platform/README.chromium
vendored
@ -9,17 +9,19 @@ License File: NOT_SHIPPED
|
||||
Security Critical: no
|
||||
|
||||
Description:
|
||||
Android Platform engineering tools, specifically stack symbolization scripts
|
||||
and a jar containing the AOSP framework to compile the Android WebView
|
||||
glue layer against. The AOSP framework is built from the Android release tag
|
||||
after which it is named, and the jar can be built by invoking make on the
|
||||
android_system_stubs target.
|
||||
|
||||
Also includes a ported copy of the Android relocation packing tool source,
|
||||
along with the files required to build it in the chromium tree.
|
||||
Android Platform engineering tools, specifically:
|
||||
1. stack symbolization scripts
|
||||
2. jars containing the AOSP framework to compile the Android WebView glue layer
|
||||
against. The AOSP framework is built from the Android release tag
|
||||
after which it is named, and the jar can be built by invoking make on the
|
||||
android_system_stubs target.
|
||||
3. A ported copy of the Android relocation packing tool source, along with the
|
||||
files required to build it in the chromium tree.
|
||||
4. IntelliJ formatting settings.
|
||||
Taken from commit: 622d3d4c5b3bee50fd335f3282d9e9d64ae0f5f7
|
||||
|
||||
Local Modifications:
|
||||
Only picked the few scripts needed by chrome.
|
||||
Only picked the few components useful to Chromium (as listed above).
|
||||
|
||||
The scripts have been modified to better suit Chromium development. Changes
|
||||
include, but are not limited to, the following:
|
||||
|
320
third_party/android_platform/development/ide/intellij/codestyles/AndroidStyle.xml
vendored
Normal file
320
third_party/android_platform/development/ide/intellij/codestyles/AndroidStyle.xml
vendored
Normal file
@ -0,0 +1,320 @@
|
||||
<code_scheme name="AndroidStyle">
|
||||
<option name="JAVA_INDENT_OPTIONS">
|
||||
<value>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="8" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="FIELD_NAME_PREFIX" value="m" />
|
||||
<option name="STATIC_FIELD_NAME_PREFIX" value="s" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="9999" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="9999" />
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="android" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="com.android" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="dalvik" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="libcore" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="com" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="gov" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="junit" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="net" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="org" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="java" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="javax" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="true" />
|
||||
<emptyLine />
|
||||
<package name="android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="com.android" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="dalvik" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="libcore" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="com" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="gov" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="junit" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="net" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="org" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="java" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="javax" withSubpackages="true" static="false" />
|
||||
<emptyLine />
|
||||
<package name="" withSubpackages="true" static="false" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="RIGHT_MARGIN" value="100" />
|
||||
<option name="JD_P_AT_EMPTY_LINES" value="false" />
|
||||
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
|
||||
<option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
|
||||
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
|
||||
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
|
||||
<option name="JD_PRESERVE_LINE_FEEDS" value="true" />
|
||||
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||
<option name="BLANK_LINES_AROUND_FIELD" value="1" />
|
||||
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_LIST_WRAP" value="1" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="WRAP_COMMENTS" value="true" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<XML>
|
||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||
</XML>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="java">
|
||||
<option name="TAB_SIZE" value="8" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<ADDITIONAL_INDENT_OPTIONS fileType="js">
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</ADDITIONAL_INDENT_OPTIONS>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="PREFER_PARAMETERS_WRAP" value="true" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="RESOURCE_LIST_WRAP" value="1" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<option name="WRAP_LONG_LINES" value="true" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||
<option name="BLANK_LINES_AROUND_FIELD" value="1" />
|
||||
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="1" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="1" />
|
||||
<option name="THROWS_LIST_WRAP" value="1" />
|
||||
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
|
||||
<option name="THROWS_KEYWORD_WRAP" value="1" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="1" />
|
||||
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE" value="true" />
|
||||
<option name="WRAP_COMMENTS" value="true" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:android</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>xmlns:.*</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:id</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:name</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>name</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>style</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:layout_.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:width</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*:height</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<NAME>.*</NAME>
|
||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||
</AND>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
Reference in New Issue
Block a user