Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the rome formatter #2119

Merged
merged 6 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
### Removed
* **BREAKING** Remove `JarState.getMavenCoordinate(String prefix)`. ([#1945](https://github.com/diffplug/spotless/pull/1945))
* **BREAKING** Replace `PipeStepPair` with `FenceStep`. ([#1954](https://github.com/diffplug/spotless/pull/1954))
* **BREAKING** Fully removed `Rome`, use `Biome` instead. ([#2119](https://github.com/diffplug/spotless/pull/2119))

## [2.45.0] - 2024-01-23
### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.spotless.rome;
package com.diffplug.spotless.biome;

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

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

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

if (arch.equals("ppc64le")) {
throw new IllegalStateException(msg);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.spotless.rome;
package com.diffplug.spotless.biome;

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

/**
* The checksum algorithm to use for checking the integrity of downloaded files.
Expand Down Expand Up @@ -80,7 +80,7 @@ final class RomeExecutableDownloader {
* @param flavor Flavor of Biome to use.
* @param downloadDir Directory where to store the downloaded executable.
*/
public RomeExecutableDownloader(BiomeFlavor flavor, Path downloadDir) {
public BiomeExecutableDownloader(BiomeFlavor flavor, Path downloadDir) {
this.flavor = flavor;
this.downloadDir = downloadDir;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 DiffPlug
* Copyright 2023-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.spotless.rome;
package com.diffplug.spotless.biome;

/**
* The flavor of Biome to use. Exists for compatibility reason, may be removed
Expand All @@ -24,17 +24,7 @@
public enum BiomeFlavor {
/** The new forked Biome project. */
BIOME("biome", "1.2.0", "biome.json", "biome-%s-%s-%s",
"https://github.com/biomejs/biome/releases/download/cli%%2Fv%s/biome-%s"),

/**
* The old deprecated Rome project.
*
* @deprecated Will be removed once the old Rome project is not supported
* anymore.
*/
@Deprecated
ROME("rome", "12.0.0", "rome.json", "rome-%s-%s-%s",
"https://github.com/rome/tools/releases/download/cli%%2Fv%s/rome-%s");
"https://github.com/biomejs/biome/releases/download/cli%%2Fv%s/biome-%s");

private final String configName;
private final String defaultVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.spotless.rome;
package com.diffplug.spotless.biome;

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

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

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

/**
Expand Down Expand Up @@ -230,7 +230,7 @@ private static void validateBiomeExecutable(String resolvedPathToExe) {
* @param pathToExe Path to the Biome executable to use.
* @param downloadDir Directory where to place the downloaded executable.
*/
private RomeStep(BiomeFlavor flavor, String version, String pathToExe, String downloadDir) {
private BiomeStep(BiomeFlavor flavor, String version, String pathToExe, String downloadDir) {
this.flavor = flavor;
this.version = version != null && !version.isBlank() ? version : defaultVersion(flavor);
this.pathToExe = pathToExe;
Expand All @@ -255,7 +255,7 @@ public FormatterStep create() {
* a file named {@code biome.json}.
* @return This builder instance for chaining method calls.
*/
public RomeStep withConfigPath(String configPath) {
public BiomeStep withConfigPath(String configPath) {
this.configPath = configPath;
return this;
}
Expand All @@ -280,7 +280,7 @@ public RomeStep withConfigPath(String configPath) {
* @param language The language of the files to format.
* @return This builder instance for chaining method calls.
*/
public RomeStep withLanguage(String language) {
public BiomeStep withLanguage(String language) {
this.language = language;
return this;
}
Expand Down Expand Up @@ -333,7 +333,7 @@ private String resolveExe() throws IOException, InterruptedException {
return pathToExe;
}
} else {
var downloader = new RomeExecutableDownloader(flavor, Paths.get(downloadDir));
var downloader = new BiomeExecutableDownloader(flavor, Paths.get(downloadDir));
var downloaded = downloader.ensureDownloaded(version).toString();
makeExecutable(downloaded);
return downloaded;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.spotless.rome;
package com.diffplug.spotless.biome;

import java.util.Locale;

Expand All @@ -38,12 +38,12 @@ enum OS {
public static OS guess() {
var osName = System.getProperty("os.name");
if (osName == null || osName.isBlank()) {
throw new IllegalStateException("No OS information is available, specify the Rome executable manually");
throw new IllegalStateException("No OS information is available, specify the Biome executable manually");
}
var osNameUpper = osName.toUpperCase(Locale.ROOT);
if (osNameUpper.contains("SUNOS") || osName.contains("AIX")) {
throw new IllegalStateException(
"Unsupported OS " + osName + ", specify the path to the Rome executable manually");
"Unsupported OS " + osName + ", specify the path to the Biome executable manually");
}
if (osNameUpper.contains("WINDOWS")) {
return OS.WINDOWS;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 DiffPlug
* Copyright 2016-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.spotless.rome;
package com.diffplug.spotless.biome;

/**
* Represents a platform where code is run, consisting of an operating system
Expand Down
2 changes: 2 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
* Bump default `ktlint` version to latest `1.1.1` -> `1.2.1`. ([#2057](https://github.com/diffplug/spotless/pull/2057))
* Bump default `sortpom` version to latest `3.4.0` -> `3.4.1`. ([#2078](https://github.com/diffplug/spotless/pull/2078))
* 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))
### Removed
* **BREAKING** Fully removed `Rome`, use `Biome` instead. ([#2119](https://github.com/diffplug/spotless/pull/2119))

## [6.25.0] - 2024-01-23
### Added
Expand Down
6 changes: 0 additions & 6 deletions plugin-gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1299,12 +1299,6 @@ a formatter that for the frontend written in Rust, which has a native binary, do
is pretty fast. It can currently format JavaScript, TypeScript, JSX, and JSON, and may support
[more frontend languages](https://biomejs.dev/internals/language-support/) such as CSS in the future.

Note: Biome [was formerly called Rome](https://biomejs.dev/blog/annoucing-biome/). Configurations with
the old `<rome>` tag and `rome(...)` function are still supported for the time being. This will be removed
in a future version, you should migrate to the new `<biome>` tag or `biome(...)` function. The configuration
remains the same, you only need to update the version. If you are using a custom `rome.json` configuration file,
you need to rename it to `biome.json`.

You can use Biome in any language-specific format for supported languages, but
usually you will be creating a generic format.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 DiffPlug
* Copyright 2023-2024 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,10 +28,10 @@
import org.gradle.api.artifacts.repositories.MavenArtifactRepository;

import com.diffplug.spotless.FormatterStep;
import com.diffplug.spotless.rome.BiomeFlavor;
import com.diffplug.spotless.rome.RomeStep;
import com.diffplug.spotless.biome.BiomeFlavor;
import com.diffplug.spotless.biome.BiomeStep;

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

protected RomeStepConfig(Project project, Consumer<FormatterStep> replaceStep, BiomeFlavor flavor,
protected BiomeStepConfig(Project project, Consumer<FormatterStep> replaceStep, BiomeFlavor flavor,
String version) {
this.project = requireNonNull(project);
this.replaceStep = requireNonNull(replaceStep);
Expand Down Expand Up @@ -234,13 +234,13 @@ private File findDataDir() {
*
* @return A builder for a Biome step.
*/
private RomeStep newBuilder() {
private BiomeStep newBuilder() {
if (pathToExe != null) {
var resolvedPathToExe = resolvePathToExe();
return RomeStep.withExePath(flavor, resolvedPathToExe);
return BiomeStep.withExePath(flavor, resolvedPathToExe);
} else {
var downloadDir = resolveDownloadDir();
return RomeStep.withExeDownload(flavor, version, downloadDir);
return BiomeStep.withExeDownload(flavor, version, downloadDir);
}
}

Expand Down
Loading
Loading