Skip to content

Commit 0a149ab

Browse files
Release 1.0.2 (#13)
2 parents fcd0a7a + bc0ea40 commit 0a149ab

13 files changed

Lines changed: 207 additions & 113 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
push:
66
branches:
77
- main
8-
- dev*
98

109
jobs:
1110
publish-central:

.github/workflows/verify.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Verify state
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
name: Gradle build
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up JDK 17
13+
uses: actions/setup-java@v4
14+
with:
15+
distribution: adopt
16+
java-version: 17
17+
- name: Test with Gradle
18+
run: ./gradlew --build-cache test

build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ plugins {
77
`java-library`
88
id("de.chojo.publishdata") version "1.4.0"
99
alias(libs.plugins.spotless)
10-
id("com.vanniktech.maven.publish") version "0.30.0"
10+
id("com.vanniktech.maven.publish") version "0.31.0"
1111
}
1212

1313
publishData {
1414
useEldoNexusRepos(false)
15-
publishingVersion = "1.0.1"
15+
publishingVersion = "1.0.2"
1616
}
1717

1818
group = "dev.chojo"
@@ -26,7 +26,7 @@ repositories {
2626

2727
dependencies {
2828
compileOnly("org.slf4j", "slf4j-api", "2.0.16")
29-
compileOnlyApi("org.jetbrains", "annotations", "24.1.0")
29+
compileOnlyApi("org.jetbrains", "annotations", "26.0.2")
3030
api("com.fasterxml.jackson.core", "jackson-databind") {
3131
version {
3232
require("2.13.0")
@@ -36,9 +36,9 @@ dependencies {
3636
compileOnly("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml")
3737
compileOnly("com.fasterxml.jackson.dataformat", "jackson-dataformat-toml")
3838

39-
testImplementation(platform("org.junit:junit-bom:5.10.0"))
39+
testImplementation(platform("org.junit:junit-bom:5.11.4"))
4040
testImplementation("org.junit.jupiter:junit-jupiter")
41-
testImplementation("org.jetbrains", "annotations", "24.1.0")
41+
testImplementation("org.jetbrains", "annotations", "26.0.2")
4242
testImplementation("org.slf4j", "slf4j-api", "2.0.16")
4343
testImplementation("org.slf4j", "slf4j-simple", "2.0.16")
4444
testImplementation("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml")

gradle/wrapper/gradle-wrapper.jar

-16.7 KB
Binary file not shown.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#Sun Jan 26 12:24:25 CET 2025
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 30 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 94 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencyResolutionManagement {
2121
create("libs") {
2222

2323
// plugins
24-
plugin("spotless", "com.diffplug.spotless").version("6.25.0")
24+
plugin("spotless", "com.diffplug.spotless").version("7.0.2")
2525
plugin("shadow", "com.github.johnrengelman.shadow").version("8.1.1")
2626

2727
version("indra", "3.1.3")

src/main/java/dev/chojo/ocular/components/FileWrapper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ public record FileWrapper<T>(Format<?, ?> format, T file) {
2424
* @throws JsonProcessingException if an error occurs during serialization
2525
*/
2626
public String asString() throws JsonProcessingException {
27+
if (format.format().enablePrettyPrint()) {
28+
return format.writer().writerWithDefaultPrettyPrinter().writeValueAsString(file);
29+
}
30+
2731
return format.writer().writeValueAsString(file);
2832
}
2933
}

src/main/java/dev/chojo/ocular/dataformats/DataFormat.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* @param <B> the type of MapperBuilder used to configure the associated ObjectMapper
2323
*/
2424
public interface DataFormat<M extends ObjectMapper, B extends MapperBuilder<M, B>> extends Configurator<M, B> {
25+
2526
/**
2627
* Creates and returns a new instance of the mapper builder associated with the data format.
2728
* This method is used to initialize the builder for configuring the ObjectMapper for
@@ -40,6 +41,13 @@ public interface DataFormat<M extends ObjectMapper, B extends MapperBuilder<M, B
4041
*/
4142
String type();
4243

44+
/**
45+
* Used to determine whether the default pretty printer should be used explicitly
46+
*/
47+
default boolean enablePrettyPrint() {
48+
return false;
49+
}
50+
4351
/**
4452
* Checks whether the specified key matches the type or any of the type aliases of the current data format.
4553
*

0 commit comments

Comments
 (0)