Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 4K

SteadyHua/O2OA

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (4)
Tags (86)
master
develop
master_java8
develop_java8
7.1.4
develop-7.2
7.1.3
7.1.2
7.1.1
7.1.0
7.0.5
7.0.4
7.0.3
7.0.2
7.0.1
7.0.0
develop-7.1
develop-7.0
6.4.7
6.4.6
6.4.5
6.4.4
6.4.3
6.4.2
master
Branches (4)
Tags (86)
master
develop
master_java8
develop_java8
7.1.4
develop-7.2
7.1.3
7.1.2
7.1.1
7.1.0
7.0.5
7.0.4
7.0.3
7.0.2
7.0.1
7.0.0
develop-7.1
develop-7.0
6.4.7
6.4.6
6.4.5
6.4.4
6.4.3
6.4.2
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (4)
Tags (86)
master
develop
master_java8
develop_java8
7.1.4
develop-7.2
7.1.3
7.1.2
7.1.1
7.1.0
7.0.5
7.0.4
7.0.3
7.0.2
7.0.1
7.0.0
develop-7.1
develop-7.0
6.4.7
6.4.6
6.4.5
6.4.4
6.4.3
6.4.2
O2OA
/
gulpfile.js
O2OA
/
gulpfile.js
gulpfile.js 51.39 KB
Copy Edit Raw Blame History
tommy authored 2022年05月13日 17:45 +08:00 . 打包vue或react组件时,先进行npm install
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288
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');
const ora = require('ora');
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 supportedLanguage = ["zh-cn", "en"];
var downloadHost = "git.o2oa.net";
var protocol = "https";
var commonUrl = "/o2oa/evn-o2server-commons/-/archive/7.0/evn-o2server-commons-7.0.tar.gz?path=commons";
var jvmUrls = {
"all": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm",
"linux_java11": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/linux_java11",
"aix_java11": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/aix_java11",
"arm_java11": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/arm_java11",
"macos_java11": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/macos_java11",
"risc_java11": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/risc_java11",
"mips_java11": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/mips_java11",
"raspi_java11": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/raspi_java11",
"windows_java11": "/o2oa/evn-o2server-jvm/-/archive/master/evn-o2server-jvm-master.tar.gz?path=jvm/windows_java11"
};
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"],
"mips": ["o2server/*mips*", "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", "w", "m", "d"]
});
var options = {};
options.ev = o_options.e || "all";
options.lp = o_options.lp || "zh-cn";
options.webSite = o_options.w || "https://www.o2oa.net";
options.mirrorSite = o_options.m || "http://mirror1.o2oa.net";
options.downloadSite = o_options.d || "https://download.o2oa.net";
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}`;
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 {
downloadFile(path, filename, headcb, progresscb, cb)
//gutil.log(gutil.colors.red("download error"), ":", gutil.colors.red(filename), "statusCode:"+res.statusCode);
}
})
req.on('error', (e) => {
downloadFile(path, filename, headcb, progresscb, cb)
//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}`;
const spinner = ora({
'prefixText': 'Downloading '+filename+' ...',
'spinner': {
interval: 80, // Optional
frames: ['','','','','','','','','','']
}
}).start();
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!");
spinner.stop();
spinner.succeed(filename + ' Downloaded!');
cb();
});
stream.on('error', (err) => {
gutil.log(gutil.colors.red("download error"), ":", gutil.colors.red(filename), err);
});
request.get(options).pipe(stream);
}
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_progress(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_progress(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/tmp',
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/tmp',
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/tmp/evn-o2server-commons-7.0-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/tmp/evn-o2server-jvm-master-jvm/jvm/**/*"
}else{
path = "o2server/tmp/evn-o2server-jvm-master-jvm-"+options.ev+"/jvm/**/*"
}
return gulp.src(path)
.pipe(gulp.dest("o2server/jvm/"));
}
async function clear_commons_git(cb) {
var dest = ['o2server/tmp/evn-o2server-commons-7.0-commons/', 'o2server/commons_git.tar.gz'];
await del(dest, {force: true});
cb();
}
async function clear_jvm_git(cb){
//var path;
// if (options.ev=="all"){
// path = "o2server/tmp/evn-o2server-jvm-master-jvm/"
// }else{
// path = "o2server/tmp/evn-o2server-jvm-master-jvm-"+options.ev+"/"
// }
await del(['o2server/tmp/', 'o2server/jvm_git.tar.gz'], { force: true });
cb();
}
var moduleFolder = [];
async function build_web_module() {
var dest = 'target/o2server/servers/webServer/';
var srcPath = 'o2web/source';
const fp = fs.promises;
return fp.readdir(srcPath).then((files)=>{
let statP = [];
files.forEach((file) => {
let p = path.resolve(srcPath, file)
statP.push(fp.stat(p).then((s)=>{
if (s.isDirectory()){
var pkgPath = path.resolve(srcPath, p, 'package.json');
if (fs.existsSync(pkgPath)){
var pkg = require(pkgPath);
if (pkg.scripts['o2-build']){
moduleFolder.push(file);
}
}
}
}));
});
const shelljs = require('shelljs');
return Promise.all(statP).then(()=>{
// var tasks = [];
moduleFolder.forEach((f)=>{
shelljs.config.verbose = true;
shelljs.exec('npm install && npm run o2-build', {cwd: path.resolve(srcPath, f)});
});
});
});
}
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/**/*'];
moduleFolder.forEach((f)=>{
src_min.push('!o2web/source/'+f+'/**/*');
})
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/**'];
moduleFolder.forEach((f)=>{
src_move.push('!o2web/source/'+f+'/**/*');
})
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_core/polyfill.js',
'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, {sourcemaps: true})
//.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, {sourcemaps: '.'}))
}
function build_concat_base(){
var src = [
'o2web/source/x_desktop/js/base.js',
'o2web/source/o2_core/o2/xScript/PageEnvironment.js',
'o2web/source/o2_core/o2/framework.js',
'o2web/source/x_desktop/js/base_loader.js'
];
var dest = 'target/o2server/servers/webServer/x_desktop/js/';
return gulp.src(src, {sourcemaps: true})
//.pipe(sourceMap.init())
.pipe(concat('base.js'))
.pipe(gulp.dest(dest))
.pipe(concat('base.min.js'))
.pipe(uglify())
//.pipe(rename({ extname: '.min.js' }))
//.pipe(sourceMap.write(""))
.pipe(gulp.dest(dest, {sourcemaps: '.'}));
}
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, {sourcemaps: true})
//.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, {sourcemaps: '.'}))
}
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 + '/Documenteditor.js ',
'!o2web/source/' + path + '/Office.js'
];
var dest = 'target/o2server/servers/webServer/'+path+'/';
return gulp.src(src, {sourcemaps: true})
//.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, {sourcemaps: '.'}))
}
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, {sourcemaps: true})
//.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, {sourcemaps: '.'}))
}
function build_bundle(){
let path = "o2_core";
var src = [
'o2web/source/o2_core/polyfill.js',
'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/xScript/PageEnvironment.js',
"o2web/source/o2_core/o2/framework.js"
];
var dest = 'target/o2server/servers/webServer/'+path+'/';
return gulp.src(src, {sourcemaps: true})
//.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, {sourcemaps: '.'}))
}
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_lp(cb) {
var lpTasks = [];
supportedLanguage.forEach(function(lp){
var src = [
'o2web/source/o2_core/o2/lp/'+(lp)+'.js',
'o2web/source/x_component_process_Work/lp/'+(lp)+'.js',
'o2web/source/x_component_process_Xform/lp/'+(lp)+'.js',
'o2web/source/x_component_Selector/lp/'+(lp)+'.js',
'o2web/source/x_component_Template/lp/'+(lp)+'.js',
'o2web/source/x_component_portal_Portal/lp/'+(lp)+'.js',
'o2web/source/x_component_cms_Document/lp/'+(lp)+'.js',
'o2web/source/x_component_cms_Xform/lp/'+(lp)+'.js',
];
var dest = 'target/o2server/servers/webServer/x_desktop/js/';
// lpTasks["build_concat_lp_"+lp] = function(){
// return
// };
var stream = gulp.src(src, {"allowEmpty": true, sourcemaps: true});
lpTasks.push(new Promise((resolve)=>{
stream.on("end", ()=>{ resolve(); });
}));
//.pipe(sourceMap.init())
stream.pipe(concat('base_lp_' + lp + '.js'))
.pipe(gulp.dest(dest))
.pipe(concat('base_lp_' + lp + '.min.js'))
.pipe(uglify())
//.pipe(rename({ extname: '.min.js' }))
// .pipe(sourceMap.write(""))
.pipe(gulp.dest(dest, {sourcemaps: '.' }));
});
return Promise.all(lpTasks);
//var build_concat_lp = gulp.parallel( Object.values(lpTasks) );
// return gulp.parallel(lpTasks);
}
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, {sourcemaps: true})
//.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, {sourcemaps: '.'}));
}
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_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_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_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_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, {sourcemaps: true})
//.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, {sourcemaps: '.'}));
}
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, {sourcemaps: true})
//.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, {sourcemaps: '.'}));
}
exports.build_concat = gulp.parallel(
build_concat_o2,
build_concat_base,
build_concat_desktop,
build_concat_xform,
build_concat_cms_xform,
build_bundle,
build_concat_lp,
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.lastIndexOf("-"));
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());
});
}
async function clear_build(cb) {
console.log(`---------------------------------------------------------------------
. clear old build ...
---------------------------------------------------------------------`);
var dest = 'target';
await del(dest, {force: true});
cb();
}
async 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"]);
await 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);
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 shelljs = require("shelljs");
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_module,
build_web_minimize,
build_web_move,
gulp.parallel(
build_concat_o2,
build_concat_base,
build_concat_desktop,
build_concat_xform,
build_concat_cms_xform,
build_concat_lp,
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 createHistoryJsonFile(url, fileName, host){
const fp = fs.promises;
return new Promise(function(resolve){
request.get({'url': url}, function(error, response, body) {
if (!error && response.statusCode == 200) {
const historyJsons = JSON.parse(body);
fp.readFile(path.resolve(process.cwd(), 'download-pro.json'), 'utf8').then(function(str){
const downloadJson = JSON.parse(str);
downloadJson.windows.url = host+downloadJson.windows.url;
downloadJson.linux.url = host+downloadJson.linux.url
downloadJson.macos.url = host+downloadJson.macos.url
downloadJson.aix.url = host+downloadJson.aix.url
downloadJson.raspi.url = host+downloadJson.raspi.url
downloadJson.mips.url = host+downloadJson.mips.url
downloadJson.arm.url = host+downloadJson.arm.url
let append = true;
for (var i=0; i<historyJsons.length; i++){
var o = historyJsons[i];
if (o.title == downloadJson.title){
historyJsons.splice(i, 1, downloadJson)
append = false;
break;
}
}
if (append){
historyJsons.unshift(downloadJson);
}
const jsonStr = JSON.stringify(historyJsons, null, '\t');
fp.writeFile(path.resolve(process.cwd(), fileName), jsonStr).then(()=>{resolve();});
});
}
});
});
}
async function createHistroyJson(cb) {
const host = options.webSite;
const mirrorHost = options.mirrorSite;
const downloadHost = options.downloadSite
if (host) {
const url = host + "/webSite/history.json?t=" + (new Date()).getTime();
const mirrorUrl = mirrorHost + "/download/download-history.json?t=" + (new Date()).getTime();
var doneWebSite = false;
var doneMirror = false;
var check = function () {
if (doneWebSite && doneMirror) cb();
};
await createHistoryJsonFile(url, 'history.json', downloadHost);
await createHistoryJsonFile(mirrorUrl, 'download-history.json', mirrorHost);
}
cb();
}
exports.build_historyJson = createHistroyJson;
// /exports.build_module = build_web_module;
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

开源OA系统 - 码云GVP|Java开源oa|企业OA办公平台|企业OA|协同办公OA|流程平台OA|O2OA|OA,支持国产麒麟操作系统和国产数据库(达梦、人大金仓),政务OA,军工信息化OA
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/Murderers/O2OA.git
git@gitee.com:Murderers/O2OA.git
Murderers
O2OA
O2OA
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /