Migrating to new plugin (not working with three-js yet)

This commit is contained in:
Alexander Nozik 2019-07-21 18:21:13 +03:00
parent a7fd76a4f5
commit effa19a95e
9 changed files with 80 additions and 84 deletions

View File

@ -1,12 +1,17 @@
val dataforgeVersion by extra("0.1.3-dev-9") val dataforgeVersion by extra("0.1.3-dev-9")
plugins{ plugins{
kotlin("jvm") version "1.3.41" apply false val kotlinVersion = "1.3.50-eap-5"
id("kotlin2js") version "1.3.41" apply false
id("kotlin-dce-js") version "1.3.41" apply false 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("org.jetbrains.kotlin.frontend") version "0.0.45" apply false
id("scientifik.mpp") version "0.1.3" apply false id("scientifik.mpp") version "0.1.4-dev" apply false
id("scientifik.publish") version "0.1.3" 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 { allprojects {
@ -16,10 +21,12 @@ allprojects {
maven("https://kotlin.bintray.com/kotlinx") maven("https://kotlin.bintray.com/kotlinx")
maven("http://npm.mipt.ru:8081/artifactory/gradle-dev-local") maven("http://npm.mipt.ru:8081/artifactory/gradle-dev-local")
maven("https://kotlin.bintray.com/js-externals") 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" group = "hep.dataforge"
version = "0.1.0" version = "0.1.0-dev"
} }
val githubProject by extra("dataforge-vis") val githubProject by extra("dataforge-vis")

View File

@ -2,6 +2,10 @@ plugins {
id("scientifik.mpp") id("scientifik.mpp")
} }
scientifik{
serialization = true
}
val dataforgeVersion: String by rootProject.extra val dataforgeVersion: String by rootProject.extra
kotlin { kotlin {
@ -9,18 +13,11 @@ kotlin {
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
api("hep.dataforge:dataforge-output:$dataforgeVersion") 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 { val jsMain by getting {
dependencies { dependencies {
api("hep.dataforge:dataforge-output-html:$dataforgeVersion") api("hep.dataforge:dataforge-output-html:$dataforgeVersion")
// api("hep.dataforge:dataforge-output-js:$dataforgeVersion")
} }
} }
} }

View File

@ -5,6 +5,7 @@
*/ */
package hep.dataforge.vis.fx.meta package hep.dataforge.vis.fx.meta
import hep.dataforge.context.Global
import hep.dataforge.descriptors.NodeDescriptor import hep.dataforge.descriptors.NodeDescriptor
import hep.dataforge.meta.Config import hep.dataforge.meta.Config
import hep.dataforge.names.NameToken import hep.dataforge.names.NameToken
@ -30,7 +31,7 @@ class ConfigEditor(
) : Fragment(title = title, icon = dfIconView) { ) : Fragment(title = title, icon = dfIconView) {
constructor(config: Config, descriptor: NodeDescriptor, title: String = "Configuration editor") : 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 { override val root = borderpane {
center = treetableview<FXMeta<Config>> { center = treetableview<FXMeta<Config>> {
@ -124,13 +125,13 @@ class ConfigEditor(
when (item) { when (item) {
is FXMetaValue<Config> -> { is FXMetaValue<Config> -> {
text = null text = null
val chooser = ValueChooser.build(item.valueProperty, item.descriptor) { val chooser = ValueChooser.build(Global, item.valueProperty, item.descriptor) {
item.set(it) item.set(it)
} }
graphic = chooser.node graphic = chooser.node
} }
is FXMetaNode<Config> -> { is FXMetaNode<Config> -> {
if(allowNew) { if (allowNew) {
text = null text = null
graphic = hbox { graphic = hbox {
button("node", Glyph("FontAwesome", "PLUS_CIRCLE")) { button("node", Glyph("FontAwesome", "PLUS_CIRCLE")) {

View File

@ -1,8 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.openjfx.gradle.JavaFXOptions import org.openjfx.gradle.JavaFXOptions
plugins { plugins {
kotlin("jvm") id("scientifik.jvm")
id("org.openjfx.javafxplugin") id("org.openjfx.javafxplugin")
} }
@ -14,10 +13,4 @@ dependencies {
configure<JavaFXOptions> { configure<JavaFXOptions> {
modules("javafx.controls") modules("javafx.controls")
}
tasks.withType<KotlinCompile> {
kotlinOptions{
jvmTarget = "1.8"
}
} }

View File

@ -2,10 +2,6 @@ plugins {
id("scientifik.mpp") id("scientifik.mpp")
} }
repositories{
maven("https://dl.bintray.com/pdvrieze/maven")
}
kotlin { kotlin {
sourceSets { sourceSets {
val commonMain by getting { val commonMain by getting {

View File

@ -39,7 +39,7 @@ private fun VisualGroup.addSolid(root: GDML, solid: GDMLSolid, block: VisualObje
} }
} }
solid.sections.sortedBy { it.zOrder }.forEach { section -> 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 -> { is GDMLScaledSolid -> {

View File

@ -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 { plugins {
id("kotlin2js") id("scientifik.js")
id("kotlin-dce-js") id("kotlin-dce-js")
id("org.jetbrains.kotlin.frontend")
}
repositories{
maven("https://dl.bintray.com/pdvrieze/maven")
} }
//val kotlinVersion: String by rootProject.extra //val kotlinVersion: String by rootProject.extra
@ -22,48 +12,58 @@ dependencies {
testCompile(kotlin("test-js")) testCompile(kotlin("test-js"))
} }
configure<KotlinFrontendExtension> { kotlin{
downloadNodeJsVersion = "latest" sourceSets["main"].dependencies{
api(npm("three","0.106.2"))
configure<NpmExtension> { implementation(npm("@hi-level/three-csg"))
dependency("three","0.106.2") implementation(npm("style-loader"))
dependency("@hi-level/three-csg") implementation(npm("element-resize-event"))
dependency("style-loader")
dependency("element-resize-event")
devDependency("karma")
}
sourceMaps = true
bundle<WebPackExtension>("webpack") {
this as WebPackExtension
bundleName = "main"
contentPath = file("src/main/web")
sourceMapEnabled = true
//mode = "production"
mode = "development"
} }
} }
tasks { //
"compileKotlin2Js"(Kotlin2JsCompile::class) { //configure<KotlinFrontendExtension> {
kotlinOptions { // downloadNodeJsVersion = "latest"
metaInfo = true //
outputFile = "${project.buildDir.path}/js/${project.name}.js" // configure<NpmExtension> {
sourceMap = true // dependency("three","0.106.2")
moduleKind = "commonjs" // dependency("@hi-level/three-csg")
main = "call" // dependency("style-loader")
kotlinOptions.sourceMapEmbedSources = "always" // dependency("element-resize-event")
} // devDependency("karma")
} // }
//
"compileTestKotlin2Js"(Kotlin2JsCompile::class) { // sourceMaps = true
kotlinOptions { //
metaInfo = true // bundle<WebPackExtension>("webpack") {
outputFile = "${project.buildDir.path}/js/${project.name}-test.js" // this as WebPackExtension
sourceMap = true // bundleName = "main"
moduleKind = "commonjs" // contentPath = file("src/main/web")
kotlinOptions.sourceMapEmbedSources = "always" // 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"
// }
// }
//}

View File

@ -3,8 +3,8 @@ package hep.dataforge.vis.spatial
import hep.dataforge.meta.EmptyMeta import hep.dataforge.meta.EmptyMeta
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.meta.seal import hep.dataforge.meta.seal
import hep.dataforge.vis.common.VisualGroup
import hep.dataforge.vis.common.DisplayLeaf import hep.dataforge.vis.common.DisplayLeaf
import hep.dataforge.vis.common.VisualGroup
import hep.dataforge.vis.common.VisualObject import hep.dataforge.vis.common.VisualObject
enum class CompositeType { enum class CompositeType {

View File

@ -3,8 +3,10 @@ pluginManagement {
mavenLocal() mavenLocal()
jcenter() jcenter()
gradlePluginPortal() gradlePluginPortal()
maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://dl.bintray.com/mipt-npm/scientifik") maven("https://dl.bintray.com/mipt-npm/scientifik")
maven("https://dl.bintray.com/mipt-npm/dev")
} }
resolutionStrategy { resolutionStrategy {
@ -17,7 +19,7 @@ pluginManagement {
"kotlin-dce-js" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}") "kotlin-dce-js" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
"kotlin2js" -> 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}") "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}") "org.openjfx.javafxplugin" -> useModule("org.openjfx:javafx-plugin:${requested.version}")
} }
} }