Maximum number of arguments for qdbusxml2cpp - c++

I am extending a DBus interface on a linux build machine using Qt. The existing interface works fine and I need to add another parameter
The XML generation method generation is:
<method name="get_card_info">
<arg type="b" name="success" direction="out" />
<arg type="s" name="version" direction="out" />
<arg type="s" name="serial" direction="out" />
<arg type="s" name="BeginDate" direction="out" />
<arg type="s" name="ExpirationDate" direction="out" />
<arg type="s" name="RenewalDate" direction="out" />
<arg type="s" name="ZipCode" direction="out" />
<arg type="s" name="ZipCodeExtension" direction="out" />
<!-- <arg type="u" name="cardStatus" direction="out" /> -->
</method>
The code works fine until I uncomment the commented out line, at which point qdbusxml2cpp reports:
interface_dbus_p.h:39:103: error: wrong number of template arguments (9, should be 8)
This is even if I comment out all calls to this function; indeed this is before the linking code even gets compiled; this is all from the qdbusxml2cpp call.
The XML will compile if I change this to six, seven or eight items, but if I increase it to nine it crashes.
I've changed no other configuration files except the XML code.
What's wrong? Is there a limit of eight parameters?

Found it; yes there is a limit, thanks to QDBusPendingReply
"The QDBusPendingReply is a template class with up to 8 template parameters. Those parameters are the types that will be used to extract the contents of the reply's data."
So no more than 8 parameters for me :(

Related

How to pass arg for exec task on if-condition? [duplicate]

I've got an ant build script which I should modify. Specifically I should make a subversion checkout conditional: currently only the trunk gets checked out, the new version should checkout a given branch if needed.
<target name="do-svn-checkout" depends="init"
<property name="branch" value=""/>
<exec executable="svn">
<arg value="checkout"/>
<arg value="-r"/>
<arg value="HEAD"/>
<arg value="http://t01/java/trunk"/>
<arg value="zzz"/>
<arg value="--password"/>
<arg value="xxx"/>
<arg value="--username"/>
<arg value="yyy"/>
</exec>
</target>
The property branch will be set via the command line like for instance -Dbranch=mybranch.
If the property branch is empty, the trunk should be checked out, but if the property has any other value, the respective branch should be checked out, like http://t01/svn/hlfg/HLFG/java/branch/the-value-of-the-property. So depending on the property the respective arg-value of the svn call should be modified.
Is it possible to solve this with basic Ant or would I need to use an inline script?
When using Ant >= 1.9.3 it's a piece of cake with the new if/unless feature introduced with Ant 1.9.1
(but you should at least use Ant 1.9.3 because of bugs in Ant 1.9.1, see this answer for details)
Don't forget the namespaces to activate that feature, f.e. :
<project
xmlns:if="ant:if"
xmlns:unless="ant:unless"
>
<property name="foobar" value=" "/>
<echo if:blank="${foobar}">foobar blank !</echo>
<echo unless:blank="${foobar}">foobar not blank !</echo>
</project>
in your case something like :
<target name="do-svn-checkout" depends="init"
<property name="branch" value=""/>
<exec executable="svn">
<arg value="checkout"/>
<arg value="-r"/>
<arg value="HEAD"/>
<arg value="http://t01/java/trunk" if:blank="${branch}">
<arg value=".." unless:blank="${branch}">
<arg value="zzz"/>
<arg value="--password"/>
<arg value="xxx"/>
<arg value="--username"/>
<arg value="yyy"/>
</exec>
</target>
You could define a wrapper target which depends on two other targets - one of which does trunk checkout, the other of which does branch checkout - and each of which is conditional on existence of your optional branch property.
You could further abstract the exec call into a macrodef to which you pass the trunk or branch url.
For example:
<project name="test" default="do-svn-checkout">
<target name="do-svn-checkout" depends="do-svn-trunk-checkout, do-svn-branch-checkout"/>
<target name="do-svn-trunk-checkout" unless="branch">
<svn-checkout svn-url="http://t01/svn/java/trunk"/>
</target>
<target name="do-svn-branch-checkout" if="branch">
<svn-checkout svn-url="http://t01/svn/hlfg/HLFG/java/branch/${branch}"/>
</target>
<macrodef name="svn-checkout">
<attribute name="svn-url"/>
<sequential>
<echo message="svn-url=#{svn-url}"/>
</sequential>
</macrodef>
</project>
Output with no branch property defined:
do-svn-trunk-checkout:
[echo] svn-url=http://t01/svn/java/trunk
do-svn-branch-checkout:
do-svn-checkout:
Output with branch property defined:
do-svn-trunk-checkout:
do-svn-branch-checkout:
[echo] svn-url=http://t01/svn/hlfg/HLFG/java/branch/mybranch
do-svn-checkout:

Can we convert a freestyle job in jenkins into a template

I have configured a freestyle Jenkins job to perform build, run some tests, perform code analysis and upload artifacts to Nexus. I will need to create more of such jobs in future and so I want to create a template so that its easy for anyone else to create those jobs in future. Is there a way to convert the freestyle job into template?
You can create generic mechanisms using Ant(In my case NAnt), and use them using a set of imported variables.
My config for web app looks like:
<?xml version="1.0" encoding="utf-8"?>
<webapps>
<add basedir="deploys\JobLocation" deploydir="C:\CIReference\Sites" appname="JobLocation" appid="5" appuri="http/*:8081" apppool.runtineversion="v4.0" />
</webapps>
The add tag has the basic configuration of the webapp
And the generic mechanism to deploy web application is like this
<?xml version="1.0" encoding="utf-8"?>
<project name="webdeploy" xmlns="http://nant.sf.net/release/0.92/nant.xsd">
<include buildfile="baseconfigs.xml" />
<include buildfile="external_tools.xml" />
<call target="baseConfigs" />
<property name="current.environment.path" value="${path::combine(nant.environmentsdir,environment)}"/>
<foreachxml file="${path::combine(current.environment.path,'webapps.xml')}" xpath="/webapps/add" property="basedir,deploydir,appname,appid,appuri,apppool.runtineversion">
<exec program="${appcmd.path}" failonerror="false">
<arg value="delete" />
<arg value="site" />
<arg value="/site.name: ${appname}" />
</exec>
<exec program="${appcmd.path}" failonerror="false">
<arg value="delete" />
<arg value="apppool" />
<arg value="/apppool.name: ${appname}" />
</exec>
<echo message="Deleting directory: ${path::combine(deploydir, appname)}" />
<delete dir="${path::combine(deploydir, appname)}" failonerror="false" />
<echo message="Coping directory to: ${path::combine(deploydir, appname)}" />
<copy todir="${path::combine(deploydir, appname)}" includeemptydirs="true" overwrite="true" verbose="true">
<fileset basedir="${path::combine(directory::get-current-directory(), basedir)}">
<include name="**\*.*" />
</fileset>
</copy>
<exec program="${appcmd.path}">
<arg value="add" />
<arg value="apppool" />
<arg value="/name: ${appname}" />
</exec>
<exec program="${appcmd.path}">
<arg value="set" />
<arg value="apppool" />
<arg value="/name: ${appname}" />
<arg value="/managedRuntimeVersion:${apppool.runtineversion}" />
</exec>
<exec program="${appcmd.path}">
<arg value="add" />
<arg value="site" />
<arg value="/name: ${appname}" />
<arg value="/id: ${appid}" />
<arg value="/bindings: ${appuri}" />
<arg value="/physicalPath: ${path::combine(deploydir, appname)}" />
</exec>
<exec program="${appcmd.path}" failonerror="false">
<arg value="set" />
<arg value="site" />
<arg value="${appname}" />
<arg value="/applicationPool:${appname}" />
</exec>
</foreachxml>
</project>
You can use this tool to create whatever mechanism do you need for your CI solution.
Order files...
baseconfigs.xml
<?xml version="1.0" encoding="utf-8"?>
<project>
<property name="nant.dir" value="" />
<property name="nant.environmentsdir" value="" />
<target name="baseConfigs">
<cd dir="..\..\" />
<property name="nant.dir" value="${path::combine(directory::get-current-directory(),'jenkins\NAnt')}" />
<property name="nant.environmentsdir" value="${path::combine(nant.dir,'environments')}" />
</target>
</project>
external_tools.xml
<?xml version="1.0" encoding="utf-8"?>
<project>
<property name="appcmd.path" value="c:\windows\System32\InetSrv\appcmd.exe" />
<property name="java_path" value="C:\Program Files (x86)\Jenkins\jre\bin"/>
<property name="liquibase_exe_path" value="C:\Program Files (x86)\Jenkins\tools\liquibase\"/>
<loadtasks assembly="C:\Program Files (x86)\Jenkins\tools\nant\nantcontrib\NAnt.Contrib.Tasks.dll" />
<loadtasks assembly="C:\Program Files (x86)\Jenkins\tools\nant\NAnt.GF.Custom.Tasks.dll" />
</project>

multiple complete types in GDBus introspection xml

How can I pass give multiple complete types in gdbus introspection xml. Example,
<method name="Frobate">
<arg name="foo" type="ii" direction="in"/>
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
When I tried this format, I am getting the error as
Error org.freedesktop.DBus.Error.InvalidArgs: Type of message, '(ii)',
does not match expected type '(null)'
when I am using
<method name="Frobate">
<arg name="foo" type="(ii)" direction="in"/>
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
the error becomes,
Error org.freedesktop.DBus.Error.InvalidArgs: Type of message, '(ii)',
does not match expected type '((ii))'
By this way you can give multiple complete types,
<method name='YourMethod'>"
<arg type='i' name='name1' direction='in'/>"
<arg type='i' name='name2' direction='in'/>"
</method>

Add tuple in gdbus introspection xml

How can I receive multiple int32 values, ie when I am receiving one value i need to specify it as type=i ,
<method name="foo3" >
<annotation name="org.dsource.dbus.d.Returns" value="bar"/>
<arg name="bar" type="i" direction="in"/>
</method>
but it is not allowing me to specify as, when I am doing so I am getting the error as expecting value is null
<method name="foo3" >
<annotation name="org.dsource.dbus.d.Returns" value="bar"/>
<arg name="bar" type="ii" direction="in"/>
</method>
then I have tried
<method name="foo3" >
<annotation name="org.dsource.dbus.d.Returns" value="bar"/>
<arg name="bar" type="(ii)" direction="in"/>
</method>
The error message is :
Error org.freedesktop.DBus.Error.InvalidArgs: Type of message, '(ii)',
does not match expected type '((ii))'
It is giving the error as expected value is ((ii)), What I need to get is I need to change the expected value as (ii).. please give me answer
Thanks in advance
You can use it as ,
<method name='YourMethod'>"
<arg type='i' name='name1' direction='in'/>"
<arg type='i' name='name2' direction='in'/>"
</method>"
and you can use (ii) tuple format to call the method

Trying to add CSS to Docbook using Saxon

I am trying to add a CSS file to my Docbook HTML output. Most examples say:
xsltproc --stringparam html.stylesheet corpstyle.css chunk.xsl myfile.xml
Ours is a Saxon based toolkit... So accordingly, I changed the build file to:
<java jar="${DocBook}/saxon/saxon.jar" fork="true" dir="${gen.dir}/html-multi">
<arg line="com.icl.saxon.StyleSheet"/>
<arg line="${basedir}/book.xml "/>
<arg line="${DocBook}/html/chunk.xsl "/>
<arg line="html.stylesheet=mycss.css"/>
</java>
When running ant, this results in:
Bad param=value on the command line.
How do I set this up?
That seems more like an Ant problem, try
<java jar="${DocBook}/saxon/saxon.jar" fork="true" dir="${gen.dir}/html-multi">
<arg line="${basedir}/book.xml "/>
<arg line="${DocBook}/html/chunk.xsl "/>
<arg line="html.stylesheet=mycss.css"/>
</java>
as it seems the main class is taken from the jar argument.