Skip to content

Commit

Permalink
Fix problems with OSGi.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Sep 18, 2023
1 parent f91ecc8 commit 6a686d9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 0 additions & 6 deletions org.jgrapes.util/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ Export-Package: \
org.jgrapes.util;version="${api_version}",\
org.jgrapes.util.events;version="${api_version}"

# Not directly referenced and not derived from gradle configuration
Import-Package: com.electronwill.nightconfig.json,\
com.electronwill.nightconfig.toml,\
com.electronwill.nightconfig.yaml,\
*

-sources: true

-dsannotations:
Expand Down
8 changes: 4 additions & 4 deletions org.jgrapes.util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ dependencies {
api project(':org.jgrapes.core')

implementation 'com.electronwill.night-config:core:[3.6.7,3.7]'
runtimeOnly 'com.electronwill.night-config:json:[3.6.7,3.7]'
runtimeOnly 'com.electronwill.night-config:toml:[3.6.7,3.7]'
runtimeOnly 'com.electronwill.night-config:yaml:[3.6.7,3.7]'
implementation 'com.electronwill.night-config:json:[3.6.7,3.7]'
implementation 'com.electronwill.night-config:toml:[3.6.7,3.7]'
implementation 'com.electronwill.night-config:yaml:[3.6.7,3.7]'
// https://security.snyk.io/package/maven/org.yaml:snakeyaml
runtimeOnly 'org.yaml:snakeyaml:[1.33,2]'
implementation 'org.yaml:snakeyaml:[1.33,2]'

testImplementation 'org.jdrupes.json:json:[2.0.0,2.1.0)'
testRuntimeOnly project.files('test-resources')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public JsonConfigurationStore(Channel componentChannel, File file,
public JsonConfigurationStore(Channel componentChannel, File file,
boolean update, boolean watch) throws IOException {
super(componentChannel, file, update, watch);
// Force load of JsonFormat and its registration. Required for OSGi.
com.electronwill.nightconfig.json.JsonFormat.minimalInstance();
config = FileConfig.builder(file.getAbsolutePath()).sync().concurrent()
.build();
config.load();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public TomlConfigurationStore(Channel componentChannel, File file,
public TomlConfigurationStore(Channel componentChannel, File file,
boolean update, boolean watch) throws IOException {
super(componentChannel, file, update, watch);
// Force load of TomlFormat and its registration. Required for OSGi.
com.electronwill.nightconfig.toml.TomlFormat.instance();
config = CommentedFileConfig.builder(file.getAbsolutePath()).sync()
.concurrent().build();
config.load();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public YamlConfigurationStore(Channel componentChannel, File file,
public YamlConfigurationStore(Channel componentChannel, File file,
boolean update, boolean watch) throws IOException {
super(componentChannel, file, update, watch);
// Force load of YamlFormat and its registration. Required for OSGi.
com.electronwill.nightconfig.yaml.YamlFormat.defaultInstance();
config = FileConfig.builder(file.getAbsolutePath()).sync().concurrent()
.build();
config.load();
Expand Down

0 comments on commit 6a686d9

Please sign in to comment.