Skip to content

Commit

Permalink
Add resources to jvm-native, embedded resources, add back common
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrich committed Sep 30, 2023
1 parent 2ca72b3 commit a1fb45f
Show file tree
Hide file tree
Showing 58 changed files with 1,337 additions and 3 deletions.
5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ lazy val sconfig = crossProject(JVMPlatform, NativePlatform, JSPlatform)
.nativeConfigure(_.enablePlugins(ScalaNativeJUnitPlugin))
.nativeSettings(
crossScalaVersions := versions,
nativeConfig ~= (_.withLinkStubs(true)),
nativeConfig ~= (
_.withLinkStubs(true)
.withEmbedResources(true)
),
logLevel := Level.Info, // Info or Debug
libraryDependencies += "org.ekrich" %%% "sjavatime" % javaTime % "provided"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package org.ekrich.config
/**
* [[ConfigFactory]] methods for Scala.js platform
*/
abstract class PlatformConfigFactory {}
abstract class PlatformConfigFactory extends ConfigFactoryCommon {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ package org.ekrich.config
/**
* [[ConfigFactory]] methods common to JVM and Native
*/
abstract class ConfigFactoryJvmNative {}
abstract class ConfigFactoryJvmNative extends ConfigFactoryCommon {}
1 change: 1 addition & 0 deletions sconfig/jvm-native/src/test/resources/a_1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a=1
1 change: 1 addition & 0 deletions sconfig/jvm-native/src/test/resources/b_2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b=2
2 changes: 2 additions & 0 deletions sconfig/jvm-native/src/test/resources/bom.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#
foo = bar
1 change: 1 addition & 0 deletions sconfig/jvm-native/src/test/resources/cycle.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include "cycle.conf"
45 changes: 45 additions & 0 deletions sconfig/jvm-native/src/test/resources/equiv01/comments.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ // These are some integers
"ints" : { # we can comment them with # too
"fortyTwo" : 42, ## double-# !
"fortyTwoAgain" : 42 # { }
},
######## COMMENT COMMENT COMMENT
/// I COMMENT YOU
"floats" : {
"fortyTwoPointOne" : 42.1,
"fortyTwoPointOneAgain" : 42.1
// I CAN HAS COMMENT
},

"strings" : {
"abcd" : // I got yr comment right here
"abcd",
"abcdAgain" : "abcd",
"a" : "a",
"b" : "b",
"c" : "c",
"d" : "d",
"concatenated" # more to say?
: "null bar 42 baz true 3.14 hi"
},

"arrays" : {
"empty" : [],
"1" : [ 1 ],
"12" : [1, 2],
"123" : [1, 2, 3],
"ofString" : [ "a", "b", "c" ]
},

"booleans" : {
"true" : true,
"trueAgain" : true,
"false" : false,
"falseAgain" : false
},

"nulls" : {
"null" : null,
"nullAgain" : null
}
}
41 changes: 41 additions & 0 deletions sconfig/jvm-native/src/test/resources/equiv01/equals.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"ints" = {
"fortyTwo" = 42,
"fortyTwoAgain" = 42
},

"floats" = {
"fortyTwoPointOne" = 42.1,
"fortyTwoPointOneAgain" = 42.1
},

"strings" = {
"abcd" = "abcd",
"abcdAgain" = "abcd",
"a" = "a",
"b" = "b",
"c" = "c",
"d" = "d",
"concatenated" = "null bar 42 baz true 3.14 hi"
},

"arrays" = {
"empty" = [],
"1" = [ 1 ],
"12" = [1, 2],
"123" = [1, 2, 3],
"ofString" = [ "a", "b", "c" ]
},

"booleans" = {
"true" = true,
"trueAgain" = true,
"false" = false,
"falseAgain" = false
},

"nulls" = {
"null" = null,
"nullAgain" = null
}
}
55 changes: 55 additions & 0 deletions sconfig/jvm-native/src/test/resources/equiv01/no-commas.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"ints" : {
"fortyTwo" : 42
"fortyTwoAgain" : 42
}

"floats" : {
"fortyTwoPointOne" : 42.1
"fortyTwoPointOneAgain" : 42.1
}

"strings" : {
"abcd" : "abcd"
"abcdAgain" : "abcd"
"a" : "a"
"b" : "b"
"c" : "c"
"d" : "d"
"concatenated" : "null bar 42 baz true 3.14 hi"
}

"arrays" : {
"empty" : []
"1" : [ 1 ]
"12" : [1
2]
"123" : [1
2
3 ]
"ofString" : [

"a"
"b"
"c"

]
}

"booleans" : {

"true" : true

"trueAgain" : true

"false" : false

"falseAgain" : false

}

"nulls" : {
"null" : null
"nullAgain" : null
}
}
40 changes: 40 additions & 0 deletions sconfig/jvm-native/src/test/resources/equiv01/no-root-braces.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"ints" : {
"fortyTwo" : 42,
"fortyTwoAgain" : 42
},

"floats" : {
"fortyTwoPointOne" : 42.1,
"fortyTwoPointOneAgain" : 42.1
},

"strings" : {
"abcd" : "abcd",
"abcdAgain" : "abcd",
"a" : "a",
"b" : "b",
"c" : "c",
"d" : "d",
"concatenated" : "null bar 42 baz true 3.14 hi"
},

