Browse Source

Add Build Files

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
Gordon Smith 11 năm trước cách đây
mục cha
commit
631bc05e39

+ 5 - 0
esp/CMakeLists.txt

@@ -25,3 +25,8 @@ HPCC_ADD_SUBDIRECTORY (smc "PLATFORM")
 HPCC_ADD_SUBDIRECTORY (test "PLATFORM")
 HPCC_ADD_SUBDIRECTORY (tools "CLIENTTOOLS")
 HPCC_ADD_SUBDIRECTORY (xslt "PLATFORM")
+
+if ( PLATFORM )
+    install ( CODE "message(\"Building ECL Watch\")\nexecute_process(COMMAND \"${CMAKE_CURRENT_SOURCE_DIR}/build.sh\" \"${CMAKE_CURRENT_BINARY_DIR}/tmp/files\" ERROR_QUIET)" COMPONENT Runtime)
+    Install ( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tmp/files" DESTINATION componentfiles COMPONENT Runtime USE_SOURCE_PERMISSIONS PATTERN "CMakeLists.txt" EXCLUDE )
+endif ( PLATFORM )

+ 65 - 0
esp/build.sh

@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+
+set -e
+
+# Base directory for this entire project
+BASEDIR=$(cd $(dirname $0) && pwd)
+
+# Source directory for unbuilt code
+SRCDIR="$BASEDIR/src"
+
+# Directory containing dojo build utilities
+TOOLSDIR="$SRCDIR/util/buildscripts"
+
+# Destination directory for built code
+DISTDIR=$1
+
+# Module ID of the main application package loader configuration
+LOADERMID="eclwatch/run"
+
+# Main application package loader configuration
+LOADERCONF="$SRCDIR/$LOADERMID.js"
+
+# Main application package build configuration
+PROFILE="$BASEDIR/profiles/eclwatch.profile.js"
+
+# Configuration over. Main application start up!
+
+if [ ! -d "$TOOLSDIR" ]; then
+    echo "Can't find Dojo build tools -- did you initialise submodules? (git submodule update --init --recursive)"
+    exit 1
+fi
+
+echo "Building application with $PROFILE to $DISTDIR."
+
+echo -n "Cleaning old files..."
+rm -rf "$DISTDIR"
+echo " Done"
+
+mkdir -p "$DISTDIR"
+cp -r "$SRCDIR/CodeMirror2" "$DISTDIR/CodeMirror2"
+
+cd "$TOOLSDIR"
+
+if which node >/dev/null; then
+    node ../../dojo/dojo.js load=build --require "$LOADERCONF" --profile "$PROFILE" --releaseDir "$DISTDIR" ${*:2}
+elif which java >/dev/null; then
+    java -Xms256m -Xmx256m  -cp ../shrinksafe/js.jar:../closureCompiler/compiler.jar:../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main  ../../dojo/dojo.js baseUrl=../../dojo load=build --require "$LOADERCONF" --profile "$PROFILE" --releaseDir "$DISTDIR" ${*:2}
+else
+    echo "Need node.js or Java to build!"
+    exit 1
+fi
+
+cd "$BASEDIR"
+
+LOADERMID=${LOADERMID//\//\\\/}
+
+# Copy & minify stub.htm to dist
+cat "$SRCDIR/stub.htm" | tr '\n' ' ' | \
+perl -pe "
+  s/<\!--.*?-->//g;                          # Strip comments
+#  s/isDebug: *1/deps:['$LOADERMID']/;        # Remove isDebug, add deps
+#  s/<script src=\"$LOADERMID.*?\/script>//;  # Remove script eclwatch/run
+  s/\s+/ /g;                                 # Collapse white-space" > "$DISTDIR/stub.htm"
+
+echo "Build complete"

+ 107 - 0
esp/profiles/eclwatch.profile.js

@@ -0,0 +1,107 @@
+/**
+ * This is the default application build profile used by the boilerplate. While it looks similar, this build profile
+ * is different from the package build profile at `app/package.js` in the following ways:
+ *
+ * 1. you can have multiple application build profiles (e.g. one for desktop, one for tablet, etc.), but only one
+ *    package build profile;
+ * 2. the package build profile only configures the `resourceTags` for the files in the package, whereas the
+ *    application build profile tells the build system how to build the entire application.
+ *
+ * Look to `util/build/buildControlDefault.js` for more information on available options and their default values.
+ */
+
+var profile = {
+    // `basePath` is relative to the directory containing this profile file; in this case, it is being set to the
+    // src/ directory, which is the same place as the `baseUrl` directory in the loader configuration. (If you change
+    // this, you will also need to update run.js.)
+    basePath: '../src/',
+
+    // This is the directory within the release directory where built packages will be placed. The release directory
+    // itself is defined by `build.sh`. You should probably not use this; it is a legacy option dating back to Dojo
+    // 0.4.
+    // If you do use this, you will need to update build.sh, too.
+    // releaseName: '',
+
+    // Builds a new release.
+    action: 'release',
+
+    // Strips all comments and whitespace from CSS files and inlines @imports where possible.
+    cssOptimize: 'comments',
+
+    // Excludes tests, demos, and original template files from being included in the built version.
+    mini: true,
+
+    // Uses Closure Compiler as the JavaScript minifier. This can also be set to "shrinksafe" to use ShrinkSafe,
+    // though ShrinkSafe is deprecated and not recommended.
+    // This option defaults to "" (no compression) if not provided.
+    optimize: 'closure',
+
+    // We're building layers, so we need to set the minifier to use for those, too.
+    // This defaults to "shrinksafe" if not provided.
+    layerOptimize: 'closure',
+
+    // Strips all calls to console functions within the code. You can also set this to "warn" to strip everything
+    // but console.error, and any other truthy value to strip everything but console.warn and console.error.
+    // This defaults to "normal" (strip all but warn and error) if not provided.
+    stripConsole: 'all',
+
+    // The default selector engine is not included by default in a dojo.js build in order to make mobile builds
+    // smaller. We add it back here to avoid that extra HTTP request. There is also a "lite" selector available; if
+    // you use that, you will need to set the `selectorEngine` property in `app/run.js`, too. (The "lite" engine is
+    // only suitable if you are not supporting IE7 and earlier.)
+    selectorEngine: 'acme',
+
+    // Builds can be split into multiple different JavaScript files called "layers". This allows applications to
+    // defer loading large sections of code until they are actually required while still allowing multiple modules to
+    // be compiled into a single file.
+    layers: {
+        // This is the main loader module. It is a little special because it is treated like an AMD module even though
+        // it is actually just plain JavaScript. There is some extra magic in the build system specifically for this
+        // module ID.
+        'dojo/dojo': {
+            // In addition to the loader `dojo/dojo` and the loader configuration file `app/run`, we are also including
+            // the main application `app/main` and the `dojo/i18n` and `dojo/domReady` modules because, while they are
+            // all conditional dependencies in `app/main`, we do not want to have to make extra HTTP requests for such
+            // tiny files.
+            include: [ 'dojo/i18n', 'dojo/domReady', 'hpcc/stub' ],
+
+            // By default, the build system will try to include `dojo/main` in the built `dojo/dojo` layer, which adds
+            // a bunch of stuff we do not want or need. We want the initial script load to be as small and quick to
+            // load as possible, so we configure it as a custom, bootable base.
+            boot: true,
+            customBase: true
+        }//,
+
+        // In the demo application, we conditionally require `app/Dialog` on the client-side, so here we build a
+        // separate layer containing just that client-side code. (Practically speaking, you would probably just want
+        // to roll everything into a single layer, but this helps provide a basic illustration of multi-layer builds.)
+        // Note that when you create a new layer, the module referenced by the layer is always included in the layer
+        // (in this case, `app/Dialog`), so it does not need to be explicitly defined in the `include` array.
+        //'hpcc/Dialog': {}
+    },
+
+    // Providing hints to the build system allows code to be conditionally removed on a more granular level than
+    // simple module dependencies can allow. This is especially useful for creating tiny mobile builds.
+    // Keep in mind that dead code removal only happens in minifiers that support it! Currently, only Closure Compiler
+    // to the Dojo build system with dead code removal.
+    // A documented list of has-flags in use within the toolkit can be found at
+    // <http://dojotoolkit.org/reference-guide/dojo/has.html>.
+    staticHasFeatures: {
+        // The trace & log APIs are used for debugging the loader, so we do not need them in the build.
+        'dojo-trace-api': 0,
+        'dojo-log-api': 0,
+
+        // This causes normally private loader data to be exposed for debugging. In a release build, we do not need
+        // that either.
+        'dojo-publish-privates': 0,
+
+        // This application is pure AMD, so get rid of the legacy loader.
+        'dojo-sync-loader': 0,
+
+        // `dojo-xhr-factory` relies on `dojo-sync-loader`, which we have removed.
+        'dojo-xhr-factory': 0,
+
+        // We are not loading tests in production, so we can get rid of some test sniffing code.
+        'dojo-test-sniff': 0
+    }
+};

+ 37 - 0
esp/src/eclwatch/package.js

@@ -0,0 +1,37 @@
+var profile = (function(){
+    copyOnly = function (filename, mid) {
+        var list = {
+            "hpcc/eclwatch.profile": true,
+            "hpcc/eclwatch.json": true,
+            "hpcc/dojoConfig": true,
+            "hpcc/viz/map/us.json": true,
+            "hpcc/viz/map/us_counties.json": true
+        };
+        return (mid in list) ||
+            (/^hpcc\/resources\//.test(mid) && !/\.css$/.test(filename)) ||
+            /(png|jpg|jpeg|gif|tiff)$/.test(filename);
+    };
+
+    return {
+        destLocation: "eclwatch",
+        resourceTags: {
+            test: function (filename, mid) {
+                return false;
+            },
+
+            copyOnly: function (filename, mid) {
+                return copyOnly(filename, mid);
+            },
+
+            amd: function (filename, mid) {
+                return !copyOnly(filename, mid) && /\.js$/.test(filename);
+            },
+
+            miniExclude: function (filename, mid) {
+                return mid in {
+                    'hpcc/package': 1
+                };
+            }
+        }
+    };
+})();

+ 27 - 0
esp/src/eclwatch/package.json

@@ -0,0 +1,27 @@
+{
+    "name": "eclwatch",
+    "version": "1.0",
+    "main": "stub",
+    "dependencies": {
+        "dojo": "1.9.3",
+        "dijit": "1.9.3",
+        "dojox": "1.9.3",
+        "util": "1.9.3",
+        "d3": "3.4.3",
+        "topojson": "1.4.9",
+        "dgrid": "0.3.13",
+        "xstyle": "0.2.1",
+        "put-selector": "0.3.5"
+    },
+    "description": "'ECL Watch' Web interface for HPCC Platform.",
+    "licenses": [
+        {
+            "type": "Apache License, Version 2.0",
+            "url": "https://raw.github.com/hpcc-systems/HPCC-Platform/master/LICENSE.txt"
+        }
+    ],
+    "bugs": "https://track.hpccsystems.com/issues/?jql=component%20%3D%20EclWatch%20",
+    "keywords": ["JavaScript", "HPCC", "Big Data"],
+    "homepage": "https://github.com/hpcc-systems/HPCC-Platform",
+    "dojoBuild": "package.js"
+}

+ 42 - 0
esp/src/eclwatch/run.js

@@ -0,0 +1,42 @@
+/**
+ * This file is used to reconfigure parts of the loader at runtime for this application. We've put this extra
+ * configuration in a separate file, instead of adding it directly to index.html, because it contains options that
+ * can be shared if the application is run on both the client and the server.
+ *
+ * If you aren't planning on running your app on both the client and the server, you could easily move this
+ * configuration into index.html (as a dojoConfig object) if it makes your life easier.
+ */
+require({
+    // The base path for all packages and modules. If you don't provide this, baseUrl defaults to the directory
+    // that contains dojo.js. Since all packages are in the root, we just leave it blank. (If you change this, you
+    // will also need to update `app.profile.js`).
+    baseUrl: '',
+
+    // A list of packages to register. Strictly speaking, you do not need to register any packages,
+    // but you can't require "app" and get app/main.js if you do not register the "app" package (the loader will look
+    // for a module at <baseUrl>/app.js instead). Unregistered packages also cannot use the `map` feature, which
+    // might be important to you if you need to relocate dependencies. TL;DR, register all your packages all the time:
+    // it will make your life easier.
+    packages: [
+        // If you are registering a package that has an identical name and location, you can just pass a string
+        // instead, and it will configure it using that string for both the "name" and "location" properties. Handy!
+        'dojo',
+        'dijit',
+        'dojox',
+        'dgrid',
+        'put-selector',
+        'xstyle',
+        'd3',
+        'topojson',
+
+        {
+            name: "hpcc",
+            location: "eclwatch"
+        },
+        {
+            name: "templates",
+            location: "eclwatch/templates"
+        }
+    ]
+// Require `app`. This loads the main application module, `app/main`, since we registered the `app` package above.
+});

+ 0 - 41
esp/src/eclwatch/templates/CMakeLists.txt

@@ -1,41 +0,0 @@
-################################################################################
-#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
-#
-#    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.
-################################################################################
-set ( TEMPLATES_FILES
-    ${CMAKE_CURRENT_SOURCE_DIR}/DFUSearchWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/DFUWUDetailsWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/ECLPlaygroundWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/ECLSourceWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/FilePartsWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/GraphPageWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/GraphWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/GraphWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/InfoGridWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/LFDetailsWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/LogsWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/ResultsWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/ResultWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/SampleSelectWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/TargetSelectWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/TimingGridWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/TimingPageWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/TimingTreeMapWidget.html
-    ${CMAKE_CURRENT_SOURCE_DIR}/WUDetailsWidget.html
-)
-
-FOREACH( iFile ${TEMPLATES_FILES} )
-    Install( FILES ${iFile} DESTINATION componentfiles/files/templates COMPONENT Runtime )
-ENDFOREACH ( iFile )
-

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 3
esp/src/eclwatch/viz.js