cancel
Showing results for 
Search instead for 
Did you mean: 

CBS: How to change Build-Scripts of CBS-Builds

Former Member
0 Kudos

Hello,

The Build in Component Build Service is, as far as I know based on Ant and Velocity. Is there any possibility to change the build.xml-Files used in the CBS, to add own tasks to the central build?

Greets Johann

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Can you specify what build steps do you want to execute, before or after the CBS build?

It is possible to add tasks to the default ones for some purposes. As you correctly stated out that CBS uses ANT and Velocity to execute builds and influence the way of the builds. Therefore you can add build.xml for further steps on needs.

To be honest, SAP does not like to see you to exploit this feature for a very obvious reason. This makes the support from the SAP more complicated or even impossible. If your additional build tasks demage the JDI environment and claim that CBS not work, how can SAP help you? That's why the feature is not documented.

Besides, this can leads to security problem. ANT is powerful, really! If you enable this feature for a justifiable purpose, can you protect others from smuggeling malicious code to the CBS, say ANT tasks Exec, Rexec.

Former Member
0 Kudos

Thank you, Larry. This is a good clarification. I understand your remarks on supportability very well. But sometimes code generation (before compilation) is a helpful thing. Or think about applying aspects using AspectJ (happens after the compile).

> Can you specify what build steps do you want to

> execute, before or after the CBS build?

I would like to generate code using a self-build ant task before compilation starts.

I would like to use AspectJ after the compilation of the sources, before packaging the archive.

Both relates to migration of existing code to the component model and CBS.

> It is possible to add tasks to the default ones for

> some purposes. As you correctly stated out that CBS

> uses ANT and Velocity to execute builds and influence

> the way of the builds. Therefore you can add

> build.xml for further steps on needs.

> To be honest, SAP does not like to see you to exploit

> this feature for a very obvious reason. This makes

> the support from the SAP more complicated or even

> impossible. If your additional build tasks demage the

> JDI environment and claim that CBS not work, how can

> SAP help you? That's why the feature is not

> documented.

> Besides, this can leads to security problem. ANT is

> powerful, really! If you enable this feature for a

> justifiable purpose, can you protect others from

> smuggeling malicious code to the CBS, say ANT tasks

> Exec, Rexec.

Former Member
0 Kudos

Christian,

if you look at the folder structure of a DC project, you will find a <b>cfg</b> folder. This is where to put the velocity macros. You can put up to three files in there: <b>prebuild.vm</b>, <b>build.vm</b> and <b>postbuild.vm</b>. For your needs, you can omit the build.vm. The built-in/default one will be run instead. The other two will be executed before and after the default build steps.

These files must have <b>.vm</b> as file extension. Nevertheless, you can use normal ANT build file syntax. It must contain at least a default target <b>build</b>. It can contain velocity references, i.g. <b>$foo</b> for referencing variables for paths (for output, libs ...) in the java coding of the build plug-ins. But these variables are undocumented. Also SAP can change the name of them in the future.

Just put following two files to the <b>cfg</b> folder of any DC project:

<u>prebuild.vm</u>:


<project name="pre-build" default="build">
	<target name="build">
		<echo message="Hello, the pre-build is running ..." />
	</target>
</project>

<u>postbuild.vm</u>:


<project name="post-build" default="build">
	<target name="build">
		<echo message="Hello, the post-build is running ..." />
	</target>
</project>

Use DC build from the context menu. After the build, you can check the file <b>gen/default/logs/build.log</b> for the echos during the execution.

In your case, it is difficult. You want to run aspectj after the compilation but prior to the packaging. It is not possible. You are maybe compelled to unpack and then pack the archives again.

Enjoy!

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

You might want to take a look at Note 1061467 - Build Plugin Framework Reference for NWDI. This note contains a PDF attachment that may help you to uncover the hidden treasures of Build Plugin Framework.

Make your own build plugin and put a reference on you DC to it. There you have it - your own build process using Velocity macors or even an Ant script.

Former Member
0 Kudos

Hi Johann,

I'm looking for an answer to your question as well. Currently I've only found the following presentation

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/java development infrastructure real world use webinar.pdf

showing the build process (see page 32).

But still I don't understand how additional build steps can be introduced. Did you find a solution?

Regards

Christian