Preprocessor in Blackberry (through bb-ant-tools) - blackberry

There is a project that has #preprocess directives. I.e. there is #preprocess directive in the beginning of a file and something like #ifdef BlackBerrySDK6.0.0 inside the file.
Though it compiles well in eclipse, there are problems using bb-ant-tools. It behaves as though there is no preprocessing: compile errors on strings that should not be included.
I have build.properties file; it is included through <property file="build.properties"> AND <jdp file="build.properties">. I have BlackBerrySDK5.0.0=true in it.

Realized it myself. I should claim defines="blabla" in properties of task: <rapc output="foo" destdir="bar" defines="blabla">

Related

Xarmin iOS MSBuild - Missing OutputPath?

I am currently building my Xamarmin iOS project from the command line:
MSBuild "C:\code\MyProject.iOS.csproj" /t:Build /p:Configuration=Ad-Hoc;Platform=iPhone;ServerAddress=MACIP;ServerUser=MACUSER
It fails with the following error:
The OutputPath property is not set for project 'MyProject.iOS.csproj'.
Please check to make sure that you have specified a valid combination
of Configuration and Platform for this project.
However, I there is an OutputPath set when I examine the CSPROJ.
I can get around this by forcing an "OutputPath" parameter at the command line:
OutputPath="C:\builds\xamarin\cellar-ios"
Note: OutputPath="C:\builds\xamarin\cellar-ios\" does not work and build fails (notice ending back slash)
However this creates a strange folder structure where it appends the filename:
Thoughts on what I'm doing wrong here? I feel the setup is very close!
EDIT
Using the following parameters I'm able to get it to work. Note I still have to manually include the OutputPath but this gets me by for now.
/t:Build /p:Configuration=Ad-Hoc;Platform=iPhone;ServerAddress=SERVER_IP;ServerUser=USER;ServerPassword=PASS;OutputPath=bin\iPhone\Ad-Hoc\
For any customized OutputPath of your .csproj, it should be picked up by xbuild/msbuild within the .csproj or provided as a property.
One thing you can do to customize the output path of the IPA would be to use a custom MSBuild target to copy the IPA to a folder of your choice(You could use a move task if you needed):
i.e. (Inside your .csproj):
<PropertyGroup>
<CreateIpaDependsOn>
$(CreateIpaDependsOn);
CopyIpa
</CreateIpaDependsOn>
</PropertyGroup>
<Target Name="CopyIpa"
Condition="'$(OutputType)' == 'Exe'
And '$(ComputedPlatform)' == 'iPhone'
And '$(BuildIpa)' == 'true'">
<Copy
SourceFiles="$(IpaPackagePath)"
DestinationFolder="$(OutputPath)"
/>
</Target>
You then set the DestinationFolder to the desired output folder.
This is found in our KB articles here: https://kb.xamarin.com/customer/portal/articles/2061038-can-i-change-the-output-path-of-the-ipa-file-

JacORB: changing prefix and suffix

