Re: FreeMarker for newbies
Daniel Dekany <[email protected]> Thu, 11 Jul 2013 16:45:17 +0200
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Thursday, July 11, 2013, 9:56:12 AM, Eyal wrote:
> Hi,
>
> I am using maven with nar plugin to compile also C++ code.
>
> And now I was asked to create from the maven the Visual Stuido vcprojx files
> (SInce the maven have all the information).
>
> So- I am using a maven profile to compile every "Configuration" of Visual
> Studio, I want to take an empty VCProjx file, and fill it with the relevant
> elements of each profile.
>
> Test2.xml
> <http://freemarker.624813.n4.nabble.com/file/n4654628/Test2.xml>
>
> If you look at the attached file, you can see for example-
>
> <ItemGroup Label="ProjectConfigurations">
> <ProjectConfiguration Include="Debug|Win32">
> <Configuration>Debug</Configuration>
> <Platform>Win32</Platform>
> </ProjectConfiguration>
> <ProjectConfiguration Include="Release|Win32">
> <Configuration>Release</Configuration>
> <Platform>Win32</Platform>
> </ProjectConfiguration>
> </ItemGroup>
>
>
> What I want to do- is create a template-
>
> <ProjectConfiguration Include="${configuration}|${platform}">
> <Configuration>${configuration}</Configuration>
> <Platform>${platform}</Platform>
> </ProjectConfiguration>
>
> That will be populate during running on one of the maven profiles, and it
> will create the correct XML element, that will be later injected to the -
>
> <ItemGroup Label="ProjectConfigurations">
>
>
> [ of course- I will need several templates to support all the entries in the
> vcprojx file, but the idea is the same- process the templates and inject
> them to the correct place in the file]
Can't you just do something like:
<Project DefaultTargets="Build" ToolsVersion="4.0">
<ItemGroup Label="ProjectConfigurations">
<#list profiles as p>
<ProjectConfiguration Include="${p.configuration}|${p.platform}">
<Configuration>${p.configuration}</Configuration>
<Platform>${p.platform}</Platform>
</ProjectConfiguration>
</#list>
</ItemGroup>
...
</Project>
If you need to generate those pieces in multiple rounds (calling Maven
again and again), and only after that insert them, then it sounds like
you need those little templates, save their output with a known name
somewhere, and then for the insertion you do something like:
<Project DefaultTargets="Build" ToolsVersion="4.0">
<ItemGroup Label="ProjectConfigurations">
<#list profiles as p>
<#include p + "_ProjectConfiguration.ftl">
</#list>
</ItemGroup>
...
</Project>
> Eyal
--
Thanks,
Daniel Dekany
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk