New Template System

Ian Reinhart Geiser geiseri at yahoo.com
Mon May 24 05:01:08 UTC 2004


Okay campers we now have ripped out the old perl template system and have 
something that imho is infinitely better and easier to extend.  Currently 
only a few templates have been ported, and if anyone wants to inflate their 
CVS stats feel free to chip in.  Its almost all search and replace.

So here is the lowdown on the new system:
To port a template to the new system the
information from the scrip file will need to be moved into the ini file.
The example is as follows:
install( 
"${src}/template-chello/app.kdevelop","${dest}/${APPNAMELC}.kdevelop" );
becomes
[PROJECT]
Type=install
Source=%{src}/template-chello/app.kdevelop
Dest=%{dest}/%{APPNAMELC}.kdevelop

Things like installIncAdmin(); and installGNU(); now involve unpacking
the tar archives.  This is done by creating a target in the ini file as
follows:
[GNU]
Type=install archive
Source=%{src}/template-common/gnu.tar.gz
Dest=%{dest}

The popular script functions convert as follows:
installIncAdmin(); %{src}/template-common/incadmin.tar.gz
installGNU();  %{src}/template-common/gnu.tar.gz
installAdmin(); %{src}/template-common/admin.tar.gz
installGnome(); %{src}/template-common/gnome.tar.gz
installWX(); %{src}/template-common/wxwidgets.tar.gz


To create directories is now:
[SRC]
Type= mkdir
Dir=%{dest}/src

New additions are as follows:
[MGS]
Type=message
Comment=A simple C project was created in %{dest}.

Will allow you to display a custom message when the template has
finished installing.  This is very handy for projects that require
custom variables to be set.

The concept of custom variables was also introduced.  To create a
variable that can be edited from the project wizard you need to add an
entry as follows:

[LIBS]
Type = value
ValueType=<Qt Data type>
Value= <Value Name that will be substituted in the code>
Comment= <The label in the UI>
Default= <The default value>

One special value can be used to turn targets on and off.  This is done
by adding a value as follows:
[DOCSOPT]
Type = value
ValueType=bool
Value=INSTALL_DOCS
Comment= Install Docbook documentation templates.
Default=true

Then in the targets you wish to make optional you add the Option
property with the value's name as the data. This will look as follows:
[DOCSDIREN]
Type=mkdir
Dir=%{dest}/doc/en
Option=INSTALL_DOCS

The Option target is available to the mkdir, install, and install
archive targets.

The last new addition is the optional post processing of the files as
they are copied.  For install and install archive you can add a
Process=true or Process=false to turn the processing on or off.

Now the GUI is still under heavy development and custom UI files is not yet 
working.  People are encouraged to make new templates that can use these 
systems to their fullest.  This new system is quite powerful.  As always 
comments are welcome.  

Cheers
	-ian reinhart geiser
-- 
When the meaningful words, when they cease to function?
 When there's nothing to say, when will it start bothering you?
 The requiem.
-Killing Joke, Requiem





More information about the KDevelop-devel mailing list