Commit graph

103 commits

Author SHA1 Message Date
76f12bb0a3
Fixed issue where all development dependencies were not correctly being added to debug builds in composer projects,
instead these dependencies were added globally to the build configuration. This issue was fixed by adding all the
   development dependencies to the debug build configurations only.

This commit revises the handling of composer dependencies in 'ProjectManager.php'. A problem was encountered where software development dependencies were added globally to the build configuration, rather than exclusively to debug builds. By reassigning these dependencies to the debug configuration, this issue has been remedied.

Additionally, a bug-fix in 'PackageReader.php' has been implemented to validate the package file by checking the data length. If the file is discovered to be invalid (data length is null or zero), an IOException is triggered.

These changes enhance the accuracy of dependency management and improve the robustness of package validation.
2023-10-25 17:57:51 -04:00
7befd995e7
Added host resolving in network calls to improve the handling of invalid or unreachable URLs
The 'Resolver' utility was utilized to resolve the host and cache the result, enhancing the robustness and efficiency of the network calling mechanism across different modules including PackageManager, GiteaRepository, GithubRepository, and others.
2023-10-25 15:08:58 -04:00
b2234d5040
Updated the Download function to attempt to retry the download upon an error for at least 3 times.
Updated the downloadFile function in PackageManager.php to retry the download upon an error for at least 3 times. This improvement on error handling will enhance the resilience of the download process, reducing the likelihood of a single network hiccup resulting in a failed download. This change has also been reflected in the CHANGELOG.md file.
2023-10-25 14:33:42 -04:00
de1e199dff
Fixed issue where a newline is sometimes added to the end of a download output due to how short the download process was, mitigated the issue by enforcing a "done" update at the end of the download process
A fix has been implemented for an issue where a newline was unintentionally added to the end of download output, mostly when the download process was too short. This has been mitigated by ensuring a "done" update whenever a download finishes.

