"makesite.xml" is an Ant build script for constructing a tree of webpages each relating to one project in a tree of NetBeans packages.
Properties sources
The enviroment must have a few defined properties:
Properties are read from HOME/.ant/user.prperties. This is a good place to define
Properties are read from JAVAROOT/site.properties
- site.domain : physpics.com
- # the URL to website is http://${site.domain}
- site.package.prefix : com.physpics
- # prefix for package names
- site.vendor : physpics.com
- # This value is used in both the manifest and the jnlp fle.
-
- site.ftp.host : physpics.com
- # host for ftp acess
- site.ftp.prefix: /physpics.com
- # directory to get from host access initial directory to tree of web pages
- physpics.dir = U:/Fred/java/
- # location of physpics Java tools
- cygwin.dir : c:/cygwin
- # where the cygwin tree is rooted; (Unix utilities are in ${cygwin.dir} under bin, usr/bin, or etc.)
- antform.home: C:/Progra~2/Apache/antform-bin-2.0
- # root of ant installation
propcon is called to read from Pictools.properties
in the current directory and its parents up to JAVAROOT;
and also from HOME/PictoolOverrides,
PICTOOLS/PictoolsOverrides, HOME/PictoolsDefaults,
PICTOOL/PictoolsDefaults.properties.
The combined result is placed in DOT/Pictools.xml.
If there is a distsrc/PACKAGENAME.properties,
it it property-expanded and placed in the package directory.
Trees
There are several routes to a package on the tree. All have in common a "SUBTREE" value, derived from the directory path from JAVAROOT to the package directory. If JAVAROOT is "U:\Fred\Java\" and a package directory is "U:\Fred\Java\tools\ui", then the package.subtree.name is "tools.ui" and the package.slashed.subtree.name is "tools/ui". Makesite computes these values. JAVAROOT must be defined in the environment.
Compute package.subtree.name and package.slashed.subtree.name;
this SUBTREE value appears in
package name: ${site.package.prefix}.SUBTREE
com.physpics.tools.ui
source directory: ENV.JAVAROOT/SUBTREE/src/${site.package.prefix}/SUBTREE
U:/Fred/Java/tools/ui/src/com/physpics/tools/ui
class files: build/classes/${site.package.prefix}/SUBTREE
build/classes/com/physpics/tools/ui
web ftp location: ${site.ftp.prefix}/${site.tree.dir}/SUBTREE
physpics.com/Java/tools/ui
web URL: ${site.domain}/${site.tree.dir}/SUBTREE
physpics.com/Java/tools/ui
SourceExplorer and maybe other tools need access
to the permanent home of physpics.com/Java .
So physpics.java.site is defined in .../Java/Pictools.properties .
forweb directory is items to be copied to top level of web
things may generate into there
some things for web are at the outer level (so DreamWeaver puts them in the right place
similarly, java projects are in web order/organization
ENV.home is the one we use (user.dir can be wrong)
package dir is some.prefix.{dot without JAVAROOT}
site.package.prefix (in JAVAROOT/Pictools.properties) physpics.com
${site.package.prefix}
${env.JAVAROOT}
${user.dir}
=>
package.name
&package.prefix
=>
slashed.package.name
properties in ant are in unix form
convert to windows only for <exec>
tree.logo is html for displaying a logo
default is a Java teacup
Pictools.properties is build-time and web info
it is not accessible for user parameterization
For user parameterization, use PropertyPack
thus Pictools.properties is installed on website and in package.dir
For its executable shortcuts, a project may specify an icon.
It does so by defining in Proto.properties a value for
project.shortcut.icon. The value is the name of an icon (.ico) file;
nominally in distsrc:
project.shortcut.icon: ./distsrc/icon.ico
To properly inherit to subdirectories, the value should begin with a dot;
for instance ./distsrc/toolsicon.ico
installer - unchanged
extra.javadoc.dirs
each directory in the list must be preceded by a COMMA
no spaces allowed
this list is added to the directories processed by javadoc
it results in adding the source files from the given directories
to the tree called ./SX-notags
there is dot/Pictools.properties
generate dot/pictools.ant
read dot/pictools.ant as properties
distsrc/projname.properties filtered to package dir (deprecated)
"Resources"
An ant <resources> is a collection of files or other entities.
A <fileset> is an instance of <resources>, so a set of files from
a single directory tree can be written <fileset dir="the directory" .../>
Files from diverse sources can be in a <union>.
The following <resources> id-s are copied or expanded to their indicated
destinations. Expanding replaces ant-property invocations.
processed after compile
<resources id="copy.to.assets">
<resources id="expand.to.assets">
processed before upload
<property name="copy.to.web"
value="(space-separated list of files subordinate to DOT)"/>
<resources id="copy.to.forweb">
files whose web directory
will differ from their source directory
<property name="expand.to.forweb"
value="(list of files to expand from distsrc into forweb)"/>
<resources id="to.be.installed">
- client list of items to be installed by InstallPACKAGENAME.jar
<resources id="default.to.be.installed">
- default for to.be.installed
The default is installed if there is no value for to.be.installed.
A client may list the default among the items of to.be.installed
<property name="files.minimum.for.srctar"
value="A builtin list of items to copy from DOT
to the source tarball."/>
<property name="files.additional.for.srctar"
value"client specified list of additional files
to copy from DOT to the source tarball."/>
(To print a list of the contents of <resources id="xxx"> write
<pathconvert pathsep="${line.separator} & " refid="xxx"/>
)
distsrc/Pkg.properties
is filtered into package.dir
after building and reading Pictools.ant
distsrc/Pkg.properties
needs to capture properties from pictools with rules of form
` foo=${foo}
explicitly mentioned files
distsrc/project.build.number
distsrc/README.txt -> package, dot
distsrc/manifest.mf -> dot. jar
${env.HOME}/java.site.properties
${user.home}/.ant/user.properties
./Pictools.properties
distsrc/PKG.properties -> package
./build.xml
set main class in the properties pane for the project
forweb is deletable
websrc is for permanent files to be copied to forweb
(usually such files are in DOT itself)
things to carry over or convert
DONE <property name="files.for.package"
DONE><property name="files.filtered.for.package"><resources id="resources.for.installer">
<property name="files.filtered.for.webpage"
copy-to-XXXX do both copy and filter
-do-copy-to-dot replace copy-assets
ftp dist/lib to webpage
& allow (Option +Indexes) in Java/**/lib DONE
installer installs
more.to.be.installed
default.to.be.installed
README.txt
images/
tools/selfinstall/build/classes"
how tree vs file
empty union is okay includes okay, but one may say
<union id="test-ref">
<fileset dir="other" includes="box.html"/>
<fileset dir="distsrc" includes="xxx"/>
<union></union>
<union refid="notdef"/>
</union>
<target name="copytest" description="test union as a source">
<copy todir="other/testoutput">
<union>
<!-- first output is in testoutput itself -->
<fileset dir="distsrc" includes="README.txt" />
<!-- second output is in testoutput/distsrc -->
<fileset dir="." includes="distsrc/project.build.number"/>
<union refid="test-ref"/>
</union>
</copy>
</target>
<target name="test-dir-upload" description="does ftp create dirs?">
<ftp action="put" server="${site.ftp.host}"
userid="${ftp.userid}" password="${ftp.password}"
remotedir="${project.ftp.dir}/"
verbose="yes" >
<fileset dir="dist" includes="/lib"/>
</ftp>
</target>
installing ant
https://ant.apache.org/manual/install.html#optionalTasks
Images
Image source files reside in one of
- ./images/
- ./distsrc/images/
- ./src/path.../images/
Each source has its intended installation target. If an image is to be installed
in multiple places, its original should reside in ./distsrc/images. The -after-init
target in build.xml should copy the distsrc version to the Intermediate location for the
desri3d additional location.
Source dir |
Installed to |
Intermediate |
./images/ |
./distsrc/images/ |
./src/path.../images/ |
website/images/ |
installed jar-dir/images/ |
installed jar: /path.../images/ |
./forweb/images/ |
./build/images/ |
./src/path.../images/ |
Images are usually accessed from HTML files or source code.
To do so, you may use the incantations in this table.
Source dir |
Access from html |
Access from code |
./images/name |
src='images/name'
(from web page .html)
|
IOUtils.loadImage(null, "html:..name.") |
./distsrc/images/name |
src='images/name'
(from jar-dir html)
|
IOUtils.loadImage(appClass, "images/name") |
./src/path.../images/name |
- - - |
IOUtils.loadImageResource(appClass, "images/name") |
For the Windows installer there should be a Windows icon file containing
icons at several sizes, say 32, 16, and 64.
(I create .ico files with ImageMagick 6.9.9-11 Q16 x86_64 2017-09-30 on cygwin.
If the icons have white where they should be transparent,
the Imagemagick command was
convert icon32x32.png icon16x16.png icon64x64.png
-transparent white icon.ico
HTML designed for HTMLPane can have src=... for <img> tags
when they also have embed=... .
These images can be generated when the file is being displayed in HTMLPane;
Control-Alt-i will generate the images and put them in resources/embedimages.
They must be moved or deployed from there to distribution directories.
Properties
If target 'print-properties' is run, all defined properties are listed. A typical list is in TypicalProperties.php.
When Java libraries or applications are to be released on the web, they can be managed as a tree of NetBeans projects. Each project has its own build.xm l that includes makesite.xml . In addition to the usual targets of compile , jar , and others, makesite offers the upload target which transfers the project distribution and webpage files to a website.
Throughout, the directory dot (./) is the project directory. It must be a subirectory of the directory named by environment value JAVAROOT. The Pictools.properties file in that directory must define sshdest and picsdir , as defined in /pictools/doc/properties.php . It must also define java.subtree giving the path from picsdir to the Java subtree. Accordingly, the Java package at ${env.JAVAROOT}/x/y/z/pkg willbe installed on the server at ${sshdest}/${picsdir}/${java.sub.tree}/x/y/z/pkg .
File sets to be defined in build.xml
The following are unions and get included in unions, A typical instance is
<union id="files.filtered.for.package">
<fileset dir="distsrc" includes="README.txt"/>
</union>
- files.filtered.for.dot
- These files are filtered and inserted in
./ . Automatically included files are ./distsrc/manifest.mf , ./distsrc/README.txt , and ./distsrc/Pictools.properties .
-
files.filtered.for.package
- Files to be copied with filtering to the ${package.dir}
- files.for.package
- Files to be copied without filtering to ${package.dir}
Java code can fetch these files with
Class.getResource("filename") .
Included automatically: ./Pictools.properties.
- files.filtered.for.webpage
- Files to be filtered and copied to ./forweb/ and from thence to the website.
- files.for.webpage
- Files to be copied without filtering to the website. Included automatically: ./forweb/**,
dist/**,
*.php,
*.html,
images/,
./manifest.mf,
./Pictools.properties. The first two have their directories removed before uploading.
- files.for.srctar
- Files to add to srctar.tgz. Included automatically: ./build.xml, ./distsrc/**, ./*.php,
./*.html,
./images/**, and ./src/
-
TODO
change devtree.dir to dev.tree.dir
define it to be ..
change location of site.properties
<properties site.oproperties>
add examples of the ### items in the build.xml
do all of this doucment as html
sitetree.dir to site.tree.dir
check the <resource> tags
-
in .xml, but not .php
mantemp
extract.from
wrong in .xml
distsrc
ftp.userid
sitetree.dir
wrong in php
About.text
distsrc
ftp.userid
project.name
project.site.dir
sitetree.dir
The Ant scripts for NetBeans provides scripts for compiling, executing, and jarring a project. The buildtasks script augments those NetBeans scripts with tasks for deploying the project to a website. Deployment is simple, but buildtasks makes assumptions about the project directory and the destination trees. Many properties are defined to tailor the tasks to individual tasks. Property names are written here in bold.
The buildtasks tools reside in Physpic's tools directory. Here are found the Ant script buildtasks.xml and a template directory called tools/sample.distsrc/
Project Directory
NetBeans projects have several default directories. Here they are together with the defined ant property that names them. Unfortunately, properties defined in buildtasks.xml or the files it includes are not available in build.xml itself. I have usually resorted to using the actual names instead of the property.
- src/ the tree of java source files (src.dir)
- test/ - directory of modules used in testing (test.src.dir)
- build/ - the destination directory tree for .class files resulting from compilation (build.dir)
- nbproject/ - directory private to NetBeans
- dist/ - the jar file and ancilliary distribution files (dist.dir)
- lib/ - Java libraries to be included in the final jar file (libraries.dir)
Buildtasks adds two directories:
- distsrc/ - all non-Java source files; they are inserted into src/ or webpage/ as directed by properties defined in build.xml (distsrc)
- webpage/ - destination directory for staging distribution files for transfer to a server (webpage.dir)
In a standard NetBeans project directory are two files
- build.xml - Netbeans expects a build.xml, and this one can have the usual contents. In addition, buildtasks.xml expects certain property definitions and an <include> to invoke buildtasks.xml.
- manifest.mf - NetBeans provides a simple standard manifest for the jar file. Buildtasks overwrites it with a more elaborate manifest derived from a template in distsrc/.
build.xml
Here is a sample of a build.xml for use with buildtasks.xml.
Details on the properties to be defined are below.
Values to be replaced for another project are in italics:
<?xml version="1.0" encoding="UTF-8"?>
<project name="FontViewer" default="upload" basedir=".">
<description> Displays system fonts and
helps choose among them </description>
<property name="files.for.package" value="fontcategories.txt images/**" />
<import file=../tools/makesite.xml"/>
</project>
Notes:
- There is no import of build-impl.xml (it is imported by buildtasks.xml).
Distsrc Files
A number of files generally appear in distsrc/. Prototypes for them are in the Physpics tools/sample.distsrc directory. Copy them to your distsrc file and make the adjustments suggested within them. Replace the name PROJECT_NAME with the name of your NetBeans project. When a file is copied with filtering, any instance of ${...} is replaced with the correspodning ant property value.
-
- PROJECT_NAME.properties
- Define project.version.number and various project properties to use in filtering.
Also installed as local.properties in the web directory
- README.txt
- Describe how to install the application and where to get help
- manifest.mf
- Standard netbeans manifest modified to add inforamtion with filtering.
- PROJECTNAME.jnlp -
- .jnlp file for running the application as an applet. Omit for command line apps
- runApplet.html
- (Optional) Defines a webpage that will run the object as an applet. Omit for command line applications.
- project.build.number
- Contents must be an integer. If the file is absent, it will be created with value 1.
-
Converting filenames
Ant is pretty good about allowing both unix and Windows file names. When <exec>>ing a file,
however, file names must be platform specific.
This is the realm of <pathconvert>.
As is too often the case in Ant, its behavior can only
be discovered forensically. My effort was the following
<target name="try-dirname"
description="test various mixes of filename separators">
<property name="win" value="u:\Fred\Java\tools\Tools.ico"/>
<property name="unx" value="/cygdrive/u/Fred/Java/tools/Tools.ico"/>
<basename file="${win}" property="basewin"/>
<basename file="${unx}" property="baseunx"/>
<dirname file="${win}" property="dirwin"/>
<dirname file="${unx}" property="dirunx"/>
<pathconvert targetos="windows" property="conv.win.win">
<path location="${dirwin}\Tools.ico"/>
<map from="C:/cygdrive/u" to="u:"/>
</pathconvert>
<pathconvert targetos="unix" property="conv.win.unx">
<path location="${dirwin}/Tools.ico"/>
<map from="C:/cygdrive/u" to="u:"/>
</pathconvert>
<pathconvert targetos="windows" property="conv.unx.win">
<path location="${dirunx}\Tools.ico"/>
<map from="C:/cygdrive/u" to="u:"/>
</pathconvert>
<pathconvert targetos="unix" property="conv.unx.unx">
<path location="${dirunx}/Tools.ico"/>
<map from="C:/cygdrive/u" to="u:"/>
</pathconvert>
<echo>
unx->unx : ${conv.unx.unx}
win->unx : ${conv.win.unx}
unx->win : ${conv.unx.win}
win->win : ${conv.win.win}
</echo>
</target>
The output is
dirname and basename
dirname(u:\Fred\Java\tools\Tools.ico) : u:\Fred\Java\tools
dirname(/cygdrive/u/Fred/Java/tools/Tools.ico) : C:\cygdrive\u\Fred\Java\tools
basename(u:\Fred\Java\tools\Tools.ico) : Tools.ico
basename(/cygdrive/u/Fred/Java/tools/Tools.ico) : Tools.ico
pathconvert results
unx->unx : u:/Fred/Java/tools/Tools.ico
win->unx : u:/Fred/Java/tools/Tools.ico
unx->win : u:\Fred\Java\tools\Tools.ico
win->win : u:\Fred\Java\tools\Tools.ico
Note that dirname fails to convert /cygdrive/u to a driveletter. Instead it naively prefixes
C: , which is just wrong.
The Pathconvert results are fine.
But note that they rely on a <map> clause to convert the drive letter; and the from part on that clause must have both C: and /cygdrive/u .
Assets
Files fetched from a jarfile or the web are inherently read-only.An installation may need files like properties that can be initially fetched, but may be modified and retained by the user. Such files are here called "assets". An asset is installed into the same directory as the jar file, where it can potentially be both read and written by the user. If the jar directory is unwriteable, the asset may be stored to ~/.physpics/; see below. As a backup. the asset is also available with in the jar file and on the website.
An asset-name is a file name without directory. The asset is stored in the build directory in distsrc/assets/asset-name.
If a build directory has asset(s), makesite creates an Assets class in that directory's source. The asset can be fetched with one of that class's static methods:
String s = Assets.fetch(asset-name);
InputStream is = Assets.fetchInputStream(asset-name);
Reader rdr = Assets.fetchReader(asset-name, charset);
Object obj = Assets.fetchObject(asset-name);
Assets are available under a composite name: assets/package.full.name/asset-name , where package.full.name is the full dotted name of the package. The asset is available in three location (with the notation of IOUtils:getInputStream :
jardir:assets/package.full.name/asset-name
resource:/assets/package.full.name/asset-name
http://project.path.on.site/assets/package.full.name/asset-name
To utilize assets from other projects, a build.xml file defines the property include.assets.from.projects with the value being a space separated list of the directories for those projects.
For testing with netbeans, all asset directories are copied to
build/classes/assets/${package.name}/assetname.ext
Assets were described in the code thusly
* Find and read an "asset". This is data that the application makes
* initially available, but wants the user to be able to modify.
* Examples are the list of font categories and the list of colors.
* An asset is associated with a jar, but the primary copy is outside it
* and is installed in the same directory as the jar.
* (Backup copies are in the jar and on the website.)
* It can be read and written on the client site with non-Java tools.
* It can be accessed by Java code.
*
* An "asset name" has a package-name, a slash, and a filename, as in
* com.physpics.tools.io/sample.txt (note that the package name has dots.)
* The progenitor version of an asset file is in
* the package's distsrc/assets directory. That is, if the package
* is com.physpics.pack.age the asset sample.txt
* will be in
* {java root}/pack/age/distsrc/assets/com.physpics.pack.age/sample.txt
*
* Other copies of sample.txt will be installed by makesite.xml to
* in the build directory, {java root}/pack/age/
* build/classes/assets/com.physpics.pack.age/sample.txt
* dist/{projectname}.jar
* as /assets/com.physpics.pack.age/sample.txt
* forweb/Install{projectname}.jar
* as /assets/com.physpics.pack.age/sample.txt
* (and also in the embedded (projectname}.jar)
* on the webite, {website Java root}/pack/age/
* assets/com.physpics.pack.age/sample.txt
* {projectname}.jar
* /assets/com.physpics.pack.age/sample.txt
* Install{projectname}.jar
* as /assets/com.physpics.pack.age/sample.txt
* (and also in {projectname}.jar)
* If the installer, Install{projectname}.jar, is downloaded and
* double clicked, the installation directory will have the same four
* copies of the asset as does the website.
Property Files
Properties are declared in four files. In rough order of precedence they are: ./build.xml, ../site.properties, ${user.home}/.ant/user.properties, and distsrc/${project.name}.properties.
Key properties are defined directly in the build.xml file. Typically this file includes site.properties; properties defined before the include have precedence, for the rest, site.properties has precedence. When all NetBeans projects are in a single directory, is it customary that site.properties resides therein. Hence the location ../ for site.properties. Other project structures will dictate a change in the build.xml line that includes site.properties.
At the start of initiation, buildtasks.xml includes ${user.home}/.ant/user.properties. Typically this file just declares the ftp login poperties. Next is the include for nbproject/build-impl.xml, the NetBeans ant script for the build. The last include is for distsrc/${project.name}.properties. Then several derived properties are defined for generation of files with filtering.
Server Trees
The last directory in the full path of a project should be ${project.name},
as derived from the name of the project in the build.xml file.
A developer may have several NetBeans projects, with webpages for each. These webpages are assumed to be in a subtree on the server. For URLs, the root of this subtree is
http://${site.domain}/${site.tree.dir}
The site... properties are usually defined in site.properties.
buildtasks.xml uses cygwin ftp to deploy files to the server. The ftp connection is made to
${ftp.userid}@${site.ftp.host}
with the password given by ${ftp.password} and the root directory ${site.ftp.prefix}
Properties ${site.tree.dir} and ${site.ftp.prefix} are supposed to name the same directory on the server. The names beginning the "site" are usually defined in ../site.properties. The names beginning with "ftp" are sequestered in ${user.home}/.ant/user.properties. The latter directory should probably not be distributed :-) Names site.tree.dir, site.ftp.prefix, if non-empty, must begin with a slash and not end with a slash.
Properties usually defined in build.xml
- project.name
- A one word, camel-case title for the project.
Usually the value is ${ant.project.name},
which come from the name="" field of the <project>.
- package.top.dir
- The directory at the top of the jar file. That is, the directory corresponding to the "default package."
- package.dir
- Where the .java files reside. Relative to project's directory.
Value is something like src/com/physpics/projectname. buildtasks copies files from distsrc to this directory; some with filtering and others without. See properties the next two porperties.
- files.filtered.for.package
- Files to be copied with filtering to the ${package.dir}
- files.filtered.for.top.package
- Files to be copied with filtering to the ${package.top.dir}. ${package.name}.properties is automatically included in this list; it need not be listed.
- files.for.package
-
Files to be copied (with or without filtering)
from distsrc to ${package.dir}. Java code can
fetch these files with class.getResource("filename") .
- files.filtered.for.webpage
-
Files to be filtered and copied from distsrc to forweb
In addition, if the following exist they are filtered and copied:"
runApplet.html ${project.name}.jnlp README.txt
- files.for.webpage
-
Files to be copied without filtering from distsrc
to forweb. A help file should be among these.
If it distsrc/images exists, it will also be copied to forweb;
so the help file can depend on these images.
- files.to.add.to.srctar
-
The script makes a compressed tar file of the project sources
and places it in forweb. The files saved are
named in ${files.minimum.for.srctar} as
src/ distsrc/ nbprobject/ build.xml
*.php *.html images/ resources/
Additional files to
be saved can be named in ${files.to.add.to.srctar}.
The file names must be relative to the basedir path for the project.
(Or you can define your own value for ${files.minimum.for.srctar})
- extract.from
- Source file for checking tags. Errors are printed to stderr; tags are printed to stdout and set into property tut.alltags.
- distsrc.dir
-
Define this in order to fetch files
from some directory other than ./distsrc.
- webpage.dir
-
Define this property to create the webpage files
in a directory other than ./webpage
- applet.class
-
The full classname of the applet, if any.
Example: com.physpics.fontviewer.FVApplet
- applet.width
- Width in pixels.
- applet.height
- Height in pixels.
Properties defined in distsrc/${project.name}.properties
These
appear mostly in filtered documents.
Sometimes a property definition here needs the value of another property defined here. This is possible only because buildtask.xml reads this file twice. The first time it prepends "firsttime." to all property names. So a definition of linked.author.name (name wrapped in an <a> tag) might be
linked.author.name = \
<a href="mailto:${firsttime.author.email}">${firsttime.project.author}</a>
Of course the property firsttime.linked.author.name will be itself defined, but with an incorrect value.
- project.version.number
- Digits with interspersed periods. By convention, ${project.name}.properties is the one file that defines the project.version.number.
- project.build.suffix
- An arbitrary suffix for project.build.number;
I use developer initials
- project.author
- Who dun it.
- project.author.email
- Where users may contact the author.
- project.short.description
- One line description
Defined in this file. Not used in the tools.
A definition is given in sample.distsrc, but it may be replaced.
-
- applet.class
-
The full classname of the applet, if any.
Example: com.physpics.fontviewer.FVApplet
- applet.width
- Width in pixels.
- applet.height
- Height in pixels.
Properties defined in site.properties
Properties defined in buildtasks.xml
buildtasks.xml defines a few properties that are used in the prototype tools/sample.distsrc file. These properties may be overridden in build.xml.
- project.build.number
- This value is updated in distsrc/project.build.number and set as the current value.
- project.build.date
- MMMM d, yyyy
- project.build.time
- yyyy-MM-d HH:mm
- project.build.year
- yyyy
- project.release.string
- == VXXX (BBsuf)
where V is 'V' and XXX is ${project.version.number},
BB is ${project.build.number}, suf is ${project.build.suffix}
-
- files.minimum.for.srctar
- == src/ distsrc/ nbprobject/ build.xml; these files are stuffed in a tarball and copied to project.ftp.dir by targets srctar and webpage. See build.xml property files.to.add.to.srctar.
Installation Files (for Windows)
Files are installed from a constructed .jar file. It includes the Java .jar
file as one component along with other components like a help file.
For full flexibility in source location and destination directory structure,
the installed components are given in two <resources> elements;
one the minimum set and the other additions by the client.
Additions by the client are listed in a <resources> element
with refid "more.to.be.installed'. To add file data.txt from /tmp/ and
distsrc/Helpfile.html (with filtering) the ant code would be
<resources id="more.to.be.installed">
<fileset file="/tmp/data.txt" >
<concat file="distsrc/Helpfile.html">
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile"
value="${package.dir}/${project.name}.properties"/>
</filterreader>
</filterchain>
</concat>
</fileset>
</resources>
The expected installation files are given with id "default.to.be.installed".
To alter this set, an override defnition may be listed in build.xml. The given set is
<union id="default.to.be.installed">
<fileset dir="dist" excludes="javadoc/** .htaccess" />
<fileset dir="forweb" includes="README.txt"/>
<fileset dir="build/classes" includes="assets/**"/>
</union>
Targets
The main sequence of targets is
- init - increments project.build.number ,sets properties, and does includes
- compile - compile the java code
- jar - create the executable PROJECT_NAME.jar file
- installer - create installPROJECT_FILE.jar; one-click installer
- srctar - bundle up sources sufficient to re-instantiate the project
- webpage - create directory suitable for upload
- upload - copy the webpage files to the server
Other targets
- clean - gets rid of all constructed files
- debug - debug
- javadoc - create documentation
- checktags - checks a source file for valid feature tagging syntax; also generates a list of tags
This script uses the NetBeans override targets -pre-compile, -post-jar, and -post-clean, so do not use them in client scripts. However,
you can override one of following override targets defined in buldtask.xml:
- -pre-build-install - intial target performed for installer; it could be used to insert items in ./dist before building the self-install .jar file
- -post-build-install - final target performed for installer; could clean up after -pre-build-installer
- -pre-webpage - initial target performed by webpage
- -post-webpage - final target performed by webpage
Installer
The install target builds the file installPROJECT_NAME.jar. If among the images directory, there is one called PROJET_NAME.ico, then the installation will create (on Windows) a shortcut to the PROJECT_NAME.jar file using the icon as its image. See thje README.txt file (in tools/sample.distsrc) for ways users can exploit the shortcut. |