-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbee.xml
executable file
·679 lines (652 loc) · 23.3 KB
/
bee.xml
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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE bee PUBLIC "-//Dmitriy Rogatkin//DTD Bee Project Builder 1.0//EN"
"https://raw.githubusercontent.com/drogatkin/7Bee/master/bee.dtd" [
<!ENTITY version "1.1.5">
<!ENTITY deploy_host "knitknot.info">
<!ENTITY env SYSTEM "./env.xml">
<!ENTITY maxmem "756">
]>
<!-- a multipurpose script used for Bee project
Copyright (c) 2004, 2023 Dmitriy Rogatkin -->
<bee name="bee" type="project">
&env;
<echo options="-E">Bee project building...</echo>
<expression variable="javac">
<operator name="append">
<value variable="JAVA_HOME"/>
<value>/bin/javac</value>
</operator>
</expression>
<target name="check lib" dir="BEE_HOME" comment="Check and create build output directory as needed">
<dependency>
<expression>
<operator name="eq">
<function name ="timestamp">
<parameter value="lib"/>
</function>
<value></value>
</operator>
</expression>
</dependency>
<block>
<function name="mkd">
<parameter value="lib"/>
</function>
</block>
</target>
<expression name="jdepend_lib">
<operator name="append">
<value variable="JDEPEND_HOME"/>
<value>/lib</value>
</operator>
</expression>
<target name="check lib jdepend" dir="BEE_HOME" comment="Check and create build output directory for JDepend">
<dependency>
<expression>
<operator name="eq">
<function name ="timestamp">
<parameter variable="jdepend_lib"/>
</function>
<value></value>
</operator>
</expression>
</dependency>
<block>
<echo>Creating jdepend lib</echo>
<function name="mkd">
<parameter variable="jdepend_lib"/>
</function>
</block>
</target>
<target name="Build Date" dir="BEE_HOME">
<block>
<function name="write">
<parameter value="src/java/org/bee/CompileStamp.java" type="file"/>
<parameter>package org.bee;
public class CompileStamp {
public static final String getStamp() {
return "</parameter>
<parameter>
<function name="now"/>
</parameter>
<parameter>";
}
}</parameter>
</function>
</block>
</target>
<expression variable="cp">
<operator name="append">
<value>lib</value>
<value variable="PATH SEPARATOR"/>
<value variable="JDEPEND_HOME"/>
<value>/lib</value>
<value variable="PATH SEPARATOR"/>
<value variable="JSCH_LIB"/>
</operator>
</expression>
<expression name="jdepend_java">
<operator name="append">
<value variable="JDEPEND_HOME"/>
<value>/src/java/.java</value>
</operator>
</expression>
<expression name="jdepend_class">
<operator name="append">
<value variable="jdepend_lib"/>
<value>/.class</value>
</operator>
</expression>
<expression variable="jdepend sources">
<function name="newerwithdependency">
<parameter variable="jdepend_java" type="path"/>
<parameter variable="jdepend_class" type="path"/>
<parameter/>
<parameter value="jdepend"/>
</function>
</expression>
<target
name="compile_jdepend"
dir="BEE_HOME" >
<dependency target="check lib jdepend" />
<dependency variable="jdepend sources" />
<echo>
Compiling jdepend...
</echo>
<task exec="javac" >
<parameter value="-classpath"/>
<parameter variable="3rdparty/jdepend/lib"/>
<parameter value="-source" />
<parameter variable="jdk ver" />
<parameter value="-target" />
<parameter variable="jdk ver" />
<parameter value="-d" />
<parameter variable="jdepend_lib" />
<parameter variable="jdepend sources" />
<onexit>
<if>
<expression>
<operator name="neq" >
<value variable="resultcode" />
<value>0</value>
</operator>
</expression>
<block type="then" >
<echo>
Error(s) at compilation jdepend
</echo>
<function name="stop" >
<parameter value="1" />
</function>
</block>
</if>
</onexit>
<onexception>
<block>
<echo>
Exception at compilation
</echo>
<function name="stop" >
<parameter value="-1" />
</function>
</block>
</onexception>
</task>
</target>
<target name="compile" dir="BEE_HOME">
<dependency target="check lib"/>
<dependency target="Build Date"/>
<dependency target="compile_jdepend"/>
<dependency>
<function name="allnewer">
<parameter value="bee.xml" type="file"/>
<parameter value="src/java/" type="dir"/>
</function>
</dependency>
<task exec="javac">
<parameter value="-classpath"/>
<parameter variable="cp"/>
<parameter value="-d"/>
<parameter value="lib" type="dir"/>
<parameter value="-source"/>
<parameter variable="jdk ver"/>
<parameter value="-target"/>
<parameter variable="jdk ver"/>
<!--parameter>-bootclasspath</parameter>
<parameter variable="Java5 Runtime"/-->
<parameter>-Xlint:unchecked</parameter>
<parameter value="-sourcepath"/>
<parameter value="src/java" type="dir"/>
<parameter>
<!--operator name="exclude"-->
<function name="newerthan">
<parameter value="src/java/.java" type="dir"/>
<parameter value="lib/.class" type="dir"/>
</function>
<!--value>.*askpass.*</value>
</operator-->
</parameter>
<onexit>
<if>
<expression>
<operator name="neq"><value variable="resultcode"/><value>0</value></operator>
</expression>
<block type="then">
<echo>Error(s) at compilation</echo>
<function name="stop">
<parameter value="1"/>
</function>
</block>
</if>
</onexit>
</task>
</target>
<expression variable="depend lib">
<operator name="append">
<value variable="JDEPEND_HOME"/>
<value>/lib</value>
</operator>
</expression>
<target name="clean" dir="BEE_HOME">
<dependency>
<expression>
<operator name="eq">
<value>y</value>
<function name="ask">
<parameter value="Are you sure [n]?"/>
<parameter value="n"/>
</function>
</operator>
</expression>
</dependency>
<block>
<echo>Cleaning...</echo>
<function name="rm">
<parameter value="lib/*/*/*/*.class" type="dir"/>
<parameter value="lib/bee.jar" type="dir"/>
<parameter value="deploy/*/*/*/*" type="dir"/>
<parameter value="3rdparty/jdepend/lib/*/*/*/*.class" type="dir"/>
</function>
</block>
</target>
<!-- cscript /Nologo jver.vbs
to get some registry props -->
<target name="install" dir="BEE_HOME">
<block>
<if>
<expression>
<function name="match">
<parameter>.*Windows.*</parameter>
<parameter name="os.name" type="property"/>
</function>
</expression>
<block type="then">
<echo>Installing on Windows...</echo>
<if>
<expression>
<function name="match">
<parameter>.*(Vista|Windows 8|Windows 7|Windows 10).*</parameter>
<parameter name="os.name" type="property"/>
</function>
</expression>
<block type="then">
<if>
<expression>
<function name="match">
<parameter>Administrator</parameter>
<parameter name="user.name" type="property"/>
</function>
</expression>
<else>
<echo name="user.name" type="property"/>
<echo>Make sure that you run this script as an administrator when install in the standard location</echo>
</else>
</if>
</block>
</if>
<expression variable="install directory">
<operator name="append">
<value variable="ProgramFiles"/>
</operator>
</expression>
<expression variable="install prompt">
<operator name="append">
<value>Specify directory to installation to [</value>
<value variable="install directory"/>
<value>]?</value>
</operator>
</expression>
<expression variable="install directory">
<function name="ask">
<parameter variable="install prompt"/>
<parameter variable="install directory"/>
</function>
</expression>
<expression name="script name">
<function name="ask">
<parameter>Specify starting script name [bee]? </parameter>
<parameter>bee</parameter>
</function>
</expression>
<expression variable="tools jar">
<operator name="append">
<value variable="JAVA_HOME"/>
<value>\lib</value>
<value>\tools.jar</value>
</operator>
</expression>
<expression variable="bee bin">
<operator name="append">
<value variable="install directory"/>
<value>\bee</value>
<value>\bin\</value>
<value variable="script name"/>
<value>.bat</value>
</operator>
</expression>
<expression variable="bee lib">
<operator name="append">
<value variable="install directory"/>
<value>\bee</value>
<value>\lib\*</value>
</operator>
</expression>
<function name="cp">
<parameter value="lib\bee.jar"/>
<parameter variable="bee lib"/>
<parameter value="3rdparty\jsch\lib\jsch-0.1.55.jar"/>
<parameter variable="bee lib"/>
</function>
<if>
<expression>
<function name="timestamp">
<parameter variable="tools jar"/>
</function>
</expression>
<else>
<expression name="java home prompt">
<operator name="append">
<value>Provide JDK Home path [</value>
<value variable="JAVA_HOME"/>
<value>]? </value>
</operator>
</expression>
<expression variable="JAVA_HOME">
<function name="ask">
<parameter variable="java home prompt"/>
<parameter variable="JAVA_HOME"/>
</function>
</expression>
</else>
</if>
<function name="write">
<parameter variable="bee bin" type="file"/>
<parameter>@echo off
set JAVA_HOME=</parameter>
<parameter variable="JAVA_HOME"/>
<parameter>
set BEE_HOME=</parameter>
<parameter variable="install directory"/>
<parameter>\bee
set DEFAULT_BEE_HOME=.
if "%BEE_HOME%"=="" set BEE_HOME=%DEFAULT_BEE_HOME%
"%JAVA_HOME%\bin\java" "-DJAVA_HOME=%JAVA_HOME%" -Xmx&maxmem;000000 -jar "%BEE_HOME%\lib\bee.jar" %*</parameter>
</function>
<expression variable="install note">
<operator name="append">
<value>Installation successful. Do not forget to add </value>
<value variable="install directory"/>
<value>\bee\bin in path.
Java home directory: </value>
<value variable="JAVA_HOME"/>
</operator>
</expression>
<echo variable="install note"/>
</block>
<block type="else">
<echo value="(L)Unix installation"/>
<if>
<expression>
<operator name="neq">
<value>root</value>
<value name="user.name" type="property"/>
</operator>
</expression>
<block type="then">
<echo>Please login as 'root'; change to 'root' using su, and then ./install; or sudo ./install for installation.</echo>
</block>
<block type ="else">
<variable name="empty str">
</variable>
<expression variable="bee lib">
<operator name="append">
<value value="/usr/local"/>
<value>/bee</value>
<value>/lib/*</value>
</operator>
</expression>
<function name="cp">
<parameter value="./lib/bee.jar"/>
<parameter variable="bee lib"/>
<parameter value="./3rdparty/jsch/lib/jsch-0.1.55.jar"/>
<parameter variable="bee lib"/>
</function>
<expression name="script name">
<function name="ask">
<parameter>Provide 7Bee start script name[bee]? </parameter>
<parameter>bee</parameter>
</function>
</expression>
<expression name="bin script name">
<operator name="append">
<value>/usr/local/bin/</value>
<value variable="script name"/>
</operator>
</expression>
<expression name="JAVA_11"/>
<expression name="PREVIEW"/>
<if>
<expression>
<operator name="or">
<operator name="lt">
<value>10</value>
<value name="java.specification.version" type="property"/>
</operator>
<operator name="lt">
<value name="java.specification.version" type="property"/>
<value>17</value>
</operator>
</operator>
</expression>
<then>
<variable name="JAVA_11"></variable>
</then>
<else>
<variable name="JAVA_11"> --illegal-access=warn</variable>
</else>
</if>
<if>
<expression>
<operator name="lt">
<value>20</value>
<value name="java.specification.version" type="property"/>
</operator>
</expression>
<then>
<variable name="PREVIEW"> --enable-preview </variable>
</then>
<else>
<variable name="PREVIEW"></variable>
</else>
</if>
<function name="write">
<parameter variable="bin script name" type="file"/>
<parameter>#! /bin/sh
JAVA_HOME=</parameter>
<parameter variable="JAVA_HOME"/>
<parameter>
BEE_HOME=/usr/local/bee
$JAVA_HOME/bin/java -Xmx&maxmem;m</parameter>
<parameter variable="JAVA_11"/>
<parameter variable="PREVIEW"/>
<parameter> -jar $BEE_HOME/lib/bee.jar "$@"</parameter>
</function>
<task exec="chmod" dir="./" stdin="empty str">
<parameter>755</parameter>
<parameter variable="bin script name" type="file"/>
</task>
<echo>Unix installation successful.</echo>
</block>
</if>
</block>
</if>
</block>
</target>
<target name="deploy" dir="BEE_HOME">
<dependency target="jar"/>
<block>
<if>
<expression>
<operator name="eq">
<function name ="timestamp">
<parameter value="deploy"/>
</function>
<value></value>
</operator>
</expression>
<block type="then">
<task exec="mkdir">
<parameter value="deploy"/>
</task>
</block>
</if>
<function name="cp">
<parameter value="bin/install"/>
<parameter value="deploy/"/>
<parameter value="bin/install.bat"/>
<parameter value="deploy/"/>
<parameter value="bee.dtd"/>
<parameter value="deploy/doc/*"/>
<parameter value="doc/bee.properties"/>
<parameter value="deploy/doc/*"/>
<parameter value="doc/readme"/>
<parameter value="deploy/"/>
<parameter value="doc/index-bee.html"/>
<parameter value="deploy/index.html"/>
<parameter value="bee.xml"/>
<parameter value="deploy/"/>
<parameter value="env.xml"/>
<parameter value="deploy/"/>
<parameter value="manifest.mf"/>
<parameter value="deploy/"/>
<parameter value="src/*/*/*/*/*.java"/>
<parameter value="deploy/src/*"/>
<parameter value="lib/bee.jar"/>
<parameter value="deploy/lib/*"/>
<parameter value="lib/bee.jar"/>
<parameter value="deploy/lib/bee-bootstrap.jar"/>
<parameter value="doc/alt-grammar.bgr"/>
<parameter value="deploy/examples/grammar/*"/>
<parameter variable="JSCH_LIB"/>
<parameter value="deploy/lib/"/>
</function>
<task name="jar dependencies" code="sun.tools.jar.Main" tool="jar">
<parameter value="-cf"/>
<parameter value="deploy/dependency.zip" type="file"/>
<parameter value="-C"/>
<parameter variable="JDEPEND_HOME"/>
<parameter value="."/>
</task>
<!-- deploy examples -->
<variable name="example source"/>
<variable name="example dest"/>
<for variable="example" in="AddressBook arbat ChatHouse dependency MediaChest mindterm servletapi jspapi gnujsp SpamProtector tjws generic Lab jacorb finesearch jasper lame">
<expression variable="example source">
<operator name="append">
<value>examples/</value>
<value variable="example"/>
<value>/*.xml</value>
</operator>
</expression>
<expression variable="example dest">
<operator name="append">
<value>deploy/examples/</value>
<value variable="example"/>
<value>/*</value>
</operator>
</expression>
<expression>
<function name="cp">
<parameter variable="example source"/>
<parameter variable="example dest"/>
</function>
</expression>
</for>
<task name="deployment zip" code="sun.tools.jar.Main" tool="jar">
<parameter value="-cf"/>
<parameter value="bee-&version;.zip" type="file"/>
<parameter value="-C"/>
<parameter variable="BEE_HOME"/>
<parameter value="deploy"/>
</task>
<if>
<expression>
<operator name="eq">
<function name="ask">
<parameter>Do you want to upload a new version to server?[n]</parameter>
<parameter>n</parameter>
</function>
<value>y</value>
</operator>
</expression>
<block type="then" name="upload to server">
<function name="scp">
<parameter value="bee-&version;.zip"/>
<parameter value="dmitriy@&deploy_host;:services/doc/download/bee-&version;.zip"/>
</function>
</block>
</if>
</block>
</target>
<variable name="WEBBEE_HOME" type="path">../Webbee</variable>
<expression name="WEBBEE_VIEWS">
<operator name="append">
<value variable="WEBBEE_HOME"/>
<value>/src/res/template/*.htmt</value>
</operator>
</expression>
<variable name="WEBFOLDER WAR" type="path">../webfolder/bin/webfolder.war</variable>
<target name="new" dir="BEE_HOME">
<dependency target="jar"/>
<block>
<expression name="result">
<function name="anynewer">
<parameter variable="WEBBEE_VIEWS"/>
<parameter variable="WEBFOLDER WAR" type="path"/>
</function>
</expression>
<echo variable="result"/>
</block>
</target>
<target name="calc" dir="BEE_HOME">
<block>
<expression name="result">
<function name="calc">
<parameter>3</parameter>
<parameter>+</parameter>
<parameter>5</parameter>
<parameter>+</parameter>
<parameter>6</parameter>
<parameter>*</parameter>
<parameter>7</parameter>
<parameter>*</parameter>
<parameter>8</parameter>
<parameter>+</parameter>
<parameter>5</parameter>
<parameter>/</parameter>
<parameter>4</parameter>
<parameter>+</parameter>
<parameter>sin</parameter>
<parameter>1.57</parameter>
<parameter>+</parameter>
<parameter>(</parameter>
<parameter>2</parameter>
<parameter>+</parameter>
<parameter>5</parameter>
<parameter>)</parameter>
<parameter>*</parameter>
<parameter>10</parameter>
<parameter>*</parameter>
<parameter>cos</parameter>
<parameter>3.14</parameter>
<parameter>*</parameter><parameter>1</parameter>
</function>
</expression>
<echo variable="result"/>
</block>
</target>
<target name="jar" dir="BEE_HOME">
<dependency target="compile"/>
<dependency>
<function name="allnewer">
<parameter value="lib" type="dir"/>
<parameter value="lib/bee.jar" type="file"/>
</function>
</dependency>
<dependency>true</dependency>
<task name="jar_do" code="sun.tools.jar.Main" tool="jar">
<parameter value="-cmf"/>
<parameter value="manifest.mf" type="file"/>
<parameter value="lib/bee.jar" type="file"/>
<parameter value="-C"/>
<parameter value="lib" type="dir"/>
<parameter value="org"/>
<parameter value="-C"/>
<parameter value="doc" type="dir"/>
<parameter value="bee.properties"/>
<parameter value="-C"/>
<parameter variable="depend lib"/>
<parameter value="."/>
</task>
</target>
</bee>