-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml: Rewrite using event-based loading and saving
This allows us to capture more information as representation hints and to precisely control the output. We can also read comments events to properly round-trip comments in configuration files
- Loading branch information
Showing
38 changed files
with
5,308 additions
and
149 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,22 @@ | ||
plugins { | ||
id 'org.spongepowered.configurate.build.component' | ||
id 'groovy' | ||
} | ||
|
||
tasks.processResources { | ||
inputs.property("version", project.version) | ||
expand version: project.version | ||
} | ||
|
||
dependencies { | ||
api projects.core | ||
|
||
[ | ||
libs.groovy, | ||
libs.groovy.nio | ||
].each { | ||
implementation variantOf(it) { classifier('indy') } | ||
} | ||
|
||
testImplementation variantOf(libs.groovy.test) { classifier('indy') } | ||
} |
38 changes: 38 additions & 0 deletions
38
...main/groovy/org/spongepowered/configurate/extra/groovy/ConfigurationNodeExtensions.groovy
This file contains 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,38 @@ | ||
/* | ||
* Configurate | ||
* Copyright (C) zml and Configurate contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.spongepowered.configurate.extra.groovy | ||
|
||
import org.spongepowered.configurate.ScopedConfigurationNode; | ||
|
||
class ConfigurationNodeExtensions { | ||
|
||
static <N extends ScopedConfigurationNode<N>> N getAt(final ScopedConfigurationNode<N> self, Iterable<?> path) { | ||
return self.node(path) | ||
} | ||
|
||
static <N extends ScopedConfigurationNode<N>> N getAt(final ScopedConfigurationNode<N> self, Object... path) { | ||
return self.node(path) | ||
} | ||
|
||
static <N extends ScopedConfigurationNode<N>> boolean isCase(final ScopedConfigurationNode<N> self, Iterable<?> path) { | ||
return self.hasChild(path) | ||
} | ||
|
||
static <N extends ScopedConfigurationNode<N>> boolean isCase(final ScopedConfigurationNode<N> self, Object... path) { | ||
return self.hasChild(path) | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...y/src/main/groovy/org/spongepowered/configurate/extra/groovy/GStringTypeSerializer.groovy
This file contains 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,38 @@ | ||
/* | ||
* Configurate | ||
* Copyright (C) zml and Configurate contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.spongepowered.configurate.extra.groovy | ||
|
||
import org.spongepowered.configurate.ConfigurationNode | ||
import org.spongepowered.configurate.serialize.SerializationException | ||
import org.spongepowered.configurate.serialize.TypeSerializer | ||
|
||
import java.lang.reflect.Type; | ||
|
||
class GStringTypeSerializer implements TypeSerializer<GString> { | ||
|
||
@Override | ||
GString deserialize(final Type type, final ConfigurationNode node) throws SerializationException { | ||
return GString. | ||
return null; | ||
} | ||
|
||
@Override | ||
public void serialize( | ||
final Type type, final GString obj, final ConfigurationNode node) throws SerializationException { | ||
|
||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ovy/src/main/groovy/org/spongepowered/configurate/extra/groovy/POGOFieldDiscoverer.groovy
This file contains 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,34 @@ | ||
/* | ||
* Configurate | ||
* Copyright (C) zml and Configurate contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.spongepowered.configurate.extra.groovy | ||
|
||
import io.leangen.geantyref.GenericTypeReflector | ||
import org.spongepowered.configurate.objectmapping.FieldDiscoverer | ||
import org.spongepowered.configurate.serialize.SerializationException | ||
|
||
import java.lang.reflect.AnnotatedType | ||
import java.lang.reflect.Field | ||
|
||
class POGOFieldDiscoverer implements FieldDiscoverer<Map<String, Field>> { | ||
|
||
@Override | ||
def <V> InstanceFactory<Map<String, Field>> discover(final AnnotatedType target, final FieldCollector<Map<String, Field>, V> collector) | ||
throws SerializationException { | ||
def clazz = GenericTypeReflector.erase(target.type) | ||
clazz.metaClass.properties | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
extra/groovy/src/main/resources/META-INF/groovy/org.codehause.groovy.runtime.ExtensionModule
This file contains 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,4 @@ | ||
moduleName=Extensions to configurate for compatibility with the Groovy environment | ||
moduleVersion=${version} | ||
extensionClasses=org.spongepowered.configurate.extra.groovy.ConfigurationNodeExtensions | ||
staticExtensionClasses= |
27 changes: 27 additions & 0 deletions
27
...src/test/groovy/org/spongepowered/configurate/extra/groovy/PogoFieldDiscovererTest.groovy
This file contains 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,27 @@ | ||
/* | ||
* Configurate | ||
* Copyright (C) zml and Configurate contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.spongepowered.configurate.extra.groovy | ||
|
||
import org.junit.jupiter.api.Test | ||
|
||
class PogoFieldDiscovererTest { | ||
|
||
@Test | ||
void testPogoFieldDiscoverer() { | ||
|
||
} | ||
} |
This file contains 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 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
Oops, something went wrong.