| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566 |
- var gulp = require("gulp"),
- gutil = require("gulp-util"),
- del = require("del"),
- fs = require("fs"),
- minimist = require("minimist"),
- targz = require("targz"),
- slog = require("single-line-log").stdout,
- dateFormat = require("dateformat"),
- progress = require("progress-stream"),
- request = require("request"),
- //uglify = require('gulp-tm-uglify'),
- uglify = require("gulp-uglify-es").default,
- rename = require("gulp-rename"),
- changed = require("gulp-changed"),
- gulpif = require("gulp-if"),
- http = require("http");
- concat = require("gulp-concat");
- var fg = require("fast-glob");
- var logger = require("gulp-logger");
- var assetRev = require("gulp-tm-asset-rev");
- const os = require("os");
- var through2 = require("through2");
- var path = require("path");
- var sourceMap = require("gulp-sourcemaps");
- var git = require("gulp-git");
- //var downloadHost = "download.o2oa.net";
- // var downloadHost = "release.o2oa.net";
- // var protocol = "http";
- // var commonUrl = "/build/commons.tar.gz";
- // var jvmUrls = {
- // "all": "/build/jvm.tar.gz",
- // "linux": "/build/linux.tar.gz",
- // "aix": "/build/aix.tar.gz",
- // "arm": "/build/arm.tar.gz",
- // "macos": "/build/macos.tar.gz",
- // "risc": "/build/risc.tar.gz",
- // "raspberrypi": "/build/raspberrypi.tar.gz",
- // "windows": "/build/windows.tar.gz"
- // };
- var downloadHost = "git.o2oa.net";
- var protocol = "https";
- var commonUrl =
- "/o2oa/evn-o2server-commons/-/archive/master/evn-o2server-commons-master.tar.gz?path=commons";
- var jvmUrls = {
- all:
- "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm",
- linux:
- "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/linux",
- aix:
- "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/aix",
- arm:
- "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/arm",
- macos:
- "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/macos",
- risc:
- "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/risc",
- raspi:
- "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/raspi",
- windows:
- "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/windows",
- };
- var scripts = {
- all: [
- "o2server/*.sh",
- "o2server/*.jar",
- "o2server/*.html",
- "o2server/*.bat",
- "o2server/version.o2",
- ],
- linux: [
- "o2server/*linux*",
- "o2server/*.jar",
- "o2server/*.html",
- "o2server/version.o2",
- ],
- aix: [
- "o2server/*aix*",
- "o2server/*.jar",
- "o2server/*.html",
- "o2server/version.o2",
- ],
- arm: [
- "o2server/*arm*",
- "o2server/*.jar",
- "o2server/*.html",
- "o2server/version.o2",
- ],
- macos: [
- "o2server/*macos*",
- "o2server/*.jar",
- "o2server/*.html",
- "o2server/version.o2",
- ],
- risc: [
- "o2server/*risc*",
- "o2server/*.jar",
- "o2server/*.html",
- "o2server/version.o2",
- ],
- raspi: [
- "o2server/*raspi*",
- "o2server/*.jar",
- "o2server/*.html",
- "o2server/version.o2",
- ],
- windows: [
- "o2server/*windows*",
- "o2server/*.jar",
- "o2server/*.html",
- "o2server/version.o2",
- ],
- };
- var o_options = minimist(process.argv.slice(2), {
- //upload: local ftp or sftp
- string: ["e", "lp"],
- });
- var options = {};
- options.ev = o_options.e || "all";
- options.lp = o_options.lp || "zh-cn";
- var jvmUrl = jvmUrls[options.ev];
- var scriptSource = scripts[options.ev];
- function ProgressBar(description, bar_length) {
- this.description = description || "Progress";
- this.length = bar_length || 50;
- this.render = function (opts) {
- var percent = (opts.completed / opts.total).toFixed(4);
- var cell_num = Math.floor(percent * this.length);
- var speed = "";
- if (opts.time) {
- speed = opts.completed / 1024 / 1024 / (opts.time / 1000);
- speed = speed.toFixed(2);
- speed = speed + "M/S";
- }
- var count = "";
- if (opts.count) {
- count = "[" + opts.count + "/" + opts.total + "]";
- }
- var cell = "";
- for (var i = 0; i < cell_num; i++) {
- cell += ">";
- }
- var empty = "";
- for (var i = 0; i < this.length - cell_num; i++) {
- empty += "=";
- }
- if (opts.completed <= opts.total) {
- var d = new Date();
- var cmdText =
- "[" +
- dateFormat(d, "HH:MM:ss") +
- "]" +
- " " +
- this.description +
- ": " +
- cell +
- empty +
- " " +
- (100 * percent).toFixed(2) +
- "% " +
- speed +
- count;
- slog(cmdText);
- }
- };
- }
- function downloadFile_progress(path, filename, headcb, progresscb, cb) {
- var dest = `o2server/${filename}`;
- // fs.exists(dest, function(exists) {
- // if (exists){
- // headcb(1);
- // progresscb({transferred:1});
- // cb();
- // }else{
- let stream = fs.createWriteStream(dest);
- var options = { url: protocol + "://" + downloadHost + path };
- var fileHost = downloadHost;
- var filePath = path;
- stream.on("finish", () => {
- //gutil.log("download", ":", gutil.colors.green(filename), " completed!");
- cb();
- });
- stream.on("error", (err) => {
- gutil.log(
- gutil.colors.red("download error"),
- ":",
- gutil.colors.red(filename),
- err
- );
- });
- var req = http.request(
- {
- host: fileHost,
- path: filePath,
- method: "HEAD",
- },
- function (res) {
- if (res.statusCode == 200) {
- res.setEncoding(null);
- var time = 0;
- var l = res.headers["content-length"];
- var str = progress({
- length: l,
- time: 100 /* ms */,
- });
- headcb(l);
- str.on("progress", function (progress) {
- if (pb) {
- progresscb(progress);
- pb.render({
- completed: currentLength,
- total: totalLength,
- time: (time += 100),
- });
- }
- });
- request.get(options).pipe(str).pipe(stream);
- } else {
- gutil.log(
- gutil.colors.red("download error"),
- ":",
- gutil.colors.red(filename),
- "statusCode:" + res.statusCode
- );
- }
- }
- );
- req.on("error", (e) => {
- gutil.log(
- gutil.colors.red("download error"),
- ":",
- gutil.colors.red(filename),
- e
- );
- });
- req.end();
- // }
- //});
- }
- function downloadFile(path, filename, headcb, progresscb, cb) {
- var dest = `o2server/${filename}`;
- // fs.exists(dest, function(exists) {
- // if (exists){
- // headcb(1);
- // progresscb({transferred:1});
- // cb();
- // }else{
- let stream = fs.createWriteStream(dest);
- var options = { url: protocol + "://" + downloadHost + path };
- var fileHost = downloadHost;
- var filePath = path;
- stream.on("finish", () => {
- //gutil.log("download", ":", gutil.colors.green(filename), " completed!");
- cb();
- });
- stream.on("error", (err) => {
- gutil.log(
- gutil.colors.red("download error"),
- ":",
- gutil.colors.red(filename),
- err
- );
- });
- // var req = http.request({
- // host:fileHost,
- // path:filePath,
- // method:'HEAD'
- // },function (res){
- // if (res.statusCode == 200) {
- // res.setEncoding(null);
- // var time = 0;
- // var l = res.headers['content-length'];
- // var str = progress({
- // length: l,
- // time: 100 /* ms */
- // });
- // headcb(l);
- //
- // str.on('progress', function(progress) {
- // if (pb){
- // progresscb(progress);
- // pb.render({ completed: currentLength, total: totalLength, time: time+=100 });
- // }
- //
- // });
- request.get(options).pipe(stream);
- // } else {
- // gutil.log(gutil.colors.red("download error"), ":", gutil.colors.red(filename), "statusCode:"+res.statusCode);
- // }
- // })
- // req.on('error', (e) => {
- // gutil.log(gutil.colors.red("download error"), ":", gutil.colors.red(filename), e);
- // });
- // req.end();
- // }
- //});
- }
- var commonsLength = 0;
- var jvmLenght = 0;
- var totalLength = 0;
- var currentLength = 0;
- var commonsCurrentLength = 0;
- var jvmCurrentLength = 0;
- var pb = null;
- function initProgress() {
- if (commonsLength && jvmLenght) {
- totalLength = +commonsLength + jvmLenght;
- var t = (totalLength / 1024 / 1024).toFixed(2);
- pb = new ProgressBar("total: " + t + "M", 50);
- }
- }
- function download_commons_and_jvm(cb) {
- gutil.log(gutil.colors.green("begin download commons and jvm"));
- console.log(`---------------------------------------------------------------------
- . Start to download the dependencies needed for compilation ...
- ---------------------------------------------------------------------`);
- var downloader = new Promise((resolve, reject) => {
- var commonLoaded = false;
- var jvmLoaded = false;
- downloadFile(
- commonUrl,
- "commons_git.tar.gz",
- (length) => {
- commonsLength = +length;
- initProgress();
- },
- (progress) => {
- commonsCurrentLength = progress.transferred;
- currentLength = +commonsCurrentLength + jvmCurrentLength;
- },
- () => {
- commonLoaded = true;
- if (jvmLoaded && commonLoaded) resolve();
- }
- );
- // var jvmName = jvmUrl.substr(jvmUrl.lastIndexOf("/"+1, jvmUrl.length));
- // console.log(jvmName);
- // console.log(jvmUrl);
- downloadFile(
- jvmUrl,
- "jvm_git.tar.gz",
- (length) => {
- jvmLenght = +length;
- initProgress();
- },
- (progress) => {
- jvmCurrentLength = progress.transferred;
- currentLength = +commonsCurrentLength + jvmCurrentLength;
- },
- () => {
- jvmLoaded = true;
- if (jvmLoaded && commonLoaded) resolve();
- }
- );
- });
- downloader.then(() => {
- //console.log();
- gutil.log(gutil.colors.green("download commons and jvm completed"));
- cb();
- });
- }
- function decompress_commons_and_jvm(cb) {
- console.log(`---------------------------------------------------------------------
- . Start to decompress the dependencies needed for compilation ...
- ---------------------------------------------------------------------`);
- gutil.log(gutil.colors.green("begin decompress commons and jvm"));
- var count = 0;
- var decompressor = new Promise((resolve, reject) => {
- var commonUnziped = false;
- var jvmUnziped = false;
- targz.decompress(
- {
- src: "o2server/commons_git.tar.gz",
- dest: "o2server",
- tar: {
- map: function (header) {
- count++;
- var d = new Date();
- slog(
- "[" +
- dateFormat(d, "HH:MM:ss") +
- "] " +
- count +
- " " +
- header.name +
- " ..."
- );
- //gutil.log(gutil.colors.cyan(header.name), gutil.colors.yellow("..."));
- },
- },
- },
- function (err) {
- if (err) {
- gutil.log(
- gutil.colors.red("decompress error"),
- ":",
- gutil.colors.red("common.tar.gz "),
- err
- );
- } else {
- commonUnziped = true;
- if (jvmUnziped && commonUnziped) resolve();
- }
- }
- );
- targz.decompress(
- {
- src: "o2server/jvm_git.tar.gz",
- dest: "o2server",
- tar: {
- map: function (header) {
- count++;
- var d = new Date();
- slog(
- "[" +
- dateFormat(d, "HH:MM:ss") +
- "] " +
- count +
- " " +
- header.name +
- " ..."
- );
- //slog(count +" "+ header.name+" ...");
- //gutil.log(gutil.colors.cyan(header.name), gutil.colors.yellow("..."));
- },
- },
- },
- function (err) {
- if (err) {
- gutil.log(
- gutil.colors.red("decompress error"),
- ":",
- gutil.colors.red("jvm.tar.gz "),
- err
- );
- } else {
- jvmUnziped = true;
- if (jvmUnziped && commonUnziped) resolve();
- }
- }
- );
- });
- decompressor.then(() => {
- gutil.log(
- gutil.colors.green(
- "decompress commons and jvm completed. " + count + " files"
- )
- );
- cb();
- });
- }
- function move_commons() {
- console.log(`---------------------------------------------------------------------
- . move commons files to o2server/commons ...
- ---------------------------------------------------------------------`);
- return gulp
- .src("o2server/evn-o2server-commons-master-commons/commons/**/*")
- .pipe(gulp.dest("o2server/commons/"));
- }
- function move_jvm() {
- console.log(`---------------------------------------------------------------------
- . move jvm files to o2server/jvm ...
- ---------------------------------------------------------------------`);
- var path;
- if (options.ev == "all") {
- path = "o2server/evn-o2server-jvm-master-jvm/jvm/**/*";
- } else {
- path =
- "o2server/evn-o2server-jvm-master-jvm-" + options.ev + "/jvm/**/*";
- }
- return gulp.src(path).pipe(gulp.dest("o2server/jvm/"));
- }
- function clear_commons_git(cb) {
- var dest = [
- "o2server/evn-o2server-commons-master-commons/",
- "o2server/commons_git.tar.gz",
- ];
- del(dest, { force: true });
- cb();
- }
- function clear_jvm_git(cb) {
- var path;
- if (options.ev == "all") {
- path = "o2server/evn-o2server-jvm-master-jvm/";
- } else {
- path = "o2server/evn-o2server-jvm-master-jvm-" + options.ev + "/";
- }
- del([path, "o2server/jvm_git.tar.gz"], { force: true });
- cb();
- }
- function build_web_minimize(cb) {
- console.log(`---------------------------------------------------------------------
- . Start compiling the web ...
- ---------------------------------------------------------------------`);
- var dest = "target/o2server/servers/webServer/";
- var src_min = [
- "o2web/source/**/*.js",
- "!o2web/source/o2_core/o2.js",
- "!**/*.spec.js",
- "!**/test/**",
- "!o2web/source/o2_lib/**/*",
- ];
- var entries = fg.sync(src_min, { dot: false });
- var size = entries.length;
- var pb = new ProgressBar("", 50);
- var doCount = 0;
- var stream = gulp.src(src_min);
- stream.on("end", () => {
- console.log();
- });
- return stream
- .pipe(uglify())
- .pipe(rename({ extname: ".min.js" }))
- .pipe(gulp.dest(dest))
- .pipe(
- logger(function () {
- doCount++;
- if (doCount <= size) {
- pb.render({
- completed: doCount,
- total: size,
- count: doCount,
- });
- }
- })
- )
- .pipe(gutil.noop());
- }
- function build_web_move() {
- var dest = "target/o2server/servers/webServer/";
- var src_move = [
- "o2web/source/**/*",
- "!o2web/source/o2_core/o2.js",
- "!**/*.spec.js",
- "!**/test/**",
- ];
- var entries = fg.sync(src_move, { dot: false });
- var size = entries.length;
- var pb = new ProgressBar("", 50);
- var doCount = 0;
- var stream = gulp.src(src_move);
- stream.on("end", () => {
- console.log();
- });
- return stream
- .pipe(gulp.dest(dest))
- .pipe(
- logger(function () {
- doCount++;
- if (doCount <= size) {
- pb.render({
- completed: doCount,
- total: size,
- count: doCount,
- });
- }
- })
- )
- .pipe(gutil.noop());
- }
- exports.build_web_move = build_web_move;
- function build_concat_o2() {
- var src = [
- "o2web/source/o2_lib/mootools/mootools-1.6.0_all.js",
- "o2web/source/o2_lib/mootools/plugin/mBox.js",
- "o2web/source/o2_core/o2.js",
- ];
- var dest = "target/o2server/servers/webServer/o2_core/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- .pipe(concat("o2.js"))
- .pipe(gulp.dest(dest))
- .pipe(concat("o2.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- function build_concat_base() {
- var src = [
- "o2web/source/x_desktop/js/base.js",
- "o2web/source/x_desktop/js/base_loader.js",
- ];
- var dest = "target/o2server/servers/webServer/x_desktop/js/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- //.pipe(concat('o2.js'))
- .pipe(gulp.dest(dest))
- .pipe(concat("base.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- function build_concat_desktop() {
- let path = "o2_core";
- var src = [
- "o2web/source/" + path + "/o2/widget/Common.js",
- "o2web/source/" + path + "/o2/widget/Dialog.js",
- "o2web/source/" + path + "/o2/widget/UUID.js",
- "o2web/source/" + path + "/o2/xDesktop/Common.js",
- "o2web/source/" + path + "/o2/xDesktop/Actions/RestActions.js",
- "o2web/source/" + path + "/o2/xAction/RestActions.js",
- "o2web/source/" + path + "/o2/xDesktop/Access.js",
- "o2web/source/" + path + "/o2/xDesktop/Dialog.js",
- "o2web/source/" + path + "/o2/xDesktop/Menu.js",
- "o2web/source/" + path + "/o2/xDesktop/UserData.js",
- "o2web/source/x_component_Template/MPopupForm.js",
- "o2web/source/" + path + "/o2/xDesktop/Authentication.js",
- "o2web/source/" + path + "/o2/xDesktop/Dialog.js",
- "o2web/source/" + path + "/o2/xDesktop/Window.js",
- "o2web/source/x_component_Common/Main.js",
- ];
- var dest = "target/o2server/servers/webServer/o2_core/o2/xDesktop/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- .pipe(concat("$all.js"))
- .pipe(gulp.dest(dest))
- .pipe(concat("$all.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- function build_concat_xform() {
- let path = "x_component_process_Xform";
- var src = [
- "o2web/source/o2_core/o2/widget/AttachmentController.js",
- "o2web/source/o2_core/o2/xScript/Macro.js",
- "o2web/source/o2_core/o2/widget/Tab.js",
- "o2web/source/o2_core/o2/widget/O2Identity.js",
- "o2web/source/" + path + "/Form.js",
- "o2web/source/" + path + "/$Module.js",
- "o2web/source/" + path + "/$Input.js",
- "o2web/source/" + path + "/Div.js",
- "o2web/source/" + path + "/Combox.js",
- "o2web/source/" + path + "/DatagridMobile.js",
- "o2web/source/" + path + "/DatagridPC.js",
- "o2web/source/" + path + "/Textfield.js",
- "o2web/source/" + path + "/Personfield.js",
- "o2web/source/" + path + "/Button.js",
- "o2web/source/" + path + "/ViewSelector.js",
- "o2web/source/" + path + "/*.js",
- "o2web/source/x_component_process_Work/Processor.js",
- "!o2web/source/" + path + "/Office.js",
- ];
- var dest = "target/o2server/servers/webServer/" + path + "/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- .pipe(concat("$all.js"))
- .pipe(gulp.dest(dest))
- .pipe(concat("$all.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- function build_concat_cms_xform() {
- let processPath = "x_component_process_Xform";
- let path = "x_component_cms_Xform";
- var src = [
- "o2web/source/o2_core/o2/widget/AttachmentController.js",
- // 'source/o2_core/o2/xScript/CMSEnvironment.js',
- "o2web/source/o2_core/o2/xScript/CMSMacro.js",
- "o2web/source/o2_core/o2/widget/Tab.js",
- "o2web/source/o2_core/o2/widget/O2Identity.js",
- "o2web/source/" + processPath + "/Form.js",
- "o2web/source/" + processPath + "/$Module.js",
- "o2web/source/" + processPath + "/$Input.js",
- "o2web/source/" + processPath + "/Div.js",
- //'source/' + processPath + '/Combox.js',
- "o2web/source/" + processPath + "/DatagridMobile.js",
- "o2web/source/" + processPath + "/DatagridPC.js",
- "o2web/source/" + processPath + "/Textfield.js",
- //'source/' + processPath + '/Personfield.js',
- "o2web/source/" + processPath + "/Button.js",
- //'source/' + processPath + '/ViewSelector.js',
- "o2web/source/" + processPath + "/Org.js",
- // 'source/' + processPath + '/*.js',
- "o2web/source/" + processPath + "/Actionbar.js",
- //'source/' + processPath + '/Address.js',
- "o2web/source/" + processPath + "/Attachment.js",
- "o2web/source/" + processPath + "/Calendar.js",
- "o2web/source/" + processPath + "/Checkbox.js",
- "o2web/source/" + processPath + "/Datagrid.js",
- "o2web/source/" + processPath + "/Htmleditor.js",
- //'source/' + processPath + '/Iframe.js',
- "o2web/source/" + processPath + "/Label.js",
- "o2web/source/" + processPath + "/Number.js",
- "o2web/source/" + processPath + "/Common.js",
- "o2web/source/" + processPath + "/Image.js",
- "o2web/source/" + processPath + "/ImageClipper.js",
- "o2web/source/" + processPath + "/Html.js",
- "o2web/source/" + processPath + "/Radio.js",
- "o2web/source/" + processPath + "/Select.js",
- //'source/' + processPath + '/Stat.js',
- //'source/' + processPath + '/Statement.js',
- //'source/' + processPath + '/StatementSelector.js',
- //'source/' + processPath + '/Subform.js',
- "o2web/source/" + processPath + "/Tab.js",
- "o2web/source/" + processPath + "/Table.js",
- "o2web/source/" + processPath + "/Textarea.js",
- //'source/' + processPath + '/Tree.js',
- //'source/' + processPath + '/View.js',
- // 'source/x_component_process_Work/Processor.js',
- // '!source/' + processPath + '/Office.js'
- "o2web/source/o2_core/o2/widget/SimpleToolbar.js",
- "o2web/source/" + path + "/ModuleImplements.js",
- "o2web/source/" + path + "/Package.js",
- "o2web/source/" + path + "/Form.js",
- //'source/' + path + '/widget/Comment.js',
- "o2web/source/" + path + "/widget/Log.js",
- "o2web/source/" + path + "/Org.js",
- "o2web/source/" + path + "/Author.js",
- "o2web/source/" + path + "/Reader.js",
- "o2web/source/" + path + "/Textfield.js",
- "o2web/source/" + path + "/Actionbar.js",
- "o2web/source/" + path + "/Attachment.js",
- "o2web/source/" + path + "/Button.js",
- "o2web/source/" + path + "/Calendar.js",
- "o2web/source/" + path + "/Checkbox.js",
- "o2web/source/" + path + "/Datagrid.js",
- "o2web/source/" + path + "/Htmleditor.js",
- "o2web/source/" + path + "/ImageClipper.js",
- "o2web/source/" + path + "/Label.js",
- "o2web/source/" + path + "/Number.js",
- "o2web/source/" + path + "/Radio.js",
- "o2web/source/" + path + "/Select.js",
- "o2web/source/" + path + "/Tab.js",
- "o2web/source/" + path + "/Table.js",
- "o2web/source/" + path + "/Textarea.js",
- //'source/' + path + '/Personfield.js',
- //'source/' + path + '/Readerfield.js',
- //'source/' + path + '/Authorfield.js',
- //'source/' + path + '/Orgfield.js',
- // 'source/' + path + '/*.js',
- // '!source/' + path + '/Office.js'
- ];
- var dest = "target/o2server/servers/webServer/" + path + "/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- .pipe(concat("$all.js"))
- .pipe(gulp.dest(dest))
- .pipe(concat("$all.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- function build_bundle() {
- let path = "o2_core";
- var src = [
- "o2web/source/o2_lib/mootools/mootools-1.6.0_all.js",
- "o2web/source/o2_lib/mootools/plugin/mBox.js",
- "o2web/source/o2_core/o2.js",
- "o2web/source/x_desktop/js/base.js",
- "o2web/source/x_desktop/js/base_loader.js",
- "o2web/source/o2_core/o2/framework.js",
- ];
- var dest = "target/o2server/servers/webServer/" + path + "/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- .pipe(concat("bundle.js"))
- .pipe(gulp.dest(dest))
- .pipe(concat("bundle.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- function concat_Actions() {
- return through2.obj(function (file, enc, cb) {
- if (file.isNull()) {
- this.push(file);
- return cb();
- }
- if (file.isStream()) {
- this.emit(
- "error",
- new gutil.PluginError(PLUGIN_NAME, "Streaming not supported")
- );
- return cb();
- }
- var content = file.contents.toString();
- var o = path.parse(file.path);
- var name = o.name;
- content = "var actionJson = " + content;
- content =
- content +
- '\nif (!o2.xAction.RestActions.Action["' +
- name +
- '"]) o2.xAction.RestActions.Action["' +
- name +
- '"] = new Class({Extends: o2.xAction.RestActions.Action});';
- content =
- content +
- '\no2.Actions.actions["' +
- name +
- '"] = new o2.xAction.RestActions.Action["' +
- name +
- '"]("' +
- name +
- '", actionJson);';
- file.contents = new Buffer.from(content);
- this.push(file);
- cb();
- });
- }
- function concat_Style() {
- return through2.obj(function (file, enc, cb) {
- if (file.isNull()) {
- this.push(file);
- return cb();
- }
- if (file.isStream()) {
- this.emit(
- "error",
- new gutil.PluginError(PLUGIN_NAME, "Streaming not supported")
- );
- return cb();
- }
- var content = file.contents.toString();
- var name = file.path.replace(process.cwd(), "").replace(/\\/g, "/");
- name = ".." + name.substring(name.indexOf("/source") + 7);
- content =
- 'var csskey = encodeURIComponent("' +
- name +
- '");\no2.widget.css[csskey]=' +
- content;
- file.contents = new Buffer.from(content);
- this.push(file);
- cb();
- });
- }
- function build_concat_basework_style() {
- return gulp
- .src([
- "o2web/source/x_component_process_Work/$Main/default/css.wcss",
- "o2web/source/x_component_process_Xform/$Form/default/css.wcss",
- "o2web/source/o2_core/o2/widget/$Tab/mobileForm/css.wcss",
- "o2web/source/o2_core/o2/widget/$Menu/tab/css.wcss",
- "o2web/source/o2_core/o2/widget/$Tab/form/css.wcss",
- "o2web/source/x_component_process_Xform/$Form/default/doc.wcss",
- "o2web/source/o2_core/o2/widget/$Toolbar/documentEdit/css.wcss",
- "o2web/source/o2_core/o2/widget/$Toolbar/documentEdit_side/css.wcss",
- "o2web/source/x_component_process_Xform/$Form/default/css.wcss",
- ])
- .pipe(concat_Style())
- .pipe(concat("js/base_work_style_temp.js"))
- .pipe(gulp.dest("o2web/source/x_desktop/"));
- }
- function build_concat_basework_action() {
- return gulp
- .src([
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
- "o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
- "o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
- "o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
- "o2web/source/o2_core/o2/xAction/services/x_program_center.json",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.json",
- ])
- .pipe(concat_Actions())
- .pipe(concat("js/base_work_actions_temp.js"))
- .pipe(gulp.dest("o2web/source/x_desktop/"));
- }
- function build_concat_basework_clean(cb) {
- var dest = [
- "o2web/source/x_desktop/js/base_work_actions_temp.js",
- "o2web/source/x_desktop/js/base_work_style_temp.js",
- ];
- return del(dest, cb);
- }
- function build_concat_basework_body() {
- var src = [
- "o2web/source/x_desktop/js/base_concat_head.js",
- "o2web/source/o2_core/o2/lp/" + (options.lp || "zh-cn") + ".js",
- "o2web/source/x_desktop/js/base_work_style_temp.js",
- "o2web/source/o2_core/o2/widget/Common.js",
- "o2web/source/o2_core/o2/widget/Dialog.js",
- "o2web/source/o2_core/o2/widget/UUID.js",
- "o2web/source/o2_core/o2/widget/Menu.js",
- "o2web/source/o2_core/o2/widget/Toolbar.js",
- "o2web/source/o2_core/o2/xDesktop/Common.js",
- "o2web/source/o2_core/o2/xDesktop/Actions/RestActions.js",
- "o2web/source/o2_core/o2/xAction/RestActions.js",
- "o2web/source/o2_core/o2/xDesktop/Access.js",
- "o2web/source/o2_core/o2/xDesktop/Dialog.js",
- "o2web/source/o2_core/o2/xDesktop/Menu.js",
- "o2web/source/o2_core/o2/xDesktop/UserData.js",
- "o2web/source/x_component_Template/MPopupForm.js",
- "o2web/source/o2_core/o2/xDesktop/Authentication.js",
- "o2web/source/o2_core/o2/xDesktop/Dialog.js",
- "o2web/source/o2_core/o2/xDesktop/Window.js",
- "o2web/source/x_component_Common/Main.js",
- "o2web/source/o2_core/o2/lp/" + (options.lp || "zh-cn") + ".js",
- "o2web/source/x_component_process_Work/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_process_Xform/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_Selector/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_process_Work/Main.js",
- "o2web/source/x_component_Selector/package.js",
- "o2web/source/x_component_Selector/Person.js",
- "o2web/source/x_component_Selector/Identity.js",
- "o2web/source/x_component_Selector/Unit.js",
- "o2web/source/x_component_Selector/IdentityWidthDuty.js",
- "o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js",
- "o2web/source/x_component_Selector/UnitWithType.js",
- "o2web/source/o2_core/o2/xScript/Actions/UnitActions.js",
- "o2web/source/o2_core/o2/xScript/Actions/ScriptActions.js",
- "o2web/source/o2_core/o2/xScript/Actions/CMSScriptActions.js",
- "o2web/source/o2_core/o2/xScript/Actions/PortalScriptActions.js",
- "o2web/source/o2_core/o2/xScript/Environment.js",
- "o2web/source/x_component_Template/MTooltips.js",
- "o2web/source/x_component_Template/MSelector.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js",
- "o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.js",
- "o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.js",
- "o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.js",
- "o2web/source/x_desktop/js/base_work_actions_temp.js",
- "o2web/source/x_desktop/js/base.js",
- "o2web/source/x_desktop/js/base_loader.js",
- ];
- var dest = "target/o2server/servers/webServer/x_desktop/js/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- .pipe(concat("base_work.js"))
- .pipe(gulp.dest(dest))
- .pipe(concat("base_work.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- function build_concat_baseportal_style() {
- return gulp
- .src([
- "o2web/source/x_component_process_Work/$Main/default/css.wcss",
- "o2web/source/x_component_portal_Portal/$Main/default/css.wcss",
- "o2web/source/x_component_process_Xform/$Form/default/css.wcss",
- "o2web/source/o2_core/o2/widget/$Tab/mobileForm/css.wcss",
- "o2web/source/o2_core/o2/widget/$Menu/tab/css.wcss",
- ])
- .pipe(concat_Style())
- .pipe(concat("js/base_portal_style_temp.js"))
- .pipe(gulp.dest("o2web/source/x_desktop/"));
- }
- function build_concat_baseportal_action() {
- return gulp
- .src([
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
- "o2web/source/o2_core/o2/xAction/services/x_portal_assemble_surface.json",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
- "o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
- "o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
- "o2web/source/o2_core/o2/xAction/services/x_program_center.json",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.json",
- ])
- .pipe(concat_Actions())
- .pipe(concat("js/base_portal_actions_temp.js"))
- .pipe(gulp.dest("o2web/source/x_desktop/"));
- }
- function build_concat_baseportal_clean(cb) {
- var dest = [
- "o2web/source/x_desktop/js/base_portal_actions_temp.js",
- "o2web/source/x_desktop/js/base_portal_style_temp.js",
- ];
- return del(dest, cb);
- }
- function build_concat_baseportal_body() {
- var src = [
- "o2web/source/x_desktop/js/base_concat_head.js",
- "o2web/source/o2_core/o2/lp/" + (options.lp || "zh-cn") + ".js",
- "o2web/source/x_desktop/js/base_portal_style_temp.js",
- "o2web/source/o2_core/o2/widget/Common.js",
- "o2web/source/o2_core/o2/widget/Dialog.js",
- "o2web/source/o2_core/o2/widget/UUID.js",
- "o2web/source/o2_core/o2/widget/Menu.js",
- "o2web/source/o2_core/o2/widget/Toolbar.js",
- "o2web/source/o2_core/o2/xDesktop/Common.js",
- "o2web/source/o2_core/o2/xDesktop/Actions/RestActions.js",
- "o2web/source/o2_core/o2/xAction/RestActions.js",
- "o2web/source/o2_core/o2/xDesktop/Access.js",
- "o2web/source/o2_core/o2/xDesktop/Dialog.js",
- "o2web/source/o2_core/o2/xDesktop/Menu.js",
- "o2web/source/o2_core/o2/xDesktop/UserData.js",
- "o2web/source/x_component_Template/MPopupForm.js",
- "o2web/source/o2_core/o2/xDesktop/Authentication.js",
- "o2web/source/o2_core/o2/xDesktop/Window.js",
- "o2web/source/x_component_Common/Main.js",
- "o2web/source/x_component_process_Work/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_portal_Portal/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_process_Xform/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_Selector/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_portal_Portal/Main.js",
- "o2web/source/x_component_Selector/package.js",
- "o2web/source/x_component_Selector/Person.js",
- "o2web/source/x_component_Selector/Identity.js",
- "o2web/source/x_component_Selector/Unit.js",
- "o2web/source/x_component_Selector/IdentityWidthDuty.js",
- "o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js",
- "o2web/source/x_component_Selector/UnitWithType.js",
- "o2web/source/o2_core/o2/xScript/Actions/UnitActions.js",
- "o2web/source/o2_core/o2/xScript/Actions/ScriptActions.js",
- "o2web/source/o2_core/o2/xScript/Actions/CMSScriptActions.js",
- "o2web/source/o2_core/o2/xScript/Actions/PortalScriptActions.js",
- "o2web/source/o2_core/o2/xScript/PageEnvironment.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js",
- "o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.js",
- "o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.js",
- "o2web/source/x_desktop/js/base_portal_actions_temp.js",
- "o2web/source/x_desktop/js/base.js",
- "o2web/source/x_desktop/js/base_loader.js",
- ];
- var dest = "target/o2server/servers/webServer/x_desktop/js/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- .pipe(concat("base_portal.js"))
- .pipe(gulp.dest(dest))
- .pipe(concat("base_portal.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- function build_concat_basedocument_style() {
- return gulp
- .src([
- "o2web/source/x_component_cms_Document/$Main/default/css.wcss",
- "o2web/source/x_component_cms_Xform/$Form/default/css.wcss",
- "o2web/source/o2_core/o2/widget/$AttachmentController/default/css.wcss",
- ])
- .pipe(concat_Style())
- .pipe(concat("js/base_document_style_temp.js"))
- .pipe(gulp.dest("o2web/source/x_desktop/"));
- }
- function build_concat_basedocument_action() {
- return gulp
- .src([
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
- "o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
- "o2web/source/o2_core/o2/xAction/services/x_program_center.json",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.json",
- ])
- .pipe(concat_Actions())
- .pipe(concat("js/base_document_actions_temp.js"))
- .pipe(gulp.dest("o2web/source/x_desktop/"));
- }
- function build_concat_basedocument_clean(cb) {
- var dest = [
- "o2web/source/x_desktop/js/base_document_actions_temp.js",
- "o2web/source/x_desktop/js/base_document_style_temp.js",
- ];
- return del(dest, cb);
- }
- function build_concat_basedocument_body() {
- var src = [
- "o2web/source/x_desktop/js/base_concat_head.js",
- "o2web/source/o2_core/o2/lp/" + (options.lp || "zh-cn") + ".js",
- "o2web/source/x_desktop/js/base_document_style_temp.js",
- "o2web/source/o2_core/o2/widget/Common.js",
- "o2web/source/o2_core/o2/widget/Dialog.js",
- "o2web/source/o2_core/o2/widget/UUID.js",
- "o2web/source/o2_core/o2/widget/Menu.js",
- "o2web/source/o2_core/o2/widget/Mask.js",
- "o2web/source/o2_core/o2/xDesktop/Common.js",
- "o2web/source/o2_core/o2/xDesktop/Actions/RestActions.js",
- "o2web/source/o2_core/o2/xAction/RestActions.js",
- "o2web/source/o2_core/o2/xDesktop/Access.js",
- "o2web/source/o2_core/o2/xDesktop/Dialog.js",
- "o2web/source/o2_core/o2/xDesktop/Menu.js",
- "o2web/source/o2_core/o2/xDesktop/UserData.js",
- "o2web/source/x_component_Template/MPopupForm.js",
- "o2web/source/o2_core/o2/xDesktop/Authentication.js",
- "o2web/source/o2_core/o2/xDesktop/Window.js",
- "o2web/source/x_component_Common/Main.js",
- "o2web/source/x_component_cms_Document/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_process_Xform/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_Selector/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_cms_Xform/lp/" +
- (options.lp || "zh-cn") +
- ".js",
- "o2web/source/x_component_cms_Document/Main.js",
- "o2web/source/x_component_Selector/package.js",
- "o2web/source/o2_core/o2/xScript/Actions/UnitActions.js",
- "o2web/source/o2_core/o2/xScript/Actions/CMSScriptActions.js",
- "o2web/source/o2_core/o2/xScript/CMSEnvironment.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js",
- "o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.js",
- "o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.js",
- "o2web/source/x_desktop/js/base_document_actions_temp.js",
- "o2web/source/x_desktop/js/base.js",
- "o2web/source/x_desktop/js/base_loader.js",
- ];
- var dest = "target/o2server/servers/webServer/x_desktop/js/";
- return (
- gulp
- .src(src)
- .pipe(sourceMap.init())
- .pipe(concat("base_document.js"))
- .pipe(gulp.dest(dest))
- .pipe(concat("base_document.min.js"))
- .pipe(uglify())
- //.pipe(rename({ extname: '.min.js' }))
- .pipe(sourceMap.write(""))
- .pipe(gulp.dest(dest))
- );
- }
- exports.build_concat = gulp.parallel(
- build_concat_o2,
- build_concat_base,
- build_concat_desktop,
- build_concat_xform,
- build_concat_cms_xform,
- build_bundle,
- gulp.series(
- build_concat_basework_style,
- build_concat_basework_action,
- build_concat_basework_body,
- build_concat_basework_clean
- ),
- gulp.series(
- build_concat_baseportal_style,
- build_concat_baseportal_action,
- build_concat_baseportal_body,
- build_concat_baseportal_clean
- ),
- gulp.series(
- build_concat_basedocument_style,
- build_concat_basedocument_action,
- build_concat_basedocument_body,
- build_concat_basedocument_clean
- )
- );
- function getGitV() {
- var tagPromise = new Promise(function (s, f) {
- git.exec({ args: "describe --tag" }, function (err, stdout) {
- if (err) {
- f(err);
- }
- var v = stdout.substring(0, stdout.indexOf("-"));
- s(v);
- });
- });
- var revPromise = new Promise(function (s, f) {
- git.exec({ args: "rev-parse --short HEAD" }, function (err, hash) {
- if (err) {
- f(err);
- }
- s(hash.trim());
- });
- });
- return Promise.all([tagPromise, revPromise]);
- }
- function build_web_v_html() {
- var src = "o2web/source/x_desktop/*.html";
- var dest = "target/o2server/servers/webServer/x_desktop/";
- return getGitV().then(
- function (arr) {
- return gulp
- .src(src)
- .pipe(assetRev({ verConnecter: arr[0], md5: arr[1] }))
- .pipe(gulp.dest(dest))
- .pipe(gutil.noop());
- },
- function () {
- return gulp
- .src(src)
- .pipe(assetRev())
- .pipe(gulp.dest(dest))
- .pipe(gutil.noop());
- }
- );
- }
- function build_web_api() {
- var src = "o2web/api/**/*";
- var dest = "target/o2server/servers/webServer/api/";
- return gulp.src(src).pipe(gulp.dest(dest));
- }
- function build_doc() {
- return getGitV().then(
- function (arr) {
- return shell.task(
- "jsdoc -c o2web/jsdoc.conf.json -q version=" +
- arr[0] +
- "-" +
- arr[1] +
- ""
- )();
- },
- function () {
- return shell.task("jsdoc -c o2web/jsdoc.conf.json -q version=")();
- }
- );
- }
- exports.build_api = gulp.series(build_doc, build_web_api);
- function build_web_v_o2() {
- var src = [
- "target/o2server/servers/webServer/o2_core/o2.js",
- "target/o2server/servers/webServer/o2_core/o2.min.js",
- ];
- var dest = "target/o2server/servers/webServer/o2_core/";
- return getGitV().then(
- function (arr) {
- return (
- gulp
- .src(src)
- .pipe(
- assetRev({
- verConnecter: arr[0],
- md5: arr[1],
- replace: true,
- })
- )
- //.pipe(gulp.dest(dest))
- // .pipe(uglify())
- // .pipe(rename({ extname: '.min.js' }))
- // .pipe(gulp.dest(dest))
- .pipe(gutil.noop())
- );
- },
- function () {
- return gulp.src(src).pipe(assetRev()).pipe(gutil.noop());
- }
- );
- }
- function clear_build(cb) {
- console.log(`---------------------------------------------------------------------
- . clear old build ...
- ---------------------------------------------------------------------`);
- var dest = "target";
- del(dest, { force: true });
- cb();
- }
- function clear_deploy(cb) {
- console.log(`---------------------------------------------------------------------
- . clear old deploy ...
- ---------------------------------------------------------------------`);
- var dest = [
- "target/o2server/store/",
- "target/o2server/commons/",
- "target/o2server/jvm/",
- "target/o2server/configSample/",
- "target/o2server/localSample/",
- "target/o2server/servers/",
- ];
- dest = dest.concat([
- "target/o2server/*.sh",
- "target/o2server/*.jar",
- "target/o2server/*.html",
- "target/o2server/*.bat",
- "target/o2server/version.o2",
- ]);
- del(dest, { force: true });
- cb();
- }
- exports.clear_build = clear_build;
- exports.clear_deploy = clear_deploy;
- function deploy_server() {
- console.log(`---------------------------------------------------------------------
- . deploy to target ...
- ---------------------------------------------------------------------`);
- var source = [
- "o2server/*store/**/*",
- "o2server/*commons/**/*",
- "o2server/*jvm/**/*",
- "o2server/*configSample/**/*",
- "o2server/*localSample/**/*",
- ];
- source = source.concat(scriptSource);
- console.log(source);
- var dest = "target/o2server/";
- var entries = fg.sync(source, { dot: false });
- var size = entries.length;
- var pb = new ProgressBar("", 50);
- var doCount = 0;
- var stream = gulp.src(source);
- stream.on("end", () => {
- console.log();
- });
- return stream.pipe(gulp.dest(dest)).pipe(
- logger(function () {
- doCount++;
- if (doCount <= size) {
- pb.render({ completed: doCount, total: size, count: doCount });
- }
- })
- );
- }
- exports.preperation = gulp.series(
- download_commons_and_jvm,
- decompress_commons_and_jvm,
- move_commons,
- move_jvm,
- clear_commons_git,
- clear_jvm_git
- );
- var shell = require("gulp-shell");
- const { dir } = require("console");
- exports.build_server = function () {
- console.log(`---------------------------------------------------------------------
- . Start compiling the server ...
- ---------------------------------------------------------------------`);
- return shell.task("npm run build_server_script")();
- };
- function chmod_jvm() {
- return shell.task("chmod 777 -R target/o2server/jvm")();
- }
- function chmod_commons() {
- return shell.task("chmod 777 -R target/o2server/commons")();
- }
- function chmod_sh() {
- return shell.task("chmod 777 target/o2server/*.sh")();
- }
- function chmod_servers() {
- return shell.task("chmod 777 -R target/o2server/servers")();
- }
- exports.build_web = gulp.series(
- build_web_minimize,
- build_web_move,
- gulp.parallel(
- build_concat_o2,
- build_concat_base,
- build_concat_desktop,
- build_concat_xform,
- build_concat_cms_xform,
- gulp.series(
- build_concat_basework_style,
- build_concat_basework_action,
- build_concat_basework_body,
- build_concat_basework_clean
- ),
- gulp.series(
- build_concat_baseportal_style,
- build_concat_baseportal_action,
- build_concat_baseportal_body,
- build_concat_baseportal_clean
- ),
- gulp.series(
- build_concat_basedocument_style,
- build_concat_basedocument_action,
- build_concat_basedocument_body,
- build_concat_basedocument_clean
- ),
- build_bundle
- ),
- build_web_v_html,
- build_web_v_o2,
- gulp.series(build_doc, build_web_api)
- );
- if (os.platform().indexOf("win") == -1) {
- exports.deploy = gulp.series(
- deploy_server,
- chmod_jvm,
- chmod_commons,
- chmod_sh,
- chmod_servers
- );
- } else {
- exports.deploy = gulp.series(deploy_server);
- }
- function make_def_config(cb) {
- fs.readdirSync(path.resolve(__dirname, "config")).forEach((child) => {
- if (/.+\.json/.test(child)) {
- fs.copyFileSync(
- path.resolve(__dirname, "config", child),
- path.resolve(
- __dirname,
- "target",
- "o2server",
- "config",
- child
- )
- );
- }
- });
- let manifest = fs
- .readFileSync(
- path.resolve(
- __dirname,
- "target",
- "o2server",
- "commons",
- "ext",
- "manifest.cfg"
- )
- )
- .toString();
- fs.readdirSync(path.resolve(__dirname, "jar")).forEach((child) => {
- if (/^.+\.jar$/i.test(child)) {
- fs.copyFileSync(
- path.resolve(__dirname, "jar", child),
- path.resolve(
- __dirname,
- "target",
- "o2server",
- "commons",
- "ext",
- child
- )
- );
- if (!manifest.includes(child)) {
- manifest += "\n" + child;
- }
- }
- });
- fs.writeFileSync(
- path.resolve(
- __dirname,
- "target",
- "o2server",
- "commons",
- "ext",
- "manifest.cfg"
- ),
- manifest
- );
- cb();
- }
- exports.make_def_config = gulp.series(make_def_config);
|