Integrated bb-server angular frontend in gradle build

bb-server
Tal Moran 2017-07-03 03:24:00 +03:00
parent 173b952e09
commit 08d9bd6217
34 changed files with 178 additions and 25318 deletions

2
.gitignore vendored
View File

@ -33,4 +33,6 @@ local.properties
npm-debug.log
testem.log
*/typings
bundle.js
bundle.d.ts

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version "1.0.2"
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version '1.0.2'
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -0,0 +1,58 @@
plugins {
id "com.moowork.node" version "1.2.0"
}
node {
download = true;
}
ext {
bundlejs = "src/app/bundle.js"
bundlets = "src/app/bundle.d.ts"
}
//task installAngularCli(type: NpmTask) {
// args = ['install', '@angular/cli']
//}
//npm_install.dependsOn(installAngularCli);
task printProtos {
doLast {
println getProtoFiles().join(" ")
}
}
printProtos.description = "List all the .proto files we can find."
def getProtoFiles() {
def protoFiles = []
rootProject.subprojects { proj ->
if (proj.hasProperty('sourceSets') && proj.sourceSets.hasProperty('main') &&
proj.sourceSets.main.hasProperty('proto')) {
protoFiles = protoFiles + proj.sourceSets.main.proto.getFiles();
}
}
return protoFiles;
}
task generateProtobufBundle(type: NpmTask) {
doFirst {
// We need do this in doFirst since getProtoFiles won't find all subprojects
// until after configuration is complete
def protoFiles = getProtoFiles()
setEnvironment([PROTO_FILES: protoFiles.join(" ")]);
generateProtobufBundle.args = ['run', 'protoc']
}
}
generateProtobufBundle.description = "Generate the bundle.js/bundle.d.ts files containing compiled protobufs"
npm_run_build.dependsOn(generateProtobufBundle)
npm_start.dependsOn(generateProtobufBundle)
// It would be nice if this worked, but it seems to get stuck:
//npm_start.dependsOn(project(':bulletin-board-server').jettyStart);

1
bulletin-board-server-frontend/gradlew vendored Symbolic link
View File

@ -0,0 +1 @@
../gradlew

View File

@ -7,8 +7,10 @@
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"lint": "ng e2e",
"pbts": "pbts",
"pbjs": "pbjs",
"protoc" : "pbjs -t static-module -w commonjs -o src/app/bundle.js $PROTO_FILES && pbts -o src/app/bundle.d.ts src/app/bundle.js"
},
"private": true,
"dependencies": {
@ -28,7 +30,7 @@
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.2.0",
"@angular/cli": "^1.2.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/language-service": "^4.0.0",
"@types/jasmine": "~2.5.53",

View File

@ -5,7 +5,7 @@
</h1>
<h3>Current status: {{status}}</h3>
<img width="300" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAyNTAgMjUwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNTAgMjUwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDojREQwMDMxO30NCgkuc3Qxe2ZpbGw6I0MzMDAyRjt9DQoJLnN0MntmaWxsOiNGRkZGRkY7fQ0KPC9zdHlsZT4NCjxnPg0KCTxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMTI1LDMwIDEyNSwzMCAxMjUsMzAgMzEuOSw2My4yIDQ2LjEsMTg2LjMgMTI1LDIzMCAxMjUsMjMwIDEyNSwyMzAgMjAzLjksMTg2LjMgMjE4LjEsNjMuMiAJIi8+DQoJPHBvbHlnb24gY2xhc3M9InN0MSIgcG9pbnRzPSIxMjUsMzAgMTI1LDUyLjIgMTI1LDUyLjEgMTI1LDE1My40IDEyNSwxNTMuNCAxMjUsMjMwIDEyNSwyMzAgMjAzLjksMTg2LjMgMjE4LjEsNjMuMiAxMjUsMzAgCSIvPg0KCTxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik0xMjUsNTIuMUw2Ni44LDE4Mi42aDBoMjEuN2gwbDExLjctMjkuMmg0OS40bDExLjcsMjkuMmgwaDIxLjdoMEwxMjUsNTIuMUwxMjUsNTIuMUwxMjUsNTIuMUwxMjUsNTIuMQ0KCQlMMTI1LDUyLjF6IE0xNDIsMTM1LjRIMTA4bDE3LTQwLjlMMTQyLDEzNS40eiIvPg0KPC9nPg0KPC9zdmc+DQo=">
<img width="300" src="assets/meerkat-logo.svg">
<hr>
{{errorMessage}}
</div>

View File

@ -25,8 +25,8 @@ export class AppComponent implements OnInit {
// Get initial status
this.bbservice.getStatus().subscribe(
status => { this.status = status.name },
error => this.errorMessage = <any>error
status => { this.status = status.name; this.errorMessage = ""; },
error => { this.status = "Not connected"; this.errorMessage = <any>error; }
);
this.alive = true;
@ -39,8 +39,8 @@ export class AppComponent implements OnInit {
return;
}
this.bbservice.getStatus().subscribe(
status => this.status = status.name + " " + n,
error => this.errorMessage = <any>error
status => { this.status = status.name + " " + n; this.errorMessage = ""; },
error => { this.errorMessage = <any>error; this.status = "Not connected"; }
);
});
}

