Skip to content

Commit fc79b90

Browse files
committed
yaml: Eclipse integration work
1 parent 8d3cad3 commit fc79b90

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22
/*/build/
33
/*/out/
44
/*/bin/
5+
/*/.factorypath
56
buildSrc/build/
67
buildSrc/out/
78
buildSrc/*/bin/
89
/build/
10+
buildSrc/build/
911
/format/*/bin/
1012
/format/*/build/
1113
/format/*/out/
14+
/format/*/.factorypath
1215
/extra/*/build/
1316
/extra/*/out/
1417
/extra/*/bin/
18+
/extra/*/.factorypath
1519

1620
# gitpatcher local data
1721
/vendor/snakeyaml/

buildSrc/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@ dependencies {
3636
api "net.ltgt.gradle:gradle-nullaway-plugin:1.2.0"
3737
api "me.champeau.gradle:japicmp-gradle-plugin:0.3.0"
3838
api "de.thetaphi:forbiddenapis:3.2"
39+
api "com.diffplug.gradle:goomph:3.34.0"
3940
implementation "com.google.guava:guava:31.0.1-jre"
4041
}

buildSrc/src/main/groovy/org.spongepowered.configurate.build.component.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ plugins {
1717
id "me.champeau.gradle.japicmp"
1818
id "de.thetaphi.forbiddenapis"
1919
id 'pmd'
20+
id 'com.diffplug.eclipse.apt'
2021
}
2122

2223
configurations.configureEach {

format/yaml/src/test/groovy/org/spongepowered/configurate/yaml/YamlTest.groovy

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,60 +23,61 @@ import org.yaml.snakeyaml.parser.ParserImpl
2323
import org.yaml.snakeyaml.reader.StreamReader
2424
import org.yaml.snakeyaml.scanner.ScannerImpl
2525

26-
import java.nio.charset.StandardCharsets
26+
trait YamlTest {
2727

28-
interface YamlTest {
29-
30-
default CommentedConfigurationNode parseString(final String input) {
28+
CommentedConfigurationNode parseString(final String input) {
3129
// Print events
3230
def scanner = new ScannerImpl(new StreamReader(input))
33-
scanner.emitComments = true
31+
scanner.parseComments = true
3432
scanner.acceptTabs = true
3533
def parser = new ParserImpl(scanner)
36-
do {
34+
35+
while (true) {
3736
println parser.getEvent()
38-
} while (parser.peekEvent())
37+
if (!parser.peekEvent()) break
38+
}
3939

4040
final YamlParserComposer loader = new YamlParserComposer(new StreamReader(input), Yaml11Tags.REPOSITORY, true)
4141
final CommentedConfigurationNode result = CommentedConfigurationNode.root()
4242
loader.singleDocumentStream(result)
4343
return result
4444
}
4545

46-
default CommentedConfigurationNode parseResource(final URL url) {
46+
CommentedConfigurationNode parseResource(final URL url) {
4747
// Print events
4848
url.openStream().withReader('UTF-8') {reader ->
4949
def scanner = new ScannerImpl(new StreamReader(reader))
50-
scanner.emitComments = true
50+
scanner.parseComments = true
5151
scanner.acceptTabs = true
5252
def parser = new ParserImpl(scanner)
53-
do {
53+
while (true) {
5454
println parser.getEvent()
55-
} while (parser.peekEvent())
55+
if (!parser.peekEvent()) break
56+
}
5657
}
5758

5859
assertNotNull(url, "Expected resource is missing")
59-
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {
60+
url.openStream().withReader('UTF-8') { reader ->
6061
final YamlParserComposer loader = new YamlParserComposer(new StreamReader(reader), Yaml11Tags.REPOSITORY, true)
6162
final CommentedConfigurationNode result = CommentedConfigurationNode.root()
6263
loader.singleDocumentStream(result)
6364
return result
6465
}
6566
}
6667

67-
default String dump(final CommentedConfigurationNode input) {
68+
String dump(final CommentedConfigurationNode input) {
6869
return dump(input, null)
6970
}
7071

71-
default String dump(final CommentedConfigurationNode input, final NodeStyle preferredStyle) {
72+
String dump(final CommentedConfigurationNode input, final NodeStyle preferredStyle) {
7273
return YamlConfigurationLoader.builder()
7374
.nodeStyle(preferredStyle)
7475
.indent(2)
7576
.commentsEnabled(true)
7677
.buildAndSaveString(input)
7778
}
7879

79-
default String normalize(final String input) {
80+
String normalize(final String input) {
8081
return input.stripIndent(true)
8182
}
8283

vendor/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ project(":snakeyaml") {
7171
val applyPatches = rootProject.tasks.named("applyPatches")
7272
tasks.withType(JavaCompile::class) {
7373
options.release.set(7)
74-
dependsOn(applyPatches)
74+
// dependsOn(applyPatches)
7575
}
7676
tasks.withType(ProcessResources::class) {
77-
dependsOn(applyPatches)
77+
// dependsOn(applyPatches)
7878
}
7979

8080
tasks.named("test", Test::class) {

0 commit comments

Comments
 (0)