From f78f0f814f9eb43db845e40a6385a95aa008d927 Mon Sep 17 00:00:00 2001 From: SPC-code <112205870+SPC-code@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:34:52 +0300 Subject: [PATCH 1/7] Create LICENSE --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. -- 2.34.1 From cfa20eedba49bd39270ff285a7c1f51ce7105244 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 9 Jul 2023 21:38:33 +0300 Subject: [PATCH 2/7] Update version to 1.9 --- .github/workflows/pages.yml | 27 +++++----- .github/workflows/publish.yml | 51 +++++++++---------- build.gradle.kts | 2 +- .../dataforge/actions/ReduceAction.kt | 1 - .../kscience/dataforge/actions/SplitAction.kt | 1 - gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 7 files changed, 41 insertions(+), 45 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 23ed5435..5c1c3bac 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,28 +1,31 @@ name: Dokka publication on: - push: - branches: [ master ] + workflow_dispatch: + release: + types: [ created ] jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest timeout-minutes: 40 steps: - - uses: actions/checkout@v2 - - uses: DeLaGuardo/setup-graalvm@4.0 + - uses: actions/checkout@v3.0.0 + - uses: actions/setup-java@v3.0.0 with: - graalvm: 21.2.0 - java: java11 - arch: amd64 - - uses: actions/cache@v2 + java-version: 11 + distribution: liberica + - name: Cache konan + uses: actions/cache@v3.0.1 with: - path: ~/.gradle/caches + path: ~/.konan key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} restore-keys: | ${{ runner.os }}-gradle- - - run: ./gradlew dokkaHtmlMultiModule --build-cache --no-daemon --no-parallel --stacktrace - - uses: JamesIves/github-pages-deploy-action@4.1.0 + - uses: gradle/gradle-build-action@v2.1.5 + with: + arguments: dokkaHtmlMultiModule --no-parallel + - uses: JamesIves/github-pages-deploy-action@v4.3.0 with: branch: gh-pages folder: build/dokka/htmlMultiModule diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e607e4b7..ab9243f1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,32 +9,18 @@ jobs: publish: environment: name: publish - env: - publishing.github: false strategy: matrix: os: [ macOS-latest, windows-latest ] runs-on: ${{matrix.os}} steps: - - name: Checkout the repo - uses: actions/checkout@v2 - - name: Set up JDK 11 - uses: DeLaGuardo/setup-graalvm@4.0 + - uses: actions/checkout@v3.0.0 + - uses: actions/setup-java@v3.10.0 with: - graalvm: 21.2.0 - java: java11 - arch: amd64 - - name: Cache gradle - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} - restore-keys: | - ${{ runner.os }}-gradle- + java-version: 11 + distribution: liberica - name: Cache konan - uses: actions/cache@v2 + uses: actions/cache@v3.0.1 with: path: ~/.konan key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }} @@ -42,14 +28,23 @@ jobs: ${{ runner.os }}-gradle- - name: Publish Windows Artifacts if: matrix.os == 'windows-latest' - shell: cmd - run: > - ./gradlew release --no-daemon --build-cache -Ppublishing.enabled=true - -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }} - -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }} + uses: gradle/gradle-build-action@v2.4.0 + with: + arguments: | + publishAllPublicationsToSpaceRepository + -Ppublishing.targets=all + -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }} + -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }} - name: Publish Mac Artifacts if: matrix.os == 'macOS-latest' - run: > - ./gradlew release --no-daemon --build-cache -Ppublishing.enabled=true - -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }} - -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }} + uses: gradle/gradle-build-action@v2.4.0 + with: + arguments: | + publishMacosX64PublicationToSpaceRepository + publishMacosArm64PublicationToSpaceRepository + publishIosX64PublicationToSpaceRepository + publishIosArm64PublicationToSpaceRepository + publishIosSimulatorArm64PublicationToSpaceRepository + -Ppublishing.targets=all + -Ppublishing.space.user=${{ secrets.SPACE_APP_ID }} + -Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }} diff --git a/build.gradle.kts b/build.gradle.kts index bc123f49..5b886e58 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.6.1" + version = "0.6.2-dev-kotlin-1.9.0" } subprojects { diff --git a/dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/actions/ReduceAction.kt b/dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/actions/ReduceAction.kt index c14152f8..fe823bd7 100644 --- a/dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/actions/ReduceAction.kt +++ b/dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/actions/ReduceAction.kt @@ -112,7 +112,6 @@ internal class ReduceAction( * A one-to-one mapping action */ @DFExperimental -@Suppress("FunctionName") public inline fun Action.Companion.reduce( noinline builder: ReduceGroupBuilder.() -> Unit, ): Action = ReduceAction(typeOf(), builder) diff --git a/dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/actions/SplitAction.kt b/dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/actions/SplitAction.kt index 88e6061b..24745929 100644 --- a/dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/actions/SplitAction.kt +++ b/dataforge-data/src/commonMain/kotlin/space/kscience/dataforge/actions/SplitAction.kt @@ -87,7 +87,6 @@ internal class SplitAction( * Action that splits each incoming element into a number of fragments defined in builder */ @DFExperimental -@Suppress("FunctionName") public inline fun Action.Companion.split( noinline builder: SplitBuilder.() -> Unit, ): Action = SplitAction(typeOf(), builder) \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 813d5d08..df992b2c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.mpp.stability.nowarn=true kotlin.incremental.js.ir=true kotlin.native.ignoreDisabledTargets=true -toolsVersion=0.14.5-kotlin-1.8.20-RC +toolsVersion=0.14.9-kotlin-1.9.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e1bef7e8..15de9024 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -- 2.34.1 From de476fb273eff3eb5944fe8f782872d6e1e849c8 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 26 Jul 2023 16:47:12 +0300 Subject: [PATCH 3/7] Fix json serialization. --- CHANGELOG.md | 1 + README.md | 49 ------------------- build.gradle.kts | 2 +- dataforge-io/build.gradle.kts | 6 +-- .../dataforge-io-yaml/build.gradle.kts | 8 --- dataforge-meta/build.gradle.kts | 2 +- .../space/kscience/dataforge/meta/JsonMeta.kt | 11 +++-- docs/templates/ARTIFACT-TEMPLATE.md | 29 ----------- docs/templates/README-TEMPLATE.md | 2 +- gradle.properties | 2 +- 10 files changed, 15 insertions(+), 97 deletions(-) delete mode 100644 README.md delete mode 100644 docs/templates/ARTIFACT-TEMPLATE.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ac4a5574..36105b78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added ### Changed +- Meta to Json serializer now serializes a single item with index as an array. It is important for plotly integration. ### Deprecated diff --git a/README.md b/README.md deleted file mode 100644 index b6a8a566..00000000 --- a/README.md +++ /dev/null @@ -1,49 +0,0 @@ -[![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) -[![DOI](https://zenodo.org/badge/148831678.svg)](https://zenodo.org/badge/latestdoi/148831678) - -![Gradle build](https://github.com/mipt-npm/dataforge-core/workflows/Gradle%20build/badge.svg) - -
- -* ### [dataforge-context](dataforge-context) -> -> -> **Maturity**: DEVELOPMENT -
- -* ### [dataforge-data](dataforge-data) -> -> -> **Maturity**: EXPERIMENTAL -
- -* ### [dataforge-io](dataforge-io) -> -> -> **Maturity**: PROTOTYPE -
- -* ### [dataforge-meta](dataforge-meta) -> -> -> **Maturity**: DEVELOPMENT -
- -* ### [dataforge-scripting](dataforge-scripting) -> -> -> **Maturity**: PROTOTYPE -
- -* ### [dataforge-workspace](dataforge-workspace) -> -> -> **Maturity**: EXPERIMENTAL -
- -* ### [dataforge-io-yaml](dataforge-io/dataforge-io-yaml) -> YAML meta converters and Front Matter envelope format -> -> **Maturity**: PROTOTYPE -
- diff --git a/build.gradle.kts b/build.gradle.kts index 5b886e58..883306ea 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.6.2-dev-kotlin-1.9.0" + version = "0.6.2-dev-2" } subprojects { diff --git a/dataforge-io/build.gradle.kts b/dataforge-io/build.gradle.kts index 91319d4d..9f2030c7 100644 --- a/dataforge-io/build.gradle.kts +++ b/dataforge-io/build.gradle.kts @@ -10,8 +10,8 @@ kscience { jvm() js() native() - useSerialization("1.4.1") - useSerialization("1.4.1", sourceSet = space.kscience.gradle.DependencySourceSet.TEST) { + useSerialization() + useSerialization(sourceSet = space.kscience.gradle.DependencySourceSet.TEST) { cbor() } dependencies { @@ -20,6 +20,6 @@ kscience { } } -readme{ +readme { maturity = space.kscience.gradle.Maturity.PROTOTYPE } \ No newline at end of file diff --git a/dataforge-io/dataforge-io-yaml/build.gradle.kts b/dataforge-io/dataforge-io-yaml/build.gradle.kts index b33e1b9a..505ce360 100644 --- a/dataforge-io/dataforge-io-yaml/build.gradle.kts +++ b/dataforge-io/dataforge-io-yaml/build.gradle.kts @@ -4,10 +4,6 @@ plugins { description = "YAML meta IO" -repositories { - mavenCentral() -} - kscience { jvm() js() @@ -20,10 +16,6 @@ kscience { } } -repositories{ - maven("https://dl.bintray.com/mamoe/yamlkt") -} - readme{ maturity = space.kscience.gradle.Maturity.PROTOTYPE description =""" diff --git a/dataforge-meta/build.gradle.kts b/dataforge-meta/build.gradle.kts index decf0760..51b07113 100644 --- a/dataforge-meta/build.gradle.kts +++ b/dataforge-meta/build.gradle.kts @@ -6,7 +6,7 @@ kscience { jvm() js() native() - useSerialization("1.4.1"){ + useSerialization{ json() } } diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt index e36f0e55..98f0c3e4 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt @@ -23,7 +23,6 @@ public fun Value.toJson(descriptor: MetaDescriptor? = null): JsonElement = when } //Use these methods to customize JSON key mapping -@Suppress("NULLABLE_EXTENSION_OPERATOR_WITH_SAFE_CALL_RECEIVER") private fun String.toJsonKey(descriptor: MetaDescriptor?) = descriptor?.attributes?.get("jsonName").string ?: toString() private fun Meta.toJsonWithIndex(descriptor: MetaDescriptor?, index: String?): JsonElement = if (items.isEmpty()) { @@ -35,9 +34,13 @@ private fun Meta.toJsonWithIndex(descriptor: MetaDescriptor?, index: String?): J val childDescriptor = descriptor?.children?.get(body) if (list.size == 1) { val (token, element) = list.first() - //do not add empty element - val child: JsonElement = element.toJsonWithIndex(childDescriptor, token.index) - body to child + //do not add an empty element + val child: JsonElement = element.toJsonWithIndex(childDescriptor, token.index) + if(token.index == null) { + body to child + } else { + body to JsonArray(listOf(child)) + } } else { val elements: List = list.sortedBy { it.key.index }.mapIndexed { index, entry -> //Use index if it is not equal to the item order diff --git a/docs/templates/ARTIFACT-TEMPLATE.md b/docs/templates/ARTIFACT-TEMPLATE.md deleted file mode 100644 index 6b921b05..00000000 --- a/docs/templates/ARTIFACT-TEMPLATE.md +++ /dev/null @@ -1,29 +0,0 @@ -> #### Artifact: -> -> This module artifact: `${group}:${name}:${version}`. -> -> -> [![Maven Central](https://img.shields.io/maven-central/v/space.kscience/${name}.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience%22%20AND%20a:%22${name}%22) -> -> **Gradle:** -> -> ```gradle -> repositories { -> maven { url 'https://repo.kotlin.link' } -> } -> -> dependencies { -> implementation '${group}:${name}:${version}' -> } -> ``` -> **Gradle Kotlin DSL:** -> -> ```kotlin -> repositories { -> maven("https://https://repo.kotlin.link") -> } -> -> dependencies { -> implementation("${group}:${name}:${version}") -> } -> ``` \ No newline at end of file diff --git a/docs/templates/README-TEMPLATE.md b/docs/templates/README-TEMPLATE.md index a28f0db3..762e5d7e 100644 --- a/docs/templates/README-TEMPLATE.md +++ b/docs/templates/README-TEMPLATE.md @@ -3,4 +3,4 @@ ![Gradle build](https://github.com/mipt-npm/dataforge-core/workflows/Gradle%20build/badge.svg) -$modules +${modules} diff --git a/gradle.properties b/gradle.properties index df992b2c..27743a30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,4 +6,4 @@ kotlin.mpp.stability.nowarn=true kotlin.incremental.js.ir=true kotlin.native.ignoreDisabledTargets=true -toolsVersion=0.14.9-kotlin-1.9.0 +toolsVersion=0.14.9-kotlin-1.8.20 -- 2.34.1 From ee5afcdafead87023e3478bfd745bf11c7299206 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 29 Jul 2023 12:42:14 +0300 Subject: [PATCH 4/7] Update meta serialization rules --- CHANGELOG.md | 1 + build.gradle.kts | 2 +- .../kscience/dataforge/io/JsonMetaFormat.kt | 6 +-- .../space/kscience/dataforge/meta/JsonMeta.kt | 37 +++++++++---------- .../space/kscience/dataforge/meta/Value.kt | 2 +- .../dataforge/meta/MetaSerializationTest.kt | 32 +++++++++++++++- 6 files changed, 55 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36105b78..710f8569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Changed - Meta to Json serializer now serializes a single item with index as an array. It is important for plotly integration. +- Meta to Json serializes Meta without children a value as literal or array instead of an object with `@value` field. ### Deprecated diff --git a/build.gradle.kts b/build.gradle.kts index 883306ea..dc9880bd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.6.2-dev-2" + version = "0.6.2-dev-3" } subprojects { diff --git a/dataforge-io/src/commonMain/kotlin/space/kscience/dataforge/io/JsonMetaFormat.kt b/dataforge-io/src/commonMain/kotlin/space/kscience/dataforge/io/JsonMetaFormat.kt index 4bb3c82d..f3d9e02a 100644 --- a/dataforge-io/src/commonMain/kotlin/space/kscience/dataforge/io/JsonMetaFormat.kt +++ b/dataforge-io/src/commonMain/kotlin/space/kscience/dataforge/io/JsonMetaFormat.kt @@ -6,7 +6,7 @@ package space.kscience.dataforge.io import io.ktor.utils.io.core.Input import io.ktor.utils.io.core.Output import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.json.JsonElement import space.kscience.dataforge.context.Context import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.meta.descriptors.MetaDescriptor @@ -19,8 +19,8 @@ import space.kscience.dataforge.meta.toMeta public class JsonMetaFormat(private val json: Json = DEFAULT_JSON) : MetaFormat { override fun writeMeta(output: Output, meta: Meta, descriptor: MetaDescriptor?) { - val jsonObject = meta.toJson(descriptor) - output.writeUtf8String(json.encodeToString(JsonObject.serializer(), jsonObject)) + val jsonElement = meta.toJson(descriptor) + output.writeUtf8String(json.encodeToString(JsonElement.serializer(), jsonElement)) } override fun readMeta(input: Input, descriptor: MetaDescriptor?): Meta { diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt index 98f0c3e4..7b21fad2 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt @@ -64,30 +64,29 @@ private fun Meta.toJsonWithIndex(descriptor: MetaDescriptor?, index: String?): J JsonObject(pairs.toMap()) } -public fun Meta.toJson(descriptor: MetaDescriptor? = null): JsonObject { - val element = toJsonWithIndex(descriptor, null) - return if (element is JsonObject) { - element - } else { - buildJsonObject { - put("@value", element) - } - } +public fun Meta.toJson(descriptor: MetaDescriptor? = null): JsonElement { + return toJsonWithIndex(descriptor, null) +// val element = toJsonWithIndex(descriptor, null) +// return if (element is JsonObject) { +// element +// } else { +// buildJsonObject { +// put("@value", element) +// } +// } } /** * Convert a Json primitive to a [Value] */ -public fun JsonPrimitive.toValue(descriptor: MetaDescriptor?): Value { - return when (this) { - JsonNull -> Null - else -> { - if (isString) { - StringValue(content) - } else { - //consider using LazyParse - content.parseValue() - } +public fun JsonPrimitive.toValue(descriptor: MetaDescriptor?): Value = when (this) { + JsonNull -> Null + else -> { + if (isString) { + content.asValue() + } else { + //consider using LazyParse + content.parseValue() } } } diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/Value.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/Value.kt index e051c10c..73950f53 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/Value.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/Value.kt @@ -226,7 +226,7 @@ public fun > E.asValue(): Value = EnumValue(this) /** - * Create Value from String using closest match conversion + * Create Value from String using the closest match conversion */ public fun String.parseValue(): Value { diff --git a/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/MetaSerializationTest.kt b/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/MetaSerializationTest.kt index de660e10..0f270bc6 100644 --- a/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/MetaSerializationTest.kt +++ b/dataforge-meta/src/commonTest/kotlin/space/kscience/dataforge/meta/MetaSerializationTest.kt @@ -1,15 +1,45 @@ package space.kscience.dataforge.meta import kotlinx.serialization.json.Json +import space.kscience.dataforge.names.asName import kotlin.test.Test import kotlin.test.assertEquals class MetaSerializationTest { @Test - fun singleValueDeserialization(){ + fun singleValueDeserialization() { val string = "ddd" val meta = Json.decodeFromString(MetaSerializer, string) assertEquals(string, meta.value?.string) } + + @Test + fun complexMeta() { + val meta = Meta { + "a" put 28.3 + "b" put doubleArrayOf(1.0, 2.0, 3.2) + "child" put Meta { + "a" put "aString" + "sns[0]" put Meta { + "d" put 0 + } + "sns[1]" put Meta { + "d" put 1 + } + setIndexed( + "sns2".asName(), + listOf( + Meta { "d" put "first" }, + Meta("53") + ) + ) + } + } + + val string = Json.encodeToString(MetaSerializer, meta) + println(string) + val reconstructed = Json.decodeFromString(MetaSerializer, string) + assertEquals(meta, reconstructed) + } } \ No newline at end of file -- 2.34.1 From 3644533043453238529aa77fe23b904d5edb9be5 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 29 Jul 2023 12:56:35 +0300 Subject: [PATCH 5/7] update documentation --- .../space/kscience/dataforge/meta/JsonMeta.kt | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt index 7b21fad2..7dc44785 100644 --- a/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt +++ b/dataforge-meta/src/commonMain/kotlin/space/kscience/dataforge/meta/JsonMeta.kt @@ -64,17 +64,12 @@ private fun Meta.toJsonWithIndex(descriptor: MetaDescriptor?, index: String?): J JsonObject(pairs.toMap()) } -public fun Meta.toJson(descriptor: MetaDescriptor? = null): JsonElement { - return toJsonWithIndex(descriptor, null) -// val element = toJsonWithIndex(descriptor, null) -// return if (element is JsonObject) { -// element -// } else { -// buildJsonObject { -// put("@value", element) -// } -// } -} +/** + * Convert Meta to [JsonElement]. Meta with children is converted to [JsonObject]. + * Meta without children is converted to either [JsonPrimitive] or [JsonArray] depending on the value type. + * An empty Meta is converted to an empty JsonObject. + */ +public fun Meta.toJson(descriptor: MetaDescriptor? = null): JsonElement = toJsonWithIndex(descriptor, null) /** * Convert a Json primitive to a [Value] -- 2.34.1 From d5ebef404f8cac83ec2eaf6b18146415dae10860 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 29 Jul 2023 12:59:55 +0300 Subject: [PATCH 6/7] update documentation --- CHANGELOG.md | 8 ++++++-- build.gradle.kts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 710f8569..ee7190af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,6 @@ ### Added ### Changed -- Meta to Json serializer now serializes a single item with index as an array. It is important for plotly integration. -- Meta to Json serializes Meta without children a value as literal or array instead of an object with `@value` field. ### Deprecated @@ -16,6 +14,12 @@ ### Security +## 0.6.2 - 2023-07-29 + +### Changed +- Meta to Json serializer now serializes a single item with index as an array. It is important for plotly integration. +- Meta to Json serializes Meta without children a value as literal or array instead of an object with `@value` field. + ## 0.6.1 - 2023-03-31 ### Added diff --git a/build.gradle.kts b/build.gradle.kts index dc9880bd..bbab94eb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { allprojects { group = "space.kscience" - version = "0.6.2-dev-3" + version = "0.6.2" } subprojects { -- 2.34.1 From 3806f97c77e4c41ffe11f0228015388cb87ba21f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 29 Jul 2023 13:00:17 +0300 Subject: [PATCH 7/7] update documentation --- README.md | 41 ++++++++++++++++++++++++ dataforge-context/README.md | 32 ++++++++++++++++++ dataforge-data/README.md | 32 ++++++++++++++++++ dataforge-io/README.md | 32 ++++++++++++++++++ dataforge-io/dataforge-io-yaml/README.md | 32 ++++++++++++++++++ dataforge-meta/README.md | 32 ++++++++++++++++++ dataforge-scripting/README.md | 32 ++++++++++++++++++ dataforge-workspace/README.md | 32 ++++++++++++++++++ 8 files changed, 265 insertions(+) create mode 100644 README.md create mode 100644 dataforge-context/README.md create mode 100644 dataforge-data/README.md create mode 100644 dataforge-io/README.md create mode 100644 dataforge-io/dataforge-io-yaml/README.md create mode 100644 dataforge-meta/README.md create mode 100644 dataforge-scripting/README.md create mode 100644 dataforge-workspace/README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..a973a25f --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +[![JetBrains Research](https://jb.gg/badges/research.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub) +[![DOI](https://zenodo.org/badge/148831678.svg)](https://zenodo.org/badge/latestdoi/148831678) + +![Gradle build](https://github.com/mipt-npm/dataforge-core/workflows/Gradle%20build/badge.svg) + + +### [dataforge-context](dataforge-context) +> +> +> **Maturity**: DEVELOPMENT + +### [dataforge-data](dataforge-data) +> +> +> **Maturity**: EXPERIMENTAL + +### [dataforge-io](dataforge-io) +> +> +> **Maturity**: PROTOTYPE + +### [dataforge-meta](dataforge-meta) +> +> +> **Maturity**: DEVELOPMENT + +### [dataforge-scripting](dataforge-scripting) +> +> +> **Maturity**: PROTOTYPE + +### [dataforge-workspace](dataforge-workspace) +> +> +> **Maturity**: EXPERIMENTAL + +### [dataforge-io/dataforge-io-yaml](dataforge-io/dataforge-io-yaml) +> YAML meta converters and Front Matter envelope format +> +> **Maturity**: PROTOTYPE + diff --git a/dataforge-context/README.md b/dataforge-context/README.md new file mode 100644 index 00000000..06e06f3a --- /dev/null +++ b/dataforge-context/README.md @@ -0,0 +1,32 @@ +# Module dataforge-context + +Context and provider definitions + +## Usage + +## Artifact: + +The Maven coordinates of this project are `space.kscience:dataforge-context:0.6.2-dev-2`. + +**Gradle Groovy:** +```groovy +repositories { + maven { url 'https://repo.kotlin.link' } + mavenCentral() +} + +dependencies { + implementation 'space.kscience:dataforge-context:0.6.2-dev-2' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + mavenCentral() +} + +dependencies { + implementation("space.kscience:dataforge-context:0.6.2-dev-2") +} +``` diff --git a/dataforge-data/README.md b/dataforge-data/README.md new file mode 100644 index 00000000..3b74b2de --- /dev/null +++ b/dataforge-data/README.md @@ -0,0 +1,32 @@ +# Module dataforge-data + + + +## Usage + +## Artifact: + +The Maven coordinates of this project are `space.kscience:dataforge-data:0.6.2-dev-2`. + +**Gradle Groovy:** +```groovy +repositories { + maven { url 'https://repo.kotlin.link' } + mavenCentral() +} + +dependencies { + implementation 'space.kscience:dataforge-data:0.6.2-dev-2' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + mavenCentral() +} + +dependencies { + implementation("space.kscience:dataforge-data:0.6.2-dev-2") +} +``` diff --git a/dataforge-io/README.md b/dataforge-io/README.md new file mode 100644 index 00000000..6ce35db3 --- /dev/null +++ b/dataforge-io/README.md @@ -0,0 +1,32 @@ +# Module dataforge-io + +IO module + +## Usage + +## Artifact: + +The Maven coordinates of this project are `space.kscience:dataforge-io:0.6.2-dev-2`. + +**Gradle Groovy:** +```groovy +repositories { + maven { url 'https://repo.kotlin.link' } + mavenCentral() +} + +dependencies { + implementation 'space.kscience:dataforge-io:0.6.2-dev-2' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + mavenCentral() +} + +dependencies { + implementation("space.kscience:dataforge-io:0.6.2-dev-2") +} +``` diff --git a/dataforge-io/dataforge-io-yaml/README.md b/dataforge-io/dataforge-io-yaml/README.md new file mode 100644 index 00000000..452ba504 --- /dev/null +++ b/dataforge-io/dataforge-io-yaml/README.md @@ -0,0 +1,32 @@ +# Module dataforge-io-yaml + +YAML meta IO + +## Usage + +## Artifact: + +The Maven coordinates of this project are `space.kscience:dataforge-io-yaml:0.6.2-dev-2`. + +**Gradle Groovy:** +```groovy +repositories { + maven { url 'https://repo.kotlin.link' } + mavenCentral() +} + +dependencies { + implementation 'space.kscience:dataforge-io-yaml:0.6.2-dev-2' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + mavenCentral() +} + +dependencies { + implementation("space.kscience:dataforge-io-yaml:0.6.2-dev-2") +} +``` diff --git a/dataforge-meta/README.md b/dataforge-meta/README.md new file mode 100644 index 00000000..0088dcf7 --- /dev/null +++ b/dataforge-meta/README.md @@ -0,0 +1,32 @@ +# Module dataforge-meta + +Meta definition and basic operations on meta + +## Usage + +## Artifact: + +The Maven coordinates of this project are `space.kscience:dataforge-meta:0.6.2-dev-2`. + +**Gradle Groovy:** +```groovy +repositories { + maven { url 'https://repo.kotlin.link' } + mavenCentral() +} + +dependencies { + implementation 'space.kscience:dataforge-meta:0.6.2-dev-2' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + mavenCentral() +} + +dependencies { + implementation("space.kscience:dataforge-meta:0.6.2-dev-2") +} +``` diff --git a/dataforge-scripting/README.md b/dataforge-scripting/README.md new file mode 100644 index 00000000..c4d2caad --- /dev/null +++ b/dataforge-scripting/README.md @@ -0,0 +1,32 @@ +# Module dataforge-scripting + + + +## Usage + +## Artifact: + +The Maven coordinates of this project are `space.kscience:dataforge-scripting:0.6.2-dev-2`. + +**Gradle Groovy:** +```groovy +repositories { + maven { url 'https://repo.kotlin.link' } + mavenCentral() +} + +dependencies { + implementation 'space.kscience:dataforge-scripting:0.6.2-dev-2' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + mavenCentral() +} + +dependencies { + implementation("space.kscience:dataforge-scripting:0.6.2-dev-2") +} +``` diff --git a/dataforge-workspace/README.md b/dataforge-workspace/README.md new file mode 100644 index 00000000..2aafb8df --- /dev/null +++ b/dataforge-workspace/README.md @@ -0,0 +1,32 @@ +# Module dataforge-workspace + + + +## Usage + +## Artifact: + +The Maven coordinates of this project are `space.kscience:dataforge-workspace:0.6.2-dev-2`. + +**Gradle Groovy:** +```groovy +repositories { + maven { url 'https://repo.kotlin.link' } + mavenCentral() +} + +dependencies { + implementation 'space.kscience:dataforge-workspace:0.6.2-dev-2' +} +``` +**Gradle Kotlin DSL:** +```kotlin +repositories { + maven("https://repo.kotlin.link") + mavenCentral() +} + +dependencies { + implementation("space.kscience:dataforge-workspace:0.6.2-dev-2") +} +``` -- 2.34.1