Refactor build process, update project configs, and clean up documentation
The build process has been refactored to improve maintainability and productivity. This includes simplifying the .gitlab-ci.yml file by utilizing a more updated image which has the necessary dependencies pre-installed. The Makefile has been heavily restructured to improve understandability and increase the flexibility of the build process. With these changes, the dependencies installation, uninstallation and removal of build artifacts can now be handled directly from the Makefile. The configuration in project.json was updated, reducing redundancy and clarifying output paths. In addition, README.md has been cleaned up to improve readability and keep the documentation up-to-date with the codebase changes. For instance, unnecessary functions in the usage section have been removed and links in the table of contents have been fixed. Lastly, the copyright dates in the LICENSE file have been extended to include 2023 and the format improved for better readability.
This commit is contained in:
parent
7895dc2464
commit
429ca491ed
5 changed files with 58 additions and 73 deletions
|
@ -1,43 +1,25 @@
|
|||
image: php:8.1
|
||||
image: repo.n64.cc:443/nosial/ncc:latest
|
||||
|
||||
before_script:
|
||||
# Install some stuff that the image doesn't come with
|
||||
- apt update -yqq
|
||||
- apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
|
||||
stages:
|
||||
- build
|
||||
- publish
|
||||
|
||||
# Install phive
|
||||
- wget -O phive.phar https://phar.io/releases/phive.phar
|
||||
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
|
||||
- gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79
|
||||
- gpg --verify phive.phar.asc phive.phar
|
||||
- chmod +x phive.phar
|
||||
- mv phive.phar /usr/local/bin/phive
|
||||
|
||||
# Install phab
|
||||
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
|
||||
|
||||
# Install the latest version of ncc (Nosial Code Compiler)
|
||||
- git clone https://git.n64.cc/nosial/ncc.git
|
||||
- cd ncc
|
||||
- make redist
|
||||
- php build/src/INSTALL --auto --install-composer
|
||||
- cd .. && rm -rf ncc
|
||||
variables:
|
||||
PACKAGE_NAME: $CI_COMMIT_REF_NAME
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- ncc build --config release --log-level debug
|
||||
- ncc build --config release --log-level debug -o "build/release/net.nosial.optslib.ncc"
|
||||
artifacts:
|
||||
paths:
|
||||
- build/
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
- "build/release/net.nosial.optslib.ncc"
|
||||
|
||||
release:
|
||||
stage: deploy
|
||||
publish:
|
||||
stage: publish
|
||||
before_script:
|
||||
- 'if [ "$CI_COMMIT_REF_NAME" == "master" ]; then PACKAGE_NAME="latest"; fi'
|
||||
script:
|
||||
- ncc build --config release --log-level debug
|
||||
artifacts:
|
||||
paths:
|
||||
- build/
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
- |
|
||||
curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" --upload-file build/release/net.nosial.optslib.ncc \
|
||||
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${CI_COMMIT_SHA}/net.nosial.optslib.ncc"
|
26
LICENSE
26
LICENSE
|
@ -1,18 +1,14 @@
|
|||
Copyright 2022 Nosial All Rights Reserved.
|
||||
Copyright 2022-2023 Nosial All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
||||
the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
29
Makefile
29
Makefile
|
@ -1,8 +1,27 @@
|
|||
release:
|
||||
ncc build --config="release"
|
||||
# Variables
|
||||
NCC = ncc
|
||||
PACKAGE_NAME = net.nosial.optslib.ncc
|
||||
BUILD_CONFIG = release
|
||||
|
||||
install:
|
||||
ncc package install --package="build/release/net.nosial.optslib.ncc" --skip-dependencies --reinstall -y
|
||||
# Directories
|
||||
SRC_DIR = src
|
||||
BUILD_DIR = build/$(BUILD_CONFIG)
|
||||
|
||||
.PHONY: all release install uninstall clean
|
||||
|
||||
all: release install
|
||||
|
||||
release: prepare_build
|
||||
$(NCC) build --config=$(BUILD_CONFIG)
|
||||
|
||||
install: prepare_build
|
||||
$(NCC) package install --package="$(BUILD_DIR)/$(PACKAGE_NAME)" --skip-dependencies -y
|
||||
|
||||
uninstall:
|
||||
ncc package uninstall -y --package="net.nosial.optslib"
|
||||
$(NCC) package uninstall -y --package="$(PACKAGE_NAME)"
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
prepare_build:
|
||||
mkdir -p $(BUILD_DIR)
|
18
README.md
18
README.md
|
@ -10,12 +10,11 @@ A basic Options parser and command-line arguments handling a library for PHP.
|
|||
* [Installation](#installation)
|
||||
* [Compiling from source](#compiling-from-source)
|
||||
* [Usage](#usage)
|
||||
* [parseArgument()](#parseargument--)
|
||||
* [getArguments()](#getarguments--)
|
||||
* [parseArgument()](#parseargument)
|
||||
* [getArguments()](#getarguments)
|
||||
* [Additional functionality](#additional-functionality)
|
||||
* [getRegex()](#getregex--)
|
||||
* [setRegex()](#setregex--)
|
||||
* [getArgsCache()](#getargscache--)
|
||||
* [getRegex()](#getregex)
|
||||
* [setRegex()](#setregex)
|
||||
* [Changelog](#changelog)
|
||||
* [License](#license)
|
||||
* [Logo](#logo)
|
||||
|
@ -37,7 +36,6 @@ the `build.dependencies` section:
|
|||
{
|
||||
"name": "net.nosial.optslib",
|
||||
"version": "latest",
|
||||
"source_type": "remote",
|
||||
"source": "nosial/libs.opts=latest@n64"
|
||||
}
|
||||
```
|
||||
|
@ -46,7 +44,7 @@ If you don't have the n64 source configured you can add it
|
|||
by running the following command:
|
||||
|
||||
```bash
|
||||
ncc source add --name n64 --type gitlab --host git.n64.cc
|
||||
ncc repository add --name n64 --type gitlab --host git.n64.cc
|
||||
```
|
||||
|
||||
## Compiling from source
|
||||
|
@ -165,12 +163,6 @@ the arguments, you can modify the default pattern to suit your needs.
|
|||
```
|
||||
|
||||
|
||||
### getArgsCache()
|
||||
|
||||
This method is used to return the arguments cache parsed from the global
|
||||
`$argv` variable, this can be used as a means of troubleshooting.
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
For a list of changes, see the [CHANGELOG.md](CHANGELOG.md) file.
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
"host": "git.n64.cc",
|
||||
"ssl": true
|
||||
}
|
||||
},
|
||||
"options": []
|
||||
}
|
||||
},
|
||||
"assembly": {
|
||||
"name": "OptsLib",
|
||||
|
@ -31,10 +30,7 @@
|
|||
{
|
||||
"name": "release",
|
||||
"build_type": "ncc",
|
||||
"options": {
|
||||
"compression": "high"
|
||||
},
|
||||
"output_path": "build/release"
|
||||
"output_path": "build/release/%ASSEMBLY.PACKAGE%.ncc"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue