build tools 0.7.5 and JVM-IR

This commit is contained in:
Alexander Nozik 2021-02-05 09:49:35 +03:00
parent 6a0bfae931
commit 730ac69544
8 changed files with 21 additions and 20 deletions

View File

@ -4,7 +4,7 @@ import hep.dataforge.meta.DFExperimental
import org.w3c.dom.HTMLInputElement import org.w3c.dom.HTMLInputElement
@DFExperimental @DFExperimental
fun HTMLInputElement.bindValue(property: Property<String>) { public fun HTMLInputElement.bindValue(property: Property<String>) {
if (this.onchange != null) error("Input element already bound") if (this.onchange != null) error("Input element already bound")
this.onchange = { this.onchange = {
property.value = this.value property.value = this.value
@ -18,7 +18,7 @@ fun HTMLInputElement.bindValue(property: Property<String>) {
} }
@DFExperimental @DFExperimental
fun HTMLInputElement.bindChecked(property: Property<Boolean>) { public fun HTMLInputElement.bindChecked(property: Property<Boolean>) {
if (this.onchange != null) error("Input element already bound") if (this.onchange != null) error("Input element already bound")
this.onchange = { this.onchange = {
property.value = this.checked property.value = this.checked

View File

@ -1,14 +1,10 @@
plugins { plugins {
id("ru.mipt.npm.mpp") id("ru.mipt.npm.mpp")
id("ru.mipt.npm.native") // id("ru.mipt.npm.native")
} }
description = "YAML meta IO" description = "YAML meta IO"
repositories{
jcenter()
}
kscience { kscience {
useSerialization{ useSerialization{
yamlKt() yamlKt()
@ -20,8 +16,15 @@ kotlin {
commonMain{ commonMain{
dependencies { dependencies {
api(project(":dataforge-io")) api(project(":dataforge-io"))
// api("net.mamoe.yamlkt:yamlkt:${ru.mipt.npm.gradle.KScienceVersions.Serialization.yamlKtVersion}") //api("net.mamoe.yamlkt:yamlkt:${ru.mipt.npm.gradle.KScienceVersions.Serialization.yamlKtVersion}")
} }
} }
} }
} }
readme{
maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE
description ="""
YAML meta converters and Front Matter envelope format
""".trimIndent()
}

View File

@ -17,8 +17,7 @@ public class FrontMatterEnvelopeFormat(
) : EnvelopeFormat { ) : EnvelopeFormat {
override fun readPartial(input: Input): PartialEnvelope { override fun readPartial(input: Input): PartialEnvelope {
@Suppress("VARIABLE_WITH_REDUNDANT_INITIALIZER") var line: String
var line = ""
var offset = 0u var offset = 0u
do { do {
line = input.readUtf8Line() //?: error("Input does not contain front matter separator") line = input.readUtf8Line() //?: error("Input does not contain front matter separator")
@ -44,7 +43,7 @@ public class FrontMatterEnvelopeFormat(
} }
override fun readObject(input: Input): Envelope { override fun readObject(input: Input): Envelope {
var line = "" var line: String
do { do {
line = input.readUtf8Line() //?: error("Input does not contain front matter separator") line = input.readUtf8Line() //?: error("Input does not contain front matter separator")
} while (!line.startsWith(SEPARATOR)) } while (!line.startsWith(SEPARATOR))

View File

@ -86,16 +86,15 @@ public fun YamlMap.toMeta(): Meta = YamlMeta(this)
*/ */
@DFExperimental @DFExperimental
public class YamlMetaFormat(private val meta: Meta) : MetaFormat { public class YamlMetaFormat(private val meta: Meta) : MetaFormat {
private val coder = Yaml.default
override fun writeMeta(output: Output, meta: Meta, descriptor: NodeDescriptor?) { override fun writeMeta(output: Output, meta: Meta, descriptor: NodeDescriptor?) {
val yaml = meta.toYaml() val yaml = meta.toYaml()
val string = coder.encodeToString(yaml) val string = Yaml.encodeToString(yaml)
output.writeUtf8String(string) output.writeUtf8String(string)
} }
override fun readMeta(input: Input, descriptor: NodeDescriptor?): Meta { override fun readMeta(input: Input, descriptor: NodeDescriptor?): Meta {
val yaml = coder.decodeYamlMapFromString(input.readUtf8String()) val yaml = Yaml.decodeYamlMapFromString(input.readUtf8String())
return yaml.toMeta() return yaml.toMeta()
} }
@ -116,7 +115,7 @@ public class YamlMetaFormat(private val meta: Meta) : MetaFormat {
override fun writeMeta(output: Output, meta: Meta, descriptor: NodeDescriptor?): Unit = override fun writeMeta(output: Output, meta: Meta, descriptor: NodeDescriptor?): Unit =
default.writeMeta(output, meta, descriptor) default.writeMeta(output, meta, descriptor)
override fun readMeta(input: kotlinx.io.Input, descriptor: NodeDescriptor?): Meta = override fun readMeta(input: Input, descriptor: NodeDescriptor?): Meta =
default.readMeta(input, descriptor) default.readMeta(input, descriptor)
} }
} }

View File

@ -54,7 +54,7 @@ class FileBinaryTest {
val tmpPath = Files.createTempFile("dataforge_test", ".df") val tmpPath = Files.createTempFile("dataforge_test", ".df")
Global.io.writeEnvelopeFile(tmpPath, envelope) Global.io.writeEnvelopeFile(tmpPath, envelope)
val binary = Global.io.readEnvelopeFile(tmpPath)?.data!! val binary = Global.io.readEnvelopeFile(tmpPath).data!!
assertEquals(binary.size, binary.toByteArray().size) assertEquals(binary.size, binary.toByteArray().size)
} }
} }

View File

@ -29,7 +29,7 @@ class FileEnvelopeTest {
val tmpPath = Files.createTempFile("dataforge_test", ".df") val tmpPath = Files.createTempFile("dataforge_test", ".df")
writeEnvelopeFile(tmpPath, envelope) writeEnvelopeFile(tmpPath, envelope)
println(tmpPath.toUri()) println(tmpPath.toUri())
val restored: Envelope = readEnvelopeFile(tmpPath)!! val restored: Envelope = readEnvelopeFile(tmpPath)
assertTrue { envelope.contentEquals(restored) } assertTrue { envelope.contentEquals(restored) }
} }
} }
@ -40,7 +40,7 @@ class FileEnvelopeTest {
val tmpPath = Files.createTempFile("dataforge_test_tagless", ".df") val tmpPath = Files.createTempFile("dataforge_test_tagless", ".df")
writeEnvelopeFile(tmpPath, envelope, envelopeFormat = TaglessEnvelopeFormat) writeEnvelopeFile(tmpPath, envelope, envelopeFormat = TaglessEnvelopeFormat)
println(tmpPath.toUri()) println(tmpPath.toUri())
val restored: Envelope = readEnvelopeFile(tmpPath)!! val restored: Envelope = readEnvelopeFile(tmpPath)
assertTrue { envelope.contentEquals(restored) } assertTrue { envelope.contentEquals(restored) }
} }
} }

View File

@ -10,8 +10,8 @@ pluginManagement {
maven("https://dl.bintray.com/mipt-npm/dev") maven("https://dl.bintray.com/mipt-npm/dev")
} }
val toolsVersion = "0.7.4" val toolsVersion = "0.7.5"
val kotlinVersion = "1.4.30-RC" val kotlinVersion = "1.4.30"
plugins { plugins {
id("ru.mipt.npm.project") version toolsVersion id("ru.mipt.npm.project") version toolsVersion