How to properly exclude dependencies from ASDoc? - ant

I have read some questions on StackOverflow on how to exclude the dependencies when creating the asdoc from Ant, but it seems I may not get it right.
Here (http://livedocs.adobe.com/flex/3/html/help.html?content=asdoc_9.html) it says to simply set the -exclude-dependencies argument to true or false, but I get an error. Below is the Ant output:
Generate ASDoc:
[echo] --- Generate ASDoc ---
[exec] Error: no default arguments are expected
[exec] Use 'asdoc -help' for information about using the command line.
[exec] Adobe ASDoc
[exec] Version 4.6.0 build 23201
[exec] Copyright (c) 2004-2011 Adobe Systems, Inc. All rights reserved.
[exec] Result: 1
Here is the Ant task:
<target name="Generate ASDoc">
<echo>--- Generate ASDoc ---</echo>
<!-- delete all files in the doc dir -->
<delete
includeemptydirs="true"
>
<fileset
dir="${DOCS_TARGET_DIRECTORY}"
includes="**/*"
/>
</delete>
<!-- create docs -->
<exec executable="${ASDOC_DIRECTORY}" >
<arg line="-doc-sources '${SOURCE_DIRECTORY}' "/>
<arg line="-exclude-dependencies true"/>
<arg line="-output '${DOCS_TARGET_DIRECTORY}' "/>
<arg line="-main-title 'Title' "/>
<arg line="-window-title 'Title' "/>
</exec>
<!-- compress docs -->
<antcall target="Compress ASDoc" description="Compress asdocs" />
</target>
I wonder if I may be using it wrong. Any ideas? Thanks!

From Adobe's Using the ASDoc tool
Note: You cannot use exclude-dependencies with input class specified by the doc-sources option.

Related

Execute sqlplus from ant fails to find DYLD_LIBRARY_PATH

I'm attempting to run a SQL script from within Apache Ant using the execute tag for sqlplus.
<exec dir="src/sql" executable="sqlplus" failonerror="true" output="src/sql/test.sql.err">
<arg value="${db.login}"/>
<arg value="#test.sql"/>
</exec>
Sqlplus is working from the command line using the same arguments.
Ant, however returns:
dyld: Library not loaded: /ade/b/2649109290/oracle/sqlplus/lib/libsqlplus.dylib
For the command line I have set:
export DYLD_LIBRARY_PATH=/Applications/instantclient_11_2/
Is there an equivalent action I need to take for Ant to find the libraries?
One option is to give SQLcl a try.
It's the sql scripting engine from sqldev which is sqlplus , plus a lot more
http://www.oracle.com/technetwork/developer-tools/sqlcl/overview/sqlcl-index-2994757.html
The benefit is there there's no libraries it's self contained and uses the JDBC Thin driver for db connectivity.
Here's your ANT example..
<project name="sqlcl" basedir=".">
<property name="db.login" value="klrice/klrice"/>
<target name="sqlcl">
<exec dir="." executable="/Users/klrice/Downloads/sqlcl/bin/sql"
failonerror="true"
output="sql/test.sql.err">
<arg value="${db.login}"/>
<arg value="#sql/dual.sql"/>
</exec>
</target>
</project>
Then running...
$ ant sqlcl
Buildfile: /Users/klrice/build.xml
sqlcl:
BUILD SUCCESSFUL
Total time: 3 seconds
587211042:~ klrice$ more sql/test.sql.err
SQLcl: Release 17.4.0 Production on Wed Mar 07 21:59:54 2018
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Last Successful login time: Wed Mar 07 2018 22:00:08 -05:00
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
login.sql found in the CWD. DB access is restricted for login.sql.
Adjust the SQLPATH to include the path to enable full functionality.
1
----------
1
Disconnected from Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
Using the solution #kris-rice suggested, here is my implementation including checking for errors...
<!-- =================================================================== -->
<!-- load plsql tox -->
<!-- =================================================================== -->
<target name="compile.plsql.tox" description="compile plsql for tox">
<echo message="compile.plsql.tox --------------------"/>
<mkdir dir="tmp/log"/>
<exec dir="src/sql" executable="sql" failonerror="true" output="src/sql/tox.all.sql.err">
<arg value="${db.login.tox}"/>
<arg value="#tox.all.sql"/>
</exec>
<echo message="looking for plsql errors -------------------"/>
<exec dir="src/sql" executable="grep" failonerror="false" resultproperty="found">
<arg value="LINE/COL ERROR"/>
<arg value="tox.all.sql.err"/>
</exec>
<fail message="plsql compile errors">
<condition>
<equals arg1="${found}" arg2="0"/>
</condition>
</fail>
<echo message="looking for line item errors ---------------"/>
<exec dir="src/sql" executable="grep" failonerror="false" resultproperty="found">
<arg value="ERROR at"/>
<arg value="tox.all.sql.err"/>
</exec>
<fail message="sql compile errors">
<condition>
<equals arg1="${found}" arg2="0"/>
</condition>
</fail>
<echo message="compile.plsql.tox --------------------"/>
</target>
<!-- =================================================================== -->

Sun WTK Preverify failing in J2ME- java/lang/NoClassDefFoundError

I have written ANT script to preverify the classes.,
<property name="wtkHome" location="C:/WTK2.5.2"> </property>
<property name="midp_lib" value="${wtkHome}/lib/midpapi21.jar"></property>
....
........
<property name="build" value="build"/>
.....
......
<target name="preverify">
<mkdir dir="${build}/preverified"/>
<exec executable="${wtkHome}/bin/preverify">
<arg line="-classpath ${wtkHome}/lib"/>
(or) <arg line="-classpath ${midp_lib}"/>
<arg line="-d ${build}/preverified"/>
<arg line="${build}/classes"/>
</exec>
</target>
When the above script executes, it is not able to find the midp classes in the classpath, so it's showing the error,
[exec] Error preverifying class first.MCCanvas
[exec] java/lang/NoClassDefFoundError: javax/microedition/lcdui/Canvas
[exec] Result: 1
But the required libraries are in the classpath, Please note compilation is fine for the MIDlet and Canvas classes!
Why don't you use Antenna? http://antenna.sourceforge.net/
Your build script would use:
<wtkpreverify cldc="CLDC-1.0" srcdir="${build}/classes" destdir="${build}/preverified" classpath="${wtk.home}/lib/cldcapi11.jar;${wtk.home}/lib/midpapi20.jar" />
Try with backslashes "\"
<arg line="-classpath C:\WTK2.5.2\lib\midpapi21.jar"/>

How to add all files in a fileset as an argument to the exec task?

I'm trying to provide all *.cpp files in a folder to the c++ compiler through ant. But I get no further than ant giving gpp a giant string containing all the files. I tried to prove it by using a small test application:
int main( int argc, char**args ){
for( --argc; argc != 0; --argc ) printf("arg[%d]: %s\n",argc,args[argc]);
}
With the ant script like this:
<target name="cmdline">
<fileset id="fileset" dir=".">
<include name="*"/>
</fileset>
<pathconvert refid="fileset" property="converted"/>
<exec executable="a.exe">
<arg value="${converted}"/>
</exec>
</target>
My a.exe's output is this:
[exec] arg[1]: .a.cpp.swp .build.xml.swp a.cpp a.exe build.xml
Now here's the question: how do I provide all files in the fileset individually as an argument to the executable?
This is what the apply task in ANT was designed to support.
For example:
<target name="cmdline">
<apply executable="a.exe" parallel="true">
<srcfile/>
<fileset dir="." includes="*.cpp"/>
</apply>
</target>
The parallel argument runs the program once using all the files as arguments.
Found it: the difference seems to lie in arg value vs. arg line.
<arg line="${converted}"/>
resulted in the expected output:
[exec] arg[5]: C:\cygwin\home\xtofl_2\antes\build.xml
[exec] arg[4]: C:\cygwin\home\xtofl_2\antes\a.exe
[exec] arg[3]: C:\cygwin\home\xtofl_2\antes\a.cpp
[exec] arg[2]: C:\cygwin\home\xtofl_2\antes\.build.xml.swp
[exec] arg[1]: C:\cygwin\home\xtofl_2\antes\.a.cpp.swp
Based on this article, here is the complete code illustrating the use of the pathconvert task:
<target name="atask">
<fileset dir="dir" id="myTxts">
<include name="*.txt" />
</fileset>
<pathconvert property="cmdTxts" refid="myTxts" pathsep=" " />
<apply executable="${cmd}" parallel="false" verbose="true">
<arg value="-in" />
<srcfile />
<arg line="${cmdTxts}" />
<fileset dir="${list.dir}" includes="*.list" />
</apply>
</target>
Above code assumes there are no spaces in the paths.
To support spaces in paths, change above pathconvert line to:
<pathconvert property="cmdTxts" refid="myTxts" pathsep="' '" />
and arg line to:
<arg line="'${cmdTxts}'"/>
Source: Converting an Ant fileset to multiple apply args.
Have you looked at the ant cpptasks? This would allow you to integrate C++ compilation into your Ant build in a more Ant-centric fashion. For example, specifying files to be compiled using a fileset.
Here is the example (compatible with Ant 1.6 or later)::
<project name="hello" default="compile" xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks">
<target name="compile">
<mkdir dir="target/main/obj"/>
<cpptasks:cc outtype="executable" subsystem="console" outfile="target/hello" objdir="target/main/obj">
<fileset dir="src/main/c" includes="*.c"/>
</cpptasks:cc>
</target>
</project>

Running a BAT file from ANT

I have gone through number of posts on the very forum but couldn't sort it out. I am trying to run a BAT file from ANT script. The folder hierarchy is like this
- Project
| - build.xml
| - build-C
| | - test.bat
The ANT file that i wrote so for is
<project name="MyProject" basedir=".">
<property name="buildC" value="${basedire}\build-C" />
<exec dir="${buildC}" executable="cmd" os="Windows XP">
<arg line="/c test.bat"/>
</exec>
</project>
The bat file content is
echo In Build-C Test.bat
It says that build failed .. :s i dun know what wrong am i doing ?
<property name="buildC" value="${basedire}\build-C" />
This should be ${basedir} I guess? Use
<echo>${buildC}</echo>
to make sure the dir is correct.
And shouldn't
<exec dir="${buildC}" executable="test.bat" os="Windows XP" />
do the job?
Hopefully this will help expand on the already given/accepted answers:
I suggest executing cmd with the batch script as a parameter:
<exec failonerror="true" executable="cmd" dir="${buildC}">
<arg line="/c "${buildC}/test.bat""/>
</exec>
Not sure if it is necessary to use the absolute path "${buildC}/test.bat" since dir is specified, but I put it just in case. It might be enough to use /c test.bat.
My project executes a batch script on Windows operating systems & a shell script on all others. Here is an example:
<target name="foo">
<!-- properties for Windows OSes -->
<condition property="script.exec" value="cmd">
<os family="windows"/>
</condition>
<condition property="script.param" value="/c "${basedir}/foo.bat"">
<os family="windows"/>
</condition>
<!-- properties for non-Windows OSes -->
<property name="script.exec" value="sh"/>
<property name="script.param" value=""${basedir}/foo.sh""/>
<echo message="Executing command: ${script.exec} ${script.param}"/>
<exec failonerror="true" executable="${script.exec}" dir="${basedir}">
<arg line="${script.param}"/>
</exec>
</target>

Building BIRT with PDE

I'm trying to build BIRT 2.5.2 from source to fix some bugs (I know about BIRT 2.6 but not all of our customers are on BIRT 2.6, yet).
I downloaded the BIRT 2.5.2 source ZIP and I found a couple of product files in there. I unpacked the sources, copied features and plugins to a build directory. Now I run this build.xml:
<target name="pde-build">
<java classname="org.eclipse.equinox.launcher.Main" fork="true" failonerror="true">
<arg value="-application" />
<arg value="org.eclipse.ant.core.antRunner" />
<arg value="-buildfile" />
<arg value="${eclipseLocation}/plugins/org.eclipse.pde.build_${pdeBuildPluginVersion}/scripts/productBuild/productBuild.xml" />
<arg value="-Dtimestamp=${timestamp}" />
<arg value="-verbose" />
<classpath>
<pathelement location="${eclipseLocation}/plugins/org.eclipse.equinox.launcher_${equinoxLauncherPluginVersion}.jar" />
</classpath>
</java>
</target>
But I get this error:
eclipse-3.5.2/plugins/org.eclipse.pde.build_3.5.2.R35x_20100114/scripts/productBuild/productBuild.xml:64:
Unable to find element: /org.eclipse.birt.report.engine/ReportEngineSDK.product
In my build.properties, I say:
product=/org.eclipse.birt.report.engine/ReportEngineSDK.product
and there is a file build/plugins/org.eclipse.birt.report.engine/ReportEngineSDK.product
My guess is that Eclipse has a search path of some kind to locate the product file.
What do I have to specify in the build.xml/.properties to make the productBuild.xml pick up the product file?
It seems that I need the full path to the .product file in the property product.
In addition, the ReportEngineSDK.product is outdated. Use .../features/org.eclipse.pde.build.container.feature/product/BIRT.product instead.

Resources