Permalink
Browse files

Merged all GWT modules into one because you can't cast the same jsint…

…erop class across module boundaries in JS, merged manager:shared sub-project into model, moved manager:client to top-level client sub-project
  • Loading branch information...
christianbauer committed Jan 8, 2018
1 parent f6e0b1b commit 97d9ed66148bc1aa51f22dfceea07a7ee3994f59
Showing 2,032 changed files with 49,890 additions and 49,878 deletions.
View
@@ -25,8 +25,8 @@ bower_components/
console/iOS/DerivedData
console/iOS/Pods
manager/client/src/main/webapp/gwt/
manager/client/.externalToolBuilders/
client/src/main/webapp/gwt/
client/.externalToolBuilders/
manager/.factorypath
# Ignore build/runtime only data
View
@@ -0,0 +1,173 @@
evaluationDependsOn(resolveProject(":model").path)
apply plugin: "java"
apply plugin: "distribution"
configurations {
gwtDev
}
dependencies {
compile resolveProject(":model")
// TODO Deprecate this and remove all usages
compile "com.google.gwt:gwt-elemental:$gwtVersion"
// Elemental2 from google, Elemento from jboss
compile "com.google.elemental2:elemental2-dom:$elemental2Version"
compile "com.google.elemental2:elemental2-webstorage:$elemental2Version"
compile "com.google.elemental2:elemental2-promise:$elemental2Version"
compile "org.jboss.gwt.elemento:elemento-core:$elementoCoreVersion"
compile files(['lib/gwt-jackson-0.14.3-SNAPSHOT.jar'])
//compile "com.github.nmorel.gwtjackson:gwt-jackson:$gwtJacksonVersion"
// This is not on regular classpath, only used when compiling GWT/running codeserver
gwtDev files(['lib/javapoet-1.0.0.jar', 'lib/jackson-annotations-2.8.6-sources.jar'])
gwtDev "com.google.gwt:gwt-dev:$gwtVersion"
}
def gwtOutputDir = "${project.buildDir}/gwt/output"
def gwtExtraDir = "${project.buildDir}/gwt/extra"
def gwtWorkDir = "${project.buildDir}/gwt/work"
def gwtCacheDir = "${project.buildDir}/gwt/cache"
def gwtLauncherDir = "${project.projectDir}/src/main/webapp/gwt"
task compileGwt(dependsOn: classes, type: JavaExec) {
inputs.files(sourceSets.main.java.srcDirs).skipWhenEmpty()
inputs.dir sourceSets.main.output.resourcesDir
inputs.dir(resolveProject(":model").sourceSets.main.java.srcDirs[0]).skipWhenEmpty()
outputs.dir gwtOutputDir
doFirst {
file(gwtWorkDir).mkdirs()
}
main = "com.google.gwt.dev.Compiler"
classpath {
[configurations.gwtDev,
sourceSets.main.java.srcDirs,
sourceSets.main.output.resourcesDir,
sourceSets.main.output.classesDirs,
sourceSets.main.compileClasspath]
}
maxHeapSize = "1024M"
/*
-logLevel The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM or ALL (defaults to INFO)
-workDir The compiler's working directory for internal use (must be writeable; defaults to a system temp dir)
-X[no]closureFormattedOutput EXPERIMENTAL: Enables Javascript output suitable for post-compilation by Closure Compiler (defaults to OFF)
-[no]compileReport Compile a report that tells the "Story of Your Compile". (defaults to OFF)
-X[no]checkCasts EXPERIMENTAL: DEPRECATED: use checks.checkLevel instead. (defaults to OFF)
-X[no]classMetadata EXPERIMENTAL: Include metadata for some java.lang.Class methods (e.g. getName()). (defaults to ON)
-[no]draftCompile Compile quickly with minimal optimizations. (defaults to OFF)
-[no]checkAssertions Include assert statements in compiled output. (defaults to OFF)
-X[no]closureCompiler EXPERIMENTAL: Compile output Javascript with the Closure compiler for even further optimizations. (defaults to OFF)
-XfragmentCount EXPERIMENTAL: Limits of number of fragments using a code splitter that merges split points.
-XfragmentMerge DEPRECATED (use -XfragmentCount instead): Enables Fragment merging code splitter.
-gen Debugging: causes normally-transient generated types to be saved in the specified directory
-XjsInteropMode EXPERIMENTAL: DEPRECATED: Specifies JsInterop mode: JS or JS_RC
-[no]generateJsInteropExports Generate exports for JsInterop purposes (defaults to OFF)
-XmethodNameDisplayMode EXPERIMENTAL: Specifies method display name mode for chrome devtools: NONE, ONLY_METHOD_NAME, ABBREVIATED or FULL (defaults to NONE)
-Xnamespace Puts most JavaScript globals into namespaces. Default: PACKAGE for -draftCompile, otherwise NONE
-optimize Sets the optimization level used by the compiler. 0=none 9=maximum.
-[no]saveSource Enables saving source code needed by debuggers. Also see -debugDir. (defaults to OFF)
-setProperty Set the values of a property in the form of propertyName=value1[,value2...].
-style Script output style: DETAILED, OBFUSCATED or PRETTY (defaults to OBFUSCATED)
-[no]failOnError Fail compilation if any input file contains an error. (defaults to OFF)
-[no]validateOnly Validate all source code, but do not compile. (defaults to OFF)
-sourceLevel Specifies Java source level (defaults to auto:1.8)
-localWorkers The number of local workers to use when compiling permutations
-[no]incremental Compiles faster by reusing data from the previous compile. (defaults to OFF)
-war The directory into which deployable output files will be written (defaults to 'war')
-deploy The directory into which deployable but not servable output files will be written (defaults to 'WEB-INF/deploy' under the -war directory/jar, and may be the same as the -extra directory/jar)
-extra The directory into which extra files, not intended for deployment, will be written
-saveSourceOutput Overrides where source files useful to debuggers will be written. Default: saved with extras.
*/
args = [
"org.openremote.app.App", // The production GWT modules
"-war", gwtOutputDir,
"-logLevel", "ERROR",
"-localWorkers", "2",
"-extra", gwtExtraDir,
"-generateJsInteropExports",
"-style", "OBFUSCATED"
]
}
task gwtSuperDev(dependsOn: classes, type: JavaExec) {
doFirst {
file(gwtWorkDir).mkdirs()
file(gwtLauncherDir).mkdirs()
}
main = "com.google.gwt.dev.codeserver.CodeServer"
classpath {
[configurations.gwtDev,
sourceSets.main.java.srcDirs,
sourceSets.main.output.resourcesDir,
sourceSets.main.output.classesDirs,
sourceSets.main.compileClasspath]
}
maxHeapSize = "1024M"
/*
-[no]allowMissingSrc Allows -src flags to reference missing directories. (defaults to OFF)
-bindAddress The ip address of the code server. Defaults to 127.0.0.1.
-[no]compileTest Exits after compiling the modules. The exit code will be 0 if the compile succeeded. (defaults to OFF)
-compileTestRecompiles The number of times to recompile (after the first one) during a compile test.
-[no]failOnError Stop compiling if a module has a Java file with a compile error, even if unused. (defaults to OFF)
-[no]precompile Precompile modules. (defaults to ON)
-port The port where the code server will run.
-src A directory containing GWT source to be prepended to the classpath for compiling.
-workDir The root of the directory tree where the code server willwrite compiler output. If not supplied, a temporary directorywill be used.
-launcherDir An output directory where files for launching Super Dev Mode will be written. (Optional.)
-style Script output style: DETAILED, OBFUSCATED or PRETTY
-setProperty Set the values of a property in the form of propertyName=value1[,value2...].
-[no]incremental Compiles faster by reusing data from the previous compile. (defaults to ON)
-sourceLevel Specifies Java source level (defaults to auto:1.8)
-logLevel The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM or ALL (defaults to INFO)
-XjsInteropMode EXPERIMENTAL: DEPRECATED: Specifies JsInterop mode: JS or JS_RC
-[no]generateJsInteropExports Generate exports for JsInterop purposes (defaults to OFF)
-XmethodNameDisplayMode EXPERIMENTAL: Specifies method display name mode for chrome devtools: NONE, ONLY_METHOD_NAME, ABBREVIATED or FULL (defaults to NONE)
-X[no]closureFormattedOutput EXPERIMENTAL: Enables Javascript output suitable for post-compilation by Closure Compiler (defaults to OFF)
*/
args = [
"org.openremote.app.AppDev", // Note: Different module for dev mode!
"-workDir", gwtWorkDir,
"-launcherDir", gwtLauncherDir,
"-src", resolveProject(":model").sourceSets.main.java.srcDirs[0], // Help code server detect source changes
"-logLevel", "INFO",
"-noincremental",
"-noprecompile",
"-generateJsInteropExports",
"-style", "PRETTY",
"-bindAddress", "0.0.0.0" // Careful! The code server listens on all interfaces!,
]
// Make this magic directory easily cleanable by placing it into the build folder
jvmArgs("-Dgwt.persistentunitcachedir=$gwtCacheDir")
}
installDist {
dependsOn resolveTask(":client:src:main:webapp:installDist")
}
distributions {
main {
contents {
from("src/main/webapp") {
into "webapp"
exclude "gwt", "build.gradle", "bower.json"
}
/* You can comment out this block to skip GWT compilation for fast testing the build
*/
from(compileGwt.outputs) {
into "webapp/gwt"
exclude "WEB-INF"
}
}
}
}
@@ -0,0 +1,50 @@
/*
* Copyright 2017, OpenRemote Inc.
*
* See the CONTRIBUTORS.txt file in the distribution for a
* full listing of individual contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.openremote.app.client;
import com.google.gwt.core.client.GWT;
import java.util.logging.Logger;
public class AppEntryPoint implements com.google.gwt.core.client.EntryPoint {
private static final Logger LOG = Logger.getLogger(AppEntryPoint.class.getName());
protected final ManagerGinjector injector = GWT.create(ManagerGinjector.class);
@Override
public void onModuleLoad() {
LOG.info("App GWT module loaded");
dispatchLoadedEvent();
}
protected void startManager() {
injector.getAppController().start();
}
public native void dispatchLoadedEvent() /*-{
$wnd.addEventListener("StartManager", function() {
this.@org.openremote.app.client.AppEntryPoint::startManager()();
}.bind(this));
$wnd.dispatchEvent(new CustomEvent("AppLoaded"));
}-*/;
}
@@ -0,0 +1,49 @@
package org.openremote.app.client;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.openremote.model.http.RequestParams;
import org.openremote.model.interop.Consumer;
import org.openremote.model.interop.Runnable;
/**
* The singleton of {@code <or-app-security>}.
*/
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "AppSecurity")
public interface AppSecurity {
@JsProperty
boolean isAuthenticated();
@JsProperty
String getUser();
String getFullName();
@JsProperty
String getRealm();
void logout();
boolean isSuperUser();
boolean hasRealmRole(String role);
boolean hasResourceRole(String role, String resource);
boolean hasResourceRoleOrIsSuperUser(String role, String resource);
boolean isUserTenantAdminEnabled();
/**
* Sets credentials on request params, this can happen asynchronously.
*/
void authorizeRequestParams(RequestParams requestParams, Runnable onComplete);
/**
* Sets credentials on URL, this can happen asynchronously.
*/
void authorizeUrl(String serviceUrl, Consumer<String> onComplete);
}
@@ -0,0 +1,101 @@
/*
* Copyright 2016, OpenRemote Inc.
*
* See the CONTRIBUTORS.txt file in the distribution for a
* full listing of individual contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.openremote.app.client;
import com.google.gwt.place.shared.PlaceController;
import com.google.gwt.place.shared.PlaceHistoryMapper;
import org.openremote.app.client.OpenRemoteApp;
import org.openremote.app.client.style.WidgetStyle;
import org.openremote.app.client.i18n.ManagerMessages;
import org.openremote.app.client.service.EventService;
import org.openremote.model.event.bus.EventBus;
/**
* Bundle all typically needed dependencies of activities/presenters, so
* only one thing can be injected into constructors.
*/
public interface Environment {
static Environment create(OpenRemoteApp app,
EventService eventService,
PlaceController placeController,
PlaceHistoryMapper placeHistoryMapper,
EventBus eventBus,
ManagerMessages managerMessages,
WidgetStyle widgetStyle) {
return new Environment() {
@Override
public OpenRemoteApp getApp() {
return app;
}
@Override
public EventService getEventService() {
return eventService;
}
@Override
public PlaceController getPlaceController() {
return placeController;
}
@Override
public PlaceHistoryMapper getPlaceHistoryMapper() {
return placeHistoryMapper;
}
@Override
public EventBus getEventBus() {
return eventBus;
}
@Override
public ManagerMessages getMessages() {
return managerMessages;
}
@Override
public WidgetStyle getWidgetStyle() {
return widgetStyle;
}
};
}
OpenRemoteApp getApp();
PlaceController getPlaceController();
PlaceHistoryMapper getPlaceHistoryMapper();
/**
* Subscribe to, unsubscribe from, and dispatch shared events on the server.
*/
EventService getEventService();
/**
* Register on this bus to listen for local and shared events from the server, and to dispatch local events.
*/
EventBus getEventBus();
ManagerMessages getMessages();
WidgetStyle getWidgetStyle();
}
Oops, something went wrong.

0 comments on commit 97d9ed6

Please sign in to comment.