Build fix

This commit is contained in:
Alexander Nozik 2019-04-03 21:44:10 +03:00
parent fb6a149b5e
commit 193ae96425
9 changed files with 2000 additions and 94 deletions

View File

@ -13,7 +13,7 @@ buildscript {
val dokkaVersion: String by rootProject.extra("0.9.17") val dokkaVersion: String by rootProject.extra("0.9.17")
val serializationVersion: String by rootProject.extra("0.10.0") val serializationVersion: String by rootProject.extra("0.10.0")
val dataforgeVersion: String by rootProject.extra("0.1.2-dev-3") val dataforgeVersion: String by rootProject.extra("0.1.2-dev-4")
repositories { repositories {
jcenter() jcenter()
@ -91,7 +91,6 @@ subprojects {
afterEvaluate { afterEvaluate {
extensions.findByType<KotlinMultiplatformExtension>()?.apply { extensions.findByType<KotlinMultiplatformExtension>()?.apply {
apply(plugin = "com.moowork.node")
jvm { jvm {
compilations.all { compilations.all {
kotlinOptions { kotlinOptions {
@ -120,38 +119,44 @@ subprojects {
} }
} }
configure<NodeExtension>{
nodeModulesDir = file("$buildDir/node_modules")
}
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class) val runJsTests by ext(false)
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
val populateNodeModules by tasks.registering(Copy::class) { if(runJsTests) {
dependsOn(compileKotlinJs) apply(plugin = "com.moowork.node")
from(compileKotlinJs.destinationDir) configure<NodeExtension> {
nodeModulesDir = file("$buildDir/node_modules")
compilations["test"].runtimeDependencyFiles.forEach {
if (it.exists() && !it.isDirectory) {
from(zipTree(it.absolutePath).matching { include("*.js") })
}
} }
into("$buildDir/node_modules") val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
} val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
val installMocha by tasks.registering(NpmTask::class) { val populateNodeModules by tasks.registering(Copy::class) {
setWorkingDir(buildDir) dependsOn(compileKotlinJs)
setArgs(listOf("install", "mocha")) from(compileKotlinJs.destinationDir)
}
val runMocha by tasks.registering(NodeTask::class) { compilations["test"].runtimeDependencyFiles.forEach {
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha) if (it.exists() && !it.isDirectory) {
setScript(file("$buildDir/node_modules/mocha/bin/mocha")) from(zipTree(it.absolutePath).matching { include("*.js") })
setArgs(listOf(compileTestKotlinJs.outputFile)) }
} }
tasks["jsTest"].dependsOn(runMocha) into("$buildDir/node_modules")
}
val installMocha by tasks.registering(NpmTask::class) {
setWorkingDir(buildDir)
setArgs(listOf("install", "mocha"))
}
val runMocha by tasks.registering(NodeTask::class) {
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
setArgs(listOf(compileTestKotlinJs.outputFile))
}
tasks["jsTest"].dependsOn(runMocha)
}
} }
sourceSets { sourceSets {

View File

@ -15,16 +15,16 @@ kotlin {
//api("hep.dataforge:dataforge-output-metadata:$dataforgeVersion") //api("hep.dataforge:dataforge-output-metadata:$dataforgeVersion")
} }
} }
val jvmMain by getting { // val jvmMain by getting {
dependencies { // dependencies {
api("hep.dataforge:dataforge-output-jvm:$dataforgeVersion") // api("hep.dataforge:dataforge-output-jvm:$dataforgeVersion")
//api("no.tornado:tornadofx:1.7.18") // //api("no.tornado:tornadofx:1.7.18")
} // }
} // }
val jsMain by getting { // val jsMain by getting {
dependencies { // dependencies {
api("hep.dataforge:dataforge-output-js:$dataforgeVersion") // api("hep.dataforge:dataforge-output-js:$dataforgeVersion")
} // }
} // }
} }
} }

View File

@ -1,8 +1,8 @@
package hep.dataforge.vis.spatial package hep.dataforge.vis.spatial
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.io.Output
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.output.Output
import hep.dataforge.vis.* import hep.dataforge.vis.*
import javafx.scene.Group import javafx.scene.Group
import javafx.scene.Node import javafx.scene.Node

View File

@ -8,16 +8,12 @@ plugins {
id("org.jetbrains.kotlin.frontend") id("org.jetbrains.kotlin.frontend")
} }
repositories{
maven ("https://dl.bintray.com/orangy/maven" )
}
val kotlinVersion: String by rootProject.extra val kotlinVersion: String by rootProject.extra
dependencies { dependencies {
implementation(project(":dataforge-vis-spatial")) api(project(":dataforge-vis-spatial"))
implementation("info.laht.threekt:threejs-wrapper:0.88-npm-2") implementation("info.laht.threekt:threejs-wrapper:0.88-npm-2")
//implementation("org.jetbrains.kotlinx:kotlinx-files-js:0.1.0-dev-27")
testCompile("org.jetbrains.kotlin:kotlin-test-js:$kotlinVersion") testCompile("org.jetbrains.kotlin:kotlin-test-js:$kotlinVersion")
} }
@ -27,9 +23,6 @@ configure<KotlinFrontendExtension> {
configure<NpmExtension> { configure<NpmExtension> {
dependency("three-full") dependency("three-full")
dependency("style-loader") dependency("style-loader")
// dependency("fs-remote")
// dependency("path")
// dependency("text-encoding")
devDependency("karma") devDependency("karma")
} }

View File

@ -15,3 +15,5 @@ external fun createTubeBuffer(shape: dynamic, limit: Int): BufferGeometry
external fun createXtruBuffer(shape: dynamic, limit: Int): BufferGeometry external fun createXtruBuffer(shape: dynamic, limit: Int): BufferGeometry
external fun build(obj: dynamic, opt: dynamic): Object3D external fun build(obj: dynamic, opt: dynamic): Object3D
external fun buildFromJson(obj:dynamic, opt: dynamic): Object3D

View File

@ -24,7 +24,7 @@ object ThreeJSRootObjectFactory : ThreeFactory<JSRootObject> {
override val type = JSRootObject::class override val type = JSRootObject::class
override fun invoke(obj: JSRootObject): Object3D { override fun invoke(obj: JSRootObject): Object3D {
return build(obj.data, obj.options?.toDynamic()) return buildFromJson(obj.data, obj.options?.toDynamic())
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,9 @@
(function (factory) { (function (factory) {
if (typeof define === "function" && define.amd) { if (typeof define === "function" && define.amd) {
define(['three-full', 'ThreeCSG'], factory); define(['three-full', 'ThreeCSG', 'JSRoot'], factory);
} else if (typeof exports === 'object' && typeof module !== 'undefined') { } else if (typeof exports === 'object' && typeof module !== 'undefined') {
factory(require("three-full"), require("./ThreeCSG.js")); factory(require("three-full"), require("./ThreeCSG.js"), require("./JSRoot.js"));
} else { } else {
if (typeof THREE == 'undefined') if (typeof THREE == 'undefined')
throw new Error('THREE is not defined', 'JSRootGeoBase.js'); throw new Error('THREE is not defined', 'JSRootGeoBase.js');
@ -13,50 +13,16 @@
if (typeof ThreeBSP == 'undefined') if (typeof ThreeBSP == 'undefined')
throw new Error('ThreeBSP is not defined', 'JSRootGeoBase.js'); throw new Error('ThreeBSP is not defined', 'JSRootGeoBase.js');
factory(THREE, ThreeBSP); if (typeof JSROOT == 'undefined')
throw new Error('JSROOT is not defined', 'JSRootGeoBase.js');
factory(THREE, ThreeBSP, JSROOT);
} }
}(function (THREE, ThreeBSP) { }(function (THREE, ThreeBSP, JSROOT) {
"use strict"; "use strict";
var JSROOT = {};
/** Generate mask for given bit
*
* @param {number} n bit number
* @returns {Number} produced make
* @private */
JSROOT.BIT = function (n) {
return 1 << (n);
};
/**
* @summary Generic method to invoke callback function.
*
* @param {object|function} func either normal function or container like
* { obj: object_pointer, func: name of method to call }
* @param arg1 first optional argument of callback
* @param arg2 second optional argument of callback
*
* @private
*/
JSROOT.CallBack = function (func, arg1, arg2) {
if (typeof func == 'string') func = JSROOT.findFunction(func);
if (!func) return;
if (typeof func == 'function') return func(arg1, arg2);
if (typeof func != 'object') return;
if (('obj' in func) && ('func' in func) &&
(typeof func.obj == 'object') && (typeof func.func == 'string') &&
(typeof func.obj[func.func] == 'function')) {
return func.obj[func.func](arg1, arg2);
}
};
/** @namespace GEO */ /** @namespace GEO */
/// Holder of all TGeo-related functions and classes /// Holder of all TGeo-related functions and classes
var GEO = { var GEO = {
@ -1650,7 +1616,7 @@
} else if (('fMatrix' in node) && (node.fMatrix !== null)) } else if (('fMatrix' in node) && (node.fMatrix !== null))
matrix = GEO.createMatrix(node.fMatrix); matrix = GEO.createMatrix(node.fMatrix);
else if ((node._typename == "TGeoNodeOffset") && (node.fFinder !== null)) { else if ((node._typename == "TGeoNodeOffset") && (node.fFinder !== null)) {
var kPatternReflected = GEO.BITS.kVisBranch; let kPatternReflected = GEO.BITS.kVisBranch;
if ((node.fFinder.fBits & kPatternReflected) !== 0) if ((node.fFinder.fBits & kPatternReflected) !== 0)
GEO.warn('Unsupported reflected pattern ' + node.fFinder._typename); GEO.warn('Unsupported reflected pattern ' + node.fFinder._typename);
@ -2279,12 +2245,12 @@
if (obj.fVolume.fNodes) chlds = obj.fVolume.fNodes.arr; if (obj.fVolume.fNodes) chlds = obj.fVolume.fNodes.arr;
} }
var matrix = GEO.getNodeMatrix(kind, obj); const matrix = GEO.getNodeMatrix(kind, obj);
if (matrix) { if (matrix) {
clone.matrix = matrix.elements; // take only matrix elements, matrix will be constructed in worker clone.matrix = matrix.elements; // take only matrix elements, matrix will be constructed in worker
if (clone.matrix[0] === 1) { if (clone.matrix[0] === 1) {
var issimple = true; var issimple = true;
for (var k = 1; (k < clone.matrix.length) && issimple; ++k) for (let k = 1; (k < clone.matrix.length) && issimple; ++k)
issimple = (clone.matrix[k] === ((k === 5) || (k === 10) || (k === 15) ? 1 : 0)); issimple = (clone.matrix[k] === ((k === 5) || (k === 10) || (k === 15) ? 1 : 0));
if (issimple) delete clone.matrix; if (issimple) delete clone.matrix;
} }
@ -3515,6 +3481,11 @@
return toplevel; return toplevel;
}; };
GEO.buildFromJson = function (obj, opt) {
var unrefed = JSROOT.JSONR_unref(obj);
return GEO.build(unrefed, opt)
};
GEO.getBoundingBox = function (node, box3) { GEO.getBoundingBox = function (node, box3) {
// extract code of Box3.expandByObject // extract code of Box3.expandByObject

View File

@ -27,5 +27,9 @@ include(
) )
if(file("../dataforge-core").exists()) { if(file("../dataforge-core").exists()) {
includeBuild("../dataforge-core") includeBuild("../dataforge-core"){
dependencySubstitution {
substitute(module("hep.dataforge:dataforge-output")).with(project(":dataforge-output"))
}
}
} }