From effa19a95e7f555e76b2546cbdae9424dbc7161e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 21 Jul 2019 18:21:13 +0300 Subject: [PATCH] Migrating to new plugin (not working with three-js yet) --- build.gradle.kts | 19 +++- dataforge-vis-common/build.gradle.kts | 11 +- .../hep/dataforge/vis/fx/meta/ConfigEditor.kt | 7 +- dataforge-vis-spatial-fx/build.gradle.kts | 9 +- dataforge-vis-spatial-gdml/build.gradle.kts | 4 - .../dataforge/vis/spatial/gdml/visualGDML.kt | 2 +- dataforge-vis-spatial-js/build.gradle.kts | 106 +++++++++--------- .../hep/dataforge/vis/spatial/Composite.kt | 2 +- settings.gradle.kts | 4 +- 9 files changed, 80 insertions(+), 84 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6402a8f7..a21838aa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,17 @@ val dataforgeVersion by extra("0.1.3-dev-9") plugins{ - kotlin("jvm") version "1.3.41" apply false - id("kotlin2js") version "1.3.41" apply false - id("kotlin-dce-js") version "1.3.41" apply false + val kotlinVersion = "1.3.50-eap-5" + + kotlin("jvm") version kotlinVersion apply false + id("kotlin2js") version kotlinVersion apply false + id("kotlin-dce-js") version kotlinVersion apply false id("org.jetbrains.kotlin.frontend") version "0.0.45" apply false - id("scientifik.mpp") version "0.1.3" apply false - id("scientifik.publish") version "0.1.3" apply false + id("scientifik.mpp") version "0.1.4-dev" apply false + id("scientifik.jvm") version "0.1.4-dev" apply false + id("scientifik.js") version "0.1.4-dev" apply false + id("scientifik.publish") version "0.1.4-dev" apply false + id("org.openjfx.javafxplugin") version "0.0.7" apply false } allprojects { @@ -16,10 +21,12 @@ allprojects { maven("https://kotlin.bintray.com/kotlinx") maven("http://npm.mipt.ru:8081/artifactory/gradle-dev-local") maven("https://kotlin.bintray.com/js-externals") + maven("https://dl.bintray.com/pdvrieze/maven") + maven("https://dl.bintray.com/kotlin/kotlin-eap") } group = "hep.dataforge" - version = "0.1.0" + version = "0.1.0-dev" } val githubProject by extra("dataforge-vis") diff --git a/dataforge-vis-common/build.gradle.kts b/dataforge-vis-common/build.gradle.kts index e0b750fb..e5c6d413 100644 --- a/dataforge-vis-common/build.gradle.kts +++ b/dataforge-vis-common/build.gradle.kts @@ -2,6 +2,10 @@ plugins { id("scientifik.mpp") } +scientifik{ + serialization = true +} + val dataforgeVersion: String by rootProject.extra kotlin { @@ -9,18 +13,11 @@ kotlin { val commonMain by getting { dependencies { api("hep.dataforge:dataforge-output:$dataforgeVersion") -// api("hep.dataforge:dataforge-output-metadata:$dataforgeVersion") - } - } - val jvmMain by getting { - dependencies { -// api("hep.dataforge:dataforge-output-jvm:$dataforgeVersion") } } val jsMain by getting { dependencies { api("hep.dataforge:dataforge-output-html:$dataforgeVersion") -// api("hep.dataforge:dataforge-output-js:$dataforgeVersion") } } } diff --git a/dataforge-vis-fx/src/main/kotlin/hep/dataforge/vis/fx/meta/ConfigEditor.kt b/dataforge-vis-fx/src/main/kotlin/hep/dataforge/vis/fx/meta/ConfigEditor.kt index bf6321a3..da961fdb 100644 --- a/dataforge-vis-fx/src/main/kotlin/hep/dataforge/vis/fx/meta/ConfigEditor.kt +++ b/dataforge-vis-fx/src/main/kotlin/hep/dataforge/vis/fx/meta/ConfigEditor.kt @@ -5,6 +5,7 @@ */ package hep.dataforge.vis.fx.meta +import hep.dataforge.context.Global import hep.dataforge.descriptors.NodeDescriptor import hep.dataforge.meta.Config import hep.dataforge.names.NameToken @@ -30,7 +31,7 @@ class ConfigEditor( ) : Fragment(title = title, icon = dfIconView) { constructor(config: Config, descriptor: NodeDescriptor, title: String = "Configuration editor") : - this(FXMeta.root(config, descriptor = descriptor),title = title) + this(FXMeta.root(config, descriptor = descriptor), title = title) override val root = borderpane { center = treetableview> { @@ -124,13 +125,13 @@ class ConfigEditor( when (item) { is FXMetaValue -> { text = null - val chooser = ValueChooser.build(item.valueProperty, item.descriptor) { + val chooser = ValueChooser.build(Global, item.valueProperty, item.descriptor) { item.set(it) } graphic = chooser.node } is FXMetaNode -> { - if(allowNew) { + if (allowNew) { text = null graphic = hbox { button("node", Glyph("FontAwesome", "PLUS_CIRCLE")) { diff --git a/dataforge-vis-spatial-fx/build.gradle.kts b/dataforge-vis-spatial-fx/build.gradle.kts index eb4f1bfd..4cd61958 100644 --- a/dataforge-vis-spatial-fx/build.gradle.kts +++ b/dataforge-vis-spatial-fx/build.gradle.kts @@ -1,8 +1,7 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.openjfx.gradle.JavaFXOptions plugins { - kotlin("jvm") + id("scientifik.jvm") id("org.openjfx.javafxplugin") } @@ -14,10 +13,4 @@ dependencies { configure { modules("javafx.controls") -} - -tasks.withType { - kotlinOptions{ - jvmTarget = "1.8" - } } \ No newline at end of file diff --git a/dataforge-vis-spatial-gdml/build.gradle.kts b/dataforge-vis-spatial-gdml/build.gradle.kts index def32410..c4350ef1 100644 --- a/dataforge-vis-spatial-gdml/build.gradle.kts +++ b/dataforge-vis-spatial-gdml/build.gradle.kts @@ -2,10 +2,6 @@ plugins { id("scientifik.mpp") } -repositories{ - maven("https://dl.bintray.com/pdvrieze/maven") -} - kotlin { sourceSets { val commonMain by getting { diff --git a/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt b/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt index 046ee11c..c28a05fa 100644 --- a/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt +++ b/dataforge-vis-spatial-gdml/src/commonMain/kotlin/hep/dataforge/vis/spatial/gdml/visualGDML.kt @@ -39,7 +39,7 @@ private fun VisualGroup.addSolid(root: GDML, solid: GDMLSolid, block: VisualObje } } solid.sections.sortedBy { it.zOrder }.forEach { section -> - layer(section.zPosition ?: 0f, section.xOffset, section.yOffset, section.scalingFactor) + layer(section.zPosition, section.xOffset, section.yOffset, section.scalingFactor) } } is GDMLScaledSolid -> { diff --git a/dataforge-vis-spatial-js/build.gradle.kts b/dataforge-vis-spatial-js/build.gradle.kts index 72e3b5c1..588cd849 100644 --- a/dataforge-vis-spatial-js/build.gradle.kts +++ b/dataforge-vis-spatial-js/build.gradle.kts @@ -1,16 +1,6 @@ -import org.jetbrains.kotlin.gradle.frontend.KotlinFrontendExtension -import org.jetbrains.kotlin.gradle.frontend.npm.NpmExtension -import org.jetbrains.kotlin.gradle.frontend.webpack.WebPackExtension -import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile - plugins { - id("kotlin2js") + id("scientifik.js") id("kotlin-dce-js") - id("org.jetbrains.kotlin.frontend") -} - -repositories{ - maven("https://dl.bintray.com/pdvrieze/maven") } //val kotlinVersion: String by rootProject.extra @@ -22,48 +12,58 @@ dependencies { testCompile(kotlin("test-js")) } -configure { - downloadNodeJsVersion = "latest" - - configure { - dependency("three","0.106.2") - dependency("@hi-level/three-csg") - dependency("style-loader") - dependency("element-resize-event") - devDependency("karma") - } - - sourceMaps = true - - bundle("webpack") { - this as WebPackExtension - bundleName = "main" - contentPath = file("src/main/web") - sourceMapEnabled = true - //mode = "production" - mode = "development" +kotlin{ + sourceSets["main"].dependencies{ + api(npm("three","0.106.2")) + implementation(npm("@hi-level/three-csg")) + implementation(npm("style-loader")) + implementation(npm("element-resize-event")) } } -tasks { - "compileKotlin2Js"(Kotlin2JsCompile::class) { - kotlinOptions { - metaInfo = true - outputFile = "${project.buildDir.path}/js/${project.name}.js" - sourceMap = true - moduleKind = "commonjs" - main = "call" - kotlinOptions.sourceMapEmbedSources = "always" - } - } - - "compileTestKotlin2Js"(Kotlin2JsCompile::class) { - kotlinOptions { - metaInfo = true - outputFile = "${project.buildDir.path}/js/${project.name}-test.js" - sourceMap = true - moduleKind = "commonjs" - kotlinOptions.sourceMapEmbedSources = "always" - } - } -} \ No newline at end of file +// +//configure { +// downloadNodeJsVersion = "latest" +// +// configure { +// dependency("three","0.106.2") +// dependency("@hi-level/three-csg") +// dependency("style-loader") +// dependency("element-resize-event") +// devDependency("karma") +// } +// +// sourceMaps = true +// +// bundle("webpack") { +// this as WebPackExtension +// bundleName = "main" +// contentPath = file("src/main/web") +// sourceMapEnabled = true +// //mode = "production" +// mode = "development" +// } +//} +// +//tasks { +// "compileKotlin2Js"(Kotlin2JsCompile::class) { +// kotlinOptions { +// metaInfo = true +// outputFile = "${project.buildDir.path}/js/${project.name}.js" +// sourceMap = true +// moduleKind = "commonjs" +// main = "call" +// kotlinOptions.sourceMapEmbedSources = "always" +// } +// } +// +// "compileTestKotlin2Js"(Kotlin2JsCompile::class) { +// kotlinOptions { +// metaInfo = true +// outputFile = "${project.buildDir.path}/js/${project.name}-test.js" +// sourceMap = true +// moduleKind = "commonjs" +// kotlinOptions.sourceMapEmbedSources = "always" +// } +// } +//} \ No newline at end of file diff --git a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Composite.kt b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Composite.kt index 653a5ae3..33abade8 100644 --- a/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Composite.kt +++ b/dataforge-vis-spatial/src/commonMain/kotlin/hep/dataforge/vis/spatial/Composite.kt @@ -3,8 +3,8 @@ package hep.dataforge.vis.spatial import hep.dataforge.meta.EmptyMeta import hep.dataforge.meta.Meta import hep.dataforge.meta.seal -import hep.dataforge.vis.common.VisualGroup import hep.dataforge.vis.common.DisplayLeaf +import hep.dataforge.vis.common.VisualGroup import hep.dataforge.vis.common.VisualObject enum class CompositeType { diff --git a/settings.gradle.kts b/settings.gradle.kts index 126d07e5..6f929d72 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,8 +3,10 @@ pluginManagement { mavenLocal() jcenter() gradlePluginPortal() + maven("https://kotlin.bintray.com/kotlinx") maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/mipt-npm/scientifik") + maven("https://dl.bintray.com/mipt-npm/dev") } resolutionStrategy { @@ -17,7 +19,7 @@ pluginManagement { "kotlin-dce-js" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}") "kotlin2js" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}") "org.jetbrains.kotlin.frontend" -> useModule("org.jetbrains.kotlin:kotlin-frontend-plugin:${requested.version}") - "scientifik.mpp", "scientifik.publish" -> useModule("scientifik:gradle-tools:${requested.version}") + "scientifik.mpp", "scientifik.publish", "scientifik.jvm", "scientifik.js" -> useModule("scientifik:gradle-tools:${requested.version}") "org.openjfx.javafxplugin" -> useModule("org.openjfx:javafx-plugin:${requested.version}") } }