diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/.gitignore b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..de4bae125ed0a67a7958b899044e8538ce1890e6 --- /dev/null +++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/.gitignore @@ -0,0 +1,2 @@ +config.bundle.js +openbis.bundle.js \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/build.sh b/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/build.sh deleted file mode 100755 index 5890b1829bbb48ed2087ee8beed574789faf0a71..0000000000000000000000000000000000000000 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -pushd $(dirname $0) > /dev/null - -# create temporary output folder -rm -rvf output -mkdir output - -# create a list of all *.js files from 'as', 'dss' and 'util' folders -find ../as ../dss ../util -name "*.js" | sed 's/^..\//"/g' | sed 's/.js$/",/g' > output/files.js - -# create config files from their templates by replacing '__FILES__' with a content of 'files.js' -cat r.config.template.js | sed -e '\|__FILES__|{' -e 'r output/files.js' -e 'd' -e '}' > output/r.config.js -cat config.bundle.template.js | sed -e '\|__FILES__|{' -e 'r output/files.js' -e 'd' -e '}' > output/config.bundle.js - -# create a JS bundle with all *.js files -node r.js -o output/r.config.js - -# copy relevant output files to resource folder -cp output/config.bundle.js output/openbis.bundle.js ../ - -# remove temporary output folder -rm -rvf output - -popd > /dev/null \ No newline at end of file diff --git a/openbis_ng_ui/build.gradle b/openbis_ng_ui/build.gradle index e42b1e0fb666896949db30b66281a5dcd16ef34b..2be6dcbfc183cfb5f9ce4c38629f0df958812d39 100644 --- a/openbis_ng_ui/build.gradle +++ b/openbis_ng_ui/build.gradle @@ -5,11 +5,12 @@ buildscript { url "https://plugins.gradle.org/m2/" } } + dependencies { + classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0' + } } -plugins { - id "com.moowork.node" version "1.2.0" -} +apply plugin: "com.moowork.node" configure(allprojects) { apply plugin:'base' diff --git a/openbis_standard_technologies/.gitignore b/openbis_standard_technologies/.gitignore index 44068dcafbe222e53f75bbfc61d39d298754bcc5..e88629274f8f8fe0cc9e688e0d3c4f8c09228783 100644 --- a/openbis_standard_technologies/.gitignore +++ b/openbis_standard_technologies/.gitignore @@ -1,6 +1,7 @@ /targets /bin /build/ +/node/ /.idea/ *.iml *.eml \ No newline at end of file diff --git a/openbis_standard_technologies/build.gradle b/openbis_standard_technologies/build.gradle index fb17d04db0308bfe3b24428083f4767bb117d331..e6f6c70be1869d0ee09971f45af9548d7d13d33a 100644 --- a/openbis_standard_technologies/build.gradle +++ b/openbis_standard_technologies/build.gradle @@ -6,12 +6,14 @@ buildscript { dependencies { classpath 'apache:commons-codec:1.10', 'owasp:dependency-check-gradle:3.1.2', - 'paleozogt:symzip-plugin:0.10.1' + 'paleozogt:symzip-plugin:0.10.1', + 'com.moowork.gradle:gradle-node-plugin:1.2.0' } } apply plugin: org.owasp.dependencycheck.gradle.DependencyCheckPlugin apply plugin: "org.paleozogt.symzip" +apply plugin: "com.moowork.node" dependencyCheck { failBuildOnCVSS = 7 // 0 - 4 = low, 4 - 7 = medium, 7 - 9 = high, 9-10 = critical @@ -185,7 +187,21 @@ task untarGwt(type: Copy) { into gwtBuildDir } -task copyOpenbisStaticResources(type: Copy, dependsOn: untarGwt) { +node { + download = true + version = '10.22.0' + workDir = file("${projectDir}/node/nodejs") + nodeModulesDir = file("${projectDir}") +} + +task bundleOpenbisStaticResources(type: Exec) { + dependsOn 'untarGwt' + dependsOn 'npmInstall' + commandLine 'bash', '-c', "${projectDir}/resource/js/v3/build.sh" +} + +task copyOpenbisStaticResources(type: Copy) { + dependsOn 'bundleOpenbisStaticResources' from "${project(':openbis').projectDir}/source/java/ch/systemsx/cisd/openbis/public" into gwtModuleBuildDir } diff --git a/openbis_standard_technologies/package.json b/openbis_standard_technologies/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c0cb0f5c17f2b2a29b40e30402117d8e6d531b5b --- /dev/null +++ b/openbis_standard_technologies/package.json @@ -0,0 +1,8 @@ +{ + "name": "dummy-package-json", + "version": "0.0.1", + "description": "This configuration file is required by NodeJS gradle plugin which is used to bundle all JS files together", + "scripts": {}, + "devDependencies": {}, + "dependencies": {} +} diff --git a/openbis_standard_technologies/resource/js/v3/.gitignore b/openbis_standard_technologies/resource/js/v3/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3602361dafeea2cbec159128f5166a8428c0795c --- /dev/null +++ b/openbis_standard_technologies/resource/js/v3/.gitignore @@ -0,0 +1 @@ +temp \ No newline at end of file diff --git a/openbis_standard_technologies/resource/js/v3/build.sh b/openbis_standard_technologies/resource/js/v3/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..c4e0122053bc46ca7c777df67478a2940a50bcbc --- /dev/null +++ b/openbis_standard_technologies/resource/js/v3/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +pushd $(dirname $0) > /dev/null + +OPENBIS_STANDARD_TECHNOLOGIES_DIR=../../.. +OPENBIS_DIR=../../../../openbis + +CURRENT_DIR=$(pwd) +TEMP_DIR=${CURRENT_DIR}/temp + +V3_DIR=$OPENBIS_DIR/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3 + +# create an empty temporary folder +rm -rvf $TEMP_DIR +mkdir -p $TEMP_DIR + +# create a list of all *.js files from chosen V3 folders +cd $V3_DIR +find ./as ./dss ./util -name "*.js" | sed 's/^.\//"/g' | sed 's/.js$/",/g' > $TEMP_DIR/files.js + +# create config files from their templates by replacing '__FILES__' with a content of 'files.js' +cd $CURRENT_DIR +cat r.config.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/r.config.js +cat config.bundle.template.js | sed -e '\|__FILES__|{' -e "r $TEMP_DIR/files.js" -e 'd' -e '}' > $TEMP_DIR/config.bundle.js + +# create a JS bundle using NodeJS binary installed by NodeJS gradle plugin +$OPENBIS_STANDARD_TECHNOLOGIES_DIR/node/nodejs/node-*/bin/node r.js -o $TEMP_DIR/r.config.js baseUrl=$V3_DIR + +# copy relevant files to the V3 public folder +cp $TEMP_DIR/config.bundle.js $TEMP_DIR/openbis.bundle.js $V3_DIR + +popd > /dev/null \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/config.bundle.template.js b/openbis_standard_technologies/resource/js/v3/config.bundle.template.js similarity index 91% rename from openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/config.bundle.template.js rename to openbis_standard_technologies/resource/js/v3/config.bundle.template.js index f49edcda3bef998d295a134a182007f72afda83a..ac7c455be2219b80b84e96debe850c48c15925e6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/config.bundle.template.js +++ b/openbis_standard_technologies/resource/js/v3/config.bundle.template.js @@ -18,6 +18,10 @@ var require = (function () { baseUrl: getBaseUrl(), bundles: { 'openbis.bundle': [ + 'jquery', + 'stjs', + 'underscore', + 'moment', // __FILES__ // diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/r.config.template.js b/openbis_standard_technologies/resource/js/v3/r.config.template.js similarity index 94% rename from openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/r.config.template.js rename to openbis_standard_technologies/resource/js/v3/r.config.template.js index ce3ff84dab8b97a14af81fc82b5d98f684ac5ebc..8e46ef030a6fe767e20c7cd58f0734a63c054420 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/r.config.template.js +++ b/openbis_standard_technologies/resource/js/v3/r.config.template.js @@ -1,5 +1,4 @@ ({ - baseUrl: '../../', include: [ // __FILES__ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/r.js b/openbis_standard_technologies/resource/js/v3/r.js similarity index 100% rename from openbis/source/java/ch/systemsx/cisd/openbis/public/resources/api/v3/bundle/r.js rename to openbis_standard_technologies/resource/js/v3/r.js