At the same time, improvements have been made to the download progress output. Specifically, the downloaded size now won't exceed the total download size, and a definitive "100%" progress indication is enforced when the download ends.
2023-10-25 14:00:24 -04:00
a2cd98ba98
Updated exception handling in PackageReader
Optimized exception handling in PackageReader class by replacing NotSupportedException with IntegrityException. The update aligns with the objective of more accurate error handling and reporting during ZiProto decoding. The new IntegrityException provides a detailed error message, facilitating easier debugging.
2023-10-24 16:28:10 -04:00
27baeca112
Set default process timeouts to null
This commit sets the default timeout and idleTimeout for the execution process in ExecutionUnitRunner to null when there are no specific timeouts provided by the execution policy. This change was made to avoid unexpected timeouts when no specific values are set in the execution policy.
2023-10-24 16:07:48 -04:00
4f7aa7a859
Update progress bar text to display basename only
Modified the progress bar text display in PackageManager.php and NccCompiler.php classes. Changed 'setMiscText' function to now display only the basename of the component name, execution policy name, and resource name. This change improves readability and clarity of the progress bar by reducing clutter from long file paths.
2023-10-24 16:05:40 -04:00
3ebdeb0cba
Fixed issue where progress bar is displayed in VERBOSE mode
Added checks in the update method of the ConsoleProgressBar class to prevent it from displaying when log level is set to VERBOSE. This is to prevent cluttering the command-line interface with unnecessary information when running in VERBOSE mode. The changes also are reflected in the changelog.
2023-10-22 22:16:33 -04:00
bcc6f45eb4
Fix division by zero in ConsoleProgressBar
The rendering of the progress bar was causing a division by zero error when the maximum value was set to 0. This change adds a condition to check if the maximum value is not 0 before calculating the number of hashes and the percentage done in the progress bar. This avoids the division by zero error and makes the progress bar rendering more robust. The CHANGELOG.md file has also been updated to reflect this bug fix.
2023-10-22 19:26:16 -04:00
698d2e7a1f
Updated file tracking in Runtime class
Implemented changes in Runtime.php to better handle file tracking and to prevent unnecessary inclusion of duplicate files during Runtime. Instead of directly checking if a file is already included, we now create a unique identifier for each file using a crc32 hash function. This identifier (instead of the file path) is checked and stored in the inclusion list, allowing for better handling of dynamic or virtual files.
2023-10-18 16:03:40 -04:00
89d3af8680
Improve build efficiency by preventing duplicate merges
Introduced a private property to the `NccCompiler` class, `$merged_dependencies`, to keep track of the dependencies that have already been merged. This prevents unnecessary re-merging during the build operation, potentially enhancing the efficiency of the process. The implementation involves a check for a preexisting merge before a new merge is performed. If a merge already exists, the process is skipped, thereby avoiding redundancies.
2023-10-18 15:56:24 -04:00
12d7744e1e
Bumped version to 2.0.4 2023-10-18 15:49:16 -04:00
a76a8a4ae6
Updated CHANGELOG.md 2023-10-17 21:44:22 -04:00
7293519ba3
Add error handling for unspecified package in PackageManagerMenu 2023-10-17 21:27:40 -04:00
2605b8d218
- Added new ConsoleProgressBar class for UI improvement, imrpoved the CLI Progress Bar inspired by
[pacman](https://wiki.archlinux.org/title/pacman)
2023-10-17 21:23:05 -04:00
173032df72
- 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.
 - 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.
2023-10-17 17:01:40 -04:00
c736a896fb
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 errors when the package lock contains a version that is not available in the repository. 2023-10-13 09:41:39 -04:00
4c6f2ddcfe
Updated CHANGELOG.md 2023-10-13 01:32:34 -04:00
e3ac3cf7a3
Updated CHANGELOG.md 2023-10-12 16:34:21 -04:00
81ea985b68
Updated CHANGELOG.md 2023-10-12 16:27:07 -04:00
71214e769e
Refactor ncc extension registration logic, this also allows for debian packages to install the ncc extension automatically.
The logic related to the registration of the ncc extension has been refactored. Previously, the code that registered the ncc extension was contained in the installer. However, this change moves the code that registers the ncc extension from the installer to the Utilities/Functions class. This change was made because the extension registration is not only applicable to the installer, but is also required for several other components. This fact justified the need for the logic to be located in a more generic and accessible class. The Makefile, installer, generate_build_files.php files have been updated to reflect this change. Components using these should now work properly with the changes.
2023-10-12 16:24:36 -04:00
89b0c931b9
Fixed incorrect mime type in ncc-package.xml
This update addresses a mistake in the `ncc-package.xml` file, where the wrong mime type was specified. The mime type has been corrected from `application/ncc-package` to `application/ncc` and the glob pattern from `*.ncc_pkg` to `*.ncc`. This change will ensure proper recognition and handling of the file type.
2023-10-12 15:59:58 -04:00
4ef923b83c
- 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.
 - 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.
 - 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.
2023-10-12 15:55:10 -04:00
e4a3dc2f99
Updated CHANGELOG.md 2023-10-11 20:23:45 -04:00
ff5a6c7f7a
Updated CHANGELOG.md 2023-10-11 19:06:46 -04:00
e1907911bf
Updated CHANGELOG.md 2023-10-11 00:29:41 -04:00
94e599e372
Updated CHANGELOG.md 2023-10-11 00:27:13 -04:00
35981115eb
Add functionality to install project dependencies
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`.
2023-10-11 00:25:39 -04:00
c82bc7195a
Updated CHANGELOG.md 2023-10-10 23:01:01 -04:00
71787cd7fe
Updated CHANGELOG.md 2023-10-10 22:57:56 -04:00
4673c74d16
Updated CHANGELOG.md 2023-10-01 16:39:25 -04:00
ba2e968676
Touchup 2023-09-28 21:30:00 -04:00
f62856b530
- Cleaned up imports
- Various bug fixes and improved performance on package reading/writing
 - Corrected CHANGELOG.md
 - 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
 - Added support for Gitea repositories
 - Added support for Packagist repositories
 - Added a new default Gitea repository nocturn9x at git.nocturn9x.space
 - Added a new default Gitea repository martinvlba at git.martinvlba.eu
 - Added a new default Gitea repository kuny at git.it-kuny.ch
 - Added dependency composer/semver version 3.4.0 for composer version comparison compatibility
 - Added a new class \ncc\Classes\ArchiveExtractor to extract multiple archive types
 - 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 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 access to perform any operations on the credential file. A password will still be needed to decrypt entries in the file if any entries are encrypted.
 - 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
2023-09-26 17:06:43 -04:00
de88a4fb9e
- Added the ability to compile executable binaries for php using gcc
- 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
 - Removed dependency `theseer\Autoload` in favor of ncc's own autoloader (screw you Arne Blankerts)
 - Refactored ZiProto
 - Removed runners `Python2` & `Python3` in favor of `Python`
2023-09-10 22:47:24 -04:00
5ce1c8cfa1
Bumped version to 2.0.0 2023-09-04 21:56:36 -04:00
d41ae8114f
- Refactored the entire package structure to ncc package structure 2.0 for memory efficiency and performance 2023-09-04 21:56:07 -04:00
45c53981ef
- Added the ability to clean arrays in \ncc\Utilities > Functions > cleanArray() 2023-09-01 04:06:52 -04:00
0e8397ec1f
- Added new template PhpCliTemplate phpcli
- Added new template PhpLibraryTemplate `phplib`
 - Implemented a template engine and refactored the CLI menu for the Project Manager and added a new `template` command
2023-09-01 03:47:01 -04:00
01cda99139
- \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.
 - 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.
2023-08-31 18:26:18 -04:00
230675c586
- \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`
 - Removed parameter `$throw_exception` from `\ncc\Objects\ProjectConfiguration > Project > validate()`
2023-08-30 20:38:52 -04:00
05c890f0d1
- 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
 - Removed unused `\ncc\Objects > NccUpdateInformation`
 - Removed unused `\ncc\Objects > PhpConfiguration`
2023-08-30 19:58:31 -04:00
42c26c92a0
- 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`
 - Fixed hash comparisons to use `hash_equals` implementations to combat against Timing Attacks
2023-08-28 22:54:54 -04:00
eeffb15eb7
- Updated class \ncc\Objects\Vault\Password > AccessToken to use method calls rather than direct property access 2023-08-28 18:34:19 -04:00
424b503f42
- Updated class \ncc\Objects\SymlinkDictionary > SymlinkEntry to use method calls rather than direct property access 2023-08-28 18:31:59 -04:00
729c9cb217
- Added a new interface class SerializableObjectInterface to implement serializable objects, BytecodeObjectInterface
extends this interface to allow for serialization of compiled assets
 - 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`
2023-08-28 18:27:09 -04:00
2ea1dfc27a
- 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
2023-08-27 11:41:11 -04:00
dc7fcfc757
- 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
 - Fixed all @throw tags in the project to use the correct exception class
 - Removed unused `scope` property from `\ncc\Objects\ProjectConfiguration > Build`
2023-08-27 01:04:35 -04:00
9c76d31de9
- Updated class \ncc\Objects\ProjectConfiguration > Dependency to use method calls rather than direct property access 2023-08-23 14:23:21 -04:00
eef360a8f7
- Added new exception OperationException in \ncc\Exceptions to replace all generic related exceptions
- 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.
2023-08-23 11:44:32 -04:00
69d7b86534
- 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`
2023-08-21 23:14:13 -04:00