From b6cdde9e2732db4737b9f5ee9003b9039cf52342 Mon Sep 17 00:00:00 2001 From: 90 Date: Wed, 26 Jun 2024 19:01:54 +0100 Subject: [PATCH] Switch to Biome for JSON formatting (#7967) Replaces the previous Prettier step which required a separate installation of npm to work at all. Biome no longer requires any extra dependencies as Spotless will simply grab a static binary to use from within `mavenLocal`. ~~Note that the `biome()` step also adds the `mavenLocal()` repository definition to the buildscript, which causes the project build to fail when using `RepositoriesMode.FAIL_ON_PROJECT_REPOS` in the settings file.~~ --------- Co-authored-by: Sebastian Hartte --- build.gradle | 14 ++++++++++++-- settings.gradle | 1 - 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b4ef400ebdd..a665375e86d 100644 --- a/build.gradle +++ b/build.gradle @@ -65,6 +65,7 @@ configurations { } import appengbuild.* +import com.diffplug.gradle.spotless.JsonExtension dependencies { // To be copied into the jar file @@ -411,14 +412,23 @@ spotless { if (it.contains('*;\n')) { throw new Error('No wildcard imports allowed') } + + it } bumpThisNumberIfACustomStepChanges(1) } - format 'json', { + json { target 'src/*/resources/**/*.json' targetExclude 'src/generated/resources/**' - prettier().config(['parser': 'json']) + var biomeConfig = it.new JsonExtension.BiomeJson(null) + try { + biomeConfig.downloadDir(new File(rootDir, ".gradle/biome").absolutePath) + } catch (Exception ignored) { + } + addStep(biomeConfig.createStep()) + indentWithSpaces(2) + endWithNewline() } } diff --git a/settings.gradle b/settings.gradle index 12ac6bd55da..a775709a2d6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -20,7 +20,6 @@ dependencyResolutionManagement { repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS rulesMode = RulesMode.FAIL_ON_PROJECT_RULES repositories { - mavenLocal() maven { url "https://maven.shedaniel.me/" content {