Compare commits

..

No commits in common. "master" and "1.0.1-alpha" have entirely different histories.

881 changed files with 133735 additions and 44130 deletions

View file

@ -1,136 +0,0 @@
name: CI Pipeline
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, ctype, common, zip
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y git libpq-dev libzip-dev zip make wget gnupg
- name: Install Phive
run: |
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
sudo mv phive.phar /usr/local/bin/phive
- name: Install PHPAB
run: sudo phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- name: Build project
run: make redist
- name: Find NCC build directory
id: find-ncc-dir
run: echo "NCC_DIR=$(find build/ -type d -name 'ncc_*' | head -n 1)" >> $GITHUB_ENV
- name: Upload NCC build directory
uses: actions/upload-artifact@v3
with:
name: ncc-build
path: ${{ env.NCC_DIR }}
- name: Create redist.zip
run: zip -r redist.zip ${{ env.NCC_DIR }}
- name: Upload redist.zip
uses: actions/upload-artifact@v3
with:
name: redist-zip
path: redist.zip
- name: Build Debian package
run: make deb
- name: Find Debian package
id: find-deb
run: echo "DEB_FILE=$(find build/ -type f -name '*.deb' | head -n 1)" >> $GITHUB_ENV
- name: Upload Debian package
uses: actions/upload-artifact@v3
with:
name: ncc-deb
path: ${{ env.DEB_FILE }}
test-install:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download NCC build directory
uses: actions/download-artifact@v3
with:
name: ncc-build
path: build
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, ctype, common, zip
- name: Test NCC installation
run: |
ls -l build
sudo php build/INSTALL --auto
upload-release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release' && github.event.action == 'created'
permissions: write-all
steps:
- name: Download redist.zip
uses: actions/download-artifact@v3
with:
name: redist-zip
path: .
- name: Download Debian package
uses: actions/download-artifact@v3
with:
name: ncc-deb
path: .
- name: Set DEB_FILE environment variable
run: echo "DEB_FILE=$(find . -type f -name '*.deb' | head -n 1)" >> $GITHUB_ENV
- name: Upload redist.zip to release
uses: softprops/action-gh-release@v1
with:
files: redist.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload ncc.deb to release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.DEB_FILE }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

12
.gitignore vendored
View file

@ -8,14 +8,13 @@
build
# Autoload files
src/ncc/ThirdParty/composer/Semver/autoload_spl.php
src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php
src/ncc/ThirdParty/jelix/version/autoload_spl.php
src/ncc/ThirdParty/nikic/PhpParser/autoload_spl.php
src/ncc/ThirdParty/php_parallel_lint/php_console_color/autoload_spl.php
src/ncc/ThirdParty/Symfony/polyfill_ctype/autoload_spl.php
src/ncc/ThirdParty/Symfony/polyfill_mbstring/autoload_spl.php
src/ncc/ThirdParty/Symfony/polyfill_uuid/autoload_spl.php
src/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php
src/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php
src/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php
src/ncc/ThirdParty/Symfony/Process/autoload_spl.php
src/ncc/ThirdParty/Symfony/Uid/autoload_spl.php
src/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php
@ -28,7 +27,4 @@ src/ncc/autoload.php
# Test files
tests/example_project/project.json
tests/example_project/ncc
tests/example_project/build
/.phpunit.result.cache
/.idea/php-test-framework.xml
/.idea/gbrowser_project.xml
tests/example_project/build

View file