"arrays" : {
"empty" : [],
"1" : [ 1 ],
"12" : [1, 2],
"123" : [1, 2, 3],
"ofString" : [ "a", "b", "c" ]
},

"booleans" : {
"true" : true,
"trueAgain" : true,
"false" : false,
"falseAgain" : false
},

"nulls" : {
"null" : null,
"nullAgain" : null
}

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ints":{"fortyTwo":42,"fortyTwoAgain":42},"floats":{"fortyTwoPointOne":42.1,"fortyTwoPointOneAgain":42.1},"strings":{"abcd":"abcd","abcdAgain":"abcd","a":"a","b":"b","c":"c","d":"d","concatenated":"null bar 42 baz true 3.14 hi"},"arrays":{"empty":[],"1":[1],"12":[1,2],"123":[1,2,3],"ofString":["a","b","c"]},"booleans":{"true":true,"trueAgain":true,"false":false,"falseAgain":false},"nulls":{"null":null,"nullAgain":null}}
44 changes: 44 additions & 0 deletions sconfig/jvm-native/src/test/resources/equiv01/omit-colons.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"ints" {
"fortyTwo" : 42,
"fortyTwoAgain" : 42
},

"floats"
{
"fortyTwoPointOne" : 42.1,
"fortyTwoPointOneAgain" : 42.1
},

"strings"

{
"abcd" : "abcd",
"abcdAgain" : "abcd",
"a" : "a",
"b" : "b",
"c" : "c",
"d" : "d",
"concatenated" : "null bar 42 baz true 3.14 hi"
},

"arrays" {
"empty" : [],
"1" : [ 1 ],
"12" : [1, 2],
"123" : [1, 2, 3],
"ofString" : [ "a", "b", "c" ]
},

"booleans" {
"true" : true,
"trueAgain" : true,
"false" : false,
"falseAgain" : false
},

"nulls" {
"null" : null,
"nullAgain" : null
}
}
41 changes: 41 additions & 0 deletions sconfig/jvm-native/src/test/resources/equiv01/original.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"ints" : {
"fortyTwo" : 42,
"fortyTwoAgain" : 42
},

"floats" : {
"fortyTwoPointOne" : 42.1,
"fortyTwoPointOneAgain" : 42.1
},

"strings" : {
"abcd" : "abcd",
"abcdAgain" : "abcd",
"a" : "a",
"b" : "b",
"c" : "c",
"d" : "d",
"concatenated" : "null bar 42 baz true 3.14 hi"
},

"arrays" : {
"empty" : [],
"1" : [ 1 ],
"12" : [1, 2],
"123" : [1, 2, 3],
"ofString" : [ "a", "b", "c" ]
},

"booleans" : {
"true" : true,
"trueAgain" : true,
"false" : false,
"falseAgain" : false
},

"nulls" : {
"null" : null,
"nullAgain" : null
}
}
29 changes: 29 additions & 0 deletions sconfig/jvm-native/src/test/resources/equiv01/path-keys.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
ints.fortyTwo : 42,
ints.fortyTwoAgain : 42,

floats.fortyTwoPointOne : 42.1,
floats.fortyTwoPointOneAgain : 42.1,

strings.abcd : "abcd",
strings.abcdAgain : "abcd",
strings.a : "a",
strings.b : "b",
strings.c : "c",
strings.d : "d",
strings.concatenated : "null bar 42 baz true 3.14 hi",

arrays."empty" : [],
arrays."1" : [ 1 ],
arrays.12 : [1, 2],
arrays.123 : [1, 2, 3],
arrays.ofString : [ "a", "b", "c" ],

booleans.true : true,
booleans.trueAgain : true,
booleans.false : false,
booleans.falseAgain : false,

nulls.null : null,
nulls.nullAgain : null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# this file is in a no-braces java properties style,
# but it's a .conf file with json-style escaping,
# not a Java properties file.
# lots of playing with whitespace and commas
# in here to test various cases; don't copy
# this as exemplary, it has gratuitously
# stupid formatting.
ints.fortyTwo=42
ints.fortyTwoAgain = 42 // whitespace ignored around the =
floats.fortyTwoPointOne=42.1
floats.fortyTwoPointOneAgain:42.1 // colon is fine too
strings.abcd=abcd
strings.abcdAgain : "abcd", // colon and quotes and comma!
strings.a=a
strings.b=b
strings.c="c",
strings.d:"d"
strings.concatenated=null bar 42 baz true 3.14 hi # this gets squished to a string
arrays.empty=[]
arrays.1 : [ 1 ]
# it's allowed to omit commas in arrays if you have newlines
arrays.12 = [
1
2
]
arrays.123 = [1,
2
3]
arrays.ofString = [ "a", "b", "c" ]
booleans.true=true
booleans.trueAgain=${booleans.true}
booleans.false=false
# you could quote keys, though here it's pointless
# since the key contains no special characters
"booleans"."falseAgain" : ${booleans.false},
nulls.null=${nulls.nullAgain}
nulls.nullAgain=null
Loading

0 comments on commit a1fb45f

Please sign in to comment.