I would like to change package prefix and suffix in my ant build while generating java from idl. This has to be generic solution! The idea goes like that:
I have idl files (ONE.idl, TWO.idl) with namespace ONE_cb in first and TWO_cb in second (as _cb suffix is required for c++ compatibility). TWO_cb has atributes from ONE_cb, ONE_cb has only basic types. I want to change that to packages going like com.example.ONE and com.example.TWO.
I'm using JacORB 3.6. and I don't know how to do it.
My code looks like that:
<target name="idlj-generate">
<idl2java
srcdir="${psm.dir}/${project}/"
destdir="${build.generated.dir}"
includepath="${psm.dir}"
all="true">
<define key="__JACORB_GENERATE__"/>
<i2jpackage names=":com.example"/>
<i2jpackage names="_cb:"/>
</idl2java>
</target>
It doesn't work. As I stated before it has to be generic solution. adding
<i2jpackage names="TWO_cb:TWO"/> //option 2
<i2jpackage names="ONE_cb:ONE"/> //option 2b
Is not acceptable
Thank you for Your time.
If I understand you correctly you have something like
module ONE_cb
{
...
}
but you want it to be
com.example.ONE { ... }
This is feasible with i2jpackage e.g.
idl -forceOverwrite -d /tmp/generated -i2jpackage ONE_cb:com.example.ONE myfile.idl
The problem you have is that you are compiling both files at once. Remove the "all" and try compiling them in two phases.
If you are using Maven I would also recommend trying org.codehaus.mojo:idlj-maven-plugin as you can do multiple executions very easily with that.
To use multiple i2jpackage I got it working with
idl -forceOverwrite -d /tmp/generated -all -i2jpackagefile /tmp/file antBugJac608-2.idl
(where antBugJac608-2 #includes antBugJac608).
For various research I concluded that generic solution is immpossible.
Only way to perform changing prefix and suffix the same time is to explicite set all included names.

How to specify multiple binding files in gradle for ant xjc task

I have multiple bindings(xjb files) in the gradle project. When generating JAXB classes for a xsd(C.xsd). I want to use the previously generated binding files for A.xjb & B.xjb since C.xsd refers to A.xsd & B.xsd
The below ant xjc task works if I don't have anyother bindings in same path but I want specify explicity A.xjb & B.xjb bindings. How to go about same, I tried various options but nothing seems working. Any help greatly appreciated.
ant.xjc(destdir : '${jaxbDest}', removeOldOutput:'yes', extension:'true') {
arg(line:'-Xequals -XhashCode -XtoString -Xcopyable')
schema(dir:'src/main/schema', includes:'C.xsd')
binding(dir:'src/main/schema', includes:'*.xjb)
}
Thanks
Ravi
According to this documentation for the ant xjc task -
"To specify more than one external binding file at the same time, use a nested element, which has the same syntax as fileset."
In gradle it would look like this:
binding(dir:'src/main/schema'){
include(name:'A.xjb')
include(name:'B.xjb')
}
I think this would also work:
binding(dir:'src/main/schema', includes:'A.xjb,B.xjb')

Delphi .res file changer

I'm looking for a ready-to-use piece of code that would be able to read and modify Delphi .res files. The thing is that I need to create an application that will be compiling many Delphi projects at once (using the dcc32.exe file). However, it is necessary for me to change file version and language before compilation, and as far as I know, I have to modify the .res file to do that.
Have you come across any code that would give me an interface to .res files allowing me to modify the data contained in it? The thing is that I want to change only those two pieces of information keeping the rest unchanged. This is why I can't compile my own .res file based on a script.
An application executed from a command line would also be OK if it allows to be called with parameters and does what I need it to do.
Thank you very in advance!
If all you need is to add file version resource then create appver.rc file, compile it with brcc32 and in one of your app unit (for example appver.pas) add {$R appver.res} (as Marian noticed you must turn off Delphi project option to include version info).
I created command line programs that increase build numbers in .rc file, create new branch/tag in SVN with new version in branch name, compiles .rc to .res, and build application.
My .rc files with such info (Polish language) looks like:
#define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO LOADONCALL MOVEABLE DISCARDABLE IMPURE
FILEVERSION 7,28,7,17
PRODUCTVERSION 7,28,7,17
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0
{
BLOCK "StringFileInfo"
{
BLOCK "041504E2"
{
VALUE "CompanyName", "xxx\0"
VALUE "FileDescription", "yyy\0"
VALUE "ProductName", "zzz\0"
VALUE "FileVersion", "7.28.7.17\0"
VALUE "ProductVersion", "7.28.7.17\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0415, 1250
}
}
For all things .res, look at Colin Wilson's "XN Resource Editor", for which he provides the source code: http://www.wilsonc.demon.co.uk/d10resourceeditor.htm
And probably all you need is his resource utility library:
http://www.wilsonc.demon.co.uk/d9resourceutils.htm
I haven't used this source, but if I needed it, that's the first place I'd look. His resource editor is very useful, btw.
There is ChangeRes which seems to match your needs.
Check out sources:
http://code.google.com/p/gedemin/source/browse/trunk#trunk/Gedemin/Utility/IncVerRC
It is our utility which reads .RC file with version information and increments build number. We use it inside our build process. Here is an excerpt:
incverrc.exe ..\gedemin\gedemin.rc
"%delphi_path%\brcc32.exe" -fogedemin.res -i..\images gedemin.rc
"%delphi_path%\dcc32.exe" -b gedemin.dpr
The utility uses TIncVerRc class written by Chris Morris.
Check Resource Tuner Console on www.heaventools.com. They position that product for tasks like yours. Also there's a free rcstamp tool on CodeProject.

Ant Fileset Expansion doesn't work

I get a very confusing reaction from my ant build-file and I'm wondering whether I'm just not clever enough or this might actually be a bug.
I've got the following property set globally in my project:
<property name="lib.dir" location="lib"/>
Then I'll try to add some files out of this directory into a jar file via fileset (more than one resource):
<fileset dir="${basedir}" includes="lib/*filename*"/>
There should be (and exist) 3 different libraries, which are matched that way. However, if I try to use the following, it doesn't work and no files are included:
<fileset dir="${basedir}" includes="${lib.dir}/*filename*"/>
Note that the only differences lies in the usage of the global property. Now the simple question: why does the first version work as advertised, but the second doesn't?
Please check the actual value of "lib.dir" just before and maybe after the task that uses the "fileset" expression. Just to make sure, that it hasn't been changed accidently after you've set it globally. The <echo/> task can help.
Maybe I got the solution. The description of the locationattribute is:
Sets the property to the absolute filename of the given file. If the value of this attribute is an absolute path, it is left unchanged (with / and \ characters converted to the current platforms conventions). Otherwise it is taken as a path relative to the project's basedir and expanded.
Simply use the value attribute instead of location. Here's a test script to show the difference:
<project name="test">
<property name="test1" location="lib"></property>
<property name="test2" value="lib"></property>
<target name="target" description="description">
<echo>${test1}</echo>
<echo>${test2}</echo>
</target>
</project>
The output on my system is as follows:
Buildfile: D:\Develop\workspace-jabber\scrapbook\build.xml
target:
[echo] D:\Develop\workspace-jabber\scrapbook\lib
[echo] lib
BUILD SUCCESSFUL
Total time: 307 milliseconds
I have found a clue to the answer, but not the whole thing yet.
I runned both versions of the fileset with ant -debug and here is what happens.
In the working, not-using-property version, I get the following output:
fileset: Setup scanner in dir [pathToDir] with patternSet{ includes: [lib/*filename*] excludes: [] }
whereas in the should-be-working-but-doesn't version I get:
fileset: Setup scanner in dir [pathToDir] with patternSet{ includes: [ [pathToDir]/lib/*filename*] excludes: [] }
As you can see, ant add's the [pathToDir] in the regexp, thus searching for
[pathToDir]/[pathToDir]/lib/*filename*
which obviously doesn't exist. Problem now: how do I have to modify my version to have it working properly?
When creating the property (is it done global or in a target?), does the directory lib exist? If not, the location attribute does not work - use a value attribute instead or better define the property after creating the directory.
As indicated above, the problem was that ${lib.dir} too contained the whole path, thus searching for [pathToDir]/[pathToDir]/lib/filename.
To clip away the unwanted [pathToDir] in the ${lib.dir} property, I now used the task. I got now the following, but imho not so nice looking solution:
<basename property="lib.dir.rel" file="${lib.dir}"/>
<fileset dir="${basedir}" includes="${lib.dir.rel}/*filename*"/>
P.S.: On a second look, I found that Andreas_D also found the right reason and a good suggestion yesterday, which I must have overlooked :-/

Resources