diff --git a/README.md b/README.md index dcc3aac..05b1d39 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,19 @@ Java Code Styles IntelliJ IDEA code style settings for Square's Java and Android projects. +Deprecated +---------- + +These code styles aren't maintained anymore. Block / Square has adopted +[ktfmt](https://github.com/facebook/ktfmt) with its code style. +[`.editorconfig`](https://spec.editorconfig.org/index.html) files are a better alternative to share +code styles and are supported in Jetbrains IDEs. + Installation ------------ - * Run the `install.sh` script. + * On Unix, run the `install.sh` script. Windows users should use `install.bat` instead. * Restart IntelliJ if it's running. * Open IntelliJ Project Settings -> Code Styles, change the code style for the project to the one you want. diff --git a/configs/Square.xml b/configs/Square.xml deleted file mode 100644 index e08699a..0000000 --- a/configs/Square.xml +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - diff --git a/configs/SquareAndroid.xml b/configs/codestyles/Square.xml similarity index 52% rename from configs/SquareAndroid.xml rename to configs/codestyles/Square.xml index bc6a103..ebee07c 100644 --- a/configs/SquareAndroid.xml +++ b/configs/codestyles/Square.xml @@ -1,5 +1,4 @@ - - + - - + \ No newline at end of file diff --git a/configs/codestyles/SquareAndroid.xml b/configs/codestyles/SquareAndroid.xml new file mode 100644 index 0000000..a099107 --- /dev/null +++ b/configs/codestyles/SquareAndroid.xml @@ -0,0 +1,427 @@ + + + + + diff --git a/configs/inspection/Square.xml b/configs/inspection/Square.xml new file mode 100644 index 0000000..a87576b --- /dev/null +++ b/configs/inspection/Square.xml @@ -0,0 +1,46 @@ + + diff --git a/configs/options/editor.codeinsight.xml b/configs/options/editor.codeinsight.xml new file mode 100644 index 0000000..e46761d --- /dev/null +++ b/configs/options/editor.codeinsight.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/install.bat b/install.bat new file mode 100644 index 0000000..884691c --- /dev/null +++ b/install.bat @@ -0,0 +1,25 @@ +REM Installs Square's IntelliJ configs into your user configs. +@echo off +echo Installing Square IntelliJ configs... + +setlocal enableDelayedExpansion + +for /D %%i in ("%userprofile%"\.AndroidStudio*) do call :copy_config "%%i" +for /D %%i in ("%userprofile%"\.IdeaIC*) do call :copy_config "%%i" +for /D %%i in ("%userprofile%"\.IntelliJIdea*) do call :copy_config "%%i" +for /D %%i in ("%userprofile%"\.AndroidStudio*\settingsRepository\repository) do call :copy_config "%%i" +for /D %%i in ("%userprofile%"\.IdeaIC*\settingsRepository\repository) do call :copy_config "%%i" +for /D %%i in ("%userprofile%"\.IntelliJIdea*\settingsRepository\repository) do call :copy_config "%%i" + +echo. +echo Restart IntelliJ and/or AndroidStudio, go to preferences, and apply 'Square' or 'SquareAndroid'. +exit /b + +REM sub function for copy config files +:copy_config +set config_dir=%~1\config +echo Installing to "!config_dir!" +xcopy /s configs "!config_dir!" +echo Done. +echo. +exit /b diff --git a/install.sh b/install.sh index 5477a0a..9e08c77 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/bash # Installs Square's IntelliJ configs into your user configs. -echo "Installing Square code style configs..." +echo "Installing Square IntelliJ configs..." CONFIGS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/configs" @@ -10,11 +10,25 @@ for i in $HOME/Library/Preferences/IntelliJIdea* \ $HOME/Library/Preferences/AndroidStudio* \ $HOME/.IntelliJIdea*/config \ $HOME/.IdeaIC*/config \ - $HOME/.AndroidStudio*/config + $HOME/.AndroidStudio*/config \ + $HOME/Library/Application\ Support/JetBrains/IntelliJIdea* \ + $HOME/Library/Application\ Support/Google/AndroidStudio* \ + $HOME/Library/Application\ Support/JetBrains/IdeaIC* \ + $HOME/Library/Application\ Support/Google/AndroidStudio*/settingsRepository/repository \ + $HOME/Library/Application\ Support/JetBrains/IdeaIC*/settingsRepository/repository do - if [ -d $i ]; then - mkdir -p $i/codestyles - cp -frv "$CONFIGS"/* $i/codestyles + if [[ -d "$i" ]]; then + # Install codestyles + mkdir -p "$i/codestyles" + cp -frv "$CONFIGS/codestyles"/* "$i/codestyles" + + # Install inspections + mkdir -p "$i/inspection" + cp -frv "$CONFIGS/inspection"/* "$i/inspection" + + # Install options ("Exclude from Import and Completion") + mkdir -p "$i/options" + cp -frv "$CONFIGS/options"/* "$i/options" fi done