diff --git a/etc/metadata-extractor-reflect-config.json b/META-INF/native-image/metadata-extractor-reflect-config.json similarity index 100% rename from etc/metadata-extractor-reflect-config.json rename to META-INF/native-image/metadata-extractor-reflect-config.json diff --git a/META-INF/native-image/resource-config.json b/META-INF/native-image/resource-config.json new file mode 100644 index 0000000..8e9db84 --- /dev/null +++ b/META-INF/native-image/resource-config.json @@ -0,0 +1,4 @@ +{ + "resources":[], + "bundles":[{"name":"com.sun.org.apache.xerces.internal.impl.msg.SAXMessages"}] +} \ No newline at end of file diff --git a/build.sbt b/build.sbt index fc81293..8e851de 100644 --- a/build.sbt +++ b/build.sbt @@ -3,20 +3,20 @@ import java.nio.file.{Files, StandardCopyOption} import sbt.TupleSyntax.t2ToTable2 -val copyNativeImageEtc = taskKey[Unit]("Copy native-image configurations to target") +val copyNativeImageConfigs = taskKey[Unit]("Copy native-image configurations to target") -copyNativeImageEtc := ((baseDirectory, target) map { (base, trg) => +copyNativeImageConfigs := ((baseDirectory, target) map { (base, trg) => { - Some(new File(trg, "native-image/etc").toPath) + Some(new File(trg, "native-image/META-INF/native-image").toPath) .filterNot(p => Files.isDirectory(p)) .foreach(p => Files.createDirectories(p)) - new File(base, "etc") + new File(base, "META-INF/native-image") .listFiles() .foreach( file => Files.copy( file.toPath, - new File(trg, s"native-image/etc/${file.getName}").toPath, + new File(trg, s"native-image/META-INF/native-image/${file.getName}").toPath, StandardCopyOption.REPLACE_EXISTING ) ) @@ -51,7 +51,8 @@ lazy val root = (project in file(".")) // // TODO: Generate such config automatically before building the native image nativeImageOptions ++= List( - "-H:ReflectionConfigurationFiles=etc/metadata-extractor-reflect-config.json" + "-H:ReflectionConfigurationFiles=META-INF/native-image/metadata-extractor-reflect-config.json", + "-H:ResourceConfigurationFiles=META-INF/native-image/resource-config.json" ), - nativeImage := (nativeImage dependsOn copyNativeImageEtc).value + nativeImage := (nativeImage dependsOn copyNativeImageConfigs).value ) diff --git a/src/main/resources/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages.properties b/src/main/resources/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages.properties new file mode 100644 index 0000000..571192e --- /dev/null +++ b/src/main/resources/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages.properties @@ -0,0 +1,21 @@ +BadMessageKey = The error message corresponding to the message key can not be found. +FormatFailed = An internal error occurred while formatting the following message\:\n +dom-node-read-not-supported = Cannot read DOM node property. No DOM tree exists. +errorHandlerDebugMsg=Error\: URI \= "{0}", Line \= "{1}", \: {2} +errorHandlerNotSet=Warning\: validation was turned on but an org.xml.sax.ErrorHandler was not set, which is probably not what is desired. Parser will use a default ErrorHandler to print the first {0} errors. Please call the 'setErrorHandler' method to fix this. +false-not-supported = False state for feature ''{0}'' is not supported. +feature-not-recognized = Feature ''{0}'' is not recognized. +feature-not-supported = Feature ''{0}'' is not supported. +feature-read-only = Feature ''{0}'' is read only. +incompatible-class = The value specified for property ''{0}'' cannot be casted to {1}. +jaxp-order-not-supported = Property ''{0}'' must be set before setting property ''{1}''. +jaxp-secureprocessing-feature = FEATURE_SECURE_PROCESSING\: Cannot set the feature to false when security manager is present. +nullparameter=the name parameter for "{0}" is null +property-not-parsing-supported = Property ''{0}'' is not supported while parsing. +property-not-recognized = Property ''{0}'' is not recognized. +property-not-supported = Property ''{0}'' is not supported. +property-read-only = Property ''{0}'' is read only. +schema-already-specified = Property ''{0}'' cannot be set when a non-null Schema object has already been specified. +schema-not-supported = The specified schema language is not supported. +start-document-not-called=Property "{0}" should be called after startDocument event is thrown +true-not-supported = True state for feature ''{0}'' is not supported. diff --git a/src/main/scala/net/wiringbits/myphototimeline/util/GenerateNativeReflectionConfig.scala b/src/main/scala/net/wiringbits/myphototimeline/util/GenerateNativeReflectionConfig.scala index 296bc8c..c0a66ed 100644 --- a/src/main/scala/net/wiringbits/myphototimeline/util/GenerateNativeReflectionConfig.scala +++ b/src/main/scala/net/wiringbits/myphototimeline/util/GenerateNativeReflectionConfig.scala @@ -11,7 +11,7 @@ object GenerateNativeReflectionConfig { def generateConfigFile(): Unit = { val string = metadataExtractorReflectConfig - new java.io.PrintWriter("etc/metadata-extractor-reflect-config.json") { write(string); close() } + new java.io.PrintWriter("META-INF/native-image/metadata-extractor-reflect-config.json") { write(string); close() } } def metadataExtractorReflectConfig: String = {