@ -1,132 +1,34 @@
image: php:8.2
stages:
- setup
- build
- docker
- publish
image: php:8.1
before_script:
- apt update -yqq
- apt install -yqq git libzip-dev zip make wget gnupg2 libonig-dev libcurl4-openssl-dev
- apt-get clean
# 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
# Prepare the environment
setup:
stage: setup
script:
- docker-php-ext-install mbstring ctype posix zip curl fileinfo
# 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 phpab
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
# Build the project using the Makefile
build:
stage: build
script:
- wget -O phive.phar https://phar.io/releases/phive.phar
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
- chmod +x phive.phar
- mv phive.phar /usr/local/bin/phive
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- make autoload
script:
- make tar
rules:
- if: $CI_COMMIT_BRANCH
release:
script:
- make redist
- make tar
artifacts:
paths:
- build/*.tar.gz
# Build the debian package using the Makefile
build-debian:
stage: build
script:
- wget -O phive.phar https://phar.io/releases/phive.phar
- wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
- chmod +x phive.phar
- mv phive.phar /usr/local/bin/phive
- phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
- make autoload
- make redist
- make deb
artifacts:
paths:
- build/*.deb
# Build the Alpine Docker image
docker-alpine:
image: docker:latest
stage: docker
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "master" ]]; then
DOCKER_TAG="latest"
elif [[ ! -z "$CI_COMMIT_TAG" ]]; then
DOCKER_TAG="$CI_COMMIT_TAG"
else
DOCKER_TAG="$CI_COMMIT_REF_SLUG"
fi
- docker build -f Dockerfile -t $CI_REGISTRY_IMAGE:$DOCKER_TAG .
- docker push $CI_REGISTRY_IMAGE:$DOCKER_TAG
rules:
- exists:
- Dockerfile
# Build the Debian Docker image
docker-debian:
image: docker:latest
stage: docker
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "master" ]]; then
DOCKER_TAG="debian"
elif [[ ! -z "$CI_COMMIT_TAG" ]]; then
DOCKER_TAG="$CI_COMMIT_TAG-debian"
else
DOCKER_TAG="$CI_COMMIT_REF_SLUG-debian"
fi
- docker build -f Dockerfile.debian -t $CI_REGISTRY_IMAGE:$DOCKER_TAG .
- docker push $CI_REGISTRY_IMAGE:$DOCKER_TAG
rules:
- exists:
- Dockerfile.debian
# Publish the tarball and Debian package to the GitLab Package Registry
publish:
stage: publish
script:
- |
if [[ ! -z "$CI_COMMIT_TAG" ]]; then
PACKAGE_NAME=$CI_COMMIT_TAG
FILE_NAME_TAR="ncc-$CI_COMMIT_TAG.tar.gz"
FILE_NAME_DEB="ncc-$CI_COMMIT_TAG.deb"
else
BRANCH_NAME=$(echo $CI_COMMIT_REF_NAME | sed 's/\//-/g')
COMMIT_ID=${CI_COMMIT_SHORT_SHA}
PACKAGE_NAME="$BRANCH_NAME-$COMMIT_ID"
FILE_NAME_TAR="ncc-$PACKAGE_NAME.tar.gz"
FILE_NAME_DEB="ncc-$PACKAGE_NAME.deb"
fi
mv build/*.tar.gz build/$FILE_NAME_TAR
mv build/*.deb build/$FILE_NAME_DEB
echo "Package Name: $PACKAGE_NAME"
echo "Tarball File Name: $FILE_NAME_TAR"
echo "Debian Package File Name: $FILE_NAME_DEB"
# Upload the tarball
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file build/$FILE_NAME_TAR \
"https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/packages/generic/$PACKAGE_NAME/$CI_PIPELINE_ID/$FILE_NAME_TAR"
# Upload the Debian package
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file build/$FILE_NAME_DEB \
"https://$CI_SERVER_HOST/api/v4/projects/$CI_PROJECT_ID/packages/generic/$PACKAGE_NAME/$CI_PIPELINE_ID/$FILE_NAME_DEB"
only:
- branches
- tags
- mkdir ncc_$CI_COMMIT_TAG
- cp -r build/src/* ncc_$CI_COMMIT_TAG/
artifacts:
paths:
- ncc_$CI_COMMIT_TAG/
rules:
- if: $CI_COMMIT_TAG

1
.idea/.name generated
View file

@ -1 +0,0 @@
Nosial Code Compiler

View file

@ -1,7 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>

4
.idea/icon.svg generated
View file

@ -1,4 +0,0 @@
<svg width="160" height="160" viewBox="0 0 160 160" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M80 0C76.001 0 72.002 1.51978 68.7229 4.71944L4.73883 68.7113C-1.57961 74.9506 -1.57961 85.0293 4.73883 91.2685L68.7229 155.261C74.9613 161.58 85.0388 161.58 91.2772 155.261L155.261 91.2685C161.58 85.0293 161.58 74.9506 155.261 68.7113L91.2772 4.71944C87.998 1.51978 83.999 0 80 0Z" fill="#111111"/>
<path d="M55.2178 55C53.9929 55 53 55.949 53 57.1197V80.9658C53 82.1365 53.9929 83.0855 55.2178 83.0855H72.1287V108.622L81 117L89.8713 108.622V83.0855H106.782C108.007 83.0855 109 82.1365 109 80.9658V57.1197C109 55.949 108.007 55 106.782 55H55.2178Z" fill="#EEEEEE"/>
</svg>

Before

Width:  |  Height:  |  Size: 683 B

View file

@ -1,79 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ContractViolationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<Languages>
<language minSize="133" name="PHP" />
</Languages>
</inspection_tool>
<inspection_tool class="ForgottenDebugOutputInspection" enabled="true" level="ERROR" enabled_by_default="true">
<option name="configuration">
<list>
<option value="\Codeception\Util\Debug::debug" />
<option value="\Codeception\Util\Debug::pause" />
<option value="\Doctrine\Common\Util\Debug::dump" />
<option value="\Doctrine\Common\Util\Debug::export" />
<option value="\Illuminate\Support\Debug\Dumper::dump" />
<option value="\Symfony\Component\Debug\Debug::enable" />
<option value="\Symfony\Component\Debug\DebugClassLoader::enable" />
<option value="\Symfony\Component\Debug\ErrorHandler::register" />
<option value="\Symfony\Component\Debug\ExceptionHandler::register" />
<option value="\TYPO3\CMS\Core\Utility\DebugUtility::debug" />
<option value="\Zend\Debug\Debug::dump" />
<option value="\Zend\Di\Display\Console::export" />
<option value="dd" />
<option value="debug_print_backtrace" />
<option value="debug_zval_dump" />
<option value="dpm" />
<option value="dpq" />
<option value="dsm" />
<option value="dump" />
<option value="dvm" />
<option value="error_log" />
<option value="kpr" />
<option value="phpinfo" />
<option value="print_r" />
<option value="var_dump" />
<option value="var_export" />
<option value="wp_die" />
<option value="xdebug_break" />
<option value="xdebug_call_class" />
<option value="xdebug_call_file" />
<option value="xdebug_call_function" />
<option value="xdebug_call_line" />
<option value="xdebug_code_coverage_started" />
<option value="xdebug_debug_zval" />
<option value="xdebug_debug_zval_stdout" />
<option value="xdebug_dump_superglobals" />
<option value="xdebug_enable" />
<option value="xdebug_get_code_coverage" />
<option value="xdebug_get_collected_errors" />
<option value="xdebug_get_declared_vars" />
<option value="xdebug_get_function_stack" />
<option value="xdebug_get_headers" />
<option value="xdebug_get_monitored_functions" />
<option value="xdebug_get_profiler_filename" />
<option value="xdebug_get_stack_depth" />
<option value="xdebug_get_tracefile_name" />
<option value="xdebug_is_enabled" />
<option value="xdebug_memory_usage" />
<option value="xdebug_peak_memory_usage" />
<option value="xdebug_print_function_stack" />
<option value="xdebug_start_code_coverage" />
<option value="xdebug_start_error_collection" />
<option value="xdebug_start_function_monitor" />
<option value="xdebug_start_trace" />
<option value="xdebug_stop_code_coverage" />
<option value="xdebug_stop_error_collection" />
<option value="xdebug_stop_function_monitor" />
<option value="xdebug_stop_trace" />
<option value="xdebug_time_index" />
<option value="xdebug_var_dump" />
</list>
</option>
<option name="migratedIntoUserSpace" value="true" />
</inspection_tool>
<inspection_tool class="IncorrectHttpHeaderInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="customHeaders">
<set>
@ -92,67 +19,8 @@
<option value="X-Args-3" />
<option value="X-Args-4" />
<option value="X-Args-5" />
<option value="X-Temperature" />
<option value="X-Model" />
<option value="X-OPENAI-API-KEY" />
</set>
</option>
</inspection_tool>
<inspection_tool class="SecurityAdvisoriesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="optionConfiguration">
<list>
<option value="barryvdh/laravel-debugbar" />
<option value="behat/behat" />
<option value="brianium/paratest" />
<option value="codeception/codeception" />
<option value="codedungeon/phpunit-result-printer" />
<option value="composer/composer" />
<option value="doctrine/coding-standard" />
<option value="filp/whoops" />
<option value="friendsofphp/php-cs-fixer" />
<option value="humbug/humbug" />
<option value="infection/infection" />
<option value="jakub-onderka/php-parallel-lint" />
<option value="johnkary/phpunit-speedtrap" />
<option value="kalessil/production-dependencies-guard" />
<option value="mikey179/vfsStream" />
<option value="mockery/mockery" />
<option value="mybuilder/phpunit-accelerator" />
<option value="orchestra/testbench" />
<option value="pdepend/pdepend" />
<option value="phan/phan" />
<option value="phing/phing" />
<option value="phpcompatibility/php-compatibility" />
<option value="phpmd/phpmd" />
<option value="phpro/grumphp" />
<option value="phpspec/phpspec" />
<option value="phpspec/prophecy" />
<option value="phpstan/phpstan" />
<option value="phpunit/phpunit" />
<option value="povils/phpmnd" />
<option value="roave/security-advisories" />
<option value="satooshi/php-coveralls" />
<option value="sebastian/phpcpd" />
<option value="slevomat/coding-standard" />
<option value="spatie/phpunit-watcher" />
<option value="squizlabs/php_codesniffer" />
<option value="sstalle/php7cc" />
<option value="symfony/debug" />
<option value="symfony/maker-bundle" />
<option value="symfony/phpunit-bridge" />
<option value="symfony/var-dumper" />
<option value="vimeo/psalm" />
<option value="wimg/php-compatibility" />
<option value="wp-coding-standards/wpcs" />
<option value="yiisoft/yii2-coding-standards" />
<option value="yiisoft/yii2-debug" />
<option value="yiisoft/yii2-gii" />
<option value="zendframework/zend-coding-standard" />
<option value="zendframework/zend-debug" />
<option value="zendframework/zend-test" />
</list>
</option>
</inspection_tool>
<inspection_tool class="UnknownInspectionInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
</profile>
</component>

2
.idea/modules.xml generated
View file

@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Nosial Code Compiler.iml" filepath="$PROJECT_DIR$/.idea/Nosial Code Compiler.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/ncc.iml" filepath="$PROJECT_DIR$/.idea/ncc.iml" />
</modules>
</component>
</project>

View file

@ -5,7 +5,6 @@
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tests/example_project/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tests/projects/lib/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/docs" />
<excludeFolder url="file://$MODULE_DIR$/tests/example_project/ncc" />

View file

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EAUltimateProjectSettings">
<categories>
<STRICTNESS_CATEGORY_SECURITY enabled="yes" />
<STRICTNESS_CATEGORY_PROBABLE_BUGS enabled="yes" />
<STRICTNESS_CATEGORY_PERFORMANCE enabled="yes" />
<STRICTNESS_CATEGORY_ARCHITECTURE enabled="yes" />
<STRICTNESS_CATEGORY_CONTROL_FLOW enabled="yes" />
<STRICTNESS_CATEGORY_LANGUAGE_LEVEL_MIGRATION enabled="yes" />
<STRICTNESS_CATEGORY_CODE_STYLE enabled="yes" />
<STRICTNESS_CATEGORY_UNUSED enabled="yes" />
<STRICTNESS_CATEGORY_PHPUNIT enabled="yes" />
</categories>
<settings>
<ANALYZE_ONLY_MODIFIED_FILES value="no" />
<PREFER_YODA_COMPARISON_STYLE value="no" />
</settings>
</component>
</project>

12
.idea/php.xml generated
View file

@ -14,22 +14,12 @@
<path value="/usr/share/php" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.3">
<component name="PhpProjectSharedConfiguration" php_language_level="8.2">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpRuntimeConfiguration">
<extensions>
<extension name="msgpack" enabled="true" />
</extensions>
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PhpUnit">
<phpunit_settings>
<PhpUnitSettings load_method="PHPUNIT_PHAR" custom_loader_path="" phpunit_phar_path="$USER_HOME$/phpunit.phar" />
</phpunit_settings>
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>

View file

@ -1,10 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Build Redist" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
<makefile filename="$PROJECT_DIR$/Makefile" target="redist" workingDirectory="" arguments="">
<envs />
</makefile>
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Clean" run_configuration_type="MAKEFILE_TARGET_RUN_CONFIGURATION" />
</method>
</configuration>
</component>

View file

@ -1,10 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Rebuild Autoloaders" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
<makefile filename="$PROJECT_DIR$/Makefile" target="autoload" workingDirectory="" arguments="">
<envs />
</makefile>
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Clean" run_configuration_type="MAKEFILE_TARGET_RUN_CONFIGURATION" />
</method>
</configuration>
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="NCC Source files" pattern="file[Nosial Code Compiler]:src/ncc/Managers//*||file[Nosial Code Compiler]:src/ncc/Enums//*||file[Nosial Code Compiler]:src/ncc/Exceptions//*||file[Nosial Code Compiler]:src/ncc/Runtime//*||file[Nosial Code Compiler]:src/ncc/Extensions//*||file[Nosial Code Compiler]:src/ncc/CLI//*||file[Nosial Code Compiler]:src/ncc/Classes//*||file[Nosial Code Compiler]:src/ncc/Objects//*||file[Nosial Code Compiler]:src/ncc/Interfaces//*||file[Nosial Code Compiler]:src/ncc/Utilities//*||file:src/ncc/ncc.php||file:src/ncc/ncc||file:src/ncc/banner_basic||file:src/ncc/autoload_spl.php||file:src/ncc/autoload.php||file:src/ncc/Runtime.php" />
<scope name="NCC Source files" pattern="file[ncc]:src/ncc/Managers//*||file[ncc]:src/ncc/Abstracts//*||file[ncc]:src/ncc/Exceptions//*||file[ncc]:src/ncc/Runtime//*||file[ncc]:src/ncc/Extensions//*||file[ncc]:src/ncc/CLI//*||file[ncc]:src/ncc/Classes//*||file[ncc]:src/ncc/Objects//*||file[ncc]:src/ncc/Interfaces//*||file[ncc]:src/ncc/Utilities//*||file:src/ncc/ncc.php||file:src/ncc/ncc||file:src/ncc/banner_basic||file:src/ncc/autoload_spl.php||file:src/ncc/autoload.php||file:src/ncc/Runtime.php" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Symfony\Filesystem" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/Symfony/Filesystem//*" />
<scope name="Symfony\Filesystem" pattern="file[ncc]:src/ncc/ThirdParty/Symfony/Filesystem//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Symfony\Process" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/Symfony/Process//*" />
<scope name="Symfony\Process" pattern="file[ncc]:src/ncc/ThirdParty/Symfony/Process//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Symfony\Uid" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/Symfony/Uid//*" />
<scope name="Symfony\Uid" pattern="file[ncc]:src/ncc/ThirdParty/Symfony/Uid//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Symfony\Yaml" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/Symfony/Yaml//*" />
<scope name="Symfony\Yaml" pattern="file[ncc]:src/ncc/ThirdParty/Symfony/Yaml//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Symfony\polyfill-ctype" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/Symfony/polyfill_ctype//*" />
<scope name="Symfony\polyfill-ctype" pattern="file[ncc]:src/ncc/ThirdParty/Symfony/polyfill-ctype//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Symfony\polyfill-mbstring" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/Symfony/polyfill_mbstring//*" />
<scope name="Symfony\polyfill-mbstring" pattern="file[ncc]:src/ncc/ThirdParty/Symfony/polyfill-mbstring//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Symfony\polyfill-uuid" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/Symfony/polyfill_uuid//*" />
<scope name="Symfony\polyfill-uuid" pattern="file[ncc]:src/ncc/ThirdParty/Symfony/polyfill-uuid//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Third Party Source Files" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty//*" />
<scope name="Third Party Source Files" pattern="file[ncc]:src/ncc/ThirdParty//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="defuse" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/defuse//*" />
<scope name="defuse" pattern="file[ncc]:src/ncc/ThirdParty/defuse//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="defuse\php-encryption" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/defuse/php-encryption//*" />
<scope name="defuse\php-encryption" pattern="file[ncc]:src/ncc/ThirdParty/defuse/php-encryption//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="jelix" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/jelix//*" />
<scope name="jelix" pattern="file[ncc]:src/ncc/ThirdParty/jelix//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="jelix\version" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/jelix/version//*" />
<scope name="jelix\version" pattern="file[ncc]:src/ncc/ThirdParty/jelix/version//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="nikic" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/nikic//*" />
<scope name="nikic" pattern="file[ncc]:src/ncc/ThirdParty/nikic//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="nikic\PhpParser" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/nikic/PhpParser//*" />
<scope name="nikic\PhpParser" pattern="file[ncc]:src/ncc/ThirdParty/nikic/PhpParser//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="theseer" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/theseer//*" />
<scope name="theseer" pattern="file[ncc]:src/ncc/ThirdParty/theseer//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="theseer\Autoload" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/theseer/Autoload//*" />
<scope name="theseer\Autoload" pattern="file[ncc]:src/ncc/ThirdParty/theseer/Autoload//*" />
</component>

View file

@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="theseer\DirectoryScanner" pattern="file[Nosial Code Compiler]:src/ncc/ThirdParty/theseer/DirectoryScanner//*" />
<scope name="theseer\DirectoryScanner" pattern="file[ncc]:src/ncc/ThirdParty/theseer/DirectoryScanner//*" />
</component>

View file

@ -7,7 +7,6 @@
<resourceRoots>
<path value="file://$PROJECT_DIR$/templates" />
<path value="file://$PROJECT_DIR$/assets" />
<path value="file://$PROJECT_DIR$/scratch" />
</resourceRoots>
</entryData>
</entry>

View file

@ -5,623 +5,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.1.6] - 2024-10-29
This update introduces critical bug fixes
### Fixed
- Validate package instance before checking execution policy
## [2.1.5] - 2024-10-14
This update introduces a critical bug fix
## [2.1.4] - 2024-10-13
This update introduces minor bug fixes & improvements
### Added
- Added new constant `%DEFAULT_BUILD_CONFIGURATION%` which points to the project's default build configuration
- Added new dynamic constant `%BUILD_OUTPUT_PATH%` which can be used as `%BUILD_OUTPUT_PATH%:release` to show the
output path of a specific build configuration
- Refactor CI templates to support dynamic build targets
- Added template `phpexe` & `phpgz` for generating executable binaries and compressed executables for the project
### Changed
- Refactor phpmake template to support dynamic build targets
### Fixed
- ncc will now correctly handle package execution where the main unit is not defined in the package instead of
throwing an exception.
- Executable Compiler will now correctly create a directory if it does not exist when compiling a package using gcc
## [2.1.3] - 2024-09-27
This update introduces bug fixes
### Fixed
- Null-pointer fix
## [2.1.2] - 2024-09-27
This update introduces bug fixes
### Added
- Add getter methods for installation lifecycle steps
- Added pre-install & post-install execution unit handling
### Changed
- Updated DocStrings in PackageManager
### Fixed
- Fixed incorrect enum usage in RepositoryMenu
## [2.1.1] - 2024-09-24
This update introduces a couple of new features and quality of life improvements
### Added
- Added new PHP template `phpunit` for generating PhpUnit tests for the project
- Added new PHP template `phpmake` for generating a Makefile for the project
- Added new PHP template `phplib_full` That combines `phplib`, `phpmake` and `phpunit` templates
- Added new PHP template `phpcli_full` That combines `phpcli`, `phplib`, `phpmake` and `phpunit` templates
- Added new PHP template `phpci_github` that generates a Github CI workflow for the project
### Changed
- The template `phpcli` no longer includes a Makefile, instead use `phpmake` to generate a Makefile for the project
### Fixed
- Fixed incorrect enum usage with a logging method call.
## [2.1.0] - 2024-09-20
This update introduces a refactored code-base, code quality improvements, and better exception handling.
### Added
- Added Test unit tests/ncc/Objects/Package/ComponentTest.php
- Added Test unit tests/ncc/Utilities/ResolverTest.php
- Added Test unit tests/ncc/Utilities/SecurityTest.php
- Added Test unit tests/ncc/Utilities/ValidateTest.php
- Add support for runtime constants
### Changed
- Convert Versions constants to enum cases
- Update Scopes to enum and adjust scope checks
- Convert Runners class to enum with string cases
- Convert RegexPatterns constants to enum cases
- Convert ProjectTemplates constants to enum cases
- Convert PackageStructureVersions constants to enum cases
- Convert PackageStructure constants to enum cases
- Convert PackageDirectory constants to enum cases
- Convert LogLevel constants to enum cases
- Convert FileDescriptor constants to enum cases
- Convert ExceptionCodes constants to enum cases
- Convert ConsoleColors constants to enum cases
- Convert CompilerExtensions constants to enum cases
- Convert RepositoryType constants to enum cases
- Convert RepositoryResultType constants to enum cases
- Convert ProjectType constants to enum cases
- Convert HttpRequestType constants to enum cases
- Convert ComposerStabilityTypes constants to enum cases
- Convert ComposerPackageTypes constants to enum cases
- Convert ComponentDataType constants to enum cases
- Convert BuildOutputType constants to enum cases
- Convert AuthenticationType constants to enum cases
- Convert RuntimeConstants constants to enum cases
- Convert InstallConstants constants to enum cases
- Convert DateTimeConstants constants to enum cases
- Convert BuildConstants constants to enum cases
- Convert AssemblyConstants constants to enum cases
- Convert ProjectOptions constants to enum cases
- Convert InstallPackageOptions constants to enum cases
- Convert InitializeProjectOptions constants to enum cases
- Convert ComponentDecodeOptions constants to enum cases
- Convert BuildConfigurationValues constants to enum cases
- Convert BuildConfigurationOptions constants to enum cases
- Convert CompressionOptions constants to enum cases
- Convert PackageFlags constants to enum cases
- Convert NccBuildFlags constants to enum cases
- Convert ComponentFlags constants to enum cases
- Refactor flag handling to use PackageFlags enum directly
- Refactor checkLogLevel to correctly utilize LogLevel cases
- Refactor code to improve readability in Resolver.php
- Update PHP include paths in project configuration
- Refactor logging level checks to use LogLevel enum directly
- Refactor log level parsing with enum method
- Refactor log level checking to enum method
- Updated Symfony/Filesystem from version 6.3.1 to 7.1.2
- Refactor ProjectType handling
- Validate and enforce repository type enum usage
- Updated Composer/Semver to 3.4.3
- Rename 'semver' directory to 'Semver' in composer package
- Refactor project constants handling in NccCompiler
- Updated Symfony/Yaml to version 7.1.4
- Updated Symfony/Uid to version 7.1.4
- Updated Symfony/Process to version 7.1.3
- Updated Symfony/polyfill-ctype to version 1.31.0
- Updated Symfony/polyfill-mbstring to version 1.31.0
- Updated Symfony/polyfill-uuid to version 1.31.0
- Updated nikic/PhpParser to version 5.2.0
### Fixed
- Fixed Division by zero in PackageManager
- Fixed runner argument passing for ExecCommand
### Removed
- Removed EncoderType enum file, unused.
- Removed PackageStandardVersions.php
- Removed ConstantReferences.php
- Removed HttpStatusCodes.php
- Removed CompilerExtensionDefaultVersions.php
- Removed RemoteSourceType
- Removed DependencySourceType
- Removed BuiltinRemoteSourceType
- Removed RuntimeImportOptions
- Remove ComponentFileExtensions enum
- Remove unused import and redundant scope validation method
## [2.0.3] - 2023-10-17
This update includes enhanced support for PHP statements in AST traversal, a friendly CLI Progress Bar, and fixes
related to package version searching, ncc's extension registration, and error handling in PackageManagerMenu.
The changes improve the system's efficiency, error resilience, and user experience.
### Added
- Implemented support in the AST traversal for the PHP statements `include`, `include_once`, `require`, and
`require_once`. These statements are transformed into function calls. With this change, ncc can correctly handle and
import files from system packages or direct binary package files.
- Added new `ConsoleProgressBar` class for UI improvement, imrpoved the CLI Progress Bar inspired by
[pacman](https://wiki.archlinux.org/title/pacman)
### Fixed
- When finding package versions in the package lock, ncc will try to find a satisfying version rather than the exact
version, this is to prevent[CHANGELOG.md](CHANGELOG.md) errors when the package lock contains a version that is not available in the repository.
- Fixed issue when registering ncc's extension, when using the INSTALLER, the installation path used in the process
appears to be incorrect, added a optional parameter to the `registerExtension` method to allow the installer to pass
the correct installation path.
- Add error handling for unspecified package in PackageManagerMenu
## [2.0.2] - 2023-10-13
In this new update, the software introduces a feature for importing static packages without extra dependencies and
supports pulling static versions of packages from repositories. Changes include enhanced security through an updated
fetchPackage method along with improvements in dependency imports and extension registration logic for Debian packages.
Finally, bugs related to unnecessary bundling of some build artifacts and mime type errors in ncc-package.xml have
been fixed.
### Added
- Added support for importing static packages from the system, allowing you to install static packages onto your
system and import them without importing additional dependencies that isn't already included in the package.
- Added the ability to pull static versions of packages from repositories where package names ending with `-static.ncc`
or `_static.ncc` can be pulled if you use the `--prefer-static` or `--static` option when using the `package install`
command. Otherwise, the normal package will be installed, avoiding static versions.
### Changed
- Updated fetchPackage method to include authentication
- Update dependencies import in \ncc\Classes > Runtime > importFromPackage()
- Refactor ncc extension registration logic, this also allows for debian packages to install the ncc extension
automatically.
### Fixed
- Fixed issue where some build artifacts are being bundled with package builds such as `output_path` and `static`
where they should not be included in the package.
- Corrected mistakes in `ncc-package.xml` mime type
## [2.0.1] - 2023-10-11
Added a new feature in `ProjectManager.php` that allows automatic installation of a project's dependencies. The
`installDependencies` function eases the task of separately installing each dependency. Now, both public and private
dependencies can be installed collectively using the 'install' command added in `ProjectMenu.php`. This functionality
is further documented in `DOCUMENTATION.md`
### Added
- Add functionality to install project dependencies with the new `project install` command in `ProjectMenu.php`
### Fixed
- Correct exception message for configuration property in `\ncc\Objects\ProjectConfiguration\Build > BuildConfiguration > fromArray()`
## [2.0.0] - 2023-10-10
This update introduces major changes in the codebase, including the removal of Win32 support, and the addition of new
features. This is the Mk II of ncc, and it is a major update, so please read the changelog carefully.
### Known issues
- `require` and `include` statements are not supported; when running a program directly, this feature will be added in
a future update. Using these statements will result in files not being found.
### Added
- `LICENSE.md` & `license.md` are now detected as license files in `\ncc\Classes\ComposerExtension > ComposerSourceBuiltin > convertProject()`
- Added new exception `PathNotFoundException` and implemented it in replacement for `DirectoryNotFoundException` and
`FileNotFoundException` in `\ncc\Exceptions`
- Added a new interface class `BytecodeObjectInterface` which will be used to implement object types for compiled assets
- Added new exception `GitException` in `\ncc\Exceptions` to replace all git related exceptions
- Added new exception `PackageException` in `\ncc\Exceptions` to replace all package related exceptions
- Added new exception `OperationException` in `\ncc\Exceptions` to replace all generic related exceptions
- Added a new interface class `SerializableObjectInterface` to implement serializable objects, `BytecodeObjectInterface`
extends this interface to allow for serialization of compiled assets
- Added a new interface class `ValidatableObjectInterface` to implement validatable objects, this method will throw a
`ConfigurationException` if the object is not valid or a `NotSupportedException` if the object contains methods that
are not supported by the current version of ncc or project.
- Added a new interface class `TemplateInterface` to implement template classes
- Added new template PhpCliTemplate `phpcli`
- Added new template PhpLibraryTemplate `phplib`
- Added the ability to clean arrays in `\ncc\Utilities > Functions > cleanArray()`
- Added the ability to compile executable binaries for php using `gcc`
- Added support for Gitea repositories
- Added support for Packagist repositories
- Added a new default gitea repository `nocturn9x` git.nocturn9x.space
- Added a new default gitea repository `martinvlba` git.martinvlba.eu
- Added a new default gitea repository `kuny` git.it-kuny.ch
- Added dependency `composer/semver` version 3.4.0 for composer version comparison compatibility
- Added new class `\ncc\Classes > ArchiveExtractor` to extract multiple archive types
### Fixed
- Fixed MITM attack vector in `\ncc\Classes > HttpClient > prepareCurl()`
- Fixed all @throw tags in the project to use the correct exception class
- Fixed hash comparisons to use `hash_equals` implementations to combat against Timing Attacks
### Changed
- Corrected code-smell and code style issues in `\ncc\Classes > HttpClient`
- Corrected code-smell and code style issues in `\ncc\Classes > BashExtension > BashRunner`
- Corrected code-smell and code style issues in `\ncc\Classes > ComposerExtension > ComposerSourceBuiltin`
- Corrected code-smell and code style issues in `\ncc\Classes > GithubExtension > GithubService`
- Corrected code-smell and code style issues in `\ncc\Classes > GitlabExtension > GitlabService`
- Corrected code-smell and code style issues in `\ncc\Classes > NccExtension > ConstantCompiler`
- Renamed `Abstracts` namespace to `Enums`
- Updated class type to "final class" in `\ncc\Enums\Options > BuildConfigurationValues`
- Updated class type to "final class" in `\ncc\Enums\Options > InitializeProjectOptions`
- Updated class type to "final class" in `\ncc\Enums\Options > InstallPackageOptions`
- Updated class type to "final class" in `\ncc\Enums\SpecialConstants > AssemblyConstants`
- Updated class type to "final class" in `\ncc\Enums\SpecialConstants > BuildConstants`
- Updated class type to "final class" in `\ncc\Enums\SpecialConstants > DateTimeConstants`
- Updated class type to "final class" in `\ncc\Enums\SpecialConstants > InstallConstants`
- Updated class type to "final class" in `\ncc\Enums\SpecialConstants > RuntimeConstants`
- Updated class type to "final class" in `\ncc\Enums > AuthenticationType`
- Updated class type to "final class" in `\ncc\Enums > CompilerExtensionDefaultVersions`
- Updated class type to "final class" in `\ncc\Enums > CompilerExtensions`
- Updated class type to "final class" in `\ncc\Enums > CompilerExtensionSupportedVersions`
- Updated class type to "final class" in `\ncc\Enums > ComponentDataType`
- Updated class type to "final class" in `\ncc\Enums > ComponentFileExtensions`
- Updated class type to "final class" in `\ncc\Enums > ComposerPackageTypes`
- Updated class type to "final class" in `\ncc\Enums > ComposerStabilityTypes`
- Updated class type to "final class" in `\ncc\Enums > EncoderType`
- Updated class type to "final class" in `\ncc\Enums > ExceptionCodes`
- Updated class type to "final class" in `\ncc\Enums > HttpRequestType`
- Updated class type to "final class" in `\ncc\Enums > HttpStatusCodes`
- Updated class type to "final class" in `\ncc\Enums > LogLevel`
- Updated class type to "final class" in `\ncc\Enums > NccBuildFlags`
- Updated class type to "final class" in `\ncc\Enums > PackageStandardVersions`
- Updated class type to "final class" in `\ncc\Enums > PackageStructureVersions`
- Updated class type to "final class" in `\ncc\Enums > ProjectType`
- Updated class type to "final class" in `\ncc\Enums > RegexPattern`
- Updated class type to "final class" in `\ncc\Enums > RemoteSourceType`
- Updated class type to "final class" in `\ncc\Enums > Runners`
- Updated class type to "final class" in `\ncc\Enums > Scopes`
- Updated class type to "final class" in `\ncc\Enums > Versions`
- Corrected code-smell and code style issues in `src/installer/hash_check.php`
- Corrected code-smell and code style issues in `\ncc\Managers > ProjectManager`
- Corrected code-smell and code style issues in `\ncc\Objects\NccVersionInformation > Component`
- Corrected code-smell and code style issues in `\ncc\Objects\Package > Component`
- Corrected code-smell and code style issues in `\ncc\Managers > ConfigurationManager`
- Corrected code-smell and code style issues in `\ncc\Managers > CredentialManager`
- Refactored `\ncc\Utilities > PathFinder` to remove all Win32 references
- Corrected code-smell and code style issues in `\ncc\Objects > ExecutionPointers`
- Corrected code-smell and code style issues in `\ncc\Managers > ExecutionPointerManager`
- Corrected code-smell and code style issues in `\ncc\Utilities > Functions`
- Corrected code-smell and code style issues in `\ncc\Managers > PackageManager`
- Corrected code-smell and code style issues in `\ncc\Utilities > IO`
- Corrected code-smell and code style issues in `\ncc > ncc`
- Corrected code-smell and code style issues in `\ncc\CLI > Main`
- Corrected code-smell and code style issues in `\ncc\Objects > Package`
- Corrected code-smell and code style issues in `\ncc\Classes\NccExtension > PackageCompiler`
- Corrected code-smell and code style issues in `\ncc\CLI > PackageManagerMenu`
- Corrected code-smell and code style issues in `\ncc\Classes\PhpExtension > PhpCompiler`
- Corrected code-smell and code style issues in `\ncc\Classes\PhpExtension > PhpInstaller`
- Corrected code-smell and code style issues in `\ncc\Classes\PhpExtension > PhpRunner`
- Corrected code-smell and code style issues in `\ncc\Objects > ProjectConfiguraiton`
- Corrected code-smell and code style issues in `\ncc\Managers > ProjectManager`
- Corrected code-smell and code style issues in `\ncc\Classes\Extensions\PythonExtension > Python2Runner`
- Corrected code-smell and code style issues in `\ncc\Classes\Extensions\PythonExtension > Python3Runner`
- Corrected code-smell and code style issues in `\ncc\Classes\Extensions\PythonExtension > PythonRunner`
- Corrected code-smell and code style issues in `\ncc\Interfaces > RunnerInterface`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects > Package`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects > Vault`
- Corrected code-smell and code style issues in `\ncc\Objects > Vault`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects > ProjectConfiguration`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects > ExecutionPointers`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects > DefinedRemoteSource`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\Vault > Entry`
- Corrected code-smell and code style issues in `\ncc\Objects\Vault\Password > AccessToken`
- Corrected code-smell and code style issues in `\ncc\Objects\Vault\Password > UsernamePassword`
- Extended `PasswordInterface` with `BytecodeObjectInterface`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\SymlinkDictionary > SymlinkEntry`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > UpdateSource`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Project`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Installer`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > ExecutionPolicy`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Dependecy`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Compiler`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Build`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration > Assembly`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\UpdateSource > Repository`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > Execute`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > ExitHandle`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > ExitHandlers`
- Implemented interface `BytecodeObjectInterface` into `\ncc\Objects\ProjectConfiguration\Build > BuildConfiguration`
- Updated `\ncc\Classes > GitClient > cloneRepository()` to throw `GitException` instead of `GitCloneException`
- Updated `\ncc\Classes > GitClient > checkout()` to throw `GitException` instead of `GitCheckoutException`
- Corrected code-smell and code style issues in `\ncc\Objects > PackageLock`
- Corrected code-smell and code style issues in `\ncc\Classes\PhpExtension > PhpRuntime`
- Updated class `\ncc\Objects\ProjectConfiguration > Dependency` to use method calls rather than direct property access
- Updated class `\ncc\Objects\ProjectConfiguration\Build > BuildConfiguration` to use method calls rather than direct
property access
- Updated class `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > Execute` to use method calls rather than direct
property access
- Changed all uppercase occurrences of `NCC` to `ncc` in the entire project
- Corrected code-smell and code style issues in `\ncc\Utilities > Base64`
- Corrected code-smell and code style issues in `\ncc\Utilities > Console`
- Updated class `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > ExitHandle` to use method calls rather than direct
property access
- Updated class `\ncc\Objects\ProjectConfiguration\ExecutionPolicy > ExitHandlers` to use method calls rather than
direct property access
- Updated class `\ncc\Objects\ProjectConfiguration\UpdateSource > Repository` to use method calls rather than direct
property access
- Updated class `\ncc\Objects\ProjectConfiguration > Assembly` to use method calls rather than direct property access
- Updated class `\ncc\Objects\ProjectConfiguration > Build` to use method calls rather than direct property access
- Updated class `\ncc\Objects\ProjectConfiguration > Compiler` to use method calls rather than direct property access
- Updated class `\ncc\Objects\ProjectConfiguration > ExecutionPolicy` to use method calls rather than direct property access
- Updated class `\ncc\Objects\ProjectConfiguration > Installer` to use method calls rather than direct property access
- Updated class `\ncc\Objects\ProjectConfiguration > Project` to use method calls rather than direct property access
- Updated class `\ncc\Objects\ProjectConfiguration > UpdateSource` to use method calls rather than direct property access
- Updated class `\ncc\Objects\ComposerJson > Author` to use method calls rather than direct property access and
implemented `SerializableObjectInterface`
- Updated class `\ncc\Objects\ComposerJson > Autoloader` to use method calls rather than direct property access and
implemented `SerializableObjectInterface`
- Updated class `\ncc\Objects\ComposerJson > Funding` to use method calls rather than direct property access and
implemented `SerializableObjectInterface`
- Updated class `\ncc\Objects\ComposerJson > NamespacePointer` to use method calls rather than direct property access
and implemented `SerializableObjectInterface`
- Updated class `\ncc\Objects\ComposerJson > PackageLink` to use method calls rather than direct property access and
implemented `SerializableObjectInterface`
- Updated class `\ncc\Objects\ComposerJson > Suggestion` to use method calls rather than direct property access and
implemented `SerializableObjectInterface`
- Updated class `\ncc\Objects\ComposerJson > Support` to use method calls rather than direct property access and
implemented `SerializableObjectInterface`
- Updated class `\ncc\Objects\ExecutionPointers > ExecutionPointer` to use method calls rather than direct property
access and implemented `BytecodeObjectInterface`
- Updated class `\ncc\Objects\NccVersionInformation > Component` to use method calls rather than direct property access
and implemented `SerializableObjectInterface`
- Updated class `\ncc\Objects\Package > Component` to use method calls rather than direct property access and
implemented `BytecodeObjectInterface`
- Updated class `\ncc\Objects\Package > ExecutionUnit` to use method calls rather than direct property access and
implemented `BytecodeObjectInterface`
- Updated class `\ncc\Objects\Package > Header` to use method calls rather than direct property access and implemented
`BytecodeObjectInterface`
- Updated class `\ncc\Objects\Package > Installer` to use method calls rather than direct property access and implemented
`BytecodeObjectInterface`
- Updated class `\ncc\Objects\Package > MagicBytes` to use method calls rather than direct property access and implemented
`SerializableObjectInterface`
- Updated class `\ncc\Objects\Package > Resource` to use method calls rather than direct property access and implemented
`BytecodeObjectInterface`
- Updated class `\ncc\Objects\PackageLock > DependencyEntry` to use method calls rather than direct property access
and implemented `BytecodeObjectInterface`
- Updated class `\ncc\Objects\PackageLock > PackageEntry` to use method calls rather than direct property access
and implemented `BytecodeObjectInterface`
- Updated class `\ncc\Objects\PackageLock > VersionEntry` to use method calls rather than direct property access
and implemented `BytecodeObjectInterface`
- Updated class `\ncc\Objects\SymlinkDictionary > SymlinkEntry` to use method calls rather than direct property access
- Updated class `\ncc\Objects\Vault\Password > AccessToken` to use method calls rather than direct property access
- Updated class `\ncc\Objects > CliHelpSection` to use method calls rather than direct property access
- Updated class `\ncc\Objects > ComposerJson` to use method calls rather than direct property access
- Updated class `\ncc\Objects > ComposerLock` to use method calls rather than direct property access
- Updated class `\ncc\Objects > DefinedRemoteSource` to use method calls rather than direct property access
- Updated class `\ncc\Objects > HttpRequest` to use method calls rather than direct property access and implemented
`SerializableObjectInterface`
- Updated class `\ncc\Objects > HttpResponse` to use method calls rather than direct property access and implemented
`SerializableObjectInterface`
- Corrected code-smell and code style issues in `\ncc\Objects > HttpResponseCache`
- Corrected code-smell and code style issues in `\ncc\Objects > InstallationPaths`
- Updated class `\ncc\Objects > NccVersionInformation` to use method calls rather than direct property access and implemented
`SerializableObjectInterface`
- Updated class `\ncc\Objects > Package` to use method calls rather than direct property access and implemented
`SerializableObjectInterface`
- Updated class `\ncc\Objects > PackageLock` to use method calls rather than direct property access and implemented
`BytecodeObjectInterface`
- Updated class `\ncc\Objects > ProjectConfiguration` to use method calls rather than direct property access
- Updated class `\ncc\Objects > ProjectDetectionResults` to use method calls rather than direct property access
- Updated class `\ncc\Objects > RemotePackageInput` to use method calls rather than direct property access
- Updated class `\ncc\Objects > RepositoryQueryResults` to use method calls rather than direct property access
- Updated class `\ncc\Objects > Vault` to use method calls rather than direct property access
- `\ncc\Objects\ProjectConfiguration > Compiler`: Added Public Constructor to automatically determine the minimum and
maximum supported compiler version for the selected extension
- `\ncc\Objects\ProjectConfiguration > Compiler > fromArray()` throws an ConfigurationException if the property `extension` is null
- `\ncc\Objects\ProjectConfiguration > Compiler > fromArray()` throws an NotSupportedException if the `extension` uses an
unsupported compiler extension
- `\ncc\Objects\ProjectConfiguration > Compiler > validate()` No longer accepts `$throw_exception` and throws an
`ConfigurationException` or `NotSupportedException` if the validation fails, otherwise it returns `True`.
- `\ncc\Objects\ProjectConfiguration > Project > fromArray()` Throws an `ConfigurationException` if the property `compiler`
is missing in the project configuration
- `\ncc\Objects > ProjectConfiguration > fromArray()` Throws an `ConfigurationException` if the property 'project' is
missing in the root configuration
- `\ncc\Objects\ProjectConfiguration > Project > __construct()` now requires the parameter `$compiler`
- `\ncc\Objects\ProjectConfiguration > Dependency > __construct()` now requires the parameters `$name`, `$source_type`,
`$source` and `$version`
- `\ncc\Objects\ProjectConfiguration > Dependency > fromArray()` Throws an `ConfigurationException` if the property
`name` is missing in the dependency configuration
- Also updated a bunch of objects in a similar fashion to the ones above, (BuildConfiguration, Execute, ExitHandle,
ExitHandler, Repository, Assembly, Build, Dependency, ExecutionPolicy, Installer, Project, UpdateSource) I'm not
going to list them all here, but you can find them in the commit history.
- Implemented a template engine and refactored the CLI menu for the Project Manager and added a new `template` command
- Refactored the entire package structure to ncc package structure 2.0 for memory efficiency and performance
- Refactored execution unit system to use a new execution pointer system
- Refactored `PhpRunner` to use the new execution pointer system
- Refactored `BashRunner` to use the new execution pointer system
- Refactored `LuaRunner` to use the new execution pointer system
- Refactored `PerlRunner` to use the new execution pointer system
- Refactored `PythonRunner` to use the new execution pointer system
- Refactored `\ncc\Objects > RemoteRepository`
- Refactored the repository system
- Refactored Github's repository interface
- Refactored Gitlab's repository interface
- Refactored SourcesMenu in the CLI to use the new repository system
- Updated dependency `nikic/php-parser` to version 4.17.1
- Added a simple security measure in `\ncc\Objects\Value > Entry > unlock()` to delay returns randomly when the password
is incorrect
- Refactored the CLI menu system to use a return exit code system
- Updated the installer to remove unused components and installation steps
- Updated dependency `Symfony/Filesystem` to 6.3.1
- Updated dependency `Symfony/polyfill-ctype` to 1.28.0
- Enforced credential storage security by applying `600` permissions to the storage file so that only the owner can
read/write to the file, this will require root to do anything with the credential file. A password will still be
needed to decrypt entries in the file if any entries are encrypted.
- Updated dependency `Symfony/polyfill-mbstring` to 1.28.0
- Updated dependency `Symfony/polyfill-uuid` to 1.28.0
- Updated dependency `Symfony/Process` to 6.3.4
- Updated dependency `Symfony/Uid` to 6.3.0
- Updated dependency `Symfony/Yaml` to 6.3.3
- Refactored ZiProto
### Removed
- Removed `FileNotFoundException` and `DirectoryNotFoundException` from `\ncc\Exceptions`
- Removed the use of `InvalidScopeException` across the project
- Removed references of Win32 from the project as Windows is not going supported
- Removed unused exception `FileNotFoundException` in `\ncc\CLI > HelpMenu`
- Removed unused class `\ncc\Objects > SymlinkDictionary`
- Removed unused exception `GitCloneException` in `\ncc\Exceptions` in favor of `GitException`
- Removed unused exception `GitCheckoutException` in `\ncc\Exceptions` in favor of `GitException`
- Removed unused exception `GithubServiceException` in `\ncc\Exceptions` in favor of `GitException`
- Removed unused exception `GitTagsException` in `\ncc\Exceptions` in favor of `GitException`
- Removed unused exception `GitlabServiceException` in `\ncc\Exceptions` in favor of `GitException`
- Removed unused exception `UnsupportedArchiveException` in `\ncc\Exceptions` in favor of `ArchiveException`
- Removed unused exception `NotImplementedException` in `\ncc\Exceptions` in favor of `NotSupportedException`
- Removed unused exception `UnsupportedCompilerExtensionException` in `\ncc\Exceptions` in favor of `NotSupportedException`
- Removed unused exception `UnsupportedExtensionVersionException` in `\ncc\Exceptions` (not used)
- Removed unused exception `UnsupportedComponentTypeException` in `\ncc\Exceptions` in favor of `NotSupportedException`
- Removed unused exception `UnsupportedPackageException` in `\ncc\Exceptions` (not used)
- Removed unused exception `UnsupportedRemoteTypeSource` in `\ncc\Exceptions` (not used)
- Removed unused exception `UnsupportedProjectTypeException` in `\ncc\Exceptions` (not used)
- Removed unused exception `InvalidProjectConfigurationException` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `InvalidScopeException` in `\ncc\Exceptions` in favor of `InvalidArgumentException` (standard php)
- Removed unused exception `InvalidCredentialsEntryException` in `\ncc\Exceptions` (not used)
- Removed unused exception `ComponentNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `InvalidPackageNameException` in `\ncc\Exceptions` (not used)
- Removed unused exception `InvalidVersionNumberException` in `\ncc\Exceptions` (not used)
- Removed unused exception `InvalidProjectException` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `InvalidProjectNameException` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `BuildConfigurationNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `InvalidBuildConfigurationException` in `\ncc\Exceptions` (not used)
- Removed unused exception `InvalidPropertyValue` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `InvalidVersionConfiguration` in `\ncc\Exceptions` (not used)
- Removed unused exception `InvalidDependencyConfiguraiton` in `\ncc\Exceptions` (not used)
- Removed unused exception `ProjectConfigurationNotFoundException` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `UndefinedExecutionPolicyExpection` in `\ncc\Exceptions` in favor of `ConfigurationException`
- Removed unused exception `InvalidExecutionPolicyName` in `\ncc\Exceptions` (not used)
- Removed unused exception `AccessDeniedException` in `\ncc\Exceptions` in favor of `AuthenticationException`
- Removed unused exception `HttpException` in `\ncc\Exceptions` in favor of `NetworkException`
- Removed unused exception `ComposerDisabledException` in `\ncc\Exceptions` in favor of `ComposerException`
- Removed unused exception `ComposerNotAvailable` in `\ncc\Exceptions` in favor of `ComposerException`
- Removed unused exception `InternalComposerNotAvailable` in `\ncc\Exceptions` in favor of `ComposerException`
- Removed unused exception `PackagePreperationFailedException` in `\ncc\Exceptions` in favor of `PackageException`
- Removed unused exception `PackageParsingException` in `\ncc\Exceptions` in favor of `PackageException`
- Removed unused exception `MissingDependencyException` in `\ncc\Exceptions` (not used)
- Removed unused exception `PackageAlreadyInstalledException` in `\ncc\Exceptions` in favor of `PackageException`
- Removed unused exception `PackageFetchException` in `\ncc\Exceptions` in favor of `PackageException`
- Removed unused exception `PackageNotFoundException` in `\ncc\Exceptions` in favor of `PackageException`
- Removed unused exception `ConstantReadonlyException` in `\ncc\Exceptions` in favor of `IntegrityException` & `\InvalidArgumentException`
- Removed unused exception `InvalidConstantName` in `\ncc\Exceptions` in favor for `IntegrityException`
- Removed unused exception `ComponentDecodeException` in `\ncc\Exceptions` in favor for `IntegrityException`
- Removed unused exception `ResourceChecksumException` in `\ncc\Exceptions` in favor for `IntegrityException`
- Removed unused exception `AutoloadGeneratorException` in `\ncc\Exceptions` in favor for `IOException`
- Removed unused exception `SymlinkException` in `\ncc\Exceptions` in favor for `IOException`
- Removed unused exception `PackageLockException` in `\ncc\Exceptions` in favor for `IOException`
- Removed unused exception `UnitsNotFoundException` in `\ncc\Exceptions` (not used)
- Removed unused exception `NoAvailableUnitsException` in `\ncc\Exceptions` in favor for `OperationException`
- Removed unused exception `InstallationException` in `\ncc\Exceptions` in favor for `OperationException`
- Removed all unused exceptions from the project, reduced the number of exceptions in total.
- Removed unused `scope` property from `\ncc\Objects\ProjectConfiguration > Build`
- Removed unused `\ncc\Objects > NccUpdateInformation`
- Removed unused `\ncc\Objects > PhpConfiguration`
- Removed parameter `$throw_exception` from `\ncc\Objects\ProjectConfiguration > Project > validate()`
- Removed dependency `theseer\Autoload` in favor of ncc's own autoloader (screw you Arne Blankerts)
- Removed runners `Python2` & `Python3` in favor of `Python`
- Removed `\ncc\Classes\NccExtension > Runner` in favor of the new Execution Unit system
- Removed `\ncc\Managers > ExecutionPointerManager` in favor of the new Execution Unit system
- Removed checksum properties from Component & Resource since they are unused
## [1.0.3] - 2023-08-16
### Changed
- Refactored `\ncc\Objects > PackageLock`
- Updated `defuse\php-encryption` to version 2.4.0
- Updated `\ncc\Classes > GitClient > cloneRepositor()` to clone submodules recursively by default
- Updated `\ncc\Classes > GitClient > checkout()` to update submoudles.
- Updated build system for Gitlab
### Fixed
- Fixed issue in `\ncc\Managers > ExecutionPointerManager > executeUnit()` where if ttyMode is enabled in a non-tty
environment, the process will throw an exception
"/etc/ncc/ThirdParty/Symfony/Process/Process.php:1019 Error: TTY mode requires /dev/tty to be read/writable.", now
ncc will display a warning if TTY mode cannot be enabled
## [1.0.2] - 2023-06-29
### Fixed
- Fixed issue where error states are not properly handled in `ExecutionPointerManager` issue [#44](https://git.n64.cc/nosial/ncc/-/issues/44)
- Updated \ncc\Managers > ExecutionPointerManager > executeUnit to set processes to run forever if a timeout is not set/null
### Changed
- Updated `Symfony\Filesystem` to version 6.2.5
- Updated `Symfony\polyfill-ctype` to version 1.27.0
- Updated `Symfony\polyfill-mbstring` to version 1.27.0
- Updated `Symfony\polyfill-uuid` to version 1.27.0
- Updated `Symfony\Process` to version 6.2.5
- Updated `Symfony\Uid` to version 6.2.5
- Updated `Symfony\Yaml` to version 6.2.5
- Updated `\ncc\Managers > PackageManager` to display more logging messages
### Added
- Dockerfile for building a docker image of ncc
## [1.0.1] - 2023-02-07
### Added
- Added file downloads progress
- Added pass-through arguments to `composer` command, all arguments beginning with `--composer-` will be passed to the
`composer` command, for example `--composer-dev` will be passed as `--dev` to the `composer` command
- Added file downloads progress
- Added pass-through arguments to `composer` command, all arguments beginning with `--composer-` will be passed to the
`composer` command, for example `--composer-dev` will be passed as `--dev` to the `composer` command
### Fixed
- Bug fix where resources are not decoded correctly when installing packages [#31](https://git.n64.cc/nosial/ncc/-/issues/42)
- Fixed issue where dependency conflicts are thrown even when `--reinstall` is used
- Properly implemented `composer.enable_internal_composer` so that warnings regarding improper configuration values are not thrown
- Minor improvements to the CLI interface including fixing `--version`
- Bug fix where resources are not decoded correctly when installing packages [#31](https://git.n64.cc/nosial/ncc/-/issues/42)
- Fixed issue where dependency conflicts are thrown even when `--reinstall` is used
- Properly implemented `composer.enable_internal_composer` so that warnings regarding improper configuration values are not thrown
- Minor improvements to the CLI interface including fixing `--version`
### Changed
- File downloads now cache the URL as a pointer to the file reducing the number of times the same file is downloaded
- File downloads now cache the URL as a pointer to the file reducing the number of times the same file is downloaded
## [1.0.0] - 2022-01-29
### Added
- Initial release of ncc
- Initial release of NCC

View file

@ -1,3 +1,4 @@
# Code of Conduct
We are committed to maintaining a welcoming and inclusive environment for all contributors. In order to ensure that

View file

@ -1,4 +1,4 @@
# Contributing to ncc
# Contributing to NCC
We welcome contributions to NCC! If you have an idea for how to improve the project, please don't hesitate to reach out.
There are many ways to contribute, and we appreciate all forms of support.

File diff suppressed because it is too large Load diff

View file

@ -1,72 +0,0 @@
# 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:
#
# 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.
#
# ncc in Docker
#
# This image is intended to be used as a base for projects using ncc.
#
# Build-time args
ARG PHP_VERSION=8.2
# Builder stage: downloads necessary files and serves them on a silver platter.
FROM php:${PHP_VERSION}-fpm AS builder
ENV GENERIC_BUILD_PATH=/tmp/ncc_build
WORKDIR /tmp
# Install some stuff the default image doesn't come with
RUN apt-get update -yqq && \
apt-get install git libpq-dev libzip-dev zip make wget gnupg -yqq
# Download phive and install phab
RUN 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 && \
rm phive.phar.asc && chmod +x phive.phar && \
./phive.phar install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
# Copy the local repository to the image
COPY . /tmp/ncc
# Build ncc
RUN cd /tmp/ncc && make redist
# Main stage: Copies build files and installs all dependencies
FROM php:${PHP_VERSION}-fpm-alpine AS production
# OSI labels
LABEL maintainer="Netkas <netkas@nosial.net>"
LABEL description="ncc's official Docker image"
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
# Copy downloaded files
COPY --from=builder /tmp/ncc_build/. .
# Install some stuff the default image doesn't come with
RUN apk update && \
apk add --no-cache git libpq libzip zip make wget gnupg gcc
RUN chmod +x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions zip xsl
# Install ncc
RUN php INSTALL --auto
# Finalize image
RUN mkdir /app
WORKDIR /app

View file

@ -1,72 +0,0 @@
# 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:
#
# 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.
#
# ncc in Docker
#
# This image is intended to be used as a base for projects using ncc.
#
# Build-time args
ARG PHP_VERSION=8.2
# Builder stage: downloads necessary files and serves them on a silver platter.
FROM php:${PHP_VERSION}-fpm AS builder
ENV GENERIC_BUILD_PATH=/tmp/ncc_build
WORKDIR /tmp
# Install some stuff the default image doesn't come with
RUN apt-get update -yqq && \
apt-get install git libpq-dev libzip-dev zip make wget gnupg -yqq
# Download phive and install phab
RUN 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 && \
rm phive.phar.asc && chmod +x phive.phar && \
./phive.phar install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
# Copy the local repository to the image
COPY . /tmp/ncc
# Build ncc
RUN cd /tmp/ncc && make redist
# Main stage: Copies build files and installs all dependencies
FROM php:${PHP_VERSION}-fpm AS production
# OSI labels
LABEL maintainer="Netkas <netkas@nosial.net>"
LABEL description="ncc's official Docker image"
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
# Copy downloaded files
COPY --from=builder /tmp/ncc_build/. .
# Install some stuff the default image doesn't come with
RUN apt-get update -yqq && \
apt-get install -yqq git libpq-dev libzip-dev zip make wget gnupg gcc -yqq
RUN chmod +x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions zip xsl
# Install ncc
RUN php INSTALL --auto
# Finalize image
RUN mkdir /app
WORKDIR /app

239
Makefile
View file

@ -1,54 +1,76 @@
# Variables
PHPCC := $(shell which php)
PHPAB := $(shell which phpab)
DEBPKG := $(shell which dpkg-deb)
SRC_PATH := src
ASSETS_PATH := assets
INSTALLER_SRC_PATH := $(SRC_PATH)/installer
CONFIG_PATH := $(SRC_PATH)/config
BUILD_VERSION := $(shell cat $(SRC_PATH)/ncc/VERSION)
BUILD_PATH := build
ifndef GENERIC_BUILD_PATH
GENERIC_BUILD_PATH := $(BUILD_PATH)/ncc_$(BUILD_VERSION)
endif
TAR_BUILD:= ncc_$(BUILD_VERSION).tar.gz
DEBIAN_SRC_PATH := $(SRC_PATH)/debian
DEBIAN_BUILD_PATH := $(BUILD_PATH)/debian/ncc_$(BUILD_VERSION)_all
DEBIAN_PACKAGE_BUILD_PATH := $(BUILD_PATH)/ncc_$(BUILD_VERSION)_all.deb
PHPCC:=$(shell which php)
PHPAB:=$(shell which phpab)
BUILD_PATH=build
SRC_PATH=src
# List of paths for autoloading
AUTOLOAD_PATHS := $(addprefix $(SRC_PATH)/ncc/ThirdParty/, \
composer/Semver \
defuse/php-encryption \
jelix/version \
nikic/PhpParser \
Symfony/polyfill_ctype \
Symfony/polyfill_mbstring \
Symfony/polyfill_uuid \
Symfony/Process \
Symfony/Uid \
Symfony/Filesystem \
Symfony/Yaml \
theseer/DirectoryScanner \
)
autoload:
# Generates/creates all the autoloader files
make $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/nikic/php-parser/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php
make $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php
make $(SRC_PATH)/ncc/autoload_spl.php
cp $(SRC_PATH)/autoload/autoload.php $(SRC_PATH)/ncc/autoload.php
# Check for necessary binaries
ifndef PHPCC
$(error "PHP binary not found. Please install PHP or check your PATH")
endif
$(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption
# Check if phpab is installed
ifndef PHPAB
$(error "phpab (PHP Autoload Builder) not found. Please install phpab or check your PATH")
endif
$(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/jelix/version
# Build rules
$(SRC_PATH)/%/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $@ $(SRC_PATH)/$*
$(SRC_PATH)/ncc/ThirdParty/nikic/php-parser/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser
$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype
$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring
$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid
$(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/Symfony/Process
$(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php:
$(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/Symfony/Uid
$(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem
$(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml
$(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/theseer/Autoload
$(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php \
$(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner
$(SRC_PATH)/ncc/autoload_spl.php:
$(PHPCC) $(PHPAB) --output $@ \
$(SRC_PATH)/ncc/Enums \
$(PHPCC) $(PHPAB) --output $(SRC_PATH)/ncc/autoload_spl.php \
$(SRC_PATH)/ncc/Abstracts \
$(SRC_PATH)/ncc/Classes \
$(SRC_PATH)/ncc/CLI \
$(SRC_PATH)/ncc/Exceptions \
@ -56,110 +78,43 @@ $(SRC_PATH)/ncc/autoload_spl.php:
$(SRC_PATH)/ncc/Interfaces \
$(SRC_PATH)/ncc/Managers \
$(SRC_PATH)/ncc/Objects \
$(SRC_PATH)/ncc/Runtime \
$(SRC_PATH)/ncc/Utilities \
$(SRC_PATH)/ncc/ncc.php \
$(SRC_PATH)/ncc/Runtime.php
# Phony targets
.PHONY: autoload
autoload: $(addsuffix /autoload_spl.php, $(AUTOLOAD_PATHS)) $(SRC_PATH)/ncc/autoload_spl.php
cp -f $(SRC_PATH)/autoload/autoload.php $(SRC_PATH)/ncc/autoload.php
.PHONY: redist
redist: autoload
rm -rf $(GENERIC_BUILD_PATH)
mkdir -p $(GENERIC_BUILD_PATH)
cp -rf $(SRC_PATH)/ncc/* $(GENERIC_BUILD_PATH)
cp -f $(INSTALLER_SRC_PATH)/installer $(GENERIC_BUILD_PATH)/INSTALL
cp -f $(INSTALLER_SRC_PATH)/ncc.sh $(GENERIC_BUILD_PATH)/ncc.sh
cp -f $(CONFIG_PATH)/ncc.yaml $(GENERIC_BUILD_PATH)/default_config.yaml
cp -f $(CONFIG_PATH)/ncc.yaml $(GENERIC_BUILD_PATH)/CLI/template_config.yaml
cp -f $(CONFIG_PATH)/default_repositories.json $(GENERIC_BUILD_PATH)/default_repositories.json
cp -f $(INSTALLER_SRC_PATH)/ncc-package.xml $(GENERIC_BUILD_PATH)/ncc-package.xml
chmod +x $(GENERIC_BUILD_PATH)/INSTALL
cp -f LICENSE $(GENERIC_BUILD_PATH)/LICENSE
cp -f README.md $(GENERIC_BUILD_PATH)/README.md
cp -f $(INSTALLER_SRC_PATH)/hash_check.php $(GENERIC_BUILD_PATH)/hash_check.php
$(PHPCC) $(GENERIC_BUILD_PATH)/hash_check.php
rm $(GENERIC_BUILD_PATH)/hash_check.php
cp -f $(INSTALLER_SRC_PATH)/generate_build_files.php $(GENERIC_BUILD_PATH)/generate_build_files.php
$(PHPCC) $(GENERIC_BUILD_PATH)/generate_build_files.php
rm $(GENERIC_BUILD_PATH)/generate_build_files.php
rm -rf $(BUILD_PATH)/src
mkdir -p $(BUILD_PATH)/src
cp -rf $(SRC_PATH)/ncc/* $(BUILD_PATH)/src
cp $(SRC_PATH)/installer/installer $(BUILD_PATH)/src/INSTALL
cp $(SRC_PATH)/installer/ncc.sh $(BUILD_PATH)/src/ncc.sh
cp $(SRC_PATH)/config/ncc.yaml $(BUILD_PATH)/src/default_config.yaml;
cp $(SRC_PATH)/config/ncc.yaml $(BUILD_PATH)/src/CLI/template_config.yaml;
cp $(SRC_PATH)/installer/extension $(BUILD_PATH)/src/extension
chmod +x $(BUILD_PATH)/src/INSTALL
cp LICENSE $(BUILD_PATH)/src/LICENSE
cp README.md $(BUILD_PATH)/src/README.md
cp $(SRC_PATH)/installer/hash_check.php $(BUILD_PATH)/src/hash_check.php; $(PHPCC) $(BUILD_PATH)/src/hash_check.php; rm $(BUILD_PATH)/src/hash_check.php
cp $(SRC_PATH)/installer/generate_build_files.php $(BUILD_PATH)/src/generate_build_files.php; $(PHPCC) $(BUILD_PATH)/src/generate_build_files.php; rm $(BUILD_PATH)/src/generate_build_files.php
mkdir -p $(BUILD_PATH)/src/repositories
cp -rf $(SRC_PATH)/default_repositories/*.json $(BUILD_PATH)/src/repositories
.PHONY: debian_prepare
debian_prepare: autoload
rm -rf $(DEBIAN_BUILD_PATH)
mkdir -p $(DEBIAN_BUILD_PATH)
mkdir -p $(DEBIAN_BUILD_PATH)/DEBIAN
mkdir -p $(DEBIAN_BUILD_PATH)/usr/share/ncc
cp -rf $(SRC_PATH)/ncc/* $(DEBIAN_BUILD_PATH)/usr/share/ncc
cp -rf $(CONFIG_PATH)/ncc.yaml $(DEBIAN_BUILD_PATH)/usr/share/ncc/default_config.yaml
cp -rf $(CONFIG_PATH)/ncc.yaml $(DEBIAN_BUILD_PATH)/usr/share/ncc/CLI/template_config.yaml
cp -rf $(CONFIG_PATH)/default_repositories.json $(DEBIAN_BUILD_PATH)/usr/share/ncc/default_repositories.json
cp -f LICENSE $(DEBIAN_BUILD_PATH)/usr/share/ncc/LICENSE
mkdir -p $(DEBIAN_BUILD_PATH)/usr/share/mime/packages
cp -rf $(INSTALLER_SRC_PATH)/ncc-package.xml $(DEBIAN_BUILD_PATH)/usr/share/mime/packages/ncc-package.xml
mkdir -p $(DEBIAN_BUILD_PATH)/usr/share/applications
cp -rf $(INSTALLER_SRC_PATH)/ncc.desktop $(DEBIAN_BUILD_PATH)/usr/share/applications/ncc.desktop
mkdir -p $(DEBIAN_BUILD_PATH)/usr/share/icons
cp -rf $(ASSETS_PATH)/icon/ncc@256px.png $(DEBIAN_BUILD_PATH)/usr/share/icons/ncc.png
cp -rf $(INSTALLER_SRC_PATH)/hash_check.php $(DEBIAN_BUILD_PATH)/usr/share/ncc/hash_check.php
cp -rf $(DEBIAN_SRC_PATH)/control $(DEBIAN_BUILD_PATH)/DEBIAN/control
cp -rf $(DEBIAN_SRC_PATH)/postinst $(DEBIAN_BUILD_PATH)/DEBIAN/postinst
chmod +x $(DEBIAN_BUILD_PATH)/DEBIAN/postinst
cp -rf $(DEBIAN_SRC_PATH)/postrm $(DEBIAN_BUILD_PATH)/DEBIAN/postrm
chmod +x $(DEBIAN_BUILD_PATH)/DEBIAN/postrm
cp -rf $(DEBIAN_SRC_PATH)/copyright $(DEBIAN_BUILD_PATH)/DEBIAN/copyright
tar: redist
cd $(BUILD_PATH)/src; tar -czvf ../build.tar.gz *
$(BUILD_PATH)/$(TAR_BUILD): redist
cd $(GENERIC_BUILD_PATH) && tar -czf ../$(TAR_BUILD) *
.PHONY: tar
tar: $(BUILD_PATH)/$(TAR_BUILD)
$(DEBIAN_PACKAGE_BUILD_PATH): debian_prepare
$(DEBPKG) --build $(DEBIAN_BUILD_PATH) $(DEBIAN_PACKAGE_BUILD_PATH)
.PHONY: deb
deb: $(DEBIAN_PACKAGE_BUILD_PATH)
.PHONY: install
install: redist
$(GENERIC_BUILD_PATH)/INSTALL --auto
.PHONY: docker-debian
docker-debian:
docker build -t ncc-debian -f Dockerfile.debian .
.PHONY: docker-debian-run
docker-debian-run:
docker run -it --rm ncc-debian /bin/bash
.PHONY: docker-alpine
docker-alpine:
docker build -t ncc-alpine -f Dockerfile .
.PHONY: docker-alpine-run
docker-alpine-run:
docker run -it --rm ncc-alpine /bin/sh
.PHONY: clean
clean:
rm -rf $(BUILD_PATH)
rm -f $(SRC_PATH)/ncc/autoload_spl.php
rm -f $(addsuffix /autoload_spl.php, $(AUTOLOAD_PATHS))
.PHONY: help
help:
@echo "Available commands:"
@echo " make autoload - Generate autoload files"
@echo " make redist - Prepare the project for redistribution"
@echo " make install - Installs ncc on the system (requires root privileges & php)"
@echo " make tar - Package the project into a tarball (Generic installer, requires php)"
@echo " make deb - Package the project into a Debian package"
@echo " make docker-debian - Build a Debian Docker image"
@echo " make docker-debian-run - Run the Debian Docker image"
@echo " make docker-alpine - Build an Alpine Docker image"
@echo " make docker-alpine-run - Run the Alpine Docker image"
@echo " make clean - Clean the build artifacts"
rm -f $(SRC_PATH)/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/jelix/version/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/nikic/PhpParser/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/polyfill-uuid/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Process/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Uid/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/theseer/Autoload/autoload_spl.php
rm -f $(SRC_PATH)/ncc/ThirdParty/theseer/DirectoryScanner/autoload_spl.php

View file

@ -1,74 +1,44 @@
# ![NCC](assets/icon/ncc@32px.png "NCC") Nosial Code Compiler
# ![NCC](assets/icon/ncc_32px.png "NCC") NCC
[![wakatime](https://wakatime.com/badge/user/bc15cc8e-c9b9-4c11-bad9-3e3cfacf01e4/project/273bc06f-12e7-43d7-824d-40a78b02aada.svg)](https://wakatime.com/badge/user/bc15cc8e-c9b9-4c11-bad9-3e3cfacf01e4/project/273bc06f-12e7-43d7-824d-40a78b02aada)
Nosial Code Compiler is a program written in PHP designed to be a multi-purpose compiler, package manager and toolkit.
This program is a complete re-write of the now defunct [PHP Package Manager (PPM)](https://git.n64.cc/intellivoid/ppm)
toolkit offering more features, security and proper code licensing and copyrighting for the components used for the project.
Nosial Code Compiler is a package compiler, manager & installer for PHP. Allowing you to install and manage multiple
versions of php packages on your system that your PHP programs/projects can share and use. Additionally, ncc also allows
you to create a redistributable package of your PHP program/project in the form of a `.ncc` binary package file.
## Alpha Stage
NCC is currently in alpha stage, meaning that it's not fully functional and may not work on your system. If you find any bugs
or issues please report them to the [GitHub Issue Tracker](https://git.n64.cc/intellivoid/ncc/issues).
## Features
- [x] Package Manager
- [x] Support for repositories such as GitHub, GitLab, GitTea and Packagist
- [x] Package compiler
- [x] Execution Handler
- [x] Import System (*No need for autoloaders!*)
## Dependencies
- PHP 8.0 or higher
- php-mbstring extension
- php-zip extension
- php-mbcrypt extension
- php-ctype extension
- php-curl extension
## Documentation
Extensive documentation for ncc can be found on at [DOCUMENTATION.md](DOCUMENTATION.md), explaining how from how to
build and install ncc to how to use it, it is highly recommended that you read the documentation before using ncc.
## Bugs and issues
If you encounter any bugs or issues with ncc, please report them on the [issue tracker](https://git.n64.cc/nosial/ncc/-/issues).
At the moment NCC is currently being used while developing other software, this serves as a test run to
improve on changes for the next version.
## Changelog
The changelog for ncc can be found in the [CHANGELOG.md](CHANGELOG.md) file.
The changelog for NCC can be found in the [CHANGELOG.md](CHANGELOG.md) file.
## Repository Mirrors
The official repository for ncc is hosted on [n64](https://git.n64.cc/nosial/ncc); however, you can also find
The official repository for NCC is hosted on [GitLab](https://git.n64.cc/intellivoid/ncc), however, you can also find
mirrors of the repository mirrored on different platforms, including
community-powered mirrors. (more to come)
community powered mirrors. (more to come)
- [git.it-kuny.ch](https://git.it-kuny.ch)
- [git.martinvlba.eu](https://git.martinvlba.eu/Nosial/ncc)
- [github.com](https://github.com/Nosial/ncc)
# Contributing
We welcome contributions to ncc! If you have an idea for how to improve the project, please don't hesitate to reach out.
We welcome contributions to NCC! If you have an idea for how to improve the project, please don't hesitate to reach out.
There are many ways to contribute, and we appreciate all forms of support.
For more information on how to contribute, please read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
# Code of Conduct
We are committed to maintaining a welcoming and inclusive environment for all contributors. Please read and follow our
[Code of Conduct](CODE_OF_CONDUCT.md).
# Authors
- Zi Xing Narrakas (netkas) <[netkas@n64.cc](mailto:netkas@64.cc)>
@ -78,16 +48,16 @@ We are committed to maintaining a welcoming and inclusive environment for all co
- Marc Gutt (mgutt) <[marc@gutt.it](mailto:marc@gutt.it)>
- Debusschère Alexandre ([debuss](https://github.com/debuss))
- badPointer <[https://git.n64.cc/badPointer](https://git.n64.cc/badPointer)>
- Cybersecbyte <[https://git.n64.cc/Cybersecbyte](https://git.n64.cc/Cybersecbyte)>
# Copyright
- Copyright (c) 2022-2023, NosialAll Rights Reserved
- Copyright (c) 2022-2023, Nosial - All Rights Reserved
# Licenses
ncc is licensed under the MIT License, see [LICENSE](LICENSE) for more information.
Multiple licenses for the open-source components used in this project can be found at [LICENSE](LICENSES)
NCC is licensed under the MIT License, see [LICENSE](LICENSE) for more information.
Multiple licenses for the open source components used in this
project can be found at [LICENSE](LICENSES)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

BIN
assets/icon/ncc.ai Normal file

Binary file not shown.

BIN
assets/icon/ncc.icns Normal file

Binary file not shown.

BIN
assets/icon/ncc.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -1,4 +1 @@
<svg width="160" height="160" viewBox="0 0 160 160" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M80 0C76.001 0 72.002 1.51978 68.7229 4.71944L4.73883 68.7113C-1.57961 74.9506 -1.57961 85.0293 4.73883 91.2685L68.7229 155.261C74.9613 161.58 85.0388 161.58 91.2772 155.261L155.261 91.2685C161.58 85.0293 161.58 74.9506 155.261 68.7113L91.2772 4.71944C87.998 1.51978 83.999 0 80 0Z" fill="#111111"/>
<path d="M55.2178 55C53.9929 55 53 55.949 53 57.1197V80.9658C53 82.1365 53.9929 83.0855 55.2178 83.0855H72.1287V108.622L81 117L89.8713 108.622V83.0855H106.782C108.007 83.0855 109 82.1365 109 80.9658V57.1197C109 55.949 108.007 55 106.782 55H55.2178Z" fill="#EEEEEE"/>
</svg>
<?xml version="1.0" ?><svg fill="none" height="48" viewBox="0 0 48 48" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M6 14C6 4 14 4 14 4V24H6C6 24 6 24 6 14Z" fill="#2F88FF" stroke="black" stroke-linejoin="round" stroke-width="4"/><rect fill="#2F88FF" height="6" stroke="black" stroke-linejoin="round" stroke-width="4" width="28" x="14" y="10"/><path d="M6 30H42C42 30 42 38 36 38C30 38 29 38 29 38L31 44H13L15 38H6V30Z" fill="#2F88FF" stroke="black" stroke-linejoin="round" stroke-width="4"/></svg>

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

BIN
assets/icon/ncc_1024px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
assets/icon/ncc_128px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
assets/icon/ncc_16px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

BIN
assets/icon/ncc_2048px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
assets/icon/ncc_20px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

BIN
assets/icon/ncc_24px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

BIN
assets/icon/ncc_256px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
assets/icon/ncc_32px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

BIN
assets/icon/ncc_4096px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
assets/icon/ncc_48px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

BIN
assets/icon/ncc_512px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
assets/icon/ncc_64px.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

BIN
assets/ncc_cli.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

BIN
assets/pkg_struct_1.0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View file

@ -1,9 +0,0 @@
<?php
$autoload_path = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'ncc' . DIRECTORY_SEPARATOR . 'autoload.php';
if(!file_exists($autoload_path))
{
throw new Exception("Autoload file not found");
}
require $autoload_path;

View file

@ -1,71 +0,0 @@
# 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:
#
# 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.
#
# ncc in Docker
#
# This image is intended to be used as a base for projects using ncc.
#
#
# Builder stage: downloads necessary files and serves them on a silver platter.
#
FROM php:8.2-fpm AS builder
WORKDIR /tmp
# Install some stuff the default image doesn't come with
RUN apt update -yqq; \
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
# Download phive and install phab
RUN 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; \
rm phive.phar.asc; chmod +x phive.phar; ./phive.phar install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
# Copy the local repository to the image
COPY . /tmp/ncc
# Download the latest version of ncc (Nosial Code Compiler)
RUN cd /tmp/ncc && make redist
#
# Main stage: Copies downloaded files and installs all
#
FROM php:8.2-fpm-alpine
# Add extensions
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
# Copy downloaded files
COPY --from=builder /tmp/. .
# Install extensions required to run ncc
RUN install-php-extensions mbstring \
ctype \
common; \
# Add git and tar
apk add git tar; \
# Install phive, phab and ncc; create workdir
chmod +x phive.phar; \
mv phive.phar /usr/local/bin/phive; \
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C; \
cd ncc; php build/src/INSTALL --auto; cd ..; rm -rf ncc; \
mkdir /app
WORKDIR /app

View file

@ -1,74 +0,0 @@
# 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:
#
# 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.
#
# ncc in Docker
#
# This image is intended to be used as a base for projects using ncc.
#
#
# Builder stage: downloads necessary files and serves them on a silver platter.
#
FROM php:8.2-fpm AS builder
WORKDIR /tmp
# Install some stuff the default image doesn't come with
RUN apt update -yqq; \
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
# Download phive and install phab
RUN 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; \
rm phive.phar.asc; chmod +x phive.phar; ./phive.phar install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C
# Copy the local repository to the image
COPY . /tmp/ncc
# Download the latest version of ncc (Nosial Code Compiler)
RUN cd /tmp/ncc && make redist
#
# Main stage: Copies downloaded files and installs all
#
FROM php:8.2-fpm
# Add extensions
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
# Copy downloaded files
COPY --from=builder /tmp/. .
# Install some stuff the default image doesn't come with
RUN apt update -yqq; \
apt install git libpq-dev libzip-dev zip make wget gnupg -yqq
# Install extensions required to run ncc
RUN install-php-extensions mbstring \
ctype \
common; \
# Add git
apt install -y git; \
# Install phive, phab and ncc; create workdir
chmod +x phive.phar; \
mv phive.phar /usr/local/bin/phive; \
phive install phpab --global --trust-gpg-keys 0x2A8299CE842DD38C; \
cd ncc; php build/src/INSTALL --auto; cd ..; rm -rf ncc; \
mkdir /app
WORKDIR /app

View file

@ -1,2 +0,0 @@
These are the old dockerfiles for ncc, they are no longer used. The new dockerfiles are in the root of the repository.
These files are kept for reference and may be removed in the future.

View file

@ -1,11 +0,0 @@
<phpunit bootstrap="bootstrap.php">
<testsuites>
<testsuite name="ncc Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="-1"/>
<server name="KERNEL_DIR" value="app/"/>
</php>
</phpunit>

View file

@ -13,20 +13,20 @@
$third_party_path = __DIR__ . DIRECTORY_SEPARATOR . 'ThirdParty' . DIRECTORY_SEPARATOR;
$target_files = [
__DIR__ . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'composer' . DIRECTORY_SEPARATOR . 'Semver' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'defuse' . DIRECTORY_SEPARATOR . 'php-encryption' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'jelix' . DIRECTORY_SEPARATOR . 'version' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'nikic' . DIRECTORY_SEPARATOR . 'PhpParser' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill_ctype' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill_ctype' . DIRECTORY_SEPARATOR . 'bootstrap.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill_mbstring' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill_mbstring' . DIRECTORY_SEPARATOR . 'bootstrap.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill_uuid' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill_uuid' . DIRECTORY_SEPARATOR . 'bootstrap.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-ctype' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-ctype' . DIRECTORY_SEPARATOR . 'bootstrap.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-mbstring' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-mbstring' . DIRECTORY_SEPARATOR . 'bootstrap.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-uuid' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-uuid' . DIRECTORY_SEPARATOR . 'bootstrap.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'Process' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'Uid' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'Filesystem' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'Yaml' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'theseer' . DIRECTORY_SEPARATOR . 'Autoload' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'theseer' . DIRECTORY_SEPARATOR . 'DirectoryScanner' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
];

View file

@ -1,50 +0,0 @@
[
{
"name": "n64",
"type": "gitlab",
"host": "git.n64.cc",
"ssl": true
},
{
"name": "packagist",
"type": "packagist",
"host": "packagist.org",
"ssl": true
},
{
"name": "github",
"type": "github",
"host": "api.github.com",
"ssl": true
},
{
"name": "gitlab",
"type": "gitlab",
"host": "gitlab.com",
"ssl": true
},
{
"name": "gitgud",
"type": "gitlab",
"host": "gitgud.io",
"ssl": true
},
{
"name": "nocturn9x",
"type": "gitea",
"host": "git.nocturn9x.space",
"ssl": true
},
{
"name": "martinvlba",
"type": "gitea",
"host": "git.martinvlba.eu",
"ssl": true
},
{
"name": "kuny",
"type": "gitea",
"host": "git.it-kuny.ch",
"ssl": true
}
]

View file

@ -13,4 +13,75 @@ ncc:
# The default logging level to use in the CLI
# Values can be (silent, verbose, debug, info, warn, error or fatal)
logging: "info"
logging: "info"
# Configuration section for the PHP configuration that NCC will use to run
php:
# The main executable path for PHP that NCC should use
executable_path: "/usr/bin/php"
git:
# if git is enabled or not
enabled: true
# The executable path of git
executable_path: "/usr/bin/git"
# When enabled, NCC will use it's builtin version of composer
# to execute composer tasks, if disabled it will fall back to
# the `executable_path` option and attempt to use that specified
# location of composer
composer:
# if composer is enabled or not
enabled: true
# If internal composer is enabled (install must be executed with --install-composer)
enable_internal_composer: true
# The executable path to the system's installed composer executable
executable_path: "/home/user/composer.phar"
# Composer options
options:
# Do not output any message
quiet: false
# Disable ANSI output
no_ansi: true
# Do not ask any interactive question
no_interaction: true
# Display timing and memory usage information
profile: false
# Skips the execution of all scripts defined in composer.json file.
no_scripts: true
# Prevent use of the cache
no_cache: false
# 1 normal output, 2 for more verbose output and 3 for debug output, 4 to match NCC's logging level
logging: 1
# NCC Composer Extension options
extension:
# If licenses should be displayed in the conversion process of a composer package
display_licenses: true
# If authors should be displayed in the conversion process of a composer package
display_authors: true
# If NCC should try to install suggested packages
try_install_suggested: true
# Supported runners executable paths
runners:
php: "/usr/bin/php"
bash: "/usr/bin/bash"
sh: "/usr/bin/sh"
python: "/usr/bin/python"
python3: "/usr/bin/python3"
python2: "/usr/bin/python2"

View file

@ -1,18 +0,0 @@
Package: ncc
Source: ncc
Section: devel
Priority: optional
Version: 2.0.4
Maintainer: netkas <netkas@nosial.net>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.5.1
Homepage: https://git.n64.cc/nosial/ncc
Vcs-Git: https://git.n64.cc/nosial/ncc.git
Vcs-Browser: https://git.n64.cc/nosial/ncc
Name: Nosial Code Compiler
Architecture: all
Depends: shared-mime-info, php (>= 8.0), php-mbstring, php-common, php-ctype, php-curl, zlib1g, php-zip
Description: Nosial Code Compiler is a multi-purpose compiler, package manager, and toolkit written in PHP.
NCC (Nosial Code Compiler) is a versatile tool designed for various tasks related to PHP development.
It allows you to compile PHP code, manage packages, and perform various tasks in a PHP-centric environment.

View file

@ -1,8 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ncc
Upstream-Contact: netkas <netkas@nosial.net>
Source: https://git.n64.cc/nosial/ncc
Files: *
Copyright: 2022-2023 Nosial - All Rights Reserved.
License: MIT

View file

@ -1,33 +0,0 @@
#!/bin/bash
set -e
# Update MIME database
if ! update-mime-database /usr/share/mime; then
echo "Error: Failed to update MIME database"
exit 1
fi
# Ensure PHP is installed
PHP_BIN=$(command -v php)
if [ -z "$PHP_BIN" ]; then
echo "Error: PHP binary not found"
exit 1
fi
# Create symlink for ncc-cli
ENTRY_POINT="/usr/bin/ncc"
if ! cat <<EOF > "$ENTRY_POINT"
#!/bin/bash
$PHP_BIN /usr/share/ncc/ncc --ncc-cli "\$@"
EOF
then
echo "Error: Failed to create entry point script at $ENTRY_POINT"
exit 1
fi
chmod +x "$ENTRY_POINT"
# Initialize ncc
if ! ncc setup --default-repositories=/usr/share/ncc/default_repositories.json; then
echo "Error: Failed to setup ncc"
exit 1
fi

View file

@ -1,21 +0,0 @@
#!/bin/bash
set -e
case "$1" in
remove|purge)
# Remove the entry point script
ENTRY_POINT="/usr/bin/ncc"
if [ -f "$ENTRY_POINT" ]; then
rm -f "$ENTRY_POINT"
echo "Removed $ENTRY_POINT"
else
echo "$ENTRY_POINT not found. Skipping removal."
fi
;;
*)
esac
# End of the script
exit 0

View file

@ -0,0 +1,6 @@
[
"gitgud.json",
"github.json",
"gitlab.json",
"n64.json"
]

View file

@ -0,0 +1,6 @@
{
"name": "gitgud",
"type": "gitlab",
"host": "gitgud.io",
"ssl": true
}

View file

@ -0,0 +1,6 @@
{
"name": "github",
"type": "github",
"host": "api.github.com",
"ssl": true
}

View file

@ -0,0 +1,6 @@
{
"name": "gitlab",
"type": "gitlab",
"host": "gitlab.com",
"ssl": true
}

View file

@ -0,0 +1,6 @@
{
"name": "n64",
"type": "gitlab",
"host": "git.n64.cc",
"ssl": true
}

170
src/installer/extension Normal file
View file

@ -0,0 +1,170 @@
<?php
use ncc\Abstracts\Versions;
use ncc\Exceptions\ConstantReadonlyException;
use ncc\Exceptions\ImportException;
use ncc\Exceptions\InvalidConstantNameException;
use ncc\Exceptions\InvalidPackageNameException;
use ncc\Exceptions\InvalidScopeException;
use ncc\Exceptions\PackageLockException;
use ncc\Exceptions\PackageNotFoundException;
use ncc\ncc;
use ncc\Runtime;
if(!defined('NCC_INIT'))
{
if(!file_exists('%ncc_install' . DIRECTORY_SEPARATOR . 'autoload.php'))
{
throw new RuntimeException('Cannot locate file \'%ncc_install' . DIRECTORY_SEPARATOR . 'autoload.php\'');
}
else
{
require('%ncc_install' . DIRECTORY_SEPARATOR . 'autoload.php');
}
if(!function_exists('import'))
{
/**
* Attempts to import a package into the current runtime
*
* @param string $package
* @param string $version
* @param array $options
* @return void
* @throws ImportException
*/
function import(string $package, string $version= Versions::Latest, array $options=[]): void
{
Runtime::import($package, $version, $options);
}
}
if(!function_exists('get_imported'))
{
/**
* Returns an array of all imported packages
*
* @return array
*/
function get_imported(): array
{
return Runtime::getImportedPackages();
}
}
if(!function_exists('ncc_constants'))
{
/**
* Returns an array of constants defined by NCC
*
* @return array
* @throws \ncc\Exceptions\RuntimeException
*/
function ncc_constants(): array
{
return ncc::getConstants();
}
}
if(!function_exists('consts_get'))
{
/**
* Returns the value of a constant defined in NCC's runtime environment
*
* @param string $package
* @param string $name
* @return string|null
*/
function consts_get(string $package, string $name): ?string
{
return Runtime\Constants::get($package, $name);
}
}
if(!function_exists('consts_set'))
{
/**
* Sets the value of a constant defined in NCC's runtime environment
*
* @param string $package
* @param string $name
* @param string $value
* @param bool $readonly
* @return void
* @throws ConstantReadonlyException
* @throws InvalidConstantNameException
*/
function consts_set(string $package, string $name, string $value, bool $readonly=false): void
{
Runtime\Constants::register($package, $name, $value, $readonly);
}
}
if(!function_exists('consts_delete'))
{
/**
* Deletes a constant defined in NCC's runtime environment
*
* @param string $package
* @param string $name
* @return void
* @throws ConstantReadonlyException
*/
function consts_delete(string $package, string $name): void
{
Runtime\Constants::delete($package, $name);
}
}
if(!function_exists('get_data_path'))
{
/**
* Returns the data path of the package
*
* @param string $package
* @return string
* @throws InvalidPackageNameException
* @throws InvalidScopeException
* @throws PackageLockException
* @throws PackageNotFoundException
*/
function get_data_path(string $package): string
{
return Runtime::getDataPath($package);
}
}
if(!function_exists('get_constant'))
{
/**
* Returns the value of a constant defined in NCC's runtime environment
*
* @param string $package
* @param string $name
* @return string|null
*/
function get_constant(string $package, string $name): ?string
{
return Runtime::getConstant($package, $name);
}
}
if(!function_exists('set_constant'))
{
/**
* Sets the value of a constant defined in NCC's runtime environment
*
* @param string $package
* @param string $name
* @param string $value
* @return void
* @throws ConstantReadonlyException
* @throws InvalidConstantNameException
*/
function set_constant(string $package, string $name, string $value): void
{
Runtime::setConstant($package, $name, $value);
}
}
}

