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/codestyles/Square.xml b/configs/codestyles/Square.xml index e08699a..ebee07c 100644 --- a/configs/codestyles/Square.xml +++ b/configs/codestyles/Square.xml @@ -1,6 +1,6 @@ - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/configs/codestyles/SquareAndroid.xml b/configs/codestyles/SquareAndroid.xml index bc6a103..a099107 100644 --- a/configs/codestyles/SquareAndroid.xml +++ b/configs/codestyles/SquareAndroid.xml @@ -1,4 +1,3 @@ - - - - diff --git a/configs/inspection/Square.xml b/configs/inspection/Square.xml index f06b122..a87576b 100644 --- a/configs/inspection/Square.xml +++ b/configs/inspection/Square.xml @@ -1,6 +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 b7617b1..9e08c77 100755 --- a/install.sh +++ b/install.sh @@ -10,17 +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 - + if [[ -d "$i" ]]; then # Install codestyles - mkdir -p $i/codestyles - cp -frv "$CONFIGS/codestyles"/* $i/codestyles + mkdir -p "$i/codestyles" + cp -frv "$CONFIGS/codestyles"/* "$i/codestyles" # Install inspections - mkdir -p $i/inspection - cp -frv "$CONFIGS/inspection"/* $i/inspection + 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