Skip to content

Commit 1ea8ba0

Browse files
committed
yaml: Eclipse integration work
1 parent 6f3a051 commit 1ea8ba0

3 files changed

Lines changed: 18 additions & 20 deletions

File tree

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ build-logic/*/bin/
2323
# gitpatcher local data
2424
/vendor/snakeyaml
2525

26-
# gitpatcher local data
27-
/vendor/snakeyaml/
28-
2926
# IntelliJ project data
3027
.idea
3128
*.iml

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)