View File

@ -1,5 +1,4 @@
import { Component } from '@angular/core';
/// <reference types="@types/long" />
import { Injectable } from '@angular/core';
import {Headers, Http, RequestOptions, ResponseContentType} from '@angular/http';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -1 +0,0 @@
../../../distributed-key-generation/src/main/proto/meerkat/DKG.proto

View File

@ -1 +0,0 @@
../../../meerkat-common/src/main/proto/meerkat/ballot_question_ui_element.proto

View File

@ -1 +0,0 @@
../../../meerkat-common/src/main/proto/meerkat/bulletin_board_api.proto

View File

@ -1 +0,0 @@
../../../bulletin-board-server/src/main/proto/meerkat/bulletin_board_webapp.proto

View File

@ -1 +0,0 @@
../../../meerkat-common/src/main/proto/meerkat/comm.proto

View File

@ -1 +0,0 @@
../../../mixer/docs/concrete_crypto.proto

View File

@ -1 +0,0 @@
../../../mixer/docs/crypto.proto

View File

@ -1 +0,0 @@
../../../mixer/src/main/proto/meerkat/mixing.proto

View File

@ -1 +0,0 @@
../../../scanner-api-common/src/main/proto/meerkat/polling_station.proto

View File

@ -1 +0,0 @@
../../../meerkat-common/src/main/proto/meerkat/voting.proto

View File

@ -1,8 +1,8 @@
plugins {
id "us.kirchmeier.capsule" version '1.0.2'
id 'com.google.protobuf' version '0.8.0'
id 'org.akhikhl.gretty' version "1.2.4"
id 'com.google.protobuf' version '0.8.1'
id 'org.akhikhl.gretty' version "2.0.0"
}
apply plugin: 'org.akhikhl.gretty'
@ -10,6 +10,7 @@ apply plugin: 'com.google.protobuf'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'war'
//apply plugin: 'application'
@ -51,13 +52,24 @@ dependencies {
compile 'org.apache.commons:commons-dbcp2:2.0.+'
// Servlets
compile 'javax.servlet:javax.servlet-api:3.0.+'
// compile 'javax.servlet:javax.servlet-api:3.0.+'
// Depend on test resources from meerkat-common
testCompile project(path: ':meerkat-common', configuration: 'testOutput')
testCompile 'junit:junit:4.+'
}
ext {
frontendProject = project(":bulletin-board-server-frontend")
}
war {
from frontendProject.projectDir.toPath().resolve("dist").toString()
}
frontendProject.afterEvaluate {
war.dependsOn frontendProject.npm_run_build
}
test {
exclude '**/*SQLite*Test*'

View File

@ -1,6 +1,6 @@
<web-app>
<servlet>
<servlet-name>Jersey Hello World</servlet-name>
<servlet-name>bbserver</servlet-name>
<servlet-class>
org.glassfish.jersey.servlet.ServletContainer
</servlet-class>
@ -11,7 +11,11 @@
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Hello World</servlet-name>
<servlet-name>bbserver</servlet-name>
<url-pattern>/bbserver/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version '1.0.2'
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version '1.0.2'
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -8,7 +8,7 @@ public interface BulletinBoardConstants {
// Relative addresses for Bulletin Board operations
public static final String STATUS_PATH = "/status";
public static final String BULLETIN_BOARD_SERVER_PATH = "/bbserver";
public static final String BULLETIN_BOARD_SERVER_PATH = "/"; // The actual prefix is set in web.xml
public static final String GENERATE_SYNC_QUERY_PATH = "/generatesyncquery";
public static final String READ_MESSAGES_PATH = "/readmessages";
public static final String COUNT_MESSAGES_PATH = "/countmessages";

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version '1.0.2'
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version '1.0.2'
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version '1.0.2'
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version "1.0.2"
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -10,6 +10,7 @@ include 'mixer'
include 'bulletin-board-client'
include 'distributed-key-generation'
include 'voting-booth-gui'
include 'bulletin-board-server-frontend'
// Only include the android projects if the android SDK directory is set
// we assume that if you have a local.properties file it contains

View File

@ -1,7 +1,7 @@
plugins {
id "us.kirchmeier.capsule" version "1.0.2"
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'

View File

@ -1,6 +1,6 @@
plugins {
id "us.kirchmeier.capsule" version '1.0.2'
id 'com.google.protobuf' version '0.8.0'
id 'com.google.protobuf' version '0.8.1'
}
apply plugin: 'java'