Skip to content

Commit f562f6d

Browse files
committed
update circle config
1 parent c4fb0e0 commit f562f6d

4 files changed

Lines changed: 45 additions & 3 deletions

File tree

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ aliases:
9595
executors:
9696
rqueue-executor:
9797
machine:
98-
image: ubuntu-2204:current
99-
resource_class: xlarge
98+
image: ubuntu-2204:2022.10.2
99+
resource_class: large
100100

101101
working_directory: ~/repo
102102

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
2525

26+
* Format Java sources before opening the PR with `./gradlew formatJava`.
27+
2628

2729
#### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
2830

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ gradle to start with. In root `build.gradle` file comment out spring related ver
326326
environment variables for Spring versions. You can use [module, class and other diagrams](https://sourcespy.com/github/sonus21rqueue/)
327327
to familiarise yourself with the project.
328328

329-
**Please format your code with Google Java formatter.**
329+
**Please format your code with Palantir Java Format using `./gradlew formatJava`.**
330330

331331
## Links
332332

build.gradle

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ plugins {
55
id "com.github.nbaztec.coveralls-jacoco" version "1.2.20"
66
}
77

8+
configurations {
9+
palantirJavaFormat
10+
}
11+
12+
dependencies {
13+
palantirJavaFormat "com.palantir.javaformat:palantir-java-format:2.69.0"
14+
}
15+
816
allprojects {
917
apply plugin: "idea"
1018
apply plugin: "java-library"
@@ -174,3 +182,35 @@ coverallsJacoco {
174182
it.sourceSets.main.allSource.srcDirs
175183
}
176184
}
185+
186+
def javaFormatSources = providers.provider {
187+
files(subprojects.collect { subproject ->
188+
subproject.fileTree(dir: subproject.projectDir) {
189+
include "src/**/*.java"
190+
}
191+
}).files.findAll { it.exists() }
192+
}
193+
194+
tasks.register("formatJava", JavaExec) {
195+
group = "formatting"
196+
description = "Formats all Java sources with Palantir Java Format."
197+
classpath = configurations.palantirJavaFormat
198+
mainClass = "com.palantir.javaformat.java.Main"
199+
doFirst {
200+
args = ["--replace"] + javaFormatSources.get().collect { it.absolutePath }
201+
}
202+
}
203+
204+
tasks.register("checkFormatJava", JavaExec) {
205+
group = "verification"
206+
description = "Checks whether all Java sources are formatted with Palantir Java Format."
207+
classpath = configurations.palantirJavaFormat
208+
mainClass = "com.palantir.javaformat.java.Main"
209+
doFirst {
210+
args = ["--dry-run", "--set-exit-if-changed"] + javaFormatSources.get().collect { it.absolutePath }
211+
}
212+
}
213+
214+
tasks.named("check") {
215+
dependsOn(tasks.named("checkFormatJava"))
216+
}

0 commit comments

Comments
 (0)