Composite build fixed. Works only with EAP IDEA

This commit is contained in:
Alexander Nozik 2017-04-05 22:07:43 +03:00
parent 9825b657c2
commit 995aebbd03
20 changed files with 170 additions and 191 deletions

View File

@ -1,31 +1,41 @@
apply plugin: 'base'
apply plugin: 'project-report'
apply plugin: 'build-dashboard'
htmlDependencyReport {
projects = project.allprojects
}
File dataforgeDir = new File(rootDir, dataforgePath);
print "The dataforge directory is ${dataforgeDir}"
if(dataforgeDir.exists()){
rootProject.ext.dataforgeLocal = true;
}
subprojects {
if(path.startsWith(':dataforge')){
apply from: new File(dataforgeDir, 'dataforge.gradle')
}
if(path.startsWith(':numass')){
apply from: rootProject.file('numass.gradle')
}
apply plugin: 'java'
apply plugin: 'idea'
group = 'inr.numass'
version = '1.0.0'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
repositories {
jcenter()
mavenCentral()
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
}
buildscript {
repositories { jcenter() }
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.+'
testCompile 'org.codehaus.groovy:groovy-all:2.4.+'
testCompile group: 'junit', name: 'junit', version: '4.+'
testCompile "org.spockframework:spock-core:1.0-groovy-2.+"
}
}
// id 'project-report'
// id 'build-dashboard'
//htmlDependencyReport {
// projects = project.allprojects
//}
task wrapper(type: Wrapper) {
gradleVersion = '3.4.1'
}

View File

@ -1 +0,0 @@
dataforgePath=../dataforge

View File

@ -7,7 +7,7 @@ configurations {
dependencies {
compile project(':numass-storage:numass-client')
compile project(':dataforge-plots:plots-jfc')
compile project(':dataforge-control')
compile project(':dataforge-fx')
compile "hep.dataforge:plots-jfc" // project(':dataforge-plots:plots-jfc')
compile "hep.dataforge:dataforge-control" //project(':dataforge-control')
compile "hep.dataforge:dataforge-fx" //project(':dataforge-fx')
}

View File

@ -1,3 +1,8 @@
apply plugin: 'application'
if (!hasProperty('mainClass')) {

View File

@ -108,7 +108,7 @@ public class PKT8PlotController implements Initializable, MeasurementListener<PK
//plot config from device configuration
//Do not use view config here, it is applyed separately
channels.stream()
.filter(channel -> !plottables.hasPlottable(channel.getName()))
.filter(channel -> !plottables.has(channel.getName()))
.forEach(channel -> {
//plot config from device configuration
@ -119,7 +119,7 @@ public class PKT8PlotController implements Initializable, MeasurementListener<PK
if (deviceLineMeta.hasMeta("plot")) {
plottable.configure(deviceLineMeta.getMeta("plot"));
}
plottables.addPlottable(plottable);
plottables.add(plottable);
plotFrame.add(plottable);
});
if (device.meta().hasMeta("plotConfig")) {

View File

@ -10,7 +10,7 @@ mainClassName = mainClass
dependencies {
compile 'ch.qos.logback:logback-classic:1.1.0+'
compile 'org.scream3r:jssc:2.8.0'
compile project(':dataforge-control')
compile "hep.dataforge:dataforge-control" //project(':dataforge-control')
}
task talkToServer(type: JavaExec) {

View File

@ -29,13 +29,12 @@ import hep.dataforge.meta.ConfigChangeListener;
import hep.dataforge.meta.Configuration;
import hep.dataforge.meta.Meta;
import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.plots.data.PlottableGroup;
import hep.dataforge.plots.data.TimePlottable;
import hep.dataforge.plots.data.TimePlottableGroup;
import hep.dataforge.plots.fx.PlotContainer;
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
import hep.dataforge.storage.api.Storage;
import hep.dataforge.storage.commons.StorageManager;
import hep.dataforge.tables.MapPoint;
import hep.dataforge.values.Value;
import inr.numass.client.NumassClient;
import inr.numass.control.msp.MspDevice;
@ -64,7 +63,6 @@ import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
@ -79,7 +77,7 @@ public class MspViewController implements Initializable, MspListener {
public static final String MSP_DEVICE_TYPE = "msp";
public static final String DEFAULT_CONFIG_LOCATION = "msp-config.xml";
private final TimePlottableGroup plottables = new TimePlottableGroup();
private final PlottableGroup<TimePlottable> plottables = new PlottableGroup<>();
private final String mspName = "msp";
private MspDevice device;
private Configuration viewConfig;
@ -258,13 +256,13 @@ public class MspViewController implements Initializable, MspListener {
for (Meta an : config.getMetaList("peakJump.line")) {
String mass = an.getString("mass");
if (!this.plottables.hasPlottable(mass)) {
if (!this.plottables.has(mass)) {
TimePlottable newPlottable = new TimePlottable(mass, mass);
newPlottable.configure(an);
this.plottables.addPlottable(newPlottable);
this.plottables.add(newPlottable);
plot.add(newPlottable);
} else {
plottables.getPlottable(mass).configure(an);
plottables.get(mass).configure(an);
}
}
} else {
@ -275,15 +273,17 @@ public class MspViewController implements Initializable, MspListener {
@Override
public void acceptScan(Map<Integer, Double> measurement) {
MapPoint.Builder point = new MapPoint.Builder();
// MapPoint.Builder point = new MapPoint.Builder();
for (Map.Entry<Integer, Double> entry : measurement.entrySet()) {
Double val = entry.getValue();
if (val <= 0) {
val = Double.NaN;
}
point.putValue(Integer.toString(entry.getKey()), val);
TimePlottable pl = plottables.get(Integer.toString(entry.getKey()));
if(pl!= null){
pl.put(Value.of(val));
}
}
plottables.put(point.build());
}
@Override
@ -311,7 +311,7 @@ public class MspViewController implements Initializable, MspListener {
@FXML
private void onAutoRangeChange(DragEvent event) {
plottables.setMaxAge(Duration.ofMinutes((long) this.autoRangeSlider.getValue()));
plottables.setValue(TimePlottable.MAX_AGE_KEY, this.autoRangeSlider.getValue()*60000);
}
@FXML

View File

@ -175,9 +175,9 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
TimePlottable plot = new TimePlottable(controller.getTitle(),
controller.getName());
plot.configure(controller.meta());
plottables.addPlottable(plot);
plottables.add(plot);
});
plottables.setEachConfigValue("thickness", 3);
plottables.setValue("thickness", 3);
plottables.setMaxAge(java.time.Duration.ofHours(3));
plotContainer.setPlot(setupPlot(plottables));
}

View File

@ -10,9 +10,9 @@ description = "Main numass project"
dependencies {
compile group: 'commons-cli', name: 'commons-cli', version: '1.+'
compile group: 'commons-io', name: 'commons-io', version: '2.+'
compile project(':dataforge-stat:dataforge-minuit')
compile project(':numass-storage')
compile project(':dataforge-grind:grind-terminal')
compile "hep.dataforge:dataforge-minuit" //project(':dataforge-stat:dataforge-minuit')
compile "hep.dataforge:grind-terminal" //project(':dataforge-grind:grind-terminal')
}
task listActions(dependsOn: classes, type: JavaExec) {

View File

@ -1,4 +1,4 @@
dependencies {
compile project(':dataforge-storage')
compile "hep.dataforge:dataforge-storage" //project(':dataforge-storage')
}

View File

@ -1,24 +1,11 @@
description = 'dataforge-server'
processResources {
from project(':dataforge-storage:storage-servlet').file('/src/main/resources/ratpack')
}
//sourceSets.main.resources{
// srcDir project(':dataforge-storage:storage-servlet').file('ratpack')
//}
//task copyAssets(type: Copy) {
// from project(':dataforge-storage:storage-servlet').file('src/main/resouces/ratpack')
// into 'src/main/resouces/ratpack'
//}
//processResources.dependsOn("copyAssets")
dependencies {
compile project(':numass-storage')
compile project(':dataforge-storage:storage-servlet')
compile "hep.dataforge:storage-servlet" // project(':dataforge-storage:storage-servlet')
compile 'commons-daemon:commons-daemon:1.+'
}
processResources {
// from configurations.compile.files {"hep.dataforge:storage-servlet"}.find {'/src/main/resources/ratpack'}
}

View File

@ -12,6 +12,7 @@ import hep.dataforge.storage.api.PointLoader;
import hep.dataforge.storage.api.Storage;
import hep.dataforge.storage.servlet.ServletUtils;
import hep.dataforge.storage.servlet.StorageRatpackHandler;
import inr.numass.storage.NumassData;
import org.slf4j.LoggerFactory;
import ratpack.handling.Context;
@ -43,7 +44,9 @@ public class NumassStorageHandler extends StorageRatpackHandler {
@Override
protected void renderObjects(Context ctx, ObjectLoader<?> loader) {
if (NumassRun.RUN_NOTES.equals(loader.getName())) {
if (loader instanceof NumassData) {
} else if (NumassRun.RUN_NOTES.equals(loader.getName())) {
try {
ObjectLoader<NumassNote> noteLoader = (ObjectLoader<NumassNote>) loader;
ctx.getResponse().contentType("text/html");

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<title>${loaderName}</title>
<meta charset="UTF-8">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['table','corechart']});
google.charts.setOnLoadCallback(startUpdate);
function startUpdate() {
var opts = {sendMethod: 'auto'};
// alert('sending request to ${dataSource}')
var query = new google.visualization.Query("${dataSource}", opts);
query.setRefreshInterval(${updateInterval});
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
google.visualization.errors.addError.addErrorFromQueryResponse(document.getElementById('table_div'),response);
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var table = new google.visualization.Table(document.getElementById('table_div'));
var tableOptions = {
showRowNumber: false,
page: 'enable',
width : '90%',
pageSize: 50,
sort : 'disable'
};
table.draw(data, tableOptions);
<#if plotParams??>
var options = ${plotParams};
var chart = new google.visualization.LineChart(document.getElementById('plot_div'));
chart.draw(data, options);
</#if>
}
</script>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Point loader: ${loaderName}</h1>
</div>
<br/>
<div id="plot_div">
</div>
<br/>
<div id="table_div">
<h2>Loading data...</h2>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>

View File

@ -25,5 +25,5 @@ task runClient(type: JavaExec) {
dependencies {
compile project(':numass-storage:numass-client')
compile project(':numass-storage:numass-server')
compile project(':dataforge-grind')
compile "hep.dataforge:dataforge-grind" //project(':dataforge-grind')
}

View File

@ -25,12 +25,12 @@ configurations {
dependencies {
compile project(':numass-main')
compile project(':dataforge-plots:plots-jfc')
compile "hep.dataforge:plots-jfc" //project(':dataforge-plots:plots-jfc')
compile 'com.jcraft:jsch:0.1.54'
}
shadowJar {
baseName = 'numass-viewer'
classifier = null
version = null
}
//shadowJar {
// baseName = 'numass-viewer'
// classifier = null
// version = null
//}

View File

@ -122,7 +122,7 @@ public class MspViewController implements Encapsulated {
// .forEach(point -> {
// for (String name : point.names()) {
// if (!name.equals("timestamp")) {
// if (!plottables.hasPlottable(name)) {
// if (!plottables.has(name)) {
// plottables.addPlottable(new TimePlottable(name, name));
// }
// }
@ -221,8 +221,8 @@ public class MspViewController implements Encapsulated {
// for (DataPoint point : mspData) {
// for (String name : point.names()) {
// if (!name.equals("timestamp")) {
// if (!plottables.hasPlottable(name)) {
// plottables.addPlottable(new TimePlottable(name, name));
// if (!plottables.has(name)) {
// plottables.add(new TimePlottable(name, name));
// }
// }
// }

View File

@ -15,12 +15,6 @@
*/
package inr.numass.viewer;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import hep.dataforge.context.Context;
import hep.dataforge.fx.work.Work;
import hep.dataforge.fx.work.WorkManager;
@ -30,8 +24,8 @@ import hep.dataforge.meta.MetaBuilder;
import hep.dataforge.plots.XYPlotFrame;
import hep.dataforge.plots.data.PlotDataUtils;
import hep.dataforge.plots.data.PlottableData;
import hep.dataforge.plots.data.PlottableGroup;
import hep.dataforge.plots.data.TimePlottable;
import hep.dataforge.plots.data.TimePlottableGroup;
import hep.dataforge.plots.fx.FXPlotFrame;
import hep.dataforge.plots.fx.PlotContainer;
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
@ -250,13 +244,13 @@ public class NumassLoaderViewComponent extends AnchorPane implements Initializab
Platform.runLater(() -> {
if (t != null) {
hvPlot.getPlot().plottables().clear();
TimePlottableGroup set = new TimePlottableGroup();
PlottableGroup<TimePlottable> set = new PlottableGroup<>();
for (DataPoint dp : t) {
String block = dp.getString("block", "default");
if (!set.hasPlottable(block)) {
set.addPlottable(new TimePlottable(block, block));
if (!set.has(block)) {
set.add(new TimePlottable(block, block));
}
set.getPlottable(block).put(dp.getValue("timestamp").timeValue(), dp.getValue("value"));
set.get(block).put(dp.getValue("timestamp").timeValue(), dp.getValue("value"));
}
hvPlot.getPlot().addAll(set);
}

View File

@ -1,53 +0,0 @@
/*
* Copyright 2015 Alexander Nozik.
*
* 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.
*/
package inr.numass.viewer;
import java.awt.BorderLayout;
import javafx.embed.swing.SwingNode;
import javafx.scene.layout.AnchorPane;
import javax.swing.JPanel;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
/**
*
* @author darksnake
*/
public class NumassViewerUtils {
/**
* Display given JFreeChart in the FX container
*
* @param container
* @param chart
*/
public static void displayPlot(AnchorPane container, JFreeChart chart) {
SwingNode viewer = new SwingNode();
JPanel panel = new JPanel(new BorderLayout(), true);
panel.removeAll();
panel.add(new ChartPanel(chart));
panel.revalidate();
panel.repaint();
viewer.setContent(panel);
AnchorPane.setBottomAnchor(viewer, 0d);
AnchorPane.setTopAnchor(viewer, 0d);
AnchorPane.setLeftAnchor(viewer, 0d);
AnchorPane.setRightAnchor(viewer, 0d);
container.getChildren().add(viewer);
}
}

View File

@ -1,32 +0,0 @@
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'com.github.johnrengelman.shadow'
group = 'inr.numass'
version = '1.0.0'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
configurations {
deployerJars
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
// Adding dependencies here will add the dependencies to each subproject.
testCompile group: 'junit', name: 'junit', version:'4.+'
}
shadowJar {
dependencies {
mergeServiceFiles()
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
}

View File

@ -1,25 +1,19 @@
rootProject.name = 'numass'
def includeProjects;
includeProjects = {File dir, String prefix ->
dir.listFiles().each{
String name = prefix + ":" + it.getName();
if(it.isDirectory() && ! it.getName().startsWith("build")){
if(new File(it, 'build.gradle').isFile()){
include name
project(name).projectDir = it
}
includeProjects(it, name);
}
}
if(file("../dataforge").exists()){
includeBuild('../dataforge')
}
includeProjects(rootDir, '')
include ":numass-control"
include ":numass-control:cryotemp"
include ":numass-control:magnet"
include ":numass-control:msp"
File dataforgeDir = new File(rootDir,'../dataforge');
include ":numass-main"
if(dataforgeDir.exists()){
includeFlat "dataforge"
includeProjects(dataforgeDir,'')
}
include ":numass-storage"
include ":numass-storage:numass-client"
include ":numass-storage:numass-server"
include ":numass-viewer"