Skip to content

Commit

Permalink
Add build settings
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomano committed Jan 6, 2025
1 parent 85682ce commit cbbb017
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
4 changes: 4 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source_file=src/package-info.xml
integration_file=src/Sources/Optimus/app.php
version_search_pattern=(<version>)(.*?)(<\/version>)
version_replace_pattern=<version>${release.version}</version>
46 changes: 46 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>

<project name="Optimus" default="build">
<target name="update_version">
<property file="build.properties" />
<xmlproperty file="${source_file}" keepRoot="false" />
<echo message="Current version is ${version}" />
<input message="What is your release type?" propertyName="release.type" defaultValue="thesame" validargs="thesame,major,minor,bugfix" />
<echo message="Release type: ${release.type}" />
<if>
<equals arg1="${release.type}" arg2="thesame" />
<then>
<property name="release.version" value="${version}" />
</then>
<else>
<version releasetype="${release.type}" startingVersion="${version}" property="release.version" />
<delete file="build.version" quiet="true" />
<echo message="${release.version}" />
<replaceregexp file="${source_file}" match="${version_search_pattern}" replace="${version_replace_pattern}" />
<replaceregexp file="${integration_file}" match="'OP_VERSION',\s*'(\d+\.\d+(?:.\d+)?)'" replace="'OP_VERSION', '${release.version}'"/>
</else>
</if>
</target>
<target name="build" depends="update_version">
<delete file="optimus_${release.version}.zip" quiet="true" />
<zip destfile="optimus_${release.version}.zip">
<fileset dir=".">
<include name="LICENSE" />
</fileset>
<fileset dir="./src">
<include name="Themes/**" />
<exclude name="**/.idea/**" />
<include name="Sources/**" />
<exclude name="Sources/Optimus/Addons/ExtraSettings/**" />
<exclude name="Sources/Optimus/Addons/IndexNow/**" />
<exclude name="Sources/Optimus/Addons/ExampleAddon.php" />
<exclude name="Sources/Optimus/Addons/SafeLinks.php" />
<exclude name="Sources/Optimus/Addons/StructuredData.php" />
<exclude name="Sources/Optimus/composer.json" />
<exclude name="Sources/Optimus/composer.lock" />
<include name="package-info.xml" />
<include name="*.php" />
</fileset>
</zip>
</target>
</project>
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"require-dev": {
"bugo/smf-compat": "^0.2",
"pestphp/pest": "^2.36",
"phing/phing": "^3.0",
"rector/rector": "^2.0",
"symfony/http-foundation": "^6.4"
},
Expand All @@ -27,7 +28,11 @@
"tests-coverage": "vendor/bin/pest --colors=always --coverage --min=90",
"tests-coverage-clover": "vendor/bin/pest --colors=always --min=90 --coverage-clover coverage.xml",
"tests-coverage-html": "vendor/bin/pest --colors=always --min=90 --coverage-html coverage",
"post-update-cmd": "cd src/Sources/Optimus && composer update --no-dev -o"
"post-update-cmd": "cd src/Sources/Optimus && composer update --no-dev -o",
"build": [
"composer update",
"vendor/bin/phing"
]
},
"config": {
"allow-plugins": {
Expand Down

0 comments on commit cbbb017

Please sign in to comment.