From a57bf3c199374a1799687038ac9a047ff7bc6a5c Mon Sep 17 00:00:00 2001 From: Kristof Jozsa Date: Thu, 28 Nov 2024 23:41:09 +0100 Subject: [PATCH] formatter --- build.gradle | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index bbcebbee505..500ccfe6982 100644 --- a/build.gradle +++ b/build.gradle @@ -174,12 +174,31 @@ allprojects { groovyGradle { target '*.gradle', '**/*.gradle' targetExclude '**/build/**' - greclipse() + try { + greclipse() + } catch (Exception e) { + // Fallback to basic formatting if Eclipse formatter is not available + indentWithSpaces(4) + } indentWithSpaces(4) endWithNewline() trimTrailingWhitespace() } + java { + target '**/*.java' + targetExclude '**/build/**' + try { + eclipse().configFile("${rootDir}/config/eclipse/formatter.xml") + } catch (Exception e) { + // Fallback to basic formatting if Eclipse formatter is not available + removeUnusedImports() + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } + } + lineEndings 'UNIX' } @@ -409,10 +428,14 @@ configure(project.fineractJavaProjects) { targetExclude '**/build/**', '**/bin/**', '**/out/**' importOrder() //sort imports alphabetically removeUnusedImports() - eclipse().configFile "$rootDir/config/fineractdev-formatter.xml" - endWithNewline() - trimTrailingWhitespace() - + try { + eclipse().configFile("$rootDir/config/fineractdev-formatter.xml") + } catch (Exception e) { + // Fallback to basic formatting if Eclipse formatter is not available + indentWithSpaces(4) + endWithNewline() + trimTrailingWhitespace() + } // Enforce style modifier order custom 'Modifier ordering', { def modifierRanking = [