Recent

Author Topic: Package Projtemplates  (Read 1925 times)

Inthya

  • Newbie
  • Posts: 1
Package Projtemplates
« on: November 01, 2021, 12:17:49 pm »
Hello,

I tried to configure the package ProjTemplates. After some experimentation today I was able to successfully create a new project out of a template with this package. But it seems there is a problem with the detection inside __PROJNAME__.lpi.
After creating the new project, Lazarus told me, that the created lpi-file seems no ordinary lpi-file. So I looked into the lpi-file with a basic editor. In fact the package replaced the section name

<ProjectOptions>
<\ProjectOptions>

with the name of the new Project. For example, if my given name for the new Project is “test” the package replaces

<ProjectOptions>
<\ProjectOptions>

with

<testOptions>
<\testOptions>

Obviously Lazarus isn’t able to read the informations between

<testOptions>
<\testOptions>

Is there something I’m doing wrong?

Below are my templatefiles and the files created by projtemplates. I named the new project "test". Take a look at lines 3 and 39 of __PROJNAME__.lpi and compare it with lines 3 and 39 of test.lpi.


My project.ini file
Code: Pascal  [Select][+][-]
  1. [Variables]
  2.  
  3. [Project]
  4. Name=FUH_2
  5. Description=Einfache Lazarus-Anwendung an die Vorgaben der FUH angepasst.


My __PROJNAME__.lpr file
Code: Pascal  [Select][+][-]
  1. {$R+}
  2. {$B+}
  3.  
  4. program __PROJNAME__ (output);
  5.  
  6.   { Das Programm nacht ... und gibt ... aus }
  7.  
  8.   { constant definition part }
  9.  
  10.   { type definition part}
  11.  
  12.   { variable declaration part}
  13.  
  14.   { function declaration part}
  15.  
  16. begin
  17.  
  18. end.
  19.  

My __PROJNAME__.lpi file
Code: Pascal  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CONFIG>
  3.   <ProjectOptions>
  4.     <Version Value="11"/>
  5.     <PathDelim Value="\"/>
  6.     <General>
  7.       <Flags>
  8.         <MainUnitHasCreateFormStatements Value="False"/>
  9.         <MainUnitHasTitleStatement Value="False"/>
  10.         <MainUnitHasScaledStatement Value="False"/>
  11.       </Flags>
  12.       <MainUnit Value="0"/>
  13.       <Title Value="__PROJNAME__"/>
  14.       <UseAppBundle Value="False"/>
  15.       <ResourceType Value="res"/>
  16.     </General>
  17.     <BuildModes Count="1" Active="Default">
  18.       <Item1 Name="Default" Default="True"/>
  19.     </BuildModes>
  20.     <PublishOptions>
  21.       <Version Value="2"/>
  22.       <UseFileFilters Value="True"/>
  23.     </PublishOptions>
  24.     <RunParams>
  25.       <FormatVersion Value="2"/>
  26.       <Modes Count="0"/>
  27.     </RunParams>
  28.     <Units Count="1">
  29.       <Unit0>
  30.         <Filename Value="__PROJNAME__.lpr"/>
  31.         <IsPartOfProject Value="True"/>
  32.         <IsVisibleTab Value="True"/>
  33.         <CursorPos X="5" Y="18"/>
  34.         <UsageCount Value="20"/>
  35.         <Loaded Value="True"/>
  36.       </Unit0>
  37.     </Units>
  38.     <JumpHistory HistoryIndex="-1"/>
  39.   </ProjectOptions>
  40.   <CompilerOptions>
  41.     <Version Value="11"/>
  42.     <PathDelim Value="\"/>
  43.     <Target>
  44.       <Filename Value="__PROJNAME__"/>
  45.     </Target>
  46.     <SearchPaths>
  47.       <IncludeFiles Value="$(ProjOutDir)"/>
  48.       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
  49.     </SearchPaths>
  50.   </CompilerOptions>
  51.   <Debugging>
  52.     <Exceptions Count="3">
  53.       <Item1>
  54.         <Name Value="EAbort"/>
  55.       </Item1>
  56.       <Item2>
  57.         <Name Value="ECodetoolError"/>
  58.       </Item2>
  59.       <Item3>
  60.         <Name Value="EFOpenError"/>
  61.       </Item3>
  62.     </Exceptions>
  63.   </Debugging>
  64. </CONFIG>

The created test.lpr file
Code: Pascal  [Select][+][-]
  1. {$R+}
  2. {$B+}
  3.  
  4. program test (output);
  5.  
  6.   { Das Programm nacht ... und gibt ... aus }
  7.  
  8.   { constant definition part }
  9.  
  10.   { type definition part}
  11.  
  12.   { variable declaration part}
  13.  
  14.   { function declaration part}
  15.  
  16. begin
  17.  
  18. end.
  19.  

The created test.lpi file
Code: Pascal  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CONFIG>
  3.   <testOptions>
  4.     <Version Value="11"/>
  5.     <PathDelim Value="\"/>
  6.     <General>
  7.       <Flags>
  8.         <MainUnitHasCreateFormStatements Value="False"/>
  9.         <MainUnitHasTitleStatement Value="False"/>
  10.         <MainUnitHasScaledStatement Value="False"/>
  11.       </Flags>
  12.       <MainUnit Value="0"/>
  13.       <Title Value="test"/>
  14.       <UseAppBundle Value="False"/>
  15.       <ResourceType Value="res"/>
  16.     </General>
  17.     <BuildModes Count="1" Active="Default">
  18.       <Item1 Name="Default" Default="True"/>
  19.     </BuildModes>
  20.     <PublishOptions>
  21.       <Version Value="2"/>
  22.       <UseFileFilters Value="True"/>
  23.     </PublishOptions>
  24.     <RunParams>
  25.       <FormatVersion Value="2"/>
  26.       <Modes Count="0"/>
  27.     </RunParams>
  28.     <Units Count="1">
  29.       <Unit0>
  30.         <Filename Value="test.lpr"/>
  31.         <IsPartOftest Value="True"/>
  32.         <IsVisibleTab Value="True"/>
  33.         <CursorPos X="5" Y="18"/>
  34.         <UsageCount Value="20"/>
  35.         <Loaded Value="True"/>
  36.       </Unit0>
  37.     </Units>
  38.     <JumpHistory HistoryIndex="-1"/>
  39.   </testOptions>
  40.   <CompilerOptions>
  41.     <Version Value="11"/>
  42.     <PathDelim Value="\"/>
  43.     <Target>
  44.       <Filename Value="test"/>
  45.     </Target>
  46.     <SearchPaths>
  47.       <IncludeFiles Value="$(ProjOutDir)"/>
  48.       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
  49.     </SearchPaths>
  50.   </CompilerOptions>
  51.   <Debugging>
  52.     <Exceptions Count="3">
  53.       <Item1>
  54.         <Name Value="EAbort"/>
  55.       </Item1>
  56.       <Item2>
  57.         <Name Value="ECodetoolError"/>
  58.       </Item2>
  59.       <Item3>
  60.         <Name Value="EFOpenError"/>
  61.       </Item3>
  62.     </Exceptions>
  63.   </Debugging>
  64. </CONFIG>
  65.  
« Last Edit: November 01, 2021, 12:19:45 pm by Inthya »

 

TinyPortal © 2005-2018