View file

@ -6,34 +6,30 @@
print('Could not find \'autoload.php\', this script is intended to be executed during the redistribution process');
exit(1);
}
/** @noinspection PhpIncludeInspection */
require(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');
// Start script
function scanContents($dir)
function scanContents($dir, &$results = array())
{
$results = [];
$files = scandir($dir);
foreach (scandir($dir, SCANDIR_SORT_NONE) as $key => $value)
foreach ($files as $key => $value)
{
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
if (!is_dir($path))
{
$results[] = str_ireplace(__DIR__ . DIRECTORY_SEPARATOR, '', $path);
$results[] = str_ireplace(__DIR__ . DIRECTORY_SEPARATOR, (string)null, $path);
}
elseif ($value !== '.' && $value !== '..')
else if ($value != '.' && $value != '..')
{
/** @noinspection SlowArrayOperationsInLoopInspection */
$results = array_merge($results, scanContents($path));
$results[] = str_ireplace(__DIR__ . DIRECTORY_SEPARATOR, (string)null, $path);
scanContents($path, $results);
}
}
return $results;
}
$excluded_files = [
'hash_check.php',
'generate_build_files.php',
@ -41,7 +37,8 @@
'installer',
'checksum.bin',
'build_files',
'ncc.sh'
'ncc.sh',
'extension'
];
ncc\Utilities\Console::out('Creating build_files ...');
@ -59,10 +56,8 @@
$build_files_content[] = $path;
}
}
$build_files = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'build_files', 'ab+');
$build_files = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'build_files', 'a+');
fwrite($build_files, implode("\n", $build_files_content));
fclose($build_files);
ncc\Utilities\Console::out('Created build_files');
exit(0);

View file

@ -6,20 +6,21 @@
print('Could not find \'autoload.php\', this script is intended to be executed during the redistribution process');
exit(1);
}
require(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');
// Start script
function scanContents($dir, &$results = array())
{
foreach (scandir($dir, SCANDIR_SORT_NONE) as $key => $value)
$files = scandir($dir);
foreach ($files as $key => $value)
{
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
if (!is_dir($path))
{
$results[] = str_ireplace(__DIR__ . DIRECTORY_SEPARATOR, (string)null, $path);
}
else if ($value !== '.' && $value !== '..')
else if ($value != '.' && $value != '..')
{
scanContents($path, $results);
}
@ -41,12 +42,12 @@
foreach(scanContents(__DIR__) as $file)
{
if(!in_array($file, $excluded_files, true))
if(!in_array($file, $excluded_files))
{
$hash_values[$file] = hash_file('sha256', __DIR__ . DIRECTORY_SEPARATOR . $file);
}
}
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . 'checksum.bin', \ncc\Extensions\ZiProto\ZiProto::encode($hash_values));
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . 'checksum.bin', \ncc\ZiProto\ZiProto::encode($hash_values));
ncc\Utilities\Console::out('Created checksum.bin');
exit(0);

View file

@ -3,8 +3,8 @@
# ------------------------------------------------------------------
# Nosial Code Compiler (NCC) Installation Script
#
# Nosial Code Compiler is a program written in PHP designed
# to be a multipurpose compiler, package manager and toolkit.
# Nosial Code Compiler is a program written in PHP designed
# to be a multipurpose compiler, package manager and toolkit.
#
# Dependency:
# PHP 8.0+
@ -12,12 +12,18 @@
<?PHP
use ncc\Enums\ConsoleColors;
use ncc\Abstracts\ConsoleColors;
use ncc\Exceptions\FileNotFoundException;
use ncc\Managers\RemoteSourcesManager;
use ncc\ncc;
use ncc\Objects\CliHelpSection;
use ncc\Objects\DefinedRemoteSource;
use ncc\ThirdParty\Symfony\Filesystem\Exception\IOException;
use ncc\ThirdParty\Symfony\Filesystem\Filesystem;
use ncc\ThirdParty\Symfony\Process\Exception\ProcessFailedException;
use ncc\ThirdParty\Symfony\Process\ExecutableFinder;
use ncc\ThirdParty\Symfony\process\PhpExecutableFinder;
use ncc\ThirdParty\Symfony\Process\Process;
use ncc\ThirdParty\Symfony\Yaml\Yaml;
use ncc\Utilities\Console;
use ncc\Utilities\Functions;
@ -25,34 +31,63 @@
use ncc\Utilities\PathFinder;
use ncc\Utilities\Resolver;
use ncc\Utilities\Validate;
use ncc\Extensions\ZiProto\ZiProto;
use ncc\ZiProto\ZiProto;
# Global Variables
$NCC_INSTALL_PATH = DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'share' . DIRECTORY_SEPARATOR . 'ncc';
$NCC_DATA_PATH = DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'ncc';
$NCC_CHECKSUM = __DIR__ . DIRECTORY_SEPARATOR . 'checksum.bin';
$NCC_AUTOLOAD = __DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
$NCC_PHP_EXECUTABLE = null;
$NCC_INSTALL_PATH=DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR . 'ncc';
$NCC_DATA_PATH=DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'ncc';
$NCC_COMPOSER_UPDATE_SOURCE='https://getcomposer.org/installer';
$NCC_CHECKSUM=__DIR__ . DIRECTORY_SEPARATOR . 'checksum.bin';
$NCC_AUTOLOAD=__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
$NCC_PHP_EXECUTABLE=null;
$NCC_FILESYSTEM=null;
/**
* A getParameter function to avoid code redundancy (Type-Safe)
*
* @param array|null $args
* @param string $option
* @param bool $require_content
* @return string|null
*/
function getParameter(?array $args, string $option, bool $require_content=true): ?string
{
if($args == null)
{
return null;
}
if(!isset($args[$option]))
{
return null;
}
if($require_content && ($args[$option] == null || strlen((string)$args[$option] == 0)))
{
return null;
}
return $args[$option];
}
// Require NCC
if(!file_exists($NCC_AUTOLOAD))
{
print(sprintf('Cannot find autoload file \'%s\', installation failed successfully.', $NCC_AUTOLOAD) . PHP_EOL);
print('The file \'autoload.php\' was not found, installation cannot proceed.' . PHP_EOL);
exit(1);
}
require($NCC_AUTOLOAD);
// Initialize NCC
try
{
// Initialize NCC
define('NCC_CLI_MODE', 1);
ncc::initialize();
}
catch (Exception $e)
catch (FileNotFoundException|\ncc\Exceptions\RuntimeException $e)
{
Console::outException('Cannot initialize NCC, ' . $e->getMessage() . ' (Error Code: ' . $e->getCode() . ')', $e, 1);
return;
Console::outError('Cannot initialize NCC, ' . $e->getMessage() . ' (Error Code: ' . $e->getCode() . ')');
exit(1);
}
$NCC_ARGS = null;
@ -65,14 +100,17 @@
}
$NCC_AUTO_MODE = ($NCC_ARGS !== null && isset($NCC_ARGS['auto']));
$NCC_BYPASS_OS_CHECK = ($NCC_ARGS !== null && isset($NCC_ARGS['bypass-os-check']));
$NCC_BYPASS_CLI_CHECK = ($NCC_ARGS !== null && isset($NCC_ARGS['bypass-cli-check']));
$NCC_BYPASS_CHECKSUM = ($NCC_ARGS !== null && isset($NCC_ARGS['bypass-checksum']));
if(isset($NCC_ARGS['help']))
{
$options = [
new CliHelpSection(['--help'], 'Displays this help menu about the installer'),
new CliHelpSection(['--bypass-os-check'], 'Bypasses the check for the current operating system'),
new CliHelpSection(['--auto'], 'Automates the installation process'),
new CliHelpSection(['--install-composer'], 'Require composer to be installed alongside NCC'),
new CliHelpSection(['--install-dir'], 'Specifies the installation directory for NCC'),
new CliHelpSection(['--bypass-cli-check'], 'Bypasses the check for a CLI environment'),
new CliHelpSection(['--bypass-checksum'], 'Bypasses the checksum for the installation files'),
];
@ -88,31 +126,55 @@
}
// Detect if running in Windows
if(!$NCC_BYPASS_OS_CHECK && strtolower(PHP_OS_FAMILY) === 'windows')
if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
{
Console::outError(sprintf('This installer is not compatible with Windows, detected OS: %s (This check can be bypassed with --bypass-os-check)', PHP_OS), true, 1);
return;
print('This installer can only run on Linux based machines' . PHP_EOL);
}
// Detect the server API
if(!$NCC_BYPASS_CLI_CHECK)
{
if(defined('PHP_SAPI'))
{
if(strtolower(PHP_SAPI) !== 'cli')
{
print('This installation script is meant to be running in your terminal' . PHP_EOL);
}
}
elseif(function_exists('php_sapi_name') && strtolower(php_sapi_name()) !== 'cli')
{
print('This installation script is meant to be running in your terminal' . PHP_EOL);
}
else
{
Console::outWarning(
'The installer cannot determine the Server API (SAPI), the installer will continue but it is ' .
'recommended to be running this installer in a terminal'
);
}
}
// Check if running as root
if(!function_exists('posix_getuid'))
{
Console::outError('The function posix_getuid() is not available on your system, please make sure the extension `php-common` is installed', true, 1);
return;
Console::outError('The function posix_getuid() is not available on your system, please make sure the extension `php-common` is installed');
exit(1);
}
if (posix_getuid() !== 0)
{
Console::outError('You must be running as root', true, 1);
return;
Console::outError('You must be running as root');
exit(1);
}
// Find the PHP executable
$NCC_PHP_EXECUTABLE = (new PhpExecutableFinder())->find();
$executable_finder = new PhpExecutableFinder();
$NCC_PHP_EXECUTABLE = $executable_finder->find();
$NCC_EXECUTABLE_FINDER = new ExecutableFinder();
if(!$NCC_PHP_EXECUTABLE)
{
Console::outError('Cannot find PHP executable path', true ,1);
return;
Console::outError('Cannot find PHP executable path');
exit(1);
}
// Check for the required files
@ -136,41 +198,47 @@
{
if(!$NCC_FILESYSTEM->exists($NCC_CHECKSUM))
{
Console::outError(sprintf('The checksum file \'%s\' was not found, the checksum cannot be validated', $NCC_CHECKSUM), 1, true);
return;
Console::outWarning('The file \'checksum.bin\' was not found, the contents of the program cannot be verified to be safe');
}
try
else
{
Console::out('Testing checksum...');
$checksum = ZiProto::decode(IO::fread($NCC_CHECKSUM));
}
catch(Exception $e)
{
Console::outError($e->getMessage(), true, 1);
return;
}
Console::out('Running checksum');
$checksum_failed = false;
foreach($checksum as $path => $hash)
{
if(!file_exists(__DIR__ . DIRECTORY_SEPARATOR . $path))
try
{
Console::outError('Cannot check file, \'' . $path . '\' not found.');
$checksum_failed = true;
$checksum = ZiProto::decode(IO::fread(__DIR__ . DIRECTORY_SEPARATOR . 'checksum.bin'));
}
elseif(hash_file('sha256', __DIR__ . DIRECTORY_SEPARATOR . $path) !== $hash)
catch(Exception $e)
{
Console::outWarning('The file \'' . $path . '\' does not match the original checksum');
$checksum_failed = true;
Console::outError($e->getMessage(), true, 1);
return;
}
}
if($checksum_failed)
{
Console::outError('Checksum failed, the contents of the program cannot be verified to be safe', true, 1);
return;
$checksum_failed = false;
foreach($checksum as $path => $hash)
{
if(!file_exists(__DIR__ . DIRECTORY_SEPARATOR . $path))
{
Console::outError('Cannot check file, \'' . $path . '\' not found.');
$checksum_failed = true;
}
elseif(hash_file('sha256', __DIR__ . DIRECTORY_SEPARATOR . $path) !== $hash)
{
Console::outWarning('The file \'' . $path . '\' does not match the original checksum');
$checksum_failed = true;
}
}
if($checksum_failed)
{
Console::outError('Checksum failed, the contents of the program cannot be verified to be safe');
exit(1);
}
else
{
Console::out('Checksum passed');
}
}
}
@ -181,51 +249,207 @@
{
if($installed)
{
Console::out("$ext ... " . Console::formatColor("installed", ConsoleColors::LIGHT_GREEN));
Console::out("$ext ... " . Console::formatColor("installed", ConsoleColors::LightGreen));
}
else
{
Console::out("$ext ... " . Console::formatColor("missing", ConsoleColors::LIGHT_RED));
Console::out("$ext ... " . Console::formatColor("missing", ConsoleColors::LightRed));
}
}
// Check for curl if the installer requires it
$curl_available = true;
if(!$extensions['curl'])
{
if(getParameter($NCC_ARGS, 'install-composer') !== null)
{
Console::outError('This installer requires the \'curl\' extension to install composer', true, 1);
return;
}
$curl_available = false;
Console::outWarning('The extension \'curl\' is not installed, the installer will not be able to install composer');
}
// Attempt to load version information
try
{
// Attempt to load version information
$version_information = ncc::getVersionInformation();
$VersionInformation = ncc::getVersionInformation();
}
catch (Exception $e)
catch (FileNotFoundException|\ncc\Exceptions\RuntimeException $e)
{
Console::outException('Cannot get version information, ' . $e->getMessage() . ' (Error Code: ' . $e->getCode() . ')', $e, 1);
return;
Console::outError('Cannot get version information, ' . $e->getMessage() . ' (Error Code: ' . $e->getCode() . ')');
exit(1);
}
// Start of installer
Console::out('Started NCC installer');
// Display version information
Console::out('NCC Version: ' . NCC_VERSION_NUMBER . ' (' . NCC_VERSION_BRANCH . ')');
Console::out('Build Flags: ' . implode(',', NCC_VERSION_FLAGS));
foreach($version_information->getComponents() as $component)
foreach($VersionInformation->Components as $component)
{
$full_name = $component->getVendor() . '/' . $component->getPackageName();
$full_name = $component->Vendor . '/' . $component->PackageName;
try
{
Console::out(Console::formatColor($full_name, ConsoleColors::GREEN) . ' Version: ' . Console::formatColor($component->getVersion(), ConsoleColors::LIGHT_MAGENTA));
Console::out(Console::formatColor($full_name, ConsoleColors::Green) . ' Version: ' . Console::formatColor($component->getVersion(), ConsoleColors::LightMagenta));
}
catch (Exception $e)
{
Console::outWarning('Cannot determine component version of ' . Console::formatColor($full_name, ConsoleColors::GREEN));
Console::outWarning('Cannot determine component version of ' . Console::formatColor($full_name, ConsoleColors::Green));
}
}
if(!$NCC_AUTO_MODE && !Console::getBooleanInput('Do you want install NCC?'))
{
Console::outError('Installation cancelled by user', true, 1);
return;
}
Console::out('Starting installation');
// Determine the installation path
$skip_prompt = false;
$install_dir_arg = getParameter($NCC_ARGS, 'install-dir');
// Check the arguments
if($install_dir_arg !== null)
{
if(!Validate::unixFilepath($install_dir_arg))
{
Console::outError('The given file path is not valid');
exit(1);
}
if($NCC_FILESYSTEM->exists($install_dir_arg . DIRECTORY_SEPARATOR . 'ncc'))
{
Console::out('NCC Seems to already be installed, the installer will repair/upgrade your current install');
$NCC_INSTALL_PATH = $install_dir_arg;
$skip_prompt = true;
}
else
{
Console::outError('The given directory already exists, it must be deleted before proceeding');
exit(1);
}
}
if(!$NCC_AUTO_MODE && !$skip_prompt)
{
while(true)
{
$user_input = null;
$user_input = Console::getInput("Installation Path (Default: $NCC_INSTALL_PATH): ");
if(strlen($user_input) > 0 && $NCC_FILESYSTEM->exists($user_input) && Validate::unixFilepath($user_input))
{
if($NCC_FILESYSTEM->exists($user_input . DIRECTORY_SEPARATOR . 'ncc'))
{
$NCC_INSTALL_PATH = $user_input;
break;
}
else
{
Console::outError('The given directory already exists, it must be deleted before proceeding');
}
}
elseif(strlen($user_input) > 0)
{
Console::outError('The given file path is not valid');
}
else
{
break;
}
}
}
// Determine the data path
$skip_prompt = false;
$data_dir_arg = getParameter($NCC_ARGS, 'data-dir');
// Check the arguments
if($data_dir_arg !== null)
{
if(!Validate::unixFilepath($data_dir_arg))
{
Console::outError('The given file path \''. $data_dir_arg . '\' is not valid');
exit(1);
}
if($NCC_FILESYSTEM->exists($data_dir_arg . DIRECTORY_SEPARATOR . 'package.lck'))
{
$NCC_DATA_PATH = $data_dir_arg;
$skip_prompt = true;
}
else
{
Console::outError('The given directory \'' . $data_dir_arg . '\' already exists, it must be deleted before proceeding');
exit(1);
}
}
// Proceed with prompt if not in auto mode and argument was met
if(!$NCC_AUTO_MODE && !$skip_prompt)
{
while(true)
{
$user_input = null;
$user_input = Console::getInput("Data Path (Default: $NCC_DATA_PATH): ");
if(strlen($user_input) > 0 && $NCC_FILESYSTEM->exists($user_input) && Validate::unixFilepath($user_input))
{
if($NCC_FILESYSTEM->exists($user_input . DIRECTORY_SEPARATOR . 'package.lck'))
{
$NCC_DATA_PATH = $user_input;
break;
}
else
{
Console::outError('The given directory already exists, it must be deleted before proceeding');
}
}
elseif(strlen($user_input) > 0)
{
Console::outError('The given file path is not valid');
}
else
{
break;
}
}
}
// Ask to install composer if curl is available
if($curl_available)
{
if(getParameter($NCC_ARGS, 'install-composer') !== null)
{
$update_composer = true;
}
else
{
if(!$NCC_AUTO_MODE)
{
Console::out("Note: This doesn't affect your current install of composer (if you have composer installed)");
$update_composer = Console::getBooleanInput('Do you want to install composer for NCC? (Recommended)');
}
else
{
$update_composer = false;
}
}
}
else
{
$update_composer = false;
}
if(!$NCC_AUTO_MODE)
{
if(!Console::getBooleanInput('Do you want install NCC?'))
{
Console::outError('Installation cancelled by user');
exit(1);
}
}
// Prepare installation
if($NCC_FILESYSTEM->exists($NCC_INSTALL_PATH))
{
@ -235,17 +459,97 @@
}
catch(IOException $e)
{
Console::outException('Cannot delete directory \'' . $NCC_INSTALL_PATH . '\', ' . $e->getMessage(), $e, 1);
return;
Console::outError('Cannot delete directory \'' . $NCC_INSTALL_PATH . '\', ' . $e->getMessage());
exit(1);
}
}
$NCC_FILESYSTEM->mkdir($NCC_INSTALL_PATH, 0755);
// Copy files to the installation path
try
{
Console::out('Copying files to \'' . $NCC_INSTALL_PATH . '\'');
Functions::initializeFiles();
}
catch(Exception $e)
{
Console::outError('Cannot initialize NCC files, ' . $e->getMessage());
exit(1);
}
// Install composer
if($update_composer)
{
Console::out('Installing composer for NCC');
$fp = fopen($NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'composer-setup.php', 'w+');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $NCC_COMPOSER_UPDATE_SOURCE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, 'ncc/' . NCC_VERSION_NUMBER . ' (' . NCC_VERSION_BRANCH . ')');
curl_exec($ch);
curl_close($ch);
fclose($fp);
Console::out('Running composer installer');
$Process = Process::fromShellCommandline(implode(' ', [
$NCC_PHP_EXECUTABLE,
escapeshellcmd($NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'composer-setup.php'),
'--install-dir=' . escapeshellcmd($NCC_INSTALL_PATH),
'--filename=composer.phar'
]));
$Process->setWorkingDirectory($NCC_INSTALL_PATH);
$Process->setTty(Functions::isTtyMode());
try
{
if($Process->isTty())
{
$Process->run();
}
else
{
Console::outWarning('Composer is running in non-interactive mode, this may cause issues');
$Process->run(function ($type, $buffer)
{
if (Process::ERR === $type)
{
Console::outError($buffer);
}
else
{
Console::out($buffer);
}
});
}
}
catch(ProcessFailedException $e)
{
Console::outError('Cannot install composer, ' . $e->getMessage());
exit(1);
}
// Verify install
if(!$NCC_FILESYSTEM->exists([$NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'composer.phar']))
{
Console::outError("Installation failed, the installation exited without any issues but composer doesn't seem to be installed correctly");
exit(1);
}
$NCC_FILESYSTEM->remove([$NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'composer-setup.php']);
$NCC_FILESYSTEM->chmod([$NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'composer.phar'], 0755);
Console::out('Installed composer successfully');
}
// Install NCC
Console::out('Copying files to \'' . $NCC_INSTALL_PATH . '\'');
try
{
$build_files = explode("\n", IO::fread(__DIR__ . DIRECTORY_SEPARATOR . 'build_files'));
}
catch(Exception $e)
@ -253,102 +557,184 @@
Console::outError($e->getMessage(), true, 1);
return;
}
$total_items = count($build_files);
//$processed_items = 1;
$progress_bar = new \ncc\Utilities\ConsoleProgressBar('Installing ncc', $total_items);
$processed_items = 1;
foreach ($build_files as $item)
// Create all the directories first
foreach($build_files as $path)
{
$progress_bar->setMiscText($item, true);
$source = __DIR__ . DIRECTORY_SEPARATOR . $item;
$destination = $NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . $item;
if (is_file($source))
if(is_dir(__DIR__ . DIRECTORY_SEPARATOR . $path))
{
$parent_directory = dirname($destination);
$NCC_FILESYSTEM->mkdir([$NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . $path]);
$NCC_FILESYSTEM->chmod([$NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . $path], 0755);
$processed_items += 1;
}
if(!is_dir($parent_directory))
Console::inlineProgressBar($processed_items, $total_items);
}
// Copy over all the files
foreach($build_files as $file)
{
if(is_file(__DIR__ . DIRECTORY_SEPARATOR . $file))
{
$NCC_FILESYSTEM->copy(__DIR__ . DIRECTORY_SEPARATOR . $file, $NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . $file);
$NCC_FILESYSTEM->chmod([$NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . $file], 0755);
if(!$NCC_FILESYSTEM->exists($NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . $file))
{
$NCC_FILESYSTEM->mkdir($parent_directory, 0755);
Console::outError('Cannot create file \'' . $NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . $file . '\', installation failed.');
exit(1);
}
$NCC_FILESYSTEM->copy($source, $destination);
$NCC_FILESYSTEM->chmod([$destination], 0755);
if (!$NCC_FILESYSTEM->exists($destination))
{
Console::outError(sprintf('Failed to copy file \'%s\' to \'%s\'', $source, $destination), true, 1);
return;
}
$processed_items += 1;
}
//++$processed_items;
//Console::inlineProgressBar($processed_items, $total_items);
$progress_bar->increaseValue(1, true);
Console::inlineProgressBar($processed_items, $total_items);
}
$progress_bar->setMiscText('done', true);
unset($progress_bar);
// Initialize ncc's files
try
{
if(is_file(__DIR__ . DIRECTORY_SEPARATOR . 'default_repositories.json'))
{
Functions::initializeFiles($NCC_INSTALL_PATH, Functions::loadJsonFile(__DIR__ . DIRECTORY_SEPARATOR . 'default_repositories.json', Functions::FORCE_ARRAY));
}
else
{
Functions::initializeFiles($NCC_INSTALL_PATH);
}
}
catch(Exception $e)
{
Console::outException('Cannot initialize NCC files, ' . $e->getMessage(), $e, 1);
return;
}
// Generate executable shortcut
Console::out('Creating shortcut');
try
{
$executable_shortcut = IO::fread(__DIR__ . DIRECTORY_SEPARATOR . 'ncc.sh');
}
catch(Exception $e)
{
Console::outException(sprintf('Failed to read file \'%s\', %s', __DIR__ . DIRECTORY_SEPARATOR . 'ncc.sh', $e->getMessage()), $e, 1);
Console::outError($e->getMessage(), true, 1);
return;
}
$executable_shortcut = str_ireplace(['%php_exec', '%ncc_exec'], [$NCC_PHP_EXECUTABLE, $NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'ncc'],
$executable_shortcut
);
$executable_shortcut = str_ireplace('%php_exec', $NCC_PHP_EXECUTABLE, $executable_shortcut);
$executable_shortcut = str_ireplace('%ncc_exec', $NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'ncc', $executable_shortcut);
$bin_paths = [
DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'local' . DIRECTORY_SEPARATOR . 'bin',
DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'bin',
DIRECTORY_SEPARATOR . 'bin'
];
foreach($bin_paths as $path)
{
$path .= DIRECTORY_SEPARATOR . 'ncc';
// Delete old versions of the executable shortcuts.
if($NCC_FILESYSTEM->exists($path . DIRECTORY_SEPARATOR . 'ncc'))
{
$NCC_FILESYSTEM->remove($path . DIRECTORY_SEPARATOR . 'ncc');
}
if($NCC_FILESYSTEM->exists($path))
{
$NCC_FILESYSTEM->remove($path);
try
{
IO::fwrite($path . DIRECTORY_SEPARATOR . 'ncc', $executable_shortcut);
$NCC_FILESYSTEM->chmod([$path . DIRECTORY_SEPARATOR . 'ncc'], 0755);
}
catch (Exception $e)
{
Console::outException($e->getMessage(), $e, 1);
return;
}
}
}
// Register the ncc extension
Console::out('Registering extension');
try
{
$extension_shortcut = IO::fread(__DIR__ . DIRECTORY_SEPARATOR . 'extension');
}
catch(Exception $e)
{
Console::outError($e->getMessage(), true, 1);
return;
}
$extension_shortcut = str_ireplace('%ncc_install', $NCC_INSTALL_PATH, $extension_shortcut);
// Remove all the old extensions first.
/**
* @param string $path
* @param Filesystem $filesystem
* @param string $extension_shortcut
* @return bool
*/
function install_extension(string $path, Filesystem $filesystem, string $extension_shortcut): bool
{
if ($filesystem->exists($path . DIRECTORY_SEPARATOR . 'ncc'))
{
$filesystem->remove($path . DIRECTORY_SEPARATOR . 'ncc');
}
try
{
IO::fwrite($path, $executable_shortcut);
$NCC_FILESYSTEM->chmod([$path], 0755);
IO::fwrite($path . DIRECTORY_SEPARATOR . 'ncc', $extension_shortcut);
}
catch (Exception $e)
catch (\ncc\Exceptions\IOException $e)
{
Console::outException(sprintf('Failed to write file \'%s\', %s', $path, $e->getMessage()), $e, 1);
return;
Console::outException($e->getMessage(), $e, 1);
return false;
}
if ($filesystem->exists($path . DIRECTORY_SEPARATOR . 'ncc'))
{
return true;
}
return false;
}
if(function_exists('get_include_path'))
{
$default_share = DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'share' . DIRECTORY_SEPARATOR . 'php';
$include_paths = explode(':', get_include_path());
$extension_registered = false;
if(!in_array($default_share, $include_paths))
{
foreach($include_paths as $path)
{
if($extension_registered)
break;
switch($path)
{
// Ignore local files
case '.':
case '..':
break;
// First real include path is /usr/share/php
default:
// Install the extension
$extension_registered = install_extension($path, $NCC_FILESYSTEM, $extension_shortcut);
break;
}
}
}
else
{
// Remove the old extension
install_extension($default_share, $NCC_FILESYSTEM, $extension_shortcut);
}
}
// Overwrite automatic values created by the installer
$config_obj['ncc']['data_directory'] = $NCC_DATA_PATH;
$config_obj['php']['executable_path'] = $NCC_PHP_EXECUTABLE;
$config_obj['git']['executable_path'] = $NCC_EXECUTABLE_FINDER->find('git');
$config_obj['composer']['executable_path'] = $NCC_EXECUTABLE_FINDER->find('composer');
if($config_obj['git']['executable_path'] == null)
{
Console::outWarning('Cannot locate the executable path for \'git\', run \'ncc config -p git.executable_path -v "GIT_PATH_HERE"\' as root to update the path');
}
if(!$update_composer)
{
Console::outWarning('Since composer is not installed alongside NCC, the installer will attempt to locate a install of composer on your system and configure NCC to use that');
$config_obj['composer']['enable_internal_composer'] = false;
if($config_obj['composer']['executable_path'] == null)
{
Console::outWarning('Cannot locate the executable path for \'composer\', run \'ncc config --composer.executable_path="composer.phar"\' as root to update the path');
}
}
@ -384,20 +770,18 @@
{
// handle the arguments, merge one by one
$args = func_get_args();
if (!is_array($args[0]))
$array = $args[0];
if (!is_array($array))
{
return $args[0];
return $array;
}
for ($i = 1, $i_max = count($args); $i < $i_max; $i++)
for ($i = 1; $i < count($args); $i++)
{
if (is_array($args[$i]))
{
$array = recurse($array, $args[$i]);
}
}
return $array;
}
}
@ -415,7 +799,7 @@
{
foreach ($array1 as $key => $value)
{
// create new key in $array if it is empty or not an array
// create new key in $array, if it is empty or not an array
/** @noinspection PhpConditionAlreadyCheckedInspection */
if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key])))
{
@ -427,7 +811,6 @@
{
$value = recurse($array[$key], $value);
}
$array[$key] = $value;
}
return $array;
@ -436,11 +819,9 @@
if($config_backup !== null)
{
$config_obj = array_replace_recursive($config_obj, $config_backup);
}
if($config_backup === null)
if($config_backup == null)
{
Console::out('Generating ncc.yaml');
}
@ -459,6 +840,57 @@
return;
}
if($NCC_FILESYSTEM->exists(__DIR__ . DIRECTORY_SEPARATOR . 'repositories'))
{
if(!$NCC_FILESYSTEM->exists(__DIR__ . DIRECTORY_SEPARATOR . 'repositories' . DIRECTORY_SEPARATOR . 'custom_repositories.json'))
return;
try
{
$custom_repositories = Functions::loadJsonFile(__DIR__ . DIRECTORY_SEPARATOR . 'repositories' . DIRECTORY_SEPARATOR . 'custom_repositories.json', Functions::FORCE_ARRAY);
}
catch(Exception $e)
{
$custom_repositories = null;
Console::outWarning(sprintf('Failed to load custom repositories: %s', $e->getMessage()));
}
if($custom_repositories !== null)
{
$source_manager = new RemoteSourcesManager();
foreach($custom_repositories as $repository)
{
$repo_path = __DIR__ . DIRECTORY_SEPARATOR . 'repositories' . DIRECTORY_SEPARATOR . $repository;
if($NCC_FILESYSTEM->exists($repo_path))
{
try
{
$definedEntry = DefinedRemoteSource::fromArray(Functions::loadJsonFile($repo_path, Functions::FORCE_ARRAY));
if(!$source_manager->getRemoteSource($definedEntry->Name))
$source_manager->addRemoteSource($definedEntry);
}
catch(Exception $e)
{
Console::outWarning(sprintf('Failed to load custom repository %s: %s', $repository, $e->getMessage()));
}
}
else
{
Console::outWarning(sprintf('Failed to load custom repository %s, file does not exist', $repository));
}
}
try
{
$source_manager->save();
}
catch (\ncc\Exceptions\IOException $e)
{
Console::outWarning(sprintf('Failed to save sources: %s', $e->getMessage()));
}
}
}
Console::out('NCC version: ' . NCC_VERSION_NUMBER . ' has been successfully installed');
Console::out('For licensing information see \'' . $NCC_INSTALL_PATH . DIRECTORY_SEPARATOR . 'LICENSE\' or run \'ncc help --license\'');

View file

@ -1,31 +0,0 @@
<?xml version="1.0"?>
<!--
~ Copyright (c) Nosial 2022-2023, 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:
~
~ 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 NON-INFRINGEMENT. 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.
~
-->
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/ncc">
<comment>ncc package binary</comment>
<magic priority="50">
<match type="string" value="ncc_pkg" offset="0"/>
</magic>
<glob pattern="*.ncc"/>
</mime-type>
</mime-info>

View file

@ -1,12 +0,0 @@
[Desktop Entry]
Version=1.0
Name=ncc
GenericName=Nosial Code Compiler
Comment=Nosial Code Compiler
Exec=/usr/bin/ncc
TryExec=/usr/bin/ncc
Icon=/usr/share/icons/ncc.png
Terminal=true
Type=Application
Categories=Development;
Keywords=compiler;code

View file

@ -0,0 +1,36 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, 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:
*
* 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 NON-INFRINGEMENT. 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.
*
*/
namespace ncc\Abstracts;
abstract class AuthenticationType
{
/**
* A combination of a username and password is used for authentication
*/
const UsernamePassword = 1;
/**
* A single private access token is used for authentication
*/
const AccessToken = 2;
}

View file

@ -0,0 +1,37 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, 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:
*
* 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 NON-INFRINGEMENT. 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.
*
*/
namespace ncc\Abstracts;
class BuiltinRemoteSourceType
{
/**
* The remote source indicates the package is to be
* fetched using the composer utility.
*/
const Composer = 'composer';
const All = [
self::Composer
];
}

View file

@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, 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:
*
* 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 NON-INFRINGEMENT. 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.
*
*/
namespace ncc\Abstracts;
abstract class CompilerExtensionDefaultVersions
{
// ----------------------------------------------------------------
// [0] = MinimumVersion
// [1] = MaximumVersion
// ----------------------------------------------------------------
const PHP = ['8.0', '8.2'];
}

View file

@ -0,0 +1,28 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, 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:
*
* 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 NON-INFRINGEMENT. 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.
*
*/
namespace ncc\Abstracts;
abstract class CompilerExtensionSupportedVersions
{
const PHP = ['8.0', '8.1', '8.2'];
}

View file

@ -0,0 +1,32 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, 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:
*
* 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 NON-INFRINGEMENT. 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.
*
*/
namespace ncc\Abstracts;
abstract class CompilerExtensions
{
const PHP = 'php';
const All = [
CompilerExtensions::PHP
];
}

View file

@ -0,0 +1,51 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, 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:
*
* 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 NON-INFRINGEMENT. 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.
*
*/
namespace ncc\Abstracts;
abstract class ComponentDataType
{
/**
* Indicates whether the component is represented as an AST representation
*/
const AST = 'ast';
/**
* Indicates whether the component is represented as plaintext
*/
const Plain = 'plain';
/**
* Indicates whether the component is represented as bytecode
*/
const Bytecode = 'bytecode';
/**
* Indicates whether the component is represented as binary or executable
*/
const Binary = 'binary';
/**
* Indicates whether the component is represented as as a base64 encoded string (Raw bytes' representation)
*/
const b64encoded = 'b64enc';
}

View file

@ -0,0 +1,33 @@
<?php
/*
* Copyright (c) Nosial 2022-2023, 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:
*
* 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 NON-INFRINGEMENT. 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.
*
*/
namespace ncc\Abstracts;
abstract class ComponentFileExtensions
{
/**
* The file extensions that the PHP compiler extension will accept as components.
*
* @var array
*/
const Php = ['*.php', '*.php3', '*.php4', '*.php5', '*.phtml'];
}

Some files were not shown because too many files have changed in this diff Show more