A
A
Alexey Petrov2016-06-17 12:39:22
PHP
Alexey Petrov, 2016-06-17 12:39:22

How to generate version or build number in xml file using Phing?

Hello.
I use Phing to build the installation package of the component for Joomla. I would like to make it so that the next version and/or assembly number would be automatically substituted into the <version></version> tag of the component's xml configuration file. Does anyone have an example of such a task?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Petrov, 2016-06-17
@Oegir

At least I figured out the version:

<target name="copy_admin_configure_files" description="Copying compontent configure files">
    <echo message="Copying component configure files" />
    <copy file="${joomla_admin_component}/index.html" todir="${package_temporary}" />
    <copy file="${joomla_admin_component}/script.php" todir="${package_temporary}" />

    <version releasetype="Bugfix" file="${package_root}/mycomponent_version.txt" property="version.number" />
    <copy todir="${package_temporary}">
      <fileset dir="${joomla_admin_component}">
        <include name="mycomponent.xml" />
      </fileset>
      <filterchain>
        <replaceregexp>
          <regexp pattern="&lt;version&gt;\d+\.\d+\.\d+&lt;\/version&gt;" replace="&lt;version&gt;${version.number}&lt;/version&gt;" ignoreCase="true" modifiers="m" />
        </replaceregexp>
      </filterchain>
    </copy>
  </target>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question