-
Notifications
You must be signed in to change notification settings - Fork 474
Support Rome as a formatter #1663
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
5fd904e
POC: Basic support for rome
blutorange f62050c
Default download directory for Rome binary to the local repository
blutorange 7705a14
Add Rome support to unreleased changes
blutorange c3ffe2d
Allow a command on the path to be specified as the name of the Rome
blutorange 0d1e9fc
Add optional configuration for the config path with the config file
blutorange 6fb765d
Merge remote-tracking branch 'origin/main' into js-ts-rome
blutorange c8e5430
Limit visibility of Rome internal logic classes, JavaDoc
blutorange cdb0ec6
Fix changes.md + Architecture visibility
blutorange a158493
Support formatting JSON files with Rome
blutorange 7461c04
Add rome to feature matrix
blutorange 17b05d7
Add rome() step to generic format for Gradle plugin
blutorange 7481a9b
Add license header
blutorange afd0edb
Run spotlessApply
blutorange 0afd327
Add rome format step to json/javascript/typescript languages
blutorange 8c71500
Add docs for Maven plugin
blutorange 8fa9cda
Add docs for Gradle plugin
blutorange 2330874
Readme: Mention Rome in TOC for JS/TS
blutorange 850b287
Fix readme for Gradle plugin with custom binary
blutorange 7afe75b
Minor refactor, remove useless extra builder class
blutorange 57d36b4
Fix default download dir path for Gradle plugin
blutorange c483ed3
Add tests for RomeStep
blutorange 97198cb
Add tests for Maven plugin
blutorange 77d302e
Add tests for Gradle plugin
blutorange 971824d
Fix spotbugs issues
blutorange 98910ef
Merge remote-tracking branch 'origin/main' into js-ts-rome
blutorange 071df53
Run spotlessApply again
blutorange 20729b8
Fix conversion of file URL to Path, improve exception handling
blutorange bc3261b
use sha-256 for downloaded rome binary checksum
blutorange b516c65
Remove whitespace on empty line
awa-xima 8dd9b34
Merge branch 'main' into js-ts-rome
nedtwigg 39d61bc
SHA256 -> SHA-256
awa-xima 6c8bff1
Update changelogs.
nedtwigg ed4e5c2
Move RomeStepConfig into its own file since it's so big.
nedtwigg 09d8498
Fix root path issue in the Rome formatter.
nedtwigg d8913c4
Another changelog fix.
nedtwigg a56e7e6
Use Path.of(URI) instead of manual string wrangling.
nedtwigg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.diffplug.spotless; | ||
|
||
/** | ||
* Enumeration of possible computer architectures. | ||
* | ||
*/ | ||
public enum Architecture { | ||
nedtwigg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
x86, x64, ppc64le, s390x, arm64, armv7l, ppc, ppc64; | ||
|
||
/** | ||
* Attempts to guess the architecture of the environment running the JVM. | ||
* | ||
* @return The best guess for the architecture. | ||
*/ | ||
public static Architecture guess() { | ||
var arch = System.getProperty("os.arch"); | ||
var version = System.getProperty("os.version"); | ||
|
||
if (arch.equals("ppc64le")) { | ||
throw new IllegalArgumentException(); | ||
} else if (arch.equals("aarch64")) { | ||
return arm64; | ||
} else if (arch.equals("s390x")) { | ||
return s390x; | ||
} else if (arch.equals("arm")) { | ||
if (version.contains("v7")) { | ||
return armv7l; | ||
} else { | ||
return arm64; | ||
} | ||
} else if (arch.equals("ppc64")) { | ||
return ppc64; | ||
} else if (arch.equals("ppc")) { | ||
return ppc; | ||
} else { | ||
return arch.contains("64") ? x64 : x86; | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.diffplug.spotless; | ||
|
||
/** | ||
* Enumeration of possible computer operation systems. | ||
*/ | ||
public enum OS { | ||
nedtwigg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Windows, Mac, Linux, SunOS, AIX; | ||
|
||
/** | ||
* Attempts to guess the OS of the environment running the JVM. | ||
* | ||
* @return The best guess for the architecture. | ||
*/ | ||
public static OS guess() { | ||
var osName = System.getProperty("os.name"); | ||
return osName.contains("Windows") ? OS.Windows | ||
: osName.contains("Mac") ? OS.Mac | ||
: osName.contains("SunOS") ? OS.SunOS | ||
: osName.toUpperCase().contains("AIX") ? OS.AIX : OS.Linux; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.diffplug.spotless; | ||
|
||
/** | ||
* Represents a platform where code is run, consisting of an operating system | ||
* and an architecture. | ||
*/ | ||
public class Platform { | ||
nedtwigg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/** | ||
* Attempts to guess the platform of the hosting environment running the JVM | ||
* machine. | ||
* | ||
* @return The best guess for the current OS and architecture. | ||
*/ | ||
public static Platform guess() { | ||
var os = OS.guess(); | ||
var architecture = Architecture.guess(); | ||
return new Platform(os, architecture); | ||
} | ||
|
||
private final Architecture architecture; | ||
|
||
private final OS os; | ||
|
||
/** | ||
* Creates a new Platform descriptor for the given OS and architecture. | ||
* @param os Operating system of the platform. | ||
* @param architecture Architecture of the platform. | ||
*/ | ||
public Platform(OS os, Architecture architecture) { | ||
this.os = os; | ||
this.architecture = architecture; | ||
} | ||
|
||
/** | ||
* @return The architecture of this platform. | ||
*/ | ||
public Architecture getArchitecture() { | ||
return architecture; | ||
} | ||
|
||
/** | ||
* @return The operating system of this platform. | ||
*/ | ||
public OS getOs() { | ||
return os; | ||
} | ||
|
||
/** | ||
* @return Whether the operating system is Aix. | ||
*/ | ||
public boolean isAix() { | ||
return os == OS.AIX; | ||
} | ||
|
||
/** | ||
* @return Whether the operating system is Linux. | ||
*/ | ||
public boolean isLinux() { | ||
return os == OS.Linux; | ||
} | ||
|
||
/** | ||
* @return Whether the operating system is Mac. | ||
*/ | ||
public boolean isMac() { | ||
return os == OS.Mac; | ||
} | ||
|
||
/** | ||
* @return Whether the operating system is SunOS. | ||
*/ | ||
public boolean isSunos() { | ||
return os == OS.SunOS; | ||
} | ||
|
||
/** | ||
* @return Whether the operating system is Windows. | ||
*/ | ||
public boolean isWindows() { | ||
return os == OS.Windows; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("Platform[os=%s,architecture=%s]", os, architecture); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.