Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style corrupted after copying to a project with install script #34

Open
lukaszkalnik opened this issue Sep 3, 2019 · 0 comments
Open

Comments

@lukaszkalnik
Copy link

When using the install script to copy code style to a specific project, after opening project in Android Studio 3.5 the code style file gets corrupted with several configuration options removed.

Console output when running install.sh:

Lukaszs-MBP:AndroidCodeStyle lukasz$ ./install.sh ../ThirtyInch/
Installing GCX AndroidStudio code style...

Copying...
/Users/lukasz/Projects/Android/AndroidCodeStyle/styles/grandcentrix.xml -> ../ThirtyInch/.idea/codestyles/grandcentrix.xml
Renaming grandcentrix.xml to Project.xml

Done.
Restart AndroidStudio. Go to Preferences->Editor->Code Style and apply Scheme 'grandcentrix'.

Directly after copying the codeStyle in project is identical with the original file from which it was copied (grandcentrix.xml). So the script copies the file correctly 👍

After opening the project with the new code style in Android Studio, directly after Android Studio has finished indexing it, most of the configuration options get removed.

A sample of what gets removed:

  <option name="FIELD_NAME_PREFIX" value="m" />
  <option name="STATIC_FIELD_NAME_PREFIX" value="m" />
  <option name="GENERATE_FINAL_LOCALS" value="true" />
  <option name="GENERATE_FINAL_PARAMETERS" value="true" />
  <option name="INSERT_INNER_CLASS_IMPORTS" value="true" />
  <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
  <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
  <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
    <value>
      <package name="org.mockito" withSubpackages="true" static="true" />
      <package name="org.junit" withSubpackages="true" static="false" />
      <package name="org.hamcrest" withSubpackages="true" static="true" />
      <package name="org.assertj.core.api.Java6Assertions" withSubpackages="false" static="true" />
      <package name="org.assertj.core.api.Assertions" withSubpackages="false" static="true" />
    </value>
  </option>

...and much more.

Also I think the message at the end of the script console output is misleading:
Restart AndroidStudio. Go to Preferences->Editor->Code Style and apply Scheme 'grandcentrix'.
It doesn't make sense, because grandcentrix is the name of the scheme which is globally installed in your IDE (if you have installed it globally in the first place).
The scheme which has been copied to your project is called Project.xml because it got renamed by the script. Also if you go to preferences you see it's already selected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant