|
|||
|
|||
7Bee 1.1.0 is now available for download.
This is an initial version of 7Bee. There is no any license for this product except an author's copyright. Any usage of this software is your own risk and an author has no any responsibility for it. |
|||
7Bee (Build Everything Easier) |
|||
7Bee is a Java-based build tool. 7Bee inherited some principles of Make. Why another build tool when there are make, gnumake, nmake, ant, maven, jam, and many others? Because all those tools have limitations that 7Bee's an original author couldn't live with when developing software across multiple platforms using different products. Actually, an author had two objections before starting this project:
Why 7, because 7 is a number of base classes giving 7Bee implementation. |
|||
Documentation |
|||
7Bee uses a language with a simple set of predefined operations for creation build scripts. The language is XML based, so DTD is very helpful to understand general rules of creation language constructions. Although base set of operations is very limited, it can be easily extended by adding user defined operators and functions. Creation specialized tasks can also reduce efforts of a preparation of build scripts. Another powerful thing is weakly hardcoded DTD, so generally the 7Bee processor can be configured for parsing different languages by just changing a grammar definition in externally defined file. See Getting Started section how to start using 7Bee. | |||
Basic 7Bee language elements |
|||
7Bee provides variables, expression, operators, functions, conditional operators, and loops. All variables are typeless, and they obtain a global scope in context where they defined. | |||
Basic statements |
|||
The set include statements for creation build files.
Note that 7Bee is highly expandable language for creation build files, test scripts, and many others tasks. Therefore, set of above statements can be extended by adding new ones. An external grammar definition can be applied without recompiling of any core code. |
|||
Operators |
|||
Generally any operator defined as a two addresses operation, when it applied on two operands and result takes place of first operand. Further a result used as first operand for the next operand in the chain. An operator can have unlimited number of operands. An operand can be a value, a variable or a result of a function. There are no parentheses to prioritize or group operands. However operators can be nested and operators of lower levels are calculated first. An operator has a required attribute name and an optional variable specifying a variable name for a result, otherwise an operator result passed to up level context. The first version of 7Bee doesn't have inline operators, so most of expressions will look a bit bulky. It considered as not a big disadvantage, because build files are very rarely modified, therefore one time creation efforts can be neglected in a lifetime of a project.
Some other operators can be build using the basis. Set of operators is customizable, when an operator name is a name of a class of its implementation. All operators are considered in package org.bee.oper. There is a plan of implementing arithmetic operators, as add, subtract, multiply, and divide. |
|||
Functions |
|||
Set of functions is expandable and useful for different build tasks. Functions can be used in parameters of a task, or in expressions and operators.
A function name is a class name in package org.bee.func. Function can have a variable number of Object or String parameters, a result can be any type, which will be interpreted accordingly context where the function met. |
|||
Scope rules |
|||
A variable obtains scope of its declaration and below. So variables with the same name can coexist as different only in sibling branches. When any statement is processed, all variables get evaluated first in order of appearing. | |||
Changeable Grammar |
|||
A language understandable by 7Bee can be changed. Take a look
at alt-grammar.bgr in examples. It provides a handler class for paths in
XML tree. So generally 3 different changes can be done:
All these changes should be accompanied corresponding changes of DTD. |
|||
Function parameter details |
|||
waritThis function creates .war file specified by 1st parameter 2nd provides a location of web.xml, but it can be considered as content of it, if the location can't be resolved. (a standard 7Bee behavior) Further parameters grouped by 2 or more parameters, and 1st in a group provides operation abbreviations, like
prfx -is path in .war to add files, it shouldn't start with / or \, if source path represent a single file, then prefix will be destination file name, unless it ended by / or /*. If a group started parameter has type an array, then its content considered as additional parameters. It allows to create group of parameters separately. ask1st parameter provides prompt and 2nd default value. Result of the function is user input or default value if user entered nothing. |
|||
7Bee file structure |
|||
7Bee build file starts with entities definitions. They used for definition build elements used multiple times, for example output directories, file names, main class name and so on. Using entities simplifies maintenance build file and allows to reuse it. Then global variables can be defined, for example class paths. The rest includes multiple target sections. If name of target section not specified at starting 7bee, then an execution starts from the last target section. Every target section can include several dependencies. In this case all dependencies evaluated first. If dependency is a target section, then process repeated recursively. | |||
Predefined variable names |
|||
Bee provides a mechanism of predefined variable
|
|||
Help to promote 7Bee | |||
If you use 7Bee in your development, then you can help to promote this tool. You can add a small icon somewhere
on your site web pages inserting the following simple fragment:
<a href=http://7bee.j2ee.us/bee/index-bee.html"><img
src="http://7bee.j2ee.us/bee/7bee_logo_avatar.png" border=0></a> |
|||
Getting Started | |||
Although 7Bee build files look bulky, creation of a build
script is fairly simple when templates of build files used. Folder examples of 7Bee distribution contains
many useful templates for different type of projects. Consider a simple
project with compilation, jar creation and run tasks. Examples for such
projects can be found in examples/generic folder. The templates
consider some project tree structures, with separate folders for sources,
result of compilation and build target files.
Let's create a classic Hello, world! project.
|
|||
Examples | |||
variable<variable name="jdk version">1.5</variable> <variable name="resource path" type="path">/src/resources</variable> expression<expression variable="class path"> <operator name="append"> <value variable="jdk root"/> <value variable="jdk version"/> <value>/lib/rt.jar</value> </operator> </expression> task<task exec="mkdir"> <parameter value="&build_directory;"/> </task> <task name="main" code="com.sun.tools.javac.Main" path="compiler classes"> <parameter value="-classpath"/> <parameter variable="class path"/> <parameter value="-source"/> <parameter value="1.5"/> <parameter value="-d"/> <parameter value="&build_directory;" type="dir"/> <parameter variable="java sources"/>> <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> dependency<dependency> <expression> <operator name="eq"> <function name ="timestamp"> <parameter value="lib"/> </function> <value/> </operator> </expression> </dependency> <dependency target="check lib"/> for<for variable="idl file" in="event, naming IDLs"> <task name="idl compilation" exec="idl compiler"> <parameter variable="old compatible"/> <parameter value="-i"/> <parameter variable="include_lib"/> <parameter value="-i"/> <parameter variable="common_src"/> <parameter value="-keep"/> <parameter value="-fall"/> <parameter value="-td"/> <parameter variable="Java src common"/> <parameter variable="packages list"> <expression variable="packages list"> <variable name="packages list"/> <for variable="package name" in="event, naming IDLs"> <operator name="array" variable="packages list"> <value variable="packages list"/> <value>-pkgPrefix</value> <function name="filename"> <parameter variable="package name"/> </function> <value>org.omg</value> </operator> </for> </expression> </parameter> <parameter variable="idl file"/> <onexit> <if> <expression> <operator name="neq"><value variable="resultcode"/><value>0</value></operator> </expression> <block type="then"> <echo>Error in IDL</echo> <function name="stop"> <parameter value="1"/> </function> </block> <block type="else"> <function name="write"> <parameter variable="idl.timestamp"/> <parameter value=""/> </function> </block> </if> </onexit> </task> </for> if<if> <expression> <operator name="eq"> <value>80</value> <value variable="access port"/> </operator> </expression> <block type="then"> <expression variable="access port"> <value></value> </expression> </block> <block type="else"> <expression variable="access port"> <operator name="append"> <value>:</value> <value variable="access port"/> </operator> </expression> </block> </if> block<block> <function name="touch"> <parameter value="src/Java/org/omg/timestamp.touch" type="path"/> </function> </block> switch<switch variable="component"> <block type="case" value="s"> <echo>EPM server configuration</echo> </block> <block type="case" value="c"> <echo>EPM client configuration</echo> </block> <block type="case" value="a"> <echo>EPM All-in-one configuration</echo> </block> <block type="case" value="r"> <echo>Scheduler only configuration</echo> </block> </switch> function<function name="warit"> <parameter value="&build_directory;/&webapp_file;"/> <parameter>src\javaarchitect\servlet\web.xml</parameter> <parameter>C &domain;</parameter> <parameter>&build_directory;/&domain;</parameter> <parameter/> <parameter>E config/</parameter> <parameter>src\javaarchitect\servlet\*.properties</parameter> <parameter>servlets\.properties|aliases.properties</parameter> <parameter>C &domain;/tree/resource/</parameter> <parameter>src\&domain;/tree/resource</parameter> <parameter>CVS*</parameter> <parameter>C &domain;/tree/</parameter> <parameter>src\&domain;/tree/tree.dtd</parameter> <parameter></parameter> <parameter>C &domain;/mishka/resource/</parameter> <parameter>src\&domain;/mishka/resource</parameter> <parameter>CVS*</parameter> <parameter>L</parameter> <parameter> <expression> <operator name="append"> <value variable="DEMROG_HOME"/> <value>/lib/demrog.jar</value> </operator> </expression> </parameter> <parameter/> <parameter>A</parameter> <parameter>src\javaarchitect\servlet\tree\resource/*.htm</parameter> <parameter>A tre_eview-doc.html</parameter> <parameter>doc\treeview-doc.html</parameter> <parameter>A</parameter> <parameter>doc\*.png</parameter> <parameter>A</parameter> <parameter>src\snoop.jsp</parameter> </function> operator<operator name="array"> <value>-cmf</value> <value variable="manifest file"/> </operator> target<target name="war" dir="." comment="Build J2EE deployer war.jar"> <echo>Jarring war...</echo> <dependency target="compile j2ee"/> <dependency> <function name="allnewer"> <parameter value="&build_directory;\rogatkin" type="dir"/> <parameter value="&build_directory;\war.jar" type="file"/> </function> </dependency> <task name="jar_do" code="sun.tools.jar.Main"> <parameter value="-cf"/> <parameter value="&build_directory;/war.jar" type="file"/> <parameter value="-C"/> <parameter value="&build_directory;" type="dir"/> <parameter value="rogatkin" type="dir"/> </task> </target> |
|||
7BeeSP | |||
What's 7BeeSP?
7BeeSP is 7Bee server pages. 7Bee can be used not only as a build tool, it can be used as a scripting language for generation web pages with JavaScript in, taking user requests, sending dynamic response and much more. Some examples are coming soon. |
|||
Search for another great Linux utility helping improving
productivity of your work |
Contact Dmitriy Rogatkin