Hi Team,

I want set my product name and version from a properties file instead of giving a static value in "project details" section of project file. I have different product name for windows and linux and i will have these values in properties file and i want to read dynamically.

Is this possible with Bitrock InstallBuilder ? If yes, can anyone tell me how to achieve this?

Thanks, Shiva Prasad T

asked 07 Nov '11, 02:31

shivakmpl's gravatar image

shivakmpl
1333
accept rate: 0%


You could either read the information from the properties file in the <preBuildActionList>:

<preBuildActionList>
    <propertiesFileGet>
        <file>${build_project_directory}\\data.properties</file>
        <key>version</key>
        <variable>project.version</variable>
    </propertiesFileGet>
    <propertiesFileGet>
        <file>${build_project_directory}\\data.properties</file>
        <key>full_name</key>
        <variable>project.fullName</variable>
    </propertiesFileGet>
    <propertiesFileGet>
        <file>${build_project_directory}\\data.properties</file>
        <key>short_name</key>
        <variable>project.shortName</variable>
    </propertiesFileGet>
</preBuildActionList>

Or configure it through command line when building:

builder build project.xml --setvars project.version=1.8 project.fullName="Product B" project.shortName=productb

You can find additional information here.

link

answered 07 Nov '11, 04:05

juanjo's gravatar image

juanjo ♦♦
5.8k413
accept rate: 23%

I didn't know about the ability to read a property from a file. Very nice to have this available for peculiar build situations.

(08 Dec '11, 14:15) DevHopeful_2012

You can read it inside <preBuildActionList> actions. You will also need to create a hidden parameter so that this information is stored in installer as well.

For example in your case the following will read version.ini file from same directory where project XML file is located and read version key in [info] section:


 <project>
  <version>${app_version}</version>
  ...
  <preBuildActionList>
   <iniFileGet file="${build_project_directory}/version.ini" key="version" section="info" variable="app_version" />
  <preBuildActionList>
  ...
  <parameters>
   <stringParameter name="app_version" ask="0" />
  </parameters>
 </project>

The ${app_version} variable will contain version at build and installation time. You can use it for other purposes.

Another approach is to use --setvars parameter when building to specify variables that can then be used in the fields - by removing the <iniFileGet> action and doing:


$ bin/builder build project.xml linux --setvars app_version=1.1

More complex examples of doing custom builds and custom build targets are described in our documentation: Creating Custom Builds

link

answered 07 Nov '11, 04:14

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×26
×9
×9
×5
×3
×2

Asked: 07 Nov '11, 02:31

Seen: 2,713 times

Last updated: 08 Dec '11, 14:15