Skip to content

Commit 2971c77

Browse files
authored
Remove the rome formatter (#2119)
2 parents df26a83 + f0d3b2c commit 2971c77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+386
-1741
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
2828
### Removed
2929
* **BREAKING** Remove `JarState.getMavenCoordinate(String prefix)`. ([#1945](https://github.com/diffplug/spotless/pull/1945))
3030
* **BREAKING** Replace `PipeStepPair` with `FenceStep`. ([#1954](https://github.com/diffplug/spotless/pull/1954))
31+
* **BREAKING** Fully removed `Rome`, use `Biome` instead. ([#2119](https://github.com/diffplug/spotless/pull/2119))
3132

3233
## [2.45.0] - 2024-01-23
3334
### Added

lib/src/main/java/com/diffplug/spotless/rome/Architecture.java lib/src/main/java/com/diffplug/spotless/biome/Architecture.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.diffplug.spotless.rome;
16+
package com.diffplug.spotless.biome;
1717

1818
/**
1919
* Enumeration of possible computer architectures.
@@ -34,11 +34,11 @@ public static Architecture guess() {
3434
var version = System.getProperty("os.version");
3535

3636
if (arch == null || arch.isBlank()) {
37-
throw new IllegalStateException("No OS information is available, specify the Rome executable manually");
37+
throw new IllegalStateException("No OS information is available, specify the Biome executable manually");
3838
}
3939

4040
var msg = "Unsupported architecture " + arch + "/" + version
41-
+ ", specify the path to the Rome executable manually";
41+
+ ", specify the path to the Biome executable manually";
4242

4343
if (arch.equals("ppc64le")) {
4444
throw new IllegalStateException(msg);

lib/src/main/java/com/diffplug/spotless/rome/RomeExecutableDownloader.java lib/src/main/java/com/diffplug/spotless/biome/BiomeExecutableDownloader.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.diffplug.spotless.rome;
16+
package com.diffplug.spotless.biome;
1717

1818
import java.io.IOException;
1919
import java.math.BigInteger;
@@ -41,8 +41,8 @@
4141
* Downloader for the Biome executable:
4242
* <a href="https://github.com/biomejs/biome">https://github.com/biomejs/biome</a>.
4343
*/
44-
final class RomeExecutableDownloader {
45-
private static final Logger logger = LoggerFactory.getLogger(RomeExecutableDownloader.class);
44+
final class BiomeExecutableDownloader {
45+
private static final Logger logger = LoggerFactory.getLogger(BiomeExecutableDownloader.class);
4646

4747
/**
4848
* The checksum algorithm to use for checking the integrity of downloaded files.
@@ -80,7 +80,7 @@ final class RomeExecutableDownloader {
8080
* @param flavor Flavor of Biome to use.
8181
* @param downloadDir Directory where to store the downloaded executable.
8282
*/
83-
public RomeExecutableDownloader(BiomeFlavor flavor, Path downloadDir) {
83+
public BiomeExecutableDownloader(BiomeFlavor flavor, Path downloadDir) {
8484
this.flavor = flavor;
8585
this.downloadDir = downloadDir;
8686
}

lib/src/main/java/com/diffplug/spotless/rome/BiomeFlavor.java lib/src/main/java/com/diffplug/spotless/biome/BiomeFlavor.java

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 DiffPlug
2+
* Copyright 2023-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.diffplug.spotless.rome;
16+
package com.diffplug.spotless.biome;
1717

1818
/**
1919
* The flavor of Biome to use. Exists for compatibility reason, may be removed
@@ -24,17 +24,7 @@
2424
public enum BiomeFlavor {
2525
/** The new forked Biome project. */
2626
BIOME("biome", "1.2.0", "biome.json", "biome-%s-%s-%s",
27-
"https://github.com/biomejs/biome/releases/download/cli%%2Fv%s/biome-%s"),
28-
29-
/**
30-
* The old deprecated Rome project.
31-
*
32-
* @deprecated Will be removed once the old Rome project is not supported
33-
* anymore.
34-
*/
35-
@Deprecated
36-
ROME("rome", "12.0.0", "rome.json", "rome-%s-%s-%s",
37-
"https://github.com/rome/tools/releases/download/cli%%2Fv%s/rome-%s");
27+
"https://github.com/biomejs/biome/releases/download/cli%%2Fv%s/biome-%s");
3828

3929
private final String configName;
4030
private final String defaultVersion;

lib/src/main/java/com/diffplug/spotless/rome/RomeStep.java lib/src/main/java/com/diffplug/spotless/biome/BiomeStep.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.diffplug.spotless.rome;
16+
package com.diffplug.spotless.biome;
1717

1818
import java.io.File;
1919
import java.io.IOException;
@@ -40,11 +40,11 @@
4040
/**
4141
* formatter step that formats JavaScript and TypeScript code with Biome:
4242
* <a href= "https://github.com/biomejs/biome">https://github.com/biomejs/biome</a>.
43-
* It delegates to the Biome executable. The Rome executable is downloaded from
43+
* It delegates to the Biome executable. The Biome executable is downloaded from
4444
* the network when no executable path is provided explicitly.
4545
*/
46-
public class RomeStep {
47-
private static final Logger logger = LoggerFactory.getLogger(RomeStep.class);
46+
public class BiomeStep {
47+
private static final Logger logger = LoggerFactory.getLogger(BiomeStep.class);
4848

4949
/**
5050
* Path to the directory with the {@code biome.json} config file, can be
@@ -113,8 +113,8 @@ public String name() {
113113
* @param downloadDir Directory where to place the downloaded executable.
114114
* @return A new Biome step that download the executable from the network.
115115
*/
116-
public static RomeStep withExeDownload(BiomeFlavor flavor, String version, String downloadDir) {
117-
return new RomeStep(flavor, version, null, downloadDir);
116+
public static BiomeStep withExeDownload(BiomeFlavor flavor, String version, String downloadDir) {
117+
return new BiomeStep(flavor, version, null, downloadDir);
118118
}
119119

120120
/**
@@ -125,8 +125,8 @@ public static RomeStep withExeDownload(BiomeFlavor flavor, String version, Strin
125125
* @param pathToExe Path to the Biome executable to use.
126126
* @return A new Biome step that format with the given executable.
127127
*/
128-
public static RomeStep withExePath(BiomeFlavor flavor, String pathToExe) {
129-
return new RomeStep(flavor, null, pathToExe, null);
128+
public static BiomeStep withExePath(BiomeFlavor flavor, String pathToExe) {
129+
return new BiomeStep(flavor, null, pathToExe, null);
130130
}
131131

132132
/**
@@ -230,7 +230,7 @@ private static void validateBiomeExecutable(String resolvedPathToExe) {
230230
* @param pathToExe Path to the Biome executable to use.
231231
* @param downloadDir Directory where to place the downloaded executable.
232232
*/
233-
private RomeStep(BiomeFlavor flavor, String version, String pathToExe, String downloadDir) {
233+
private BiomeStep(BiomeFlavor flavor, String version, String pathToExe, String downloadDir) {
234234
this.flavor = flavor;
235235
this.version = version != null && !version.isBlank() ? version : defaultVersion(flavor);
236236
this.pathToExe = pathToExe;
@@ -255,7 +255,7 @@ public FormatterStep create() {
255255
* a file named {@code biome.json}.
256256
* @return This builder instance for chaining method calls.
257257
*/
258-
public RomeStep withConfigPath(String configPath) {
258+
public BiomeStep withConfigPath(String configPath) {
259259
this.configPath = configPath;
260260
return this;
261261
}
@@ -280,7 +280,7 @@ public RomeStep withConfigPath(String configPath) {
280280
* @param language The language of the files to format.
281281
* @return This builder instance for chaining method calls.
282282
*/
283-
public RomeStep withLanguage(String language) {
283+
public BiomeStep withLanguage(String language) {
284284
this.language = language;
285285
return this;
286286
}
@@ -333,7 +333,7 @@ private String resolveExe() throws IOException, InterruptedException {
333333
return pathToExe;
334334
}
335335
} else {
336-
var downloader = new RomeExecutableDownloader(flavor, Paths.get(downloadDir));
336+
var downloader = new BiomeExecutableDownloader(flavor, Paths.get(downloadDir));
337337
var downloaded = downloader.ensureDownloaded(version).toString();
338338
makeExecutable(downloaded);
339339
return downloaded;

lib/src/main/java/com/diffplug/spotless/rome/OS.java lib/src/main/java/com/diffplug/spotless/biome/OS.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.diffplug.spotless.rome;
16+
package com.diffplug.spotless.biome;
1717

1818
import java.util.Locale;
1919

@@ -38,12 +38,12 @@ enum OS {
3838
public static OS guess() {
3939
var osName = System.getProperty("os.name");
4040
if (osName == null || osName.isBlank()) {
41-
throw new IllegalStateException("No OS information is available, specify the Rome executable manually");
41+
throw new IllegalStateException("No OS information is available, specify the Biome executable manually");
4242
}
4343
var osNameUpper = osName.toUpperCase(Locale.ROOT);
4444
if (osNameUpper.contains("SUNOS") || osName.contains("AIX")) {
4545
throw new IllegalStateException(
46-
"Unsupported OS " + osName + ", specify the path to the Rome executable manually");
46+
"Unsupported OS " + osName + ", specify the path to the Biome executable manually");
4747
}
4848
if (osNameUpper.contains("WINDOWS")) {
4949
return OS.WINDOWS;

lib/src/main/java/com/diffplug/spotless/rome/Platform.java lib/src/main/java/com/diffplug/spotless/biome/Platform.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.diffplug.spotless.rome;
16+
package com.diffplug.spotless.biome;
1717

1818
/**
1919
* Represents a platform where code is run, consisting of an operating system

plugin-gradle/CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
2020
* Bump default `ktlint` version to latest `1.1.1` -> `1.2.1`. ([#2057](https://github.com/diffplug/spotless/pull/2057))
2121
* Bump default `sortpom` version to latest `3.4.0` -> `3.4.1`. ([#2078](https://github.com/diffplug/spotless/pull/2078))
2222
* Bump default `sortpom` version to latest `3.4.1` -> `4.0.0` and support versions back to `3.2.1`. ([#2115](https://github.com/diffplug/spotless/pull/2115))
23+
### Removed
24+
* **BREAKING** Fully removed `Rome`, use `Biome` instead. ([#2119](https://github.com/diffplug/spotless/pull/2119))
2325

2426
## [6.25.0] - 2024-01-23
2527
### Added

plugin-gradle/README.md

-6
Original file line numberDiff line numberDiff line change
@@ -1299,12 +1299,6 @@ a formatter that for the frontend written in Rust, which has a native binary, do
12991299
is pretty fast. It can currently format JavaScript, TypeScript, JSX, and JSON, and may support
13001300
[more frontend languages](https://biomejs.dev/internals/language-support/) such as CSS in the future.
13011301
1302-
Note: Biome [was formerly called Rome](https://biomejs.dev/blog/annoucing-biome/). Configurations with
1303-
the old `<rome>` tag and `rome(...)` function are still supported for the time being. This will be removed
1304-
in a future version, you should migrate to the new `<biome>` tag or `biome(...)` function. The configuration
1305-
remains the same, you only need to update the version. If you are using a custom `rome.json` configuration file,
1306-
you need to rename it to `biome.json`.
1307-
13081302
You can use Biome in any language-specific format for supported languages, but
13091303
usually you will be creating a generic format.
13101304

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/RomeStepConfig.java plugin-gradle/src/main/java/com/diffplug/gradle/spotless/BiomeStepConfig.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 DiffPlug
2+
* Copyright 2023-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,10 +28,10 @@
2828
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;
2929

3030
import com.diffplug.spotless.FormatterStep;
31-
import com.diffplug.spotless.rome.BiomeFlavor;
32-
import com.diffplug.spotless.rome.RomeStep;
31+
import com.diffplug.spotless.biome.BiomeFlavor;
32+
import com.diffplug.spotless.biome.BiomeStep;
3333

34-
public abstract class RomeStepConfig<Self extends RomeStepConfig<Self>> {
34+
public abstract class BiomeStepConfig<Self extends BiomeStepConfig<Self>> {
3535
/**
3636
* Optional path to the directory with configuration file for Biome. The file
3737
* must be named {@code biome.json}. When none is given, the default
@@ -95,7 +95,7 @@ public abstract class RomeStepConfig<Self extends RomeStepConfig<Self>> {
9595
@Nullable
9696
private String version;
9797

98-
protected RomeStepConfig(Project project, Consumer<FormatterStep> replaceStep, BiomeFlavor flavor,
98+
protected BiomeStepConfig(Project project, Consumer<FormatterStep> replaceStep, BiomeFlavor flavor,
9999
String version) {
100100
this.project = requireNonNull(project);
101101
this.replaceStep = requireNonNull(replaceStep);
@@ -234,13 +234,13 @@ private File findDataDir() {
234234
*
235235
* @return A builder for a Biome step.
236236
*/
237-
private RomeStep newBuilder() {
237+
private BiomeStep newBuilder() {
238238
if (pathToExe != null) {
239239
var resolvedPathToExe = resolvePathToExe();
240-
return RomeStep.withExePath(flavor, resolvedPathToExe);
240+
return BiomeStep.withExePath(flavor, resolvedPathToExe);
241241
} else {
242242
var downloadDir = resolveDownloadDir();
243-
return RomeStep.withExeDownload(flavor, version, downloadDir);
243+
return BiomeStep.withExeDownload(flavor, version, downloadDir);
244244
}
245245
}
246246

0 commit comments

Comments
 (0)