- 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`
This commit is contained in:
parent
42c26c92a0
commit
05c890f0d1
38 changed files with 1247 additions and 964 deletions
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -186,6 +186,20 @@ features and reduced the number of exceptions down to 15 exceptions.
|
|||
`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
|
||||
|
||||
|
||||
### Removed
|
||||
- Removed `FileNotFoundException` and `DirectoryNotFoundException` from `\ncc\Exceptions`
|
||||
|
@ -245,6 +259,8 @@ features and reduced the number of exceptions down to 15 exceptions.
|
|||
- 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`
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@
|
|||
Console::out('NCC Version: ' . NCC_VERSION_NUMBER . ' (' . NCC_VERSION_BRANCH . ')');
|
||||
Console::out('Build Flags: ' . implode(',', NCC_VERSION_FLAGS));
|
||||
|
||||
foreach($VersionInformation->Components as $component)
|
||||
foreach($VersionInformation->getComponents() as $component)
|
||||
{
|
||||
$full_name = $component->getVendor() . '/' . $component->getPackageName();
|
||||
|
||||
|
|
|
@ -177,10 +177,10 @@
|
|||
|
||||
try
|
||||
{
|
||||
Console::out('magic_bytes: ' . json_encode(($package->magic_bytes?->toArray() ?? []), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
Console::out('header: ' . json_encode(($package->header?->toArray() ?? []), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
Console::out('assembly: ' . json_encode(($package->assembly?->toArray() ?? []), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
Console::out('installer: ' . json_encode(($package->installer?->toArray() ?? []), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
Console::out('magic_bytes: ' . json_encode(($package->getMagicBytes()?->toArray() ?? []), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
Console::out('header: ' . json_encode(($package->getHeader()?->toArray() ?? []), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
Console::out('assembly: ' . json_encode(($package->getAssembly()?->toArray() ?? []), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
Console::out('installer: ' . json_encode(($package->getInstaller()?->toArray() ?? []), JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
||||
}
|
||||
catch(JsonException $e)
|
||||
{
|
||||
|
@ -188,12 +188,12 @@
|
|||
return;
|
||||
}
|
||||
|
||||
Console::out('main: ' . ($package->main_execution_policy ?? 'N/A'));
|
||||
Console::out('main: ' . ($package->getMainExecutionPolicy() ?? 'N/A'));
|
||||
|
||||
if($package->dependencies !== null && count($package->dependencies) > 0)
|
||||
if(count($package->getDependencies()) > 0)
|
||||
{
|
||||
Console::out('dependencies:');
|
||||
foreach($package->dependencies as $dependency)
|
||||
foreach($package->getDependencies() as $dependency)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -211,10 +211,10 @@
|
|||
Console::out('dependencies: N/A');
|
||||
}
|
||||
|
||||
if($package->execution_units !== null && count($package->execution_units) > 0)
|
||||
if(count($package->getExecutionUnits()) > 0)
|
||||
{
|
||||
Console::out('execution_units:');
|
||||
foreach($package->execution_units as $unit)
|
||||
foreach($package->getExecutionUnits() as $unit)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -232,10 +232,10 @@
|
|||
Console::out('execution_units: N/A');
|
||||
}
|
||||
|
||||
if($package->resources !== null && count($package->resources) > 0)
|
||||
if(count($package->getResources()) > 0)
|
||||
{
|
||||
Console::out('resources:');
|
||||
foreach($package->resources as $resource)
|
||||
foreach($package->getResources() as $resource)
|
||||
{
|
||||
Console::out(' - ' . sprintf('%s - (%s)', $resource->getName(), Functions::b2u(strlen($resource->getData()))));
|
||||
}
|
||||
|
@ -245,10 +245,10 @@
|
|||
Console::out('resources: N/A');
|
||||
}
|
||||
|
||||
if($package->components !== null && count($package->components) > 0)
|
||||
if(count($package->getComponents()) > 0)
|
||||
{
|
||||
Console::out('components:');
|
||||
foreach($package->components as $component)
|
||||
foreach($package->getComponents() as $component)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -402,7 +402,7 @@
|
|||
try
|
||||
{
|
||||
$parsed_source = new RemotePackageInput($package);
|
||||
if($parsed_source->vendor !== null && $parsed_source->package !== null && $parsed_source->source !== null)
|
||||
if($parsed_source->getVendor() !== null && $parsed_source->getPackage() !== null && $parsed_source->getSource() !== null)
|
||||
{
|
||||
$package_path = realpath($package_manager->fetchFromSource($parsed_source->toString(), $credential));
|
||||
}
|
||||
|
@ -458,56 +458,56 @@
|
|||
|
||||
Console::out('Package installation details' . PHP_EOL);
|
||||
|
||||
if(!is_null($package->assembly->getUuid()))
|
||||
if(!is_null($package->getAssembly()->getUuid()))
|
||||
{
|
||||
Console::out(' UUID: ' . Console::formatColor($package->assembly->getUuid(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' UUID: ' . Console::formatColor($package->getAssembly()->getUuid(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
|
||||
if(!is_null($package->assembly->getPackage()))
|
||||
if(!is_null($package->getAssembly()->getPackage()))
|
||||
{
|
||||
Console::out(' Package: ' . Console::formatColor($package->assembly->getPackage(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' Package: ' . Console::formatColor($package->getAssembly()->getPackage(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
|
||||
if(!is_null($package->assembly->getName()))
|
||||
if(!is_null($package->getAssembly()->getName()))
|
||||
{
|
||||
Console::out(' Name: ' . Console::formatColor($package->assembly->getName(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' Name: ' . Console::formatColor($package->getAssembly()->getName(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
|
||||
if(!is_null($package->assembly->getVersion()))
|
||||
if(!is_null($package->getAssembly()->getVersion()))
|
||||
{
|
||||
Console::out(' Version: ' . Console::formatColor($package->assembly->getVersion(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' Version: ' . Console::formatColor($package->getAssembly()->getVersion(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
|
||||
if(!is_null($package->assembly->getDescription()))
|
||||
if(!is_null($package->getAssembly()->getDescription()))
|
||||
{
|
||||
Console::out(' Description: ' . Console::formatColor($package->assembly->getDescription(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' Description: ' . Console::formatColor($package->getAssembly()->getDescription(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
|
||||
if(!is_null($package->assembly->getProduct()))
|
||||
if(!is_null($package->getAssembly()->getProduct()))
|
||||
{
|
||||
Console::out(' Product: ' . Console::formatColor($package->assembly->getProduct(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' Product: ' . Console::formatColor($package->getAssembly()->getProduct(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
|
||||
if(!is_null($package->assembly->getCompany()))
|
||||
if(!is_null($package->getAssembly()->getCompany()))
|
||||
{
|
||||
Console::out(' Company: ' . Console::formatColor($package->assembly->getCompany(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' Company: ' . Console::formatColor($package->getAssembly()->getCompany(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
|
||||
if(!is_null($package->assembly->getCopyright()))
|
||||
if(!is_null($package->getAssembly()->getCopyright()))
|
||||
{
|
||||
Console::out(' Copyright: ' . Console::formatColor($package->assembly->getCopyright(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' Copyright: ' . Console::formatColor($package->getAssembly()->getCopyright(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
|
||||
if(!is_null($package->assembly->getTrademark()))
|
||||
if(!is_null($package->getAssembly()->getTrademark()))
|
||||
{
|
||||
Console::out(' Trademark: ' . Console::formatColor($package->assembly->getTrademark(), ConsoleColors::LIGHT_GREEN));
|
||||
Console::out(' Trademark: ' . Console::formatColor($package->getAssembly()->getTrademark(), ConsoleColors::LIGHT_GREEN));
|
||||
}
|
||||
Console::out((string)null);
|
||||
|
||||
if(count($package->dependencies) > 0)
|
||||
if(count($package->getDependencies()) > 0)
|
||||
{
|
||||
$dependencies = [];
|
||||
foreach($package->dependencies as $dependency)
|
||||
foreach($package->getDependencies() as $dependency)
|
||||
{
|
||||
$require_dependency = false;
|
||||
|
||||
|
@ -559,28 +559,20 @@
|
|||
}
|
||||
|
||||
Console::out(sprintf('Extension: %s',
|
||||
Console::formatColor($package->header->getCompilerExtension()->getExtension(), ConsoleColors::GREEN)
|
||||
Console::formatColor($package->getHeader()->getCompilerExtension()->getExtension(), ConsoleColors::GREEN)
|
||||
));
|
||||
|
||||
if($package->header->getCompilerExtension()->getMinimumVersion() !== null)
|
||||
{
|
||||
Console::out(sprintf('Maximum Version: %s',
|
||||
Console::formatColor($package->header->getCompilerExtension()->getMinimumVersion(), ConsoleColors::LIGHT_MAGENTA)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
if($package->header->getCompilerExtension()->getMinimumVersion() !== null)
|
||||
{
|
||||
Console::out(sprintf('Minimum Version: %s',
|
||||
Console::formatColor($package->header->getCompilerExtension()->getMinimumVersion(), ConsoleColors::LIGHT_MAGENTA)
|
||||
));
|
||||
}
|
||||
Console::out(sprintf('Maximum Version: %s',
|
||||
Console::formatColor($package->getHeader()->getCompilerExtension()->getMinimumVersion(), ConsoleColors::LIGHT_MAGENTA)
|
||||
));
|
||||
|
||||
Console::out(sprintf('Minimum Version: %s',
|
||||
Console::formatColor($package->getHeader()->getCompilerExtension()->getMinimumVersion(), ConsoleColors::LIGHT_MAGENTA)
|
||||
));
|
||||
|
||||
if(!$user_confirmation)
|
||||
{
|
||||
$user_confirmation = Console::getBooleanInput(sprintf('Do you want to install %s', $package->assembly->getPackage()));
|
||||
$user_confirmation = Console::getBooleanInput(sprintf('Do you want to install %s', $package->getAssembly()->getPackage()));
|
||||
}
|
||||
|
||||
if($user_confirmation)
|
||||
|
@ -588,7 +580,7 @@
|
|||
try
|
||||
{
|
||||
$package_manager->install($package_path, $credential, $installer_options);
|
||||
Console::out(sprintf('Package %s installed successfully', $package->assembly->getPackage()));
|
||||
Console::out(sprintf('Package %s installed successfully', $package->getAssembly()->getPackage()));
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
*/
|
||||
public static function fetch(RemotePackageInput $packageInput): string
|
||||
{
|
||||
$package_path = self::require($packageInput->vendor, $packageInput->package, $packageInput->version);
|
||||
$package_path = self::require($packageInput->getVendor(), $packageInput->getPackage(), $packageInput->getVersion());
|
||||
$packages = self::compilePackages($package_path . DIRECTORY_SEPARATOR . 'composer.lock');
|
||||
$real_package_name = explode('=', $packageInput->toStandard(false))[0];
|
||||
|
||||
|
@ -232,10 +232,10 @@
|
|||
$built_package = $project_manager->build();
|
||||
|
||||
// Copy the project to the build directory
|
||||
$out_path = $base_dir . DIRECTORY_SEPARATOR . 'build' . DIRECTORY_SEPARATOR . sprintf('%s.ncc', $project_configuration->assembly->getPackage());
|
||||
$out_path = $base_dir . DIRECTORY_SEPARATOR . 'build' . DIRECTORY_SEPARATOR . sprintf('%s.ncc', $project_configuration->getAssembly()->getPackage());
|
||||
$filesystem->copy($built_package, $out_path);
|
||||
$filesystem->remove($built_package);
|
||||
$built_packages[$project_configuration->assembly->getPackage()] = $out_path;
|
||||
$built_packages[$project_configuration->getAssembly()->getPackage()] = $out_path;
|
||||
}
|
||||
|
||||
return $built_packages;
|
||||
|
@ -310,27 +310,27 @@
|
|||
{
|
||||
// Generate a new project configuration object
|
||||
$project_configuration = new ProjectConfiguration();
|
||||
$project_configuration->assembly->setName($composer_package->getName());
|
||||
$project_configuration->assembly->setDescription($composer_package->getDescription());
|
||||
$project_configuration->getAssembly()->setName($composer_package->getName());
|
||||
$project_configuration->getAssembly()->setDescription($composer_package->getDescription());
|
||||
|
||||
if(isset($version_map[$composer_package->getName()]))
|
||||
{
|
||||
$project_configuration->assembly->setVersion(self::versionMap($composer_package->getName(), $version_map));
|
||||
$project_configuration->getAssembly()->setVersion(self::versionMap($composer_package->getName(), $version_map));
|
||||
}
|
||||
|
||||
if($project_configuration->assembly->getVersion() === null || $project_configuration->assembly->getVersion() === '')
|
||||
if($project_configuration->getAssembly()->getVersion() === '')
|
||||
{
|
||||
$project_configuration->assembly->setVersion('1.0.0');
|
||||
$project_configuration->getAssembly()->setVersion('1.0.0');
|
||||
}
|
||||
|
||||
|
||||
$project_configuration->assembly->setUuid(Uuid::v1()->toRfc4122());
|
||||
$project_configuration->assembly->setPackage(self::toPackageName($composer_package->getName()));
|
||||
$project_configuration->getAssembly()->setUuid(Uuid::v1()->toRfc4122());
|
||||
$project_configuration->getAssembly()->setPackage(self::toPackageName($composer_package->getName()));
|
||||
|
||||
// Add the update source
|
||||
$project_configuration->project->setUpdateSource(new ProjectConfiguration\UpdateSource());
|
||||
$project_configuration->project->getUpdateSource()?->setSource(sprintf('%s@composer', str_ireplace('\\', '/', $composer_package->getName())));
|
||||
$project_configuration->project->getUpdateSource()?->setRepository(null);
|
||||
$project_configuration->getProject()->setUpdateSource(new ProjectConfiguration\UpdateSource());
|
||||
$project_configuration->getProject()->getUpdateSource()?->setSource(sprintf('%s@composer', str_ireplace('\\', '/', $composer_package->getName())));
|
||||
$project_configuration->getProject()->getUpdateSource()?->setRepository(null);
|
||||
|
||||
// Process the dependencies
|
||||
if($composer_package->getRequire() !== null && count($composer_package->getRequire()) > 0)
|
||||
|
@ -350,7 +350,7 @@
|
|||
$dependency->setSourceType(DependencySourceType::LOCAL);
|
||||
$dependency->setVersion(self::versionMap($item->getPackageName(), $version_map));
|
||||
$dependency->setSource($package_name . '.ncc');
|
||||
$project_configuration->build->addDependency($dependency);
|
||||
$project_configuration->getBuild()->addDependency($dependency);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,14 +360,14 @@
|
|||
$build_configuration->setOutputPath('build');
|
||||
|
||||
// Apply the final properties
|
||||
$project_configuration->build->addBuildConfiguration($build_configuration);
|
||||
$project_configuration->build->setDefaultConfiguration('default');
|
||||
$project_configuration->build->setSourcePath('.src');
|
||||
$project_configuration->getBuild()->addBuildConfiguration($build_configuration);
|
||||
$project_configuration->getBuild()->setDefaultConfiguration('default');
|
||||
$project_configuration->getBuild()->setSourcePath('.src');
|
||||
|
||||
// Apply a compiler extension
|
||||
$project_configuration->project->getCompiler()->setExtension(CompilerExtensions::PHP);
|
||||
$project_configuration->project->getCompiler()->setMaximumVersion(CompilerExtensionSupportedVersions::PHP[0]);
|
||||
$project_configuration->project->getCompiler()->setMinimumVersion(CompilerExtensionSupportedVersions::PHP[(count(CompilerExtensionSupportedVersions::PHP) - 1)]);
|
||||
$project_configuration->getProject()->getCompiler()->setExtension(CompilerExtensions::PHP);
|
||||
$project_configuration->getProject()->getCompiler()->setMaximumVersion(CompilerExtensionSupportedVersions::PHP[0]);
|
||||
$project_configuration->getProject()->getCompiler()->setMinimumVersion(CompilerExtensionSupportedVersions::PHP[(count(CompilerExtensionSupportedVersions::PHP) - 1)]);
|
||||
|
||||
return $project_configuration;
|
||||
}
|
||||
|
@ -750,7 +750,7 @@
|
|||
|
||||
if (count($static_files) > 0)
|
||||
{
|
||||
$project_configuration->project->addOption('static_files', $static_files);
|
||||
$project_configuration->getProject()->addOption('static_files', $static_files);
|
||||
|
||||
foreach ($static_files as $file)
|
||||
{
|
||||
|
|
|
@ -56,18 +56,17 @@
|
|||
{
|
||||
$httpRequest = new HttpRequest();
|
||||
$protocol = ($definedRemoteSource->isSsl() ? "https" : "http");
|
||||
$owner_f = str_ireplace("/", "%2F", $packageInput->vendor);
|
||||
$owner_f = str_ireplace(".", "%2F", $owner_f);
|
||||
$repository = urlencode($packageInput->package);
|
||||
$owner_f = str_ireplace(array("/", "."), "%2F", $packageInput->getVendor());
|
||||
$repository = urlencode($packageInput->getPackage());
|
||||
$httpRequest->setUrl($protocol . '://' . $definedRemoteSource->getHost() . "/repos/$owner_f/$repository");
|
||||
$response_decoded = self::getJsonResponse($httpRequest, $entry);
|
||||
|
||||
$query = new RepositoryQueryResults();
|
||||
$query->Files->GitSshUrl = ($response_decoded['ssh_url'] ?? null);
|
||||
$query->Files->GitHttpUrl = ($response_decoded['clone_url'] ?? null);
|
||||
$query->Version = Functions::convertToSemVer($response_decoded['default_branch'] ?? null);
|
||||
$query->ReleaseDescription = ($response_decoded['description'] ?? null);
|
||||
$query->ReleaseName = ($response_decoded['name'] ?? null);
|
||||
$query->getFiles()->GitSshUrl = ($response_decoded['ssh_url'] ?? null);
|
||||
$query->getFiles()->GitHttpUrl = ($response_decoded['clone_url'] ?? null);
|
||||
$query->setVersion(Functions::convertToSemVer($response_decoded['default_branch'] ?? null));
|
||||
$query->setReleaseDescription($response_decoded['description'] ?? null);
|
||||
$query->setReleaseName($response_decoded['name'] ?? null);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
@ -120,9 +119,8 @@
|
|||
{
|
||||
$httpRequest = new HttpRequest();
|
||||
$protocol = ($definedRemoteSource->isSsl() ? "https" : "http");
|
||||
$owner_f = str_ireplace("/", "%2F", $packageInput->vendor);
|
||||
$owner_f = str_ireplace(".", "%2F", $owner_f);
|
||||
$repository = urlencode($packageInput->package);
|
||||
$owner_f = str_ireplace(array("/", "."), "%2F", $packageInput->getVersion());
|
||||
$repository = urlencode($packageInput->getPackage());
|
||||
$httpRequest->setUrl($protocol . '://' . $definedRemoteSource->getHost() . "/repos/$owner_f/$repository/releases");
|
||||
$response_decoded = self::getJsonResponse($httpRequest, $entry);
|
||||
|
||||
|
@ -135,11 +133,11 @@
|
|||
foreach($response_decoded as $release)
|
||||
{
|
||||
$query_results = new RepositoryQueryResults();
|
||||
$query_results->Version = Functions::convertToSemVer($release['tag_name']);
|
||||
$query_results->ReleaseName = $release['name'];
|
||||
$query_results->ReleaseDescription = $release['body'];
|
||||
$query_results->Files->ZipballUrl = ($release['zipball_url'] ?? null);
|
||||
$query_results->Files->TarballUrl = ($release['tarball_url'] ?? null);
|
||||
$query_results->setVersion(Functions::convertToSemVer($release['tag_name']));
|
||||
$query_results->setReleaseName($release['name']);
|
||||
$query_results->getReleaseDescription($release['body']);
|
||||
$query_results->getFiles()->ZipballUrl = ($release['zipball_url'] ?? null);
|
||||
$query_results->getFiles()->TarballUrl = ($release['tarball_url'] ?? null);
|
||||
|
||||
if(isset($release['assets']))
|
||||
{
|
||||
|
@ -148,12 +146,12 @@
|
|||
$parsed_asset = self::parseAsset($asset);
|
||||
if($parsed_asset !== null)
|
||||
{
|
||||
$query_results->Files->PackageUrl = $parsed_asset;
|
||||
$query_results->getFiles()->PackageUrl = $parsed_asset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$return[$query_results->Version] = $query_results;
|
||||
$return[$query_results->getVersion()] = $query_results;
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
@ -221,10 +219,10 @@
|
|||
|
||||
if (count($releases) === 0)
|
||||
{
|
||||
throw new GitException(sprintf('No releases found for %s/%s on %s.', $packageInput->vendor, $packageInput->package, $definedRemoteSource->getHost()));
|
||||
throw new GitException(sprintf('No releases found for %s/%s on %s.', $packageInput->getVendor(), $packageInput->getPackage(), $definedRemoteSource->getHost()));
|
||||
}
|
||||
|
||||
if ($packageInput->version === Versions::LATEST)
|
||||
if ($packageInput->getVersion() === Versions::LATEST)
|
||||
{
|
||||
$latest_version = null;
|
||||
foreach ($releases as $release)
|
||||
|
@ -245,7 +243,7 @@
|
|||
}
|
||||
|
||||
// Query a specific version
|
||||
if (!isset($releases[$packageInput->version]))
|
||||
if (!isset($releases[$packageInput->getVersion()]))
|
||||
{
|
||||
// Find the closest thing to the requested version
|
||||
$selected_version = null;
|
||||
|
@ -257,7 +255,7 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
if (VersionComparator::compareVersion($version, $packageInput->version) === 1)
|
||||
if (VersionComparator::compareVersion($version, $packageInput->getVersion()) === 1)
|
||||
{
|
||||
$selected_version = $version;
|
||||
}
|
||||
|
@ -265,17 +263,17 @@
|
|||
|
||||
if ($selected_version === null)
|
||||
{
|
||||
throw new GitException(sprintf('Version %s not found for %s/%s on %s.', $packageInput->version, $packageInput->vendor, $packageInput->package, $definedRemoteSource->getHost()));
|
||||
throw new GitException(sprintf('Version %s not found for %s/%s on %s.', $packageInput->getVersion(), $packageInput->getVendor(), $packageInput->getPackage(), $definedRemoteSource->getHost()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected_version = $packageInput->version;
|
||||
$selected_version = $packageInput->getVersion();
|
||||
}
|
||||
|
||||
if (!isset($releases[$selected_version]))
|
||||
{
|
||||
throw new GitException(sprintf('Version %s not found for %s/%s on %s.', $packageInput->version, $packageInput->vendor, $packageInput->package, $definedRemoteSource->getHost()));
|
||||
throw new GitException(sprintf('Version %s not found for %s/%s on %s.', $packageInput->getVersion(), $packageInput->getVendor(), $packageInput->getPackage(), $definedRemoteSource->getHost()));
|
||||
}
|
||||
|
||||
return $releases[$selected_version];
|
||||
|
|
|
@ -57,10 +57,8 @@
|
|||
{
|
||||
$httpRequest = new HttpRequest();
|
||||
$protocol = ($definedRemoteSource->isSsl() ? "https" : "http");
|
||||
$owner_f = str_ireplace("/", "%2F", $packageInput->vendor);
|
||||
$owner_f = str_ireplace(".", "%2F", $owner_f);
|
||||
$project_f = str_ireplace("/", "%2F", $packageInput->package);
|
||||
$project_f = str_ireplace(".", "%2F", $project_f);
|
||||
$owner_f = str_ireplace(array("/", "."), "%2F", $packageInput->getVendor());
|
||||
$project_f = str_ireplace(array("/", "."), "%2F", $packageInput->getPackage());
|
||||
$httpRequest->setUrl($protocol . '://' . $definedRemoteSource->getHost() . "/api/v4/projects/$owner_f%2F$project_f");
|
||||
$httpRequest = Functions::prepareGitServiceRequest($httpRequest, $entry);
|
||||
|
||||
|
@ -74,11 +72,11 @@
|
|||
$response_decoded = Functions::loadJson($response->getBody(), Functions::FORCE_ARRAY);
|
||||
|
||||
$query = new RepositoryQueryResults();
|
||||
$query->Files->GitSshUrl = ($response_decoded['ssh_url_to_repo'] ?? null);
|
||||
$query->Files->GitHttpUrl = ($response_decoded['http_url_to_repo'] ?? null);
|
||||
$query->Version = Functions::convertToSemVer($response_decoded['default_branch']);
|
||||
$query->ReleaseDescription = ($response_decoded['description'] ?? null);
|
||||
$query->ReleaseName = ($response_decoded['name'] ?? null);
|
||||
$query->getFiles()->GitSshUrl = ($response_decoded['ssh_url_to_repo'] ?? null);
|
||||
$query->getFiles()->GitHttpUrl = ($response_decoded['http_url_to_repo'] ?? null);
|
||||
$query->setVersion(Functions::convertToSemVer($response_decoded['default_branch']));
|
||||
$query->setReleaseDescription($response_decoded['description'] ?? null);
|
||||
$query->setReleaseName($response_decoded['name'] ?? null);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
@ -97,15 +95,15 @@
|
|||
*/
|
||||
public static function getRelease(RemotePackageInput $package_input, DefinedRemoteSource $defined_remote_source, ?Entry $entry = null): RepositoryQueryResults
|
||||
{
|
||||
$releases = self::getReleases($package_input->vendor, $package_input->package, $defined_remote_source, $entry);
|
||||
$releases = self::getReleases($package_input->getVendor(), $package_input->getPackage(), $defined_remote_source, $entry);
|
||||
|
||||
if(count($releases) === 0)
|
||||
{
|
||||
throw new GitException(sprintf('No releases found for the repository %s/%s (selected version: %s)', $package_input->vendor, $package_input->package, $package_input->version));
|
||||
throw new GitException(sprintf('No releases found for the repository %s/%s (selected version: %s)', $package_input->getVendor(), $package_input->getPackage(), $package_input->getVersion()));
|
||||
}
|
||||
|
||||
// Query the latest package only
|
||||
if($package_input->version === Versions::LATEST)
|
||||
if($package_input->getVersion() === Versions::LATEST)
|
||||
{
|
||||
$latest_version = null;
|
||||
foreach($releases as $release)
|
||||
|
@ -126,7 +124,7 @@
|
|||
}
|
||||
|
||||
// Query a specific version
|
||||
if(!isset($releases[$package_input->version]))
|
||||
if(!isset($releases[$package_input->getVersion()]))
|
||||
{
|
||||
// Find the closest thing to the requested version
|
||||
$selected_version = null;
|
||||
|
@ -138,7 +136,7 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
if(VersionComparator::compareVersion($version, $package_input->version) === 1)
|
||||
if(VersionComparator::compareVersion($version, $package_input->getVersion()) === 1)
|
||||
{
|
||||
$selected_version = $version;
|
||||
}
|
||||
|
@ -146,17 +144,17 @@
|
|||
|
||||
if($selected_version === null)
|
||||
{
|
||||
throw new GitException(sprintf('Could not find a release for %s/%s with the version %s', $package_input->vendor, $package_input->package, $package_input->version));
|
||||
throw new GitException(sprintf('Could not find a release for %s/%s with the version %s', $package_input->getVendor(), $package_input->getPackage(), $package_input->getVersion()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected_version = $package_input->version;
|
||||
$selected_version = $package_input->getVersion();
|
||||
}
|
||||
|
||||
if(!isset($releases[$selected_version]))
|
||||
{
|
||||
throw new GitException(sprintf('Could not find a release for %s/%s with the version %s', $package_input->vendor, $package_input->package, $package_input->version));
|
||||
throw new GitException(sprintf('Could not find a release for %s/%s with the version %s', $package_input->getVendor(), $package_input->getPackage(), $package_input->getVersion()));
|
||||
}
|
||||
|
||||
return $releases[$selected_version];
|
||||
|
@ -217,9 +215,9 @@
|
|||
foreach($response_decoded as $release)
|
||||
{
|
||||
$query_results = new RepositoryQueryResults();
|
||||
$query_results->ReleaseName = ($release['name'] ?? null);
|
||||
$query_results->ReleaseDescription = ($release['description'] ?? null);
|
||||
$query_results->Version = Functions::convertToSemVer($release['tag_name']);
|
||||
$query_results->setReleaseName($release['name'] ?? null);
|
||||
$query_results->setReleaseDescription($release['description'] ?? null);
|
||||
$query_results->setVersion(Functions::convertToSemVer($release['tag_name']));
|
||||
|
||||
if(isset($release['assets']['sources']) && count($release['assets']['sources']) > 0)
|
||||
{
|
||||
|
@ -227,25 +225,25 @@
|
|||
{
|
||||
if($source['format'] === 'zip')
|
||||
{
|
||||
$query_results->Files->ZipballUrl = $source['url'];
|
||||
$query_results->getFiles()->ZipballUrl = $source['url'];
|
||||
break;
|
||||
}
|
||||
|
||||
if($source['format'] === 'tar.gz')
|
||||
{
|
||||
$query_results->Files->ZipballUrl = $source['url'];
|
||||
$query_results->getFiles()->ZipballUrl = $source['url'];
|
||||
break;
|
||||
}
|
||||
|
||||
if($source['format'] === 'ncc')
|
||||
{
|
||||
$query_results->Files->PackageUrl = $source['url'];
|
||||
$query_results->getFiles()->PackageUrl = $source['url'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$return[$query_results->Version] = $query_results;
|
||||
$return[$query_results->getVersion()] = $query_results;
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
|
|
@ -144,7 +144,7 @@ namespace ncc\Classes\NccExtension;
|
|||
InstallConstants::INSTALL_PATH_DATA
|
||||
],
|
||||
[
|
||||
$installationPaths->getInstallationPath(),
|
||||
$installationPaths->getInstallationpath(),
|
||||
$installationPaths->getBinPath(),
|
||||
$installationPaths->getSourcePath(),
|
||||
$installationPaths->getDataPath()
|
||||
|
|
|
@ -65,31 +65,31 @@
|
|||
{
|
||||
$configuration = $manager->getProjectConfiguration();
|
||||
|
||||
if(Main::getLogLevel() !== null && Resolver::checkLogLevel(LogLevel::DEBUG, Main::getLogLevel()))
|
||||
if(Resolver::checkLogLevel(LogLevel::DEBUG, Main::getLogLevel()))
|
||||
{
|
||||
foreach($configuration->assembly->toArray() as $prop => $value)
|
||||
foreach($configuration->getAssembly()->toArray() as $prop => $value)
|
||||
{
|
||||
Console::outDebug(sprintf('assembly.%s: %s', $prop, ($value ?? 'n/a')));
|
||||
}
|
||||
foreach($configuration->project->getCompiler()->toArray() as $prop => $value)
|
||||
foreach($configuration->getProject()->getCompiler()->toArray() as $prop => $value)
|
||||
{
|
||||
Console::outDebug(sprintf('compiler.%s: %s', $prop, ($value ?? 'n/a')));
|
||||
}
|
||||
}
|
||||
|
||||
// Select the correct compiler for the specified extension
|
||||
if (strtolower($configuration->project->getCompiler()->getExtension()) === CompilerExtensions::PHP)
|
||||
if (strtolower($configuration->getProject()->getCompiler()->getExtension()) === CompilerExtensions::PHP)
|
||||
{
|
||||
/** @var CompilerInterface $Compiler */
|
||||
$Compiler = new PhpCompiler($configuration, $manager->getProjectPath());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException('The compiler extension \'' . $configuration->project->getCompiler()->getExtension() . '\' is not supported');
|
||||
throw new NotSupportedException('The compiler extension \'' . $configuration->getProject()->getCompiler()->getExtension() . '\' is not supported');
|
||||
}
|
||||
|
||||
$build_configuration = $configuration->build->getBuildConfiguration($build_configuration)->getName();
|
||||
Console::out(sprintf('Building %s=%s', $configuration->assembly->getPackage(), $configuration->assembly->getVersion()));
|
||||
$build_configuration = $configuration->getBuild()->getBuildConfiguration($build_configuration)->getName();
|
||||
Console::out(sprintf('Building %s=%s', $configuration->getAssembly()->getPackage(), $configuration->getAssembly()->getVersion()));
|
||||
$Compiler->prepare($build_configuration);
|
||||
$Compiler->build();
|
||||
|
||||
|
@ -113,25 +113,25 @@
|
|||
|
||||
try
|
||||
{
|
||||
if($project_type->ProjectType === ProjectType::COMPOSER)
|
||||
if($project_type->getProjectType() === ProjectType::COMPOSER)
|
||||
{
|
||||
$project_path = ComposerSourceBuiltin::fromLocal($project_type->ProjectPath);
|
||||
$project_path = ComposerSourceBuiltin::fromLocal($project_type->getProjectPath());
|
||||
}
|
||||
elseif($project_type->ProjectType === ProjectType::NCC)
|
||||
elseif($project_type->getProjectType() === ProjectType::NCC)
|
||||
{
|
||||
$project_manager = new ProjectManager($project_type->ProjectPath);
|
||||
$project_manager->getProjectConfiguration()->assembly->setVersion($version);
|
||||
$project_manager = new ProjectManager($project_type->getProjectPath());
|
||||
$project_manager->getProjectConfiguration()->getAssembly()->setVersion($version);
|
||||
$project_path = $project_manager->build();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotSupportedException(sprintf('Failed to compile %s, project type %s is not supported', $project_type->ProjectPath, $project_type->ProjectType));
|
||||
throw new NotSupportedException(sprintf('Failed to compile %s, project type %s is not supported', $project_type->getProjectPath(), $project_type->getProjectType()));
|
||||
}
|
||||
|
||||
if($version !== null)
|
||||
{
|
||||
$package = Package::load($project_path);
|
||||
$package->assembly->setVersion(Functions::convertToSemVer($version));
|
||||
$package->getAssembly()->setVersion(Functions::convertToSemVer($version));
|
||||
$package->save($project_path);
|
||||
}
|
||||
|
||||
|
@ -156,18 +156,18 @@
|
|||
*/
|
||||
public static function compileExecutionPolicies(string $path, ProjectConfiguration $configuration): array
|
||||
{
|
||||
if(count($configuration->execution_policies) === 0)
|
||||
if(count($configuration->getExecutionPolicies()) === 0)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
Console::out('Compiling Execution Policies');
|
||||
$total_items = count($configuration->execution_policies);
|
||||
$total_items = count($configuration->getExecutionPolicies());
|
||||
$execution_units = [];
|
||||
$processed_items = 1;
|
||||
|
||||
/** @var ProjectConfiguration\ExecutionPolicy $policy */
|
||||
foreach($configuration->execution_policies as $policy)
|
||||
foreach($configuration->getExecutionPolicies() as $policy)
|
||||
{
|
||||
Console::outVerbose(sprintf('Compiling Execution Policy %s', $policy->getName()));
|
||||
|
||||
|
@ -206,7 +206,7 @@
|
|||
|
||||
// Write the package to disk
|
||||
$FileSystem = new Filesystem();
|
||||
$BuildConfiguration = $configuration->build->getBuildConfiguration($build_configuration);
|
||||
$BuildConfiguration = $configuration->getBuild()->getBuildConfiguration($build_configuration);
|
||||
if(!$FileSystem->exists($path . $BuildConfiguration->getOutputPath()))
|
||||
{
|
||||
Console::outDebug(sprintf('creating output directory %s', $path . $BuildConfiguration->getOutputPath()));
|
||||
|
@ -215,7 +215,7 @@
|
|||
|
||||
// Finally write the package to the disk
|
||||
$FileSystem->mkdir($path . $BuildConfiguration->getOutputPath());
|
||||
$output_file = $path . $BuildConfiguration->getOutputPath() . DIRECTORY_SEPARATOR . $package->assembly->getPackage() . '.ncc';
|
||||
$output_file = $path . $BuildConfiguration->getOutputPath() . DIRECTORY_SEPARATOR . $package->getAssembly()->getPackage() . '.ncc';
|
||||
if($FileSystem->exists($output_file))
|
||||
{
|
||||
Console::outDebug(sprintf('removing existing package %s', $output_file));
|
||||
|
@ -244,41 +244,41 @@
|
|||
*/
|
||||
public static function compilePackageConstants(Package $package, array $refs): void
|
||||
{
|
||||
if($package->assembly !== null)
|
||||
if($package->getAssembly() !== null)
|
||||
{
|
||||
$assembly = [];
|
||||
|
||||
foreach($package->assembly->toArray() as $key => $value)
|
||||
foreach($package->getAssembly()->toArray() as $key => $value)
|
||||
{
|
||||
Console::outDebug(sprintf('compiling constant Assembly.%s (%s)', $key, implode(', ', array_keys($refs))));
|
||||
$assembly[$key] = self::compileConstants($value, $refs);
|
||||
}
|
||||
$package->assembly = Assembly::fromArray($assembly);
|
||||
$package->setAssembly(Assembly::fromArray($assembly));
|
||||
|
||||
unset($assembly);
|
||||
}
|
||||
|
||||
if($package->execution_units !== null && count($package->execution_units) > 0)
|
||||
if(count($package->getExecutionUnits()) > 0)
|
||||
{
|
||||
$units = [];
|
||||
foreach($package->execution_units as $executionUnit)
|
||||
foreach($package->ExecutionUnits() as $executionUnit)
|
||||
{
|
||||
Console::outDebug(sprintf('compiling execution unit constant %s (%s)', $executionUnit->getExecutionPolicy()->getName(), implode(', ', array_keys($refs))));
|
||||
$units[] = self::compileExecutionUnitConstants($executionUnit, $refs);
|
||||
}
|
||||
$package->execution_units = $units;
|
||||
$package->setExecutionUnits($units);
|
||||
unset($units);
|
||||
}
|
||||
|
||||
$compiled_constants = [];
|
||||
foreach($package->header->getRuntimeConstants() as $name => $value)
|
||||
foreach($package->getHeader()->getRuntimeConstants() as $name => $value)
|
||||
{
|
||||
Console::outDebug(sprintf('compiling runtime constant %s (%s)', $name, implode(', ', array_keys($refs))));
|
||||
$compiled_constants[$name] = self::compileConstants($value, $refs);
|
||||
}
|
||||
|
||||
$options = [];
|
||||
foreach($package->header->getOptions() as $name => $value)
|
||||
foreach($package->getHeader()->getOptions() as $name => $value)
|
||||
{
|
||||
if(is_array($value))
|
||||
{
|
||||
|
@ -301,8 +301,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
$package->header->setOptions($options);
|
||||
$package->header->setRuntimeConstants($compiled_constants);
|
||||
$package->getHeader()->setOptions($options);
|
||||
$package->getHeader()->setRuntimeConstants($compiled_constants);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -103,35 +103,35 @@
|
|||
}
|
||||
|
||||
// Select the build configuration
|
||||
$selected_build_configuration = $this->project_configuration->build->getBuildConfiguration($build_configuration);
|
||||
$selected_build_configuration = $this->project_configuration->getBuild()->getBuildConfiguration($build_configuration);
|
||||
|
||||
// Create the package object
|
||||
$this->package = new Package();
|
||||
$this->package->assembly = $this->project_configuration->assembly;
|
||||
$this->package->dependencies = $this->project_configuration->build->getDependencies();
|
||||
$this->package->main_execution_policy = $this->project_configuration->build->getMain();
|
||||
$this->package->setAssembly($this->project_configuration->getAssembly());
|
||||
$this->package->setDependencies($this->project_configuration->getBuild()->getDependencies());
|
||||
$this->package->setMainExecutionPolicy($this->project_configuration->getBuild()->getMain());
|
||||
|
||||
// Add the option to create a symbolic link to the package
|
||||
if(isset($this->project_configuration->project->getOptions()['create_symlink']) && $this->project_configuration->project->getOptions()['create_symlink'] === True)
|
||||
if(isset($this->project_configuration->getProject()->getOptions()['create_symlink']) && $this->project_configuration->getProject()->getOptions()['create_symlink'] === True)
|
||||
{
|
||||
$this->package->header->setOption('create_symlink', true);
|
||||
$this->package->getHeader()->setOption('create_symlink', true);
|
||||
}
|
||||
|
||||
// Add both the defined constants from the build configuration and the global constants.
|
||||
// Global constants are overridden
|
||||
$this->package->header->setRuntimeConstants(array_merge(
|
||||
$this->package->getHeader()->setRuntimeConstants(array_merge(
|
||||
$selected_build_configuration->getDefineConstants(),
|
||||
($this->project_configuration->build->getDefineConstants()),
|
||||
($this->package->header->getRuntimeConstants() ?? [])
|
||||
($this->project_configuration->getBuild()->getDefineConstants()),
|
||||
($this->package->getHeader()->getRuntimeConstants() ?? [])
|
||||
));
|
||||
|
||||
$this->package->header->setCompilerExtension($this->project_configuration->project->getCompiler());
|
||||
$this->package->header->setCompilerVersion(NCC_VERSION_NUMBER);
|
||||
$this->package->header->setOptions($this->project_configuration->project->getOptions());
|
||||
$this->package->getHeader()->setCompilerExtension($this->project_configuration->getProject()->getCompiler());
|
||||
$this->package->getHeader()->setCompilerVersion(NCC_VERSION_NUMBER);
|
||||
$this->package->getHeader()->setOptions($this->project_configuration->getProject()->getOptions());
|
||||
|
||||
if($this->project_configuration->project->getUpdateSource() !== null)
|
||||
if($this->project_configuration->getProject()->getUpdateSource() !== null)
|
||||
{
|
||||
$this->package->header->setUpdateSource($this->project_configuration->project->getUpdateSource());
|
||||
$this->package->getHeader()->setUpdateSource($this->project_configuration->getProject()->getUpdateSource());
|
||||
}
|
||||
|
||||
Console::outDebug('scanning project files');
|
||||
|
@ -157,7 +157,7 @@
|
|||
$directory_scanner->setExcludes($selected_build_configuration->getExcludeFiles());
|
||||
}
|
||||
|
||||
$source_path = $this->path . $this->project_configuration->build->getSourcePath();
|
||||
$source_path = $this->path . $this->project_configuration->getBuild()->getSourcePath();
|
||||
|
||||
// TODO: Re-implement the scanning process outside the compiler, as this is will be redundant
|
||||
// Scan for components first.
|
||||
|
@ -176,14 +176,14 @@
|
|||
|
||||
$component = new Package\Component();
|
||||
$component->setName(Functions::removeBasename($item->getPathname(), $this->path));
|
||||
$this->package->components[] = $component;
|
||||
$this->package->addComponent($component);
|
||||
|
||||
Console::outVerbose(sprintf('Found component %s', $component->getName()));
|
||||
}
|
||||
|
||||
if(count($this->package->components) > 0)
|
||||
if(count($this->package->getComponents()) > 0)
|
||||
{
|
||||
Console::outVerbose(count($this->package->components) . ' component(s) found');
|
||||
Console::outVerbose(count($this->package->getComponents()) . ' component(s) found');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -216,14 +216,14 @@
|
|||
|
||||
$resource = new Package\Resource();
|
||||
$resource->setName(Functions::removeBasename($item->getPathname(), $this->path));
|
||||
$this->package->resources[] = $resource;
|
||||
$this->package->addResource($resource);
|
||||
|
||||
Console::outVerbose(sprintf('found resource %s', $resource->getName()));
|
||||
}
|
||||
|
||||
if(count($this->package->resources) > 0)
|
||||
if(count($this->package->getResources()) > 0)
|
||||
{
|
||||
Console::outVerbose(count($this->package->resources) . ' resources(s) found');
|
||||
Console::outVerbose(count($this->package->getResources()) . ' resources(s) found');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -237,9 +237,9 @@
|
|||
|
||||
$selected_dependencies = [];
|
||||
|
||||
if(count($this->project_configuration->build->getDependencies()) > 0)
|
||||
if(count($this->project_configuration->getBuild()->getDependencies()) > 0)
|
||||
{
|
||||
$selected_dependencies = array_merge($selected_dependencies, $this->project_configuration->build->getDependencies());
|
||||
$selected_dependencies = array_merge($selected_dependencies, $this->project_configuration->getBuild()->getDependencies());
|
||||
}
|
||||
|
||||
if(count($selected_build_configuration->getDependencies()) > 0)
|
||||
|
@ -310,9 +310,9 @@
|
|||
$this->package->addDependency($dependency);
|
||||
}
|
||||
|
||||
if(count($this->package->dependencies) > 0)
|
||||
if(count($this->package->getDependencies()) > 0)
|
||||
{
|
||||
Console::outVerbose(count($this->package->dependencies) . ' dependency(ies) found');
|
||||
Console::outVerbose(count($this->package->getDependencies()) . ' dependency(ies) found');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -338,7 +338,7 @@
|
|||
$this->compileResources();
|
||||
|
||||
PackageCompiler::compilePackageConstants($this->package, [
|
||||
ConstantReferences::ASSEMBLY => $this->project_configuration->assembly,
|
||||
ConstantReferences::ASSEMBLY => $this->project_configuration->getAssembly(),
|
||||
ConstantReferences::BUILD => null,
|
||||
ConstantReferences::DATE_TIME => time()
|
||||
]);
|
||||
|
@ -361,13 +361,13 @@
|
|||
throw new BuildException('The prepare() method must be called before building the package');
|
||||
}
|
||||
|
||||
if(count($this->package->resources) === 0)
|
||||
if(count($this->package->getResources()) === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Process the resources
|
||||
$total_items = count($this->package->resources);
|
||||
$total_items = count($this->package->getResources());
|
||||
$processed_items = 1;
|
||||
$resources = [];
|
||||
|
||||
|
@ -376,7 +376,7 @@
|
|||
Console::out('Processing resources');
|
||||
}
|
||||
|
||||
foreach($this->package->resources as $resource)
|
||||
foreach($this->package->getResources() as $resource)
|
||||
{
|
||||
/** @noinspection DisconnectedForeachInstructionInspection */
|
||||
if($total_items > 5)
|
||||
|
@ -386,7 +386,7 @@
|
|||
|
||||
// Get the data and
|
||||
$resource->setData(Base64::encode(IO::fread(Functions::correctDirectorySeparator($this->path . $resource->getName()))));
|
||||
$resource->setName(str_replace($this->project_configuration->build->getSourcePath(), (string)null, $resource->getName()));
|
||||
$resource->setName(str_replace($this->project_configuration->getBuild()->getSourcePath(), (string)null, $resource->getName()));
|
||||
$resource->updateChecksum();
|
||||
$resources[] = $resource;
|
||||
|
||||
|
@ -394,7 +394,7 @@
|
|||
}
|
||||
|
||||
// Update the resources
|
||||
$this->package->resources = $resources;
|
||||
$this->package->setResources($resources);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -412,12 +412,12 @@
|
|||
throw new BuildException('The prepare() method must be called before building the package');
|
||||
}
|
||||
|
||||
if(count($this->package->components) === 0)
|
||||
if(count($this->package->getComponents()) === 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$total_items = count($this->package->components);
|
||||
$total_items = count($this->package->getComponents());
|
||||
$processed_items = 1;
|
||||
$components = [];
|
||||
|
||||
|
@ -427,7 +427,7 @@
|
|||
}
|
||||
|
||||
// Process the components and attempt to create an AST representation of the source
|
||||
foreach($this->package->components as $component)
|
||||
foreach($this->package->getComponents() as $component)
|
||||
{
|
||||
if($total_items > 5)
|
||||
{
|
||||
|
@ -454,7 +454,7 @@
|
|||
|
||||
unset($parser);
|
||||
|
||||
$component->setName(str_replace($this->project_configuration->build->getSourcePath(), (string)null, $component->getName()));
|
||||
$component->setName(str_replace($this->project_configuration->getBuild()->getSourcePath(), (string)null, $component->getName()));
|
||||
$component->updateChecksum();
|
||||
$components[] = $component;
|
||||
++$processed_items;
|
||||
|
@ -463,7 +463,7 @@
|
|||
}
|
||||
|
||||
// Update the components
|
||||
$this->package->components = $components;
|
||||
$this->package->setComponents($components);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -474,7 +474,7 @@
|
|||
*/
|
||||
public function compileExecutionPolicies(): void
|
||||
{
|
||||
$this->package->execution_units = PackageCompiler::compileExecutionPolicies($this->path, $this->project_configuration);
|
||||
$this->package->setExecutionUnits(PackageCompiler::compileExecutionPolicies($this->path, $this->project_configuration));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
final class ExceptionCodes
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace ncc\Enums;
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
final class RegexPatterns
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
}
|
||||
|
||||
$VaultObject = new Vault();
|
||||
$VaultObject->version = Versions::CREDENTIALS_STORE_VERSION;
|
||||
$VaultObject->setVersion(Versions::CREDENTIALS_STORE_VERSION);
|
||||
|
||||
IO::fwrite($this->store_path, ZiProto::encode($VaultObject->toArray()), 0744);
|
||||
}
|
||||
|
@ -125,15 +125,14 @@
|
|||
return;
|
||||
}
|
||||
|
||||
$VaultArray = ZiProto::decode(IO::fread($this->store_path));
|
||||
$VaultObject = Vault::fromArray($VaultArray);
|
||||
$vault_object = Vault::fromArray(ZiProto::decode(IO::fread($this->store_path)));
|
||||
|
||||
if($VaultObject->version !== Versions::CREDENTIALS_STORE_VERSION)
|
||||
if($vault_object->getVersion() !== Versions::CREDENTIALS_STORE_VERSION)
|
||||
{
|
||||
throw new RuntimeException('Credentials store version mismatch');
|
||||
}
|
||||
|
||||
$this->vault = $VaultObject;
|
||||
$this->vault = $vault_object;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -530,7 +530,7 @@
|
|||
|
||||
if($unit === null)
|
||||
{
|
||||
throw new OperationException(sprintf('No execution unit named \'%s\' is available for package \'%s\'', $unit_name, $package->assembly->getPackage()));
|
||||
throw new OperationException(sprintf('No execution unit named \'%s\' is available for package \'%s\'', $unit_name, $package->getAssembly()->getPackage()));
|
||||
}
|
||||
|
||||
// Get the required units
|
||||
|
@ -557,13 +557,13 @@
|
|||
}
|
||||
|
||||
// Install the units temporarily
|
||||
$this->addUnit($package->assembly->getPackage(), $package->assembly->getVersion(), $unit, true);
|
||||
$this->addUnit($package->getAssembly()->getPackage(), $package->getAssembly()->getVersion(), $unit, true);
|
||||
foreach($required_units as $r_unit)
|
||||
{
|
||||
$this->addUnit($package->assembly->getPackage(), $package->assembly->getVersion(), $r_unit, true);
|
||||
$this->addUnit($package->getAssembly()->getPackage(), $package->getAssembly()->getVersion(), $r_unit, true);
|
||||
}
|
||||
|
||||
$this->executeUnit($package->assembly->getPackage(), $package->assembly->getVersion(), $unit_name);
|
||||
$this->executeUnit($package->getAssembly()->getPackage(), $package->getAssembly()->getVersion(), $unit_name);
|
||||
$this->cleanTemporaryUnits();
|
||||
}
|
||||
|
||||
|
|
|
@ -118,14 +118,14 @@
|
|||
|
||||
$package = Package::load($package_path);
|
||||
|
||||
if(RuntimeCache::get(sprintf('installed.%s=%s', $package->assembly->getPackage(), $package->assembly->getVersion())))
|
||||
if(RuntimeCache::get(sprintf('installed.%s=%s', $package->getAssembly()->getPackage(), $package->getAssembly()->getVersion())))
|
||||
{
|
||||
Console::outDebug(sprintf('skipping installation of %s=%s, already processed', $package->assembly->getPackage(), $package->assembly->getVersion()));
|
||||
return $package->assembly->getPackage();
|
||||
Console::outDebug(sprintf('skipping installation of %s=%s, already processed', $package->getAssembly()->getPackage(), $package->getAssembly()->getVersion()));
|
||||
return $package->getAssembly()->getPackage();
|
||||
}
|
||||
|
||||
$extension = $package->header->getCompilerExtension()->getExtension();
|
||||
$installation_paths = new InstallationPaths($this->packages_path . DIRECTORY_SEPARATOR . $package->assembly->getPackage() . '=' . $package->assembly->getVersion());
|
||||
$extension = $package->getHeader()->getCompilerExtension()->getExtension();
|
||||
$installation_paths = new InstallationPaths($this->packages_path . DIRECTORY_SEPARATOR . $package->getAssembly()->getPackage() . '=' . $package->getAssembly()->getVersion());
|
||||
|
||||
$installer = match ($extension)
|
||||
{
|
||||
|
@ -133,20 +133,20 @@
|
|||
default => throw new NotSupportedException(sprintf('Compiler extension %s is not supported with ncc', $extension))
|
||||
};
|
||||
|
||||
if($this->getPackageVersion($package->assembly->getPackage(), $package->assembly->getVersion()) !== null)
|
||||
if($this->getPackageVersion($package->getAssembly()->getPackage(), $package->getAssembly()->getVersion()) !== null)
|
||||
{
|
||||
if(in_array(InstallPackageOptions::REINSTALL, $options, true))
|
||||
{
|
||||
if($this->getPackageLockManager()?->getPackageLock()?->packageExists($package->assembly->getPackage(), $package->assembly->getVersion()))
|
||||
if($this->getPackageLockManager()?->getPackageLock()?->packageExists($package->getAssembly()->getPackage(), $package->getAssembly()->getVersion()))
|
||||
{
|
||||
$this->getPackageLockManager()?->getPackageLock()?->removePackageVersion(
|
||||
$package->assembly->getPackage(), $package->assembly->getVersion()
|
||||
$package->getAssembly()->getPackage(), $package->getAssembly()->getVersion()
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PackageException('The package ' . $package->assembly->getPackage() . '=' . $package->assembly->getVersion() . ' is already installed');
|
||||
throw new PackageException('The package ' . $package->getAssembly()->getPackage() . '=' . $package->getAssembly()->getVersion() . ' is already installed');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,9 +156,9 @@
|
|||
]);
|
||||
|
||||
// Process all the required dependencies before installing the package
|
||||
if($package->dependencies !== null && count($package->dependencies) > 0 && !in_array(InstallPackageOptions::SKIP_DEPENDENCIES, $options, true))
|
||||
if(count($package->getDependencies()) > 0 && !in_array(InstallPackageOptions::SKIP_DEPENDENCIES, $options, true))
|
||||
{
|
||||
foreach($package->dependencies as $dependency)
|
||||
foreach($package->getDependencies() as $dependency)
|
||||
{
|
||||
// Uninstall the dependency if the option Reinstall is passed on
|
||||
if(in_array(InstallPackageOptions::REINSTALL, $options, true) && $this->getPackageLockManager()?->getPackageLock()?->packageExists($dependency->getName(), $dependency->getVersion()))
|
||||
|
@ -181,36 +181,36 @@
|
|||
|
||||
if(Resolver::checkLogLevel(LogLevel::DEBUG, Main::getLogLevel()))
|
||||
{
|
||||
Console::outDebug(sprintf('installer.install_path: %s', $installation_paths->getInstallationPath()));
|
||||
Console::outDebug(sprintf('installer.install_path: %s', $installation_paths->getInstallationpath()));
|
||||
Console::outDebug(sprintf('installer.data_path: %s', $installation_paths->getDataPath()));
|
||||
Console::outDebug(sprintf('installer.bin_path: %s', $installation_paths->getBinPath()));
|
||||
Console::outDebug(sprintf('installer.src_path: %s', $installation_paths->getSourcePath()));
|
||||
|
||||
foreach($package->assembly->toArray() as $prop => $value)
|
||||
foreach($package->getAssembly()->toArray() as $prop => $value)
|
||||
{
|
||||
Console::outDebug(sprintf('assembly.%s: %s', $prop, ($value ?? 'n/a')));
|
||||
}
|
||||
|
||||
foreach($package->header->getCompilerExtension()->toArray() as $prop => $value)
|
||||
foreach($package->getHeader()->getCompilerExtension()->toArray() as $prop => $value)
|
||||
{
|
||||
Console::outDebug(sprintf('header.compiler.%s: %s', $prop, ($value ?? 'n/a')));
|
||||
}
|
||||
}
|
||||
|
||||
Console::out('Installing ' . $package->assembly->getPackage());
|
||||
Console::out('Installing ' . $package->getAssembly()->getPackage());
|
||||
|
||||
// Four For Directory Creation, preInstall, postInstall & initData methods
|
||||
$steps = (4 + count($package->components) + count ($package->resources) + count ($package->execution_units));
|
||||
$steps = (4 + count($package->getComponents()) + count ($package->getResources()) + count ($package->getExecutionUnits()));
|
||||
|
||||
// Include the Execution units
|
||||
if($package->installer?->getPreInstall() !== null)
|
||||
if($package->getInstaller()?->getPreInstall() !== null)
|
||||
{
|
||||
$steps += count($package->installer->getPreInstall());
|
||||
$steps += count($package->getInstaller()?->getPreInstall());
|
||||
}
|
||||
|
||||
if($package->installer?->getPostInstall()!== null)
|
||||
if($package->getInstaller()?->getPostInstall()!== null)
|
||||
{
|
||||
$steps += count($package->installer->getPostInstall());
|
||||
$steps += count($package->getInstaller()->getPostInstall());
|
||||
}
|
||||
|
||||
$current_steps = 0;
|
||||
|
@ -218,7 +218,7 @@
|
|||
|
||||
try
|
||||
{
|
||||
$filesystem->mkdir($installation_paths->getInstallationPath(), 0755);
|
||||
$filesystem->mkdir($installation_paths->getInstallationpath(), 0755);
|
||||
$filesystem->mkdir($installation_paths->getBinPath(), 0755);
|
||||
$filesystem->mkdir($installation_paths->getDataPath(), 0755);
|
||||
$filesystem->mkdir($installation_paths->getSourcePath(), 0755);
|
||||
|
@ -258,9 +258,9 @@
|
|||
throw new OperationException('Pre installation stage failed, ' . $e->getMessage(), $e);
|
||||
}
|
||||
|
||||
if($package->installer?->getPreInstall() !== null && count($package->installer->getPreInstall()) > 0)
|
||||
if($package->getInstaller()?->getPreInstall() !== null && count($package->getInstaller()->getPreInstall()) > 0)
|
||||
{
|
||||
foreach($package->installer->getPreInstall() as $unit_name)
|
||||
foreach($package->getInstaller()->getPreInstall() as $unit_name)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -277,7 +277,7 @@
|
|||
}
|
||||
|
||||
// Process & Install the components
|
||||
foreach($package->components as $component)
|
||||
foreach($package->getComponents() as $component)
|
||||
{
|
||||
Console::outDebug(sprintf('processing component %s (%s)', $component->getName(), $component->getDataType()));
|
||||
|
||||
|
@ -307,7 +307,7 @@
|
|||
}
|
||||
|
||||
// Process & Install the resources
|
||||
foreach($package->resources as $resource)
|
||||
foreach($package->getResources() as $resource)
|
||||
{
|
||||
Console::outDebug(sprintf('processing resource %s', $resource->getName()));
|
||||
|
||||
|
@ -337,7 +337,7 @@
|
|||
}
|
||||
|
||||
// Install execution units
|
||||
if($package->execution_units !== null && count($package->execution_units) > 0)
|
||||
if($package->getExecutionUnits() !== null && count($package->getExecutionUnits()) > 0)
|
||||
{
|
||||
Console::outDebug('package contains execution units, processing');
|
||||
|
||||
|
@ -345,10 +345,10 @@
|
|||
$unit_paths = [];
|
||||
|
||||
/** @var Package\ExecutionUnit $executionUnit */
|
||||
foreach($package->execution_units as $executionUnit)
|
||||
foreach($package->getExecutionUnits() as $executionUnit)
|
||||
{
|
||||
Console::outDebug(sprintf('processing execution unit %s', $executionUnit->getExecutionPolicy()->getName()));
|
||||
$execution_pointer_manager->addUnit($package->assembly->getPackage(), $package->assembly->getVersion(), $executionUnit);
|
||||
$execution_pointer_manager->addUnit($package->getAssembly()->getPackage(), $package->getAssembly()->getVersion(), $executionUnit);
|
||||
++$current_steps;
|
||||
Console::inlineProgressBar($current_steps, $steps);
|
||||
}
|
||||
|
@ -361,17 +361,17 @@
|
|||
}
|
||||
|
||||
// After execution units are installed, create a symlink if needed
|
||||
if(!is_null($package->header->getOption('create_symlink')) && $package->header->getOption('create_symlink'))
|
||||
if(!is_null($package->getHeader()->getOption('create_symlink')) && $package->getHeader()->getOption('create_symlink'))
|
||||
{
|
||||
if($package->main_execution_policy === null)
|
||||
if($package->getMainExecutionPolicy() === null)
|
||||
{
|
||||
throw new OperationException('Cannot create symlink, no main execution policy is defined');
|
||||
}
|
||||
|
||||
Console::outDebug(sprintf('creating symlink to %s', $package->assembly->getPackage()));
|
||||
Console::outDebug(sprintf('creating symlink to %s', $package->getAssembly()->getPackage()));
|
||||
|
||||
$SymlinkManager = new SymlinkManager();
|
||||
$SymlinkManager->add($package->assembly->getPackage(), $package->main_execution_policy);
|
||||
$SymlinkManager->add($package->getAssembly()->getPackage(), $package->getMainExecutionPolicy());
|
||||
}
|
||||
|
||||
// Execute the post-installation stage after the installation is complete
|
||||
|
@ -389,11 +389,11 @@
|
|||
throw new OperationException('Post installation stage failed, ' . $e->getMessage(), $e);
|
||||
}
|
||||
|
||||
if($package->installer?->getPostInstall() !== null && count($package->installer->getPostInstall()) > 0)
|
||||
if($package->getInstaller()?->getPostInstall() !== null && count($package->getInstaller()->getPostInstall()) > 0)
|
||||
{
|
||||
Console::outDebug('executing post-installation units');
|
||||
|
||||
foreach($package->installer->getPostInstall() as $unit_name)
|
||||
foreach($package->getInstaller()->getPostInstall() as $unit_name)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -415,29 +415,29 @@
|
|||
Console::outDebug('no post-installation units to execute');
|
||||
}
|
||||
|
||||
if($package->header->getUpdateSource()?->getRepository() !== null)
|
||||
if($package->getHeader()->getUpdateSource()?->getRepository() !== null)
|
||||
{
|
||||
$sources_manager = new RemoteSourcesManager();
|
||||
if($sources_manager->getRemoteSource($package->header->getUpdateSource()->getRepository()->getName()) === null)
|
||||
if($sources_manager->getRemoteSource($package->getHeader()->getUpdateSource()->getRepository()->getName()) === null)
|
||||
{
|
||||
Console::outVerbose('Adding remote source ' . $package->header->getUpdateSource()->getRepository()->getName());
|
||||
Console::outVerbose('Adding remote source ' . $package->getHeader()->getUpdateSource()->getRepository()->getName());
|
||||
|
||||
$defined_remote_source = new DefinedRemoteSource();
|
||||
$defined_remote_source->setName($package->header->getUpdateSource()?->getRepository()?->getName());
|
||||
$defined_remote_source->setHost($package->header->getUpdateSource()?->getRepository()?->getHost());
|
||||
$defined_remote_source->setType($package->header->getUpdateSource()?->getRepository()?->getType());
|
||||
$defined_remote_source->setSsl($package->header->getUpdateSource()?->getRepository()?->isSsl());
|
||||
$defined_remote_source->setName($package->getHeader()->getUpdateSource()?->getRepository()?->getName());
|
||||
$defined_remote_source->setHost($package->getHeader()->getUpdateSource()?->getRepository()?->getHost());
|
||||
$defined_remote_source->setType($package->getHeader()->getUpdateSource()?->getRepository()?->getType());
|
||||
$defined_remote_source->setSsl($package->getHeader()->getUpdateSource()?->getRepository()?->isSsl());
|
||||
|
||||
$sources_manager->addRemoteSource($defined_remote_source);
|
||||
}
|
||||
}
|
||||
|
||||
$this->getPackageLockManager()?->getPackageLock()?->addPackage($package, $installation_paths->getInstallationPath());
|
||||
$this->getPackageLockManager()?->getPackageLock()?->addPackage($package, $installation_paths->getInstallationpath());
|
||||
$this->getPackageLockManager()?->save();
|
||||
|
||||
RuntimeCache::set(sprintf('installed.%s=%s', $package->assembly->getPackage(), $package->assembly->getVersion()), true);
|
||||
RuntimeCache::set(sprintf('installed.%s=%s', $package->getAssembly()->getPackage(), $package->getAssembly()->getVersion()), true);
|
||||
|
||||
return $package->assembly->getPackage();
|
||||
return $package->getAssembly()->getPackage();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -452,29 +452,24 @@
|
|||
{
|
||||
$input = new RemotePackageInput($source);
|
||||
|
||||
if($input->source === null)
|
||||
if($input->getSource() === null)
|
||||
{
|
||||
throw new PackageException('No source specified');
|
||||
}
|
||||
|
||||
if($input->package === null)
|
||||
if($input->getVersion() === null)
|
||||
{
|
||||
throw new PackageException('No package specified');
|
||||
$input->setVersion(Versions::LATEST);
|
||||
}
|
||||
|
||||
if($input->version === null)
|
||||
{
|
||||
$input->version = Versions::LATEST;
|
||||
}
|
||||
Console::outVerbose('Fetching package ' . $input->getPackage() . ' from ' . $input->getSource() . ' (' . $input->getVersion() . ')');
|
||||
|
||||
Console::outVerbose('Fetching package ' . $input->package . ' from ' . $input->source . ' (' . $input->version . ')');
|
||||
|
||||
$remote_source_type = Resolver::detectRemoteSourceType($input->source);
|
||||
$remote_source_type = Resolver::detectRemoteSourceType($input->getSource());
|
||||
if($remote_source_type === RemoteSourceType::BUILTIN)
|
||||
{
|
||||
Console::outDebug('using builtin source ' . $input->source);
|
||||
Console::outDebug('using builtin source ' . $input->getSource());
|
||||
|
||||
if ($input->source === 'composer')
|
||||
if ($input->getSource() === 'composer')
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -486,29 +481,29 @@
|
|||
}
|
||||
}
|
||||
|
||||
throw new NotSupportedException(sprintf('Builtin source %s is not supported', $input->source));
|
||||
throw new NotSupportedException(sprintf('Builtin source %s is not supported', $input->getSource()));
|
||||
}
|
||||
|
||||
if($remote_source_type === RemoteSourceType::DEFINED)
|
||||
{
|
||||
Console::outDebug('using defined source ' . $input->source);
|
||||
Console::outDebug('using defined source ' . $input->getSource());
|
||||
/** @noinspection CallableParameterUseCaseInTypeContextInspection */
|
||||
$source = (new RemoteSourcesManager())->getRemoteSource($input->source);
|
||||
$source = (new RemoteSourcesManager())->getRemoteSource($input->getSource());
|
||||
if($source === null)
|
||||
{
|
||||
throw new OperationException('Remote source ' . $input->source . ' is not defined');
|
||||
throw new OperationException('Remote source ' . $input->getSource() . ' is not defined');
|
||||
}
|
||||
|
||||
$repositoryQueryResults = Functions::getRepositoryQueryResults($input, $source, $entry);
|
||||
$exceptions = [];
|
||||
|
||||
if($repositoryQueryResults->Files->ZipballUrl !== null)
|
||||
if($repositoryQueryResults->getFiles()->ZipballUrl !== null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console::outDebug(sprintf('fetching package %s from %s', $input->package, $repositoryQueryResults->Files->ZipballUrl));
|
||||
$archive = Functions::downloadGitServiceFile($repositoryQueryResults->Files->ZipballUrl, $entry);
|
||||
return PackageCompiler::tryCompile(Functions::extractArchive($archive), $repositoryQueryResults->Version);
|
||||
Console::outDebug(sprintf('fetching package %s from %s', $input->getPackage(), $repositoryQueryResults->getFiles()->ZipballUrl));
|
||||
$archive = Functions::downloadGitServiceFile($repositoryQueryResults->getFiles()->ZipballUrl, $entry);
|
||||
return PackageCompiler::tryCompile(Functions::extractArchive($archive), $repositoryQueryResults->getVersion());
|
||||
}
|
||||
catch(Throwable $e)
|
||||
{
|
||||
|
@ -517,13 +512,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
if($repositoryQueryResults->Files->TarballUrl !== null)
|
||||
if($repositoryQueryResults->getFiles()->TarballUrl !== null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console::outDebug(sprintf('fetching package %s from %s', $input->package, $repositoryQueryResults->Files->TarballUrl));
|
||||
$archive = Functions::downloadGitServiceFile($repositoryQueryResults->Files->TarballUrl, $entry);
|
||||
return PackageCompiler::tryCompile(Functions::extractArchive($archive), $repositoryQueryResults->Version);
|
||||
Console::outDebug(sprintf('fetching package %s from %s', $input->getPackage(), $repositoryQueryResults->getFiles()->TarballUrl));
|
||||
$archive = Functions::downloadGitServiceFile($repositoryQueryResults->getFiles()->TarballUrl, $entry);
|
||||
return PackageCompiler::tryCompile(Functions::extractArchive($archive), $repositoryQueryResults->getVersion());
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
|
@ -532,12 +527,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
if($repositoryQueryResults->Files->PackageUrl !== null)
|
||||
if($repositoryQueryResults->getFiles()->PackageUrl !== null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console::outDebug(sprintf('fetching package %s from %s', $input->package, $repositoryQueryResults->Files->PackageUrl));
|
||||
return Functions::downloadGitServiceFile($repositoryQueryResults->Files->PackageUrl, $entry);
|
||||
Console::outDebug(sprintf('fetching package %s from %s', $input->getPackage(), $repositoryQueryResults->getFiles()->PackageUrl));
|
||||
return Functions::downloadGitServiceFile($repositoryQueryResults->getFiles()->PackageUrl, $entry);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
|
@ -546,19 +541,19 @@
|
|||
}
|
||||
}
|
||||
|
||||
if($repositoryQueryResults->Files->GitHttpUrl !== null || $repositoryQueryResults->Files->GitSshUrl !== null)
|
||||
if($repositoryQueryResults->getFiles()->GitHttpUrl !== null || $repositoryQueryResults->getFiles()->GitSshUrl !== null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console::outDebug(sprintf('fetching package %s from %s', $input->package, $repositoryQueryResults->Files->GitHttpUrl ?? $repositoryQueryResults->Files->GitSshUrl));
|
||||
$git_repository = GitClient::cloneRepository($repositoryQueryResults->Files->GitHttpUrl ?? $repositoryQueryResults->Files->GitSshUrl);
|
||||
Console::outDebug(sprintf('fetching package %s from %s', $input->getPackage(), $repositoryQueryResults->getFiles()->GitHttpUrl ?? $repositoryQueryResults->getFiles()->GitSshUrl));
|
||||
$git_repository = GitClient::cloneRepository($repositoryQueryResults->getFiles()->GitHttpUrl ?? $repositoryQueryResults->getFiles()->GitSshUrl);
|
||||
|
||||
foreach(GitClient::getTags($git_repository) as $tag)
|
||||
{
|
||||
if(VersionComparator::compareVersion($tag, $repositoryQueryResults->Version) === 0)
|
||||
if(VersionComparator::compareVersion($tag, $repositoryQueryResults->getVersion()) === 0)
|
||||
{
|
||||
GitClient::checkout($git_repository, $tag);
|
||||
return PackageCompiler::tryCompile($git_repository, $repositoryQueryResults->Version);
|
||||
return PackageCompiler::tryCompile($git_repository, $repositoryQueryResults->getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -674,7 +669,7 @@
|
|||
|
||||
if ($dependency->getSourceType() !== null && !$dependency_met)
|
||||
{
|
||||
Console::outVerbose(sprintf('Installing dependency %s=%s for %s=%s', $dependency->getName(), $dependency->getVersion(), $package->assembly->getPackage(), $package->assembly->getVersion()));
|
||||
Console::outVerbose(sprintf('Installing dependency %s=%s for %s=%s', $dependency->getName(), $dependency->getVersion(), $package->getAssembly()->getPackage(), $package->getAssembly()->getVersion()));
|
||||
switch ($dependency->getSourceType())
|
||||
{
|
||||
case DependencySourceType::LOCAL:
|
||||
|
@ -989,19 +984,19 @@
|
|||
*/
|
||||
private static function initData(Package $package, InstallationPaths $paths): void
|
||||
{
|
||||
Console::outVerbose(sprintf('Initializing data for %s', $package->assembly->getName()));
|
||||
Console::outVerbose(sprintf('Initializing data for %s', $package->getAssembly()->getName()));
|
||||
|
||||
// Create data files
|
||||
$dependencies = [];
|
||||
foreach($package->dependencies as $dependency)
|
||||
foreach($package->getDependencies() as $dependency)
|
||||
{
|
||||
$dependencies[] = $dependency->toArray(true);
|
||||
}
|
||||
|
||||
$data_files = [
|
||||
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'assembly' => ZiProto::encode($package->assembly->toArray(true)),
|
||||
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'ext' => ZiProto::encode($package->header->getCompilerExtension()->toArray()),
|
||||
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'const' => ZiProto::encode($package->header->getRuntimeConstants()),
|
||||
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'assembly' => ZiProto::encode($package->getAssembly()->toArray(true)),
|
||||
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'ext' => ZiProto::encode($package->getHeader()->getCompilerExtension()->toArray()),
|
||||
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'const' => ZiProto::encode($package->getHeader()->getRuntimeConstants()),
|
||||
$paths->getDataPath() . DIRECTORY_SEPARATOR . 'dependencies' => ZiProto::encode($dependencies),
|
||||
];
|
||||
|
||||
|
|
|
@ -125,41 +125,41 @@
|
|||
$this->project_configuration = new ProjectConfiguration();
|
||||
|
||||
// Set the compiler information
|
||||
$this->project_configuration->project->setCompiler($compiler);
|
||||
$this->project_configuration->getProject()->setCompiler($compiler);
|
||||
|
||||
// Set the assembly information
|
||||
$this->project_configuration->assembly->setName($name);
|
||||
$this->project_configuration->assembly->setPackage($package);
|
||||
$this->project_configuration->assembly->setVersion('1.0.0');
|
||||
$this->project_configuration->assembly->setUuid(Uuid::v1()->toRfc4122());
|
||||
$this->project_configuration->getAssembly()->setName($name);
|
||||
$this->project_configuration->getAssembly()->setPackage($package);
|
||||
$this->project_configuration->getAssembly()->setVersion('1.0.0');
|
||||
$this->project_configuration->getAssembly()->setUuid(Uuid::v1()->toRfc4122());
|
||||
|
||||
// Set the build information
|
||||
$this->project_configuration->build->setSourcePath($src);
|
||||
$this->project_configuration->getBuild()->setSourcePath($src);
|
||||
|
||||
if($this->project_configuration->build->getSourcePath() === null)
|
||||
if($this->project_configuration->getBuild()->getSourcePath() === null)
|
||||
{
|
||||
$this->project_configuration->build->setSourcePath($this->project_path);
|
||||
$this->project_configuration->getBuild()->setSourcePath($this->project_path);
|
||||
}
|
||||
|
||||
$this->project_configuration->build->setDefaultConfiguration('debug');
|
||||
$this->project_configuration->getBuild()->setDefaultConfiguration('debug');
|
||||
|
||||
// Assembly constants if the program wishes to check for this
|
||||
$this->project_configuration->build->addDefineConstant('ASSEMBLY_PACKAGE', '%ASSEMBLY.PACKAGE%');
|
||||
$this->project_configuration->build->addDefineConstant('ASSEMBLY_VERSION', '%ASSEMBLY.VERSION%');
|
||||
$this->project_configuration->build->addDefineConstant('ASSEMBLY_UID', '%ASSEMBLY.UID%');
|
||||
$this->project_configuration->getBuild()->addDefineConstant('ASSEMBLY_PACKAGE', '%ASSEMBLY.PACKAGE%');
|
||||
$this->project_configuration->getBuild()->addDefineConstant('ASSEMBLY_VERSION', '%ASSEMBLY.VERSION%');
|
||||
$this->project_configuration->getBuild()->addDefineConstant('ASSEMBLY_UID', '%ASSEMBLY.UID%');
|
||||
|
||||
// Generate configurations
|
||||
$debug_configuration = new ProjectConfiguration\Build\BuildConfiguration();
|
||||
$debug_configuration->setName('debug');
|
||||
$debug_configuration->setOutputPath('build/debug');
|
||||
$debug_configuration->setDefinedConstant('DEBUG', '1'); // Debugging constant if the program wishes to check for this
|
||||
$this->project_configuration->build->addBuildConfiguration($debug_configuration);
|
||||
$this->project_configuration->getBuild()->addBuildConfiguration($debug_configuration);
|
||||
|
||||
$release_configuration = new ProjectConfiguration\Build\BuildConfiguration();
|
||||
$release_configuration->setName('release');
|
||||
$release_configuration->setOutputPath('build/release');
|
||||
$release_configuration->setDefinedConstant('DEBUG', '0'); // Debugging constant if the program wishes to check for this
|
||||
$this->project_configuration->build->addBuildConfiguration($release_configuration);
|
||||
$this->project_configuration->getBuild()->addBuildConfiguration($release_configuration);
|
||||
|
||||
// Finally, create project.json
|
||||
$this->project_configuration->toFile($this->project_path . DIRECTORY_SEPARATOR . 'project.json');
|
||||
|
@ -184,8 +184,8 @@
|
|||
{
|
||||
if (
|
||||
$option === InitializeProjectOptions::CREATE_SOURCE_DIRECTORY &&
|
||||
!file_exists($this->project_configuration->build->getSourcePath()) &&
|
||||
!mkdir($concurrentDirectory = $this->project_configuration->build->getSourcePath()) &&
|
||||
!file_exists($this->project_configuration->getBuild()->getSourcePath()) &&
|
||||
!mkdir($concurrentDirectory = $this->project_configuration->getBuild()->getSourcePath()) &&
|
||||
!is_dir($concurrentDirectory)
|
||||
)
|
||||
{
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @var HttpResponse
|
||||
*/
|
||||
private $httpResponse;
|
||||
private $http_response;
|
||||
|
||||
/**
|
||||
* The Unix Timestamp of when the cache becomes invalid
|
||||
|
@ -43,12 +43,12 @@
|
|||
/**
|
||||
* Creates a new HttpResponseCache
|
||||
*
|
||||
* @param HttpResponse $httpResponse
|
||||
* @param HttpResponse $http_response
|
||||
* @param int $ttl
|
||||
*/
|
||||
public function __construct(HttpResponse $httpResponse, int $ttl)
|
||||
public function __construct(HttpResponse $http_response, int $ttl)
|
||||
{
|
||||
$this->httpResponse = $httpResponse;
|
||||
$this->http_response = $http_response;
|
||||
$this->ttl = $ttl;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
*/
|
||||
public function getHttpResponse(): HttpResponse
|
||||
{
|
||||
return $this->httpResponse;
|
||||
return $this->http_response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
|
@ -31,14 +31,14 @@
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $InstallationPath;
|
||||
private $installation_path;
|
||||
|
||||
/**
|
||||
* @param string $installation_path
|
||||
*/
|
||||
public function __construct(string $installation_path)
|
||||
{
|
||||
$this->InstallationPath = $installation_path;
|
||||
$this->installation_path = $installation_path;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
public function getDataPath(): string
|
||||
{
|
||||
return $this->InstallationPath . DIRECTORY_SEPARATOR . 'ncc';
|
||||
return $this->installation_path . DIRECTORY_SEPARATOR . 'ncc';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@
|
|||
*/
|
||||
public function getSourcePath(): string
|
||||
{
|
||||
return $this->InstallationPath . DIRECTORY_SEPARATOR . 'src';
|
||||
return $this->installation_path . DIRECTORY_SEPARATOR . 'src';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,14 +68,14 @@
|
|||
*/
|
||||
public function getBinPath(): string
|
||||
{
|
||||
return $this->InstallationPath . DIRECTORY_SEPARATOR . 'bin';
|
||||
return $this->installation_path . DIRECTORY_SEPARATOR . 'bin';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getInstallationPath(): string
|
||||
public function getInstallationpath(): string
|
||||
{
|
||||
return $this->InstallationPath;
|
||||
return $this->installation_path;
|
||||
}
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace ncc\Objects;
|
||||
|
||||
class NccUpdateInformation
|
||||
{
|
||||
/**
|
||||
* The version number
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $Version;
|
||||
|
||||
/**
|
||||
* The URL source for where the update can be obtained
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $DownloadSource;
|
||||
|
||||
/**
|
||||
* Indicates if authentication is required or not to download from the source
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $AuthenticationRequired;
|
||||
|
||||
/**
|
||||
* The username to use for the authentication if provided by the server
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $AuthenticationUsername;
|
||||
|
||||
/**
|
||||
* The password to use for the authentication if provided by the server
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $AuthenticationPassword;
|
||||
|
||||
/**
|
||||
* Flags for the build
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $Flags;
|
||||
|
||||
/**
|
||||
* A description explaining what the update consists of
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $UpdateDescription;
|
||||
|
||||
/**
|
||||
* An array of changes that has been made for the update
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
public $ChangeLog;
|
||||
|
||||
/**
|
||||
* Public Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->AuthenticationRequired = false;
|
||||
$this->Flags = [];
|
||||
$this->ChangeLog = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'version' => $this->Version,
|
||||
'download_source' => $this->DownloadSource,
|
||||
'authentication_required' => $this->AuthenticationRequired,
|
||||
'authentication_username' => $this->AuthenticationUsername,
|
||||
'authentication_password' => $this->AuthenticationPassword,
|
||||
'flags' => $this->Flags,
|
||||
'update_description' => $this->UpdateDescription,
|
||||
'changelog' => $this->ChangeLog
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an object from an array representation
|
||||
*
|
||||
* @param array $data
|
||||
* @return NccUpdateInformation
|
||||
*/
|
||||
public static function fromArray(array $data): NccUpdateInformation
|
||||
{
|
||||
$NccUpdateInformationObject = new NccUpdateInformation();
|
||||
|
||||
if(isset($data['version']))
|
||||
$NccUpdateInformationObject->Version = $data['version'];
|
||||
|
||||
if(isset($data['download_source']))
|
||||
$NccUpdateInformationObject->DownloadSource = $data['download_source'];
|
||||
|
||||
if(isset($data['authentication_required']))
|
||||
$NccUpdateInformationObject->AuthenticationRequired = $data['authentication_required'];
|
||||
|
||||
if(isset($data['authentication_username']))
|
||||
$NccUpdateInformationObject->AuthenticationUsername = $data['authentication_username'];
|
||||
|
||||
if(isset($data['authentication_password']))
|
||||
$NccUpdateInformationObject->AuthenticationPassword = $data['authentication_password'];
|
||||
|
||||
if(isset($data['flags']))
|
||||
$NccUpdateInformationObject->Flags = $data['flags'];
|
||||
|
||||
if(isset($data['update_description']))
|
||||
$NccUpdateInformationObject->UpdateDescription = $data['update_description'];
|
||||
|
||||
if(isset($data['changelog']))
|
||||
$NccUpdateInformationObject->ChangeLog = $data['changelog'];
|
||||
|
||||
return $NccUpdateInformationObject;
|
||||
}
|
||||
}
|
|
@ -1,60 +1,61 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace ncc\Objects;
|
||||
|
||||
use ncc\Interfaces\SerializableObjectInterface;
|
||||
use ncc\Objects\NccVersionInformation\Component;
|
||||
|
||||
class NccVersionInformation
|
||||
class NccVersionInformation implements SerializableObjectInterface
|
||||
{
|
||||
/**
|
||||
* The current version of the build
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $Version;
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* The branch of the version
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $Branch;
|
||||
private $branch;
|
||||
|
||||
/**
|
||||
* Flags for the current build
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
public $Flags;
|
||||
private $flags;
|
||||
|
||||
/**
|
||||
* An array of components that ncc uses and comes pre-built with
|
||||
*
|
||||
* @var Component[]
|
||||
*/
|
||||
public $Components;
|
||||
private $components;
|
||||
|
||||
/**
|
||||
* The remote source for where NCC can check for available updates and how to
|
||||
|
@ -62,7 +63,87 @@
|
|||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $UpdateSource;
|
||||
private $update_source;
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getVersion(): ?string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $version
|
||||
*/
|
||||
public function setVersion(?string $version): void
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBranch(): ?string
|
||||
{
|
||||
return $this->branch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $branch
|
||||
*/
|
||||
public function setBranch(?string $branch): void
|
||||
{
|
||||
$this->branch = $branch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getFlags(): ?array
|
||||
{
|
||||
return $this->flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $flags
|
||||
*/
|
||||
public function setFlags(?array $flags): void
|
||||
{
|
||||
$this->flags = $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Component[]
|
||||
*/
|
||||
public function getComponents(): array
|
||||
{
|
||||
return $this->components;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Component[] $components
|
||||
*/
|
||||
public function setComponents(array $components): void
|
||||
{
|
||||
$this->components = $components;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUpdateSource(): ?string
|
||||
{
|
||||
return $this->update_source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $update_source
|
||||
*/
|
||||
public function setUpdateSource(?string $update_source): void
|
||||
{
|
||||
$this->update_source = $update_source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
|
@ -73,16 +154,16 @@
|
|||
{
|
||||
$components = [];
|
||||
|
||||
foreach($this->Components as $component)
|
||||
foreach($this->components as $component)
|
||||
{
|
||||
$components[] = $component->toArray();
|
||||
}
|
||||
|
||||
return [
|
||||
'version' => $this->Version,
|
||||
'branch' => $this->Branch,
|
||||
'version' => $this->version,
|
||||
'branch' => $this->branch,
|
||||
'components' =>$components,
|
||||
'flags' => $this->Flags
|
||||
'flags' => $this->flags
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -94,25 +175,31 @@
|
|||
*/
|
||||
public static function fromArray(array $data): NccVersionInformation
|
||||
{
|
||||
$NccVersionInformationObject = new NccVersionInformation();
|
||||
$object = new self();
|
||||
|
||||
if(isset($data['flags']))
|
||||
$NccVersionInformationObject->Flags = $data['flags'];
|
||||
{
|
||||
$object->flags = $data['flags'];
|
||||
}
|
||||
|
||||
if(isset($data['branch']))
|
||||
$NccVersionInformationObject->Branch = $data['branch'];
|
||||
{
|
||||
$object->branch = $data['branch'];
|
||||
}
|
||||
|
||||
if(isset($data['components']))
|
||||
{
|
||||
foreach($data['components'] as $datum)
|
||||
{
|
||||
$NccVersionInformationObject->Components[] = Component::fromArray($datum);
|
||||
$object->components[] = Component::fromArray($datum);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data['version']))
|
||||
$NccVersionInformationObject->Version = $data['version'];
|
||||
{
|
||||
$object->version = $data['version'];
|
||||
}
|
||||
|
||||
return $NccVersionInformationObject;
|
||||
return $object;
|
||||
}
|
||||
}
|
|
@ -51,63 +51,63 @@
|
|||
*
|
||||
* @var MagicBytes
|
||||
*/
|
||||
public $magic_bytes;
|
||||
private $magic_bytes;
|
||||
|
||||
/**
|
||||
* The true header of the package
|
||||
*
|
||||
* @var Header
|
||||
*/
|
||||
public $header;
|
||||
private $header;
|
||||
|
||||
/**
|
||||
* The assembly object of the package
|
||||
*
|
||||
* @var Assembly
|
||||
*/
|
||||
public $assembly;
|
||||
private $assembly;
|
||||
|
||||
/**
|
||||
* An array of dependencies that the package depends on
|
||||
*
|
||||
* @var Dependency[]
|
||||
*/
|
||||
public $dependencies;
|
||||
private $dependencies;
|
||||
|
||||
/**
|
||||
* The Main Execution Policy object for the package if the package is an executable package.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $main_execution_policy;
|
||||
private $main_execution_policy;
|
||||
|
||||
/**
|
||||
* The installer object that is used to install the package if the package is install-able
|
||||
*
|
||||
* @var Installer|null
|
||||
*/
|
||||
public $installer;
|
||||
private $installer;
|
||||
|
||||
/**
|
||||
* An array of execution units defined in the package
|
||||
*
|
||||
* @var ExecutionUnit[]
|
||||
*/
|
||||
public $execution_units;
|
||||
private $execution_units;
|
||||
|
||||
/**
|
||||
* An array of resources that the package depends on
|
||||
*
|
||||
* @var Resource[]
|
||||
*/
|
||||
public $resources;
|
||||
private $resources;
|
||||
|
||||
/**
|
||||
* An array of components for the package
|
||||
*
|
||||
* @var Component[]
|
||||
*/
|
||||
public $components;
|
||||
private $components;
|
||||
|
||||
/**
|
||||
* Public Constructor
|
||||
|
@ -161,6 +161,218 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MagicBytes
|
||||
*/
|
||||
public function getMagicBytes(): MagicBytes
|
||||
{
|
||||
return $this->magic_bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MagicBytes $magic_bytes
|
||||
*/
|
||||
public function setMagicBytes(MagicBytes $magic_bytes): void
|
||||
{
|
||||
$this->magic_bytes = $magic_bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Header
|
||||
*/
|
||||
public function getHeader(): Header
|
||||
{
|
||||
return $this->header;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Header $header
|
||||
*/
|
||||
public function setHeader(Header $header): void
|
||||
{
|
||||
$this->header = $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Assembly
|
||||
*/
|
||||
public function getAssembly(): Assembly
|
||||
{
|
||||
return $this->assembly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Assembly $assembly
|
||||
*/
|
||||
public function setAssembly(Assembly $assembly): void
|
||||
{
|
||||
$this->assembly = $assembly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|Dependency[]
|
||||
*/
|
||||
public function getDependencies(): array
|
||||
{
|
||||
return $this->dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|Dependency[] $dependencies
|
||||
*/
|
||||
public function setDependencies(array $dependencies): void
|
||||
{
|
||||
$this->dependencies = $dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMainExecutionPolicy(): ?string
|
||||
{
|
||||
return $this->main_execution_policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $main_execution_policy
|
||||
*/
|
||||
public function setMainExecutionPolicy(?string $main_execution_policy): void
|
||||
{
|
||||
$this->main_execution_policy = $main_execution_policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Installer|null
|
||||
*/
|
||||
public function getInstaller(): ?Installer
|
||||
{
|
||||
return $this->installer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Installer|null $installer
|
||||
*/
|
||||
public function setInstaller(?Installer $installer): void
|
||||
{
|
||||
$this->installer = $installer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|ExecutionUnit[]
|
||||
*/
|
||||
public function getExecutionUnits(): array
|
||||
{
|
||||
return $this->execution_units;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|ExecutionUnit[] $execution_units
|
||||
*/
|
||||
public function setExecutionUnits(array $execution_units): void
|
||||
{
|
||||
$this->execution_units = $execution_units;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|Resource[]
|
||||
*/
|
||||
public function getResources(): array
|
||||
{
|
||||
return $this->resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|Resource[] $resources
|
||||
*/
|
||||
public function setResources(array $resources): void
|
||||
{
|
||||
$this->resources = $resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Resource $resource
|
||||
* @return void
|
||||
*/
|
||||
public function addResource(Resource $resource): void
|
||||
{
|
||||
foreach($this->resources as $res)
|
||||
{
|
||||
if($res->getName() === $resource->getName())
|
||||
{
|
||||
$this->removeResource($res->getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->resources[] = $resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
private function removeResource(string $name): void
|
||||
{
|
||||
foreach($this->resources as $key => $res)
|
||||
{
|
||||
if($res->getName() === $name)
|
||||
{
|
||||
unset($this->resources[$key]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|Component[]
|
||||
*/
|
||||
public function getComponents(): array
|
||||
{
|
||||
return $this->components;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|Component[] $components
|
||||
*/
|
||||
public function setComponents(array $components): void
|
||||
{
|
||||
$this->components = $components;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Component $component
|
||||
* @return void
|
||||
*/
|
||||
public function addComponent(Component $component): void
|
||||
{
|
||||
foreach($this->components as $comp)
|
||||
{
|
||||
if($comp->getName() === $component->getName())
|
||||
{
|
||||
$this->removeComponent($comp->getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->components[] = $component;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function removeComponent(string $name): void
|
||||
{
|
||||
foreach($this->components as $key => $comp)
|
||||
{
|
||||
if($comp->getName() === $name)
|
||||
{
|
||||
unset($this->components[$key]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the package object and returns True if the package contains the correct information
|
||||
*
|
||||
|
@ -248,7 +460,7 @@
|
|||
*/
|
||||
public static function load(string $path): Package
|
||||
{
|
||||
if(!file_exists($path) || !is_file($path) || !is_readable($path))
|
||||
if(!is_file($path) || !is_readable($path))
|
||||
{
|
||||
throw new PathNotFoundException($path);
|
||||
}
|
||||
|
@ -265,7 +477,7 @@
|
|||
// Extract the package structure version
|
||||
$package_structure_version = strtoupper(substr($header, 11, 3));
|
||||
|
||||
if(!in_array($package_structure_version, PackageStructureVersions::ALL))
|
||||
if(!in_array($package_structure_version, PackageStructureVersions::ALL, true))
|
||||
{
|
||||
throw new PackageException(sprintf("The package '%s' does not appear to be a valid NCC Package (Unsupported Package Structure Version)", $path));
|
||||
}
|
||||
|
|
|
@ -27,40 +27,41 @@
|
|||
use ncc\Enums\Versions;
|
||||
use ncc\Exceptions\ConfigurationException;
|
||||
use ncc\Exceptions\IOException;
|
||||
use ncc\Interfaces\BytecodeObjectInterface;
|
||||
use ncc\Objects\PackageLock\PackageEntry;
|
||||
use ncc\Utilities\Console;
|
||||
use ncc\Utilities\Functions;
|
||||
|
||||
class PackageLock
|
||||
class PackageLock implements BytecodeObjectInterface
|
||||
{
|
||||
/**
|
||||
* The version of package lock file structure
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $PackageLockVersion;
|
||||
private $package_lock_version;
|
||||
|
||||
/**
|
||||
* The Unix Timestamp for when this package lock file was last updated
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $LastUpdatedTimestamp;
|
||||
private $last_updated_timestamp;
|
||||
|
||||
/**
|
||||
* An array of installed packages in the PackageLock file
|
||||
*
|
||||
* @var PackageEntry[]
|
||||
*/
|
||||
public $Packages;
|
||||
private $packages;
|
||||
|
||||
/**
|
||||
* Public Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->PackageLockVersion = Versions::PACKAGE_LOCK_VERSION;
|
||||
$this->Packages = [];
|
||||
$this->package_lock_version = Versions::PACKAGE_LOCK_VERSION;
|
||||
$this->packages = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,8 +71,8 @@
|
|||
*/
|
||||
private function update(): void
|
||||
{
|
||||
$this->PackageLockVersion = Versions::PACKAGE_LOCK_VERSION;
|
||||
$this->LastUpdatedTimestamp = time();
|
||||
$this->package_lock_version = Versions::PACKAGE_LOCK_VERSION;
|
||||
$this->last_updated_timestamp = time();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,22 +83,22 @@
|
|||
*/
|
||||
public function addPackage(Package $package, string $install_path): void
|
||||
{
|
||||
Console::outVerbose("Adding package {$package->assembly->getPackage()} to package lock file");
|
||||
Console::outVerbose("Adding package {$package->getAssembly()->getPackage()} to package lock file");
|
||||
|
||||
if(!isset($this->Packages[$package->assembly->getPackage()]))
|
||||
if(!isset($this->packages[$package->getAssembly()->getPackage()]))
|
||||
{
|
||||
$package_entry = new PackageEntry();
|
||||
$package_entry->addVersion($package, $install_path, true);
|
||||
$package_entry->setName($package->assembly->getPackage());
|
||||
$package_entry->setUpdateSource($package->header->getUpdateSource());
|
||||
$this->Packages[$package->assembly->getPackage()] = $package_entry;
|
||||
$package_entry->setName($package->getAssembly()->getPackage());
|
||||
$package_entry->setUpdateSource($package->getHeader()->getUpdateSource());
|
||||
$this->packages[$package->getAssembly()->getPackage()] = $package_entry;
|
||||
$this->update();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->Packages[$package->assembly->getPackage()]->setUpdateSource($package->header->getUpdateSource());
|
||||
$this->Packages[$package->assembly->getPackage()]->addVersion($package, $install_path, true);
|
||||
$this->packages[$package->getAssembly()->getPackage()]->setUpdateSource($package->getHeader()->getUpdateSource());
|
||||
$this->packages[$package->getAssembly()->getPackage()]->addVersion($package, $install_path, true);
|
||||
$this->update();
|
||||
}
|
||||
|
||||
|
@ -112,14 +113,14 @@
|
|||
{
|
||||
Console::outVerbose(sprintf('Removing package %s version %s from package lock file', $package, $version));
|
||||
|
||||
if(isset($this->Packages[$package]))
|
||||
if(isset($this->packages[$package]))
|
||||
{
|
||||
$r = $this->Packages[$package]->removeVersion($version);
|
||||
$r = $this->packages[$package]->removeVersion($version);
|
||||
|
||||
// Remove the entire package entry if there's no installed versions
|
||||
if($r && $this->Packages[$package]->getLatestVersion() === null)
|
||||
if($r && $this->packages[$package]->getLatestVersion() === null)
|
||||
{
|
||||
unset($this->Packages[$package]);
|
||||
unset($this->packages[$package]);
|
||||
}
|
||||
|
||||
$this->update();
|
||||
|
@ -139,9 +140,9 @@
|
|||
public function removePackage(string $package): bool
|
||||
{
|
||||
Console::outVerbose(sprintf('Removing package %s from package lock file', $package));
|
||||
if(isset($this->Packages[$package]))
|
||||
if(isset($this->packages[$package]))
|
||||
{
|
||||
unset($this->Packages[$package]);
|
||||
unset($this->packages[$package]);
|
||||
$this->update();
|
||||
return true;
|
||||
}
|
||||
|
@ -158,7 +159,7 @@
|
|||
public function getPackage(string $package): ?PackageEntry
|
||||
{
|
||||
Console::outDebug(sprintf('getting package %s from package lock file', $package));
|
||||
return $this->Packages[$package] ?? null;
|
||||
return $this->packages[$package] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,7 +208,7 @@
|
|||
{
|
||||
$results = [];
|
||||
|
||||
foreach($this->Packages as $package => $entry)
|
||||
foreach($this->packages as $package => $entry)
|
||||
{
|
||||
$results[$package] = $entry->getVersions();
|
||||
}
|
||||
|
@ -215,6 +216,38 @@
|
|||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPackageLockVersion(): string
|
||||
{
|
||||
return $this->package_lock_version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $package_lock_version
|
||||
*/
|
||||
public function setPackageLockVersion(string $package_lock_version): void
|
||||
{
|
||||
$this->package_lock_version = $package_lock_version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLastUpdatedTimestamp(): int
|
||||
{
|
||||
return $this->last_updated_timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $last_updated_timestamp
|
||||
*/
|
||||
public function setLastUpdatedTimestamp(int $last_updated_timestamp): void
|
||||
{
|
||||
$this->last_updated_timestamp = $last_updated_timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
|
@ -224,14 +257,14 @@
|
|||
public function toArray(bool $bytecode=false): array
|
||||
{
|
||||
$package_entries = [];
|
||||
foreach($this->Packages as $entry)
|
||||
foreach($this->packages as $entry)
|
||||
{
|
||||
$package_entries[] = $entry->toArray($bytecode);
|
||||
}
|
||||
|
||||
return [
|
||||
($bytecode ? Functions::cbc('package_lock_version') : 'package_lock_version') => $this->PackageLockVersion,
|
||||
($bytecode ? Functions::cbc('last_updated_timestamp') : 'last_updated_timestamp') => $this->LastUpdatedTimestamp,
|
||||
($bytecode ? Functions::cbc('package_lock_version') : 'package_lock_version') => $this->package_lock_version,
|
||||
($bytecode ? Functions::cbc('last_updated_timestamp') : 'last_updated_timestamp') => $this->last_updated_timestamp,
|
||||
($bytecode ? Functions::cbc('packages') : 'packages') => $package_entries
|
||||
];
|
||||
}
|
||||
|
@ -252,12 +285,12 @@
|
|||
foreach($packages as $_datum)
|
||||
{
|
||||
$entry = PackageEntry::fromArray($_datum);
|
||||
$object->Packages[$entry->getName()] = $entry;
|
||||
$object->packages[$entry->getName()] = $entry;
|
||||
}
|
||||
}
|
||||
|
||||
$object->PackageLockVersion = Functions::array_bc($data, 'package_lock_version');
|
||||
$object->LastUpdatedTimestamp = Functions::array_bc($data, 'last_updated_timestamp');
|
||||
$object->package_lock_version = Functions::array_bc($data, 'package_lock_version');
|
||||
$object->last_updated_timestamp = Functions::array_bc($data, 'last_updated_timestamp');
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
|
|
@ -154,14 +154,14 @@
|
|||
{
|
||||
try
|
||||
{
|
||||
if ($this->getVersion($package->assembly->getVersion()) !== null)
|
||||
if ($this->getVersion($package->getAssembly()->getVersion()) !== null)
|
||||
{
|
||||
if(!$overwrite)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->removeVersion($package->assembly->getVersion());
|
||||
$this->removeVersion($package->getAssembly()->getVersion());
|
||||
}
|
||||
}
|
||||
catch (IOException $e)
|
||||
|
@ -170,10 +170,10 @@
|
|||
}
|
||||
|
||||
$version = new VersionEntry();
|
||||
$version->setVersion($package->assembly->getVersion());
|
||||
$version->setCompiler($package->header->getCompilerExtension());
|
||||
$version->setExecutionUnits($package->execution_units);
|
||||
$version->main_execution_policy = $package->main_execution_policy;
|
||||
$version->setVersion($package->getAssembly()->getVersion());
|
||||
$version->setCompiler($package->getHeader()->getCompilerExtension());
|
||||
$version->setExecutionUnits($package->getExecutionUnits());
|
||||
$version->main_execution_policy = $package->getMainExecutionPolicy();
|
||||
$version->location = $install_path;
|
||||
|
||||
foreach($version->getExecutionUnits() as $unit)
|
||||
|
@ -181,7 +181,7 @@
|
|||
$unit->setData(null);
|
||||
}
|
||||
|
||||
foreach($package->dependencies as $dependency)
|
||||
foreach($package->getDependencies() as $dependency)
|
||||
{
|
||||
$version->addDependency(new DependencyEntry($dependency));
|
||||
}
|
||||
|
|
|
@ -1,159 +0,0 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace ncc\Objects;
|
||||
|
||||
class PhpConfiguration
|
||||
{
|
||||
/**
|
||||
* The Configuration name
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
private $Name;
|
||||
|
||||
/**
|
||||
* The default value that's globally set
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $GlobalValue;
|
||||
|
||||
/**
|
||||
* The local value that has been modified by the program
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $LocalValue;
|
||||
|
||||
/**
|
||||
* The access level for modifying this configuration value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $Access;
|
||||
|
||||
/**
|
||||
* Sets a value to this Php Configuration
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
* @noinspection PhpUnused
|
||||
*/
|
||||
public function setValue(string $value): bool
|
||||
{
|
||||
if($this->Name == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ini_set($this->Name, $value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current value set for this configuration
|
||||
*
|
||||
* @return string
|
||||
* @noinspection PhpUnused
|
||||
*/
|
||||
public function getValue(): string
|
||||
{
|
||||
return $this->LocalValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the configuration value to its default state
|
||||
*
|
||||
* @return bool
|
||||
* @noinspection PhpUnused
|
||||
*/
|
||||
public function resetValue(): bool
|
||||
{
|
||||
if($this->Name == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ini_restore($this->Name);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return array
|
||||
* @noinspection PhpArrayShapeAttributeCanBeAddedInspection
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'global_value' => $this->GlobalValue,
|
||||
'local_value' => $this->LocalValue,
|
||||
'access' => $this->Access
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the object from an array representation
|
||||
*
|
||||
* @param array $data
|
||||
* @param string|null $name
|
||||
* @return PhpConfiguration
|
||||
*/
|
||||
public static function fromArray(array $data, ?string $name=null): PhpConfiguration
|
||||
{
|
||||
$PhpConfiguratoinObject = new PhpConfiguration();
|
||||
|
||||
if($name !== null)
|
||||
{
|
||||
$PhpConfiguratoinObject->Name = $name;
|
||||
}
|
||||
|
||||
if(isset($data['global_value']))
|
||||
{
|
||||
$PhpConfiguratoinObject->GlobalValue = $data['global_value'];
|
||||
}
|
||||
|
||||
if(isset($data['local_value']))
|
||||
{
|
||||
$PhpConfiguratoinObject->LocalValue = $data['local_value'];
|
||||
}
|
||||
|
||||
if(isset($data['access']))
|
||||
{
|
||||
$PhpConfiguratoinObject->Access = $data['access'];
|
||||
}
|
||||
|
||||
return $PhpConfiguratoinObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->Name;
|
||||
}
|
||||
}
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class ProjectConfiguration implements BytecodeObjectInterface
|
||||
{
|
||||
|
@ -50,35 +50,35 @@
|
|||
*
|
||||
* @var Project
|
||||
*/
|
||||
public $project;
|
||||
private $project;
|
||||
|
||||
/**
|
||||
* Assembly information for the build output
|
||||
*
|
||||
* @var Assembly
|
||||
*/
|
||||
public $assembly;
|
||||
private $assembly;
|
||||
|
||||
/**
|
||||
* An array of execution policies
|
||||
*
|
||||
* @var ExecutionPolicy[]
|
||||
*/
|
||||
public $execution_policies;
|
||||
private $execution_policies;
|
||||
|
||||
/**
|
||||
* Execution Policies to execute by the NCC installer
|
||||
*
|
||||
* @var Installer|null
|
||||
*/
|
||||
public $installer;
|
||||
private $installer;
|
||||
|
||||
/**
|
||||
* Build configuration for the project
|
||||
*
|
||||
* @var Build
|
||||
*/
|
||||
public $build;
|
||||
private $build;
|
||||
|
||||
/**
|
||||
* Public Constructor
|
||||
|
@ -91,6 +91,86 @@
|
|||
$this->build = new Build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Project
|
||||
*/
|
||||
public function getProject(): Project
|
||||
{
|
||||
return $this->project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Project $project
|
||||
*/
|
||||
public function setProject(Project $project): void
|
||||
{
|
||||
$this->project = $project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Assembly
|
||||
*/
|
||||
public function getAssembly(): Assembly
|
||||
{
|
||||
return $this->assembly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Assembly $assembly
|
||||
*/
|
||||
public function setAssembly(Assembly $assembly): void
|
||||
{
|
||||
$this->assembly = $assembly;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|ExecutionPolicy[]
|
||||
*/
|
||||
public function getExecutionPolicies(): array
|
||||
{
|
||||
return $this->execution_policies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|ExecutionPolicy[] $execution_policies
|
||||
*/
|
||||
public function setExecutionPolicies(array $execution_policies): void
|
||||
{
|
||||
$this->execution_policies = $execution_policies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Installer|null
|
||||
*/
|
||||
public function getInstaller(): ?Installer
|
||||
{
|
||||
return $this->installer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Installer|null $installer
|
||||
*/
|
||||
public function setInstaller(?Installer $installer): void
|
||||
{
|
||||
$this->installer = $installer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Build
|
||||
*/
|
||||
public function getBuild(): Build
|
||||
{
|
||||
return $this->build;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Build $build
|
||||
*/
|
||||
public function setBuild(Build $build): void
|
||||
{
|
||||
$this->build = $build;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the object for any errors
|
||||
*
|
||||
|
@ -309,45 +389,43 @@
|
|||
foreach($required_policies as $policy)
|
||||
{
|
||||
$execution_policy = $this->getExecutionPolicy($policy);
|
||||
if($execution_policy?->getExitHandlers() !== null)
|
||||
|
||||
if($execution_policy?->getExitHandlers()->getSuccess()?->getRun() !== null)
|
||||
{
|
||||
if($execution_policy?->getExitHandlers()->getSuccess()?->getRun() !== null)
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getSuccess()?->getRun(), $defined_polices, true))
|
||||
{
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getSuccess()?->getRun(), $defined_polices, true))
|
||||
{
|
||||
throw new ConfigurationException('The execution policy \'' . $execution_policy?->getName() . '\' Success exit handler points to a undefined execution policy \'' . $execution_policy?->getExitHandlers()->getSuccess()?->getRun() . '\'');
|
||||
}
|
||||
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getSuccess()?->getRun(), $required_policies, true))
|
||||
{
|
||||
$required_policies[] = $execution_policy?->getExitHandlers()->getSuccess()?->getRun();
|
||||
}
|
||||
throw new ConfigurationException('The execution policy \'' . $execution_policy?->getName() . '\' Success exit handler points to a undefined execution policy \'' . $execution_policy?->getExitHandlers()->getSuccess()?->getRun() . '\'');
|
||||
}
|
||||
|
||||
if($execution_policy?->getExitHandlers()->getWarning()?->getRun() !== null)
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getSuccess()?->getRun(), $required_policies, true))
|
||||
{
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getWarning()?->getRun(), $defined_polices, true))
|
||||
{
|
||||
throw new ConfigurationException('The execution policy \'' . $execution_policy?->getName() . '\' Warning exit handler points to a undefined execution policy \'' . $execution_policy?->getExitHandlers()->getWarning()?->getRun() . '\'');
|
||||
}
|
||||
$required_policies[] = $execution_policy?->getExitHandlers()->getSuccess()?->getRun();
|
||||
}
|
||||
}
|
||||
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getWarning()?->getRun(), $required_policies, true))
|
||||
{
|
||||
$required_policies[] = $execution_policy?->getExitHandlers()->getWarning()?->getRun();
|
||||
}
|
||||
if($execution_policy?->getExitHandlers()->getWarning()?->getRun() !== null)
|
||||
{
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getWarning()?->getRun(), $defined_polices, true))
|
||||
{
|
||||
throw new ConfigurationException('The execution policy \'' . $execution_policy?->getName() . '\' Warning exit handler points to a undefined execution policy \'' . $execution_policy?->getExitHandlers()->getWarning()?->getRun() . '\'');
|
||||
}
|
||||
|
||||
if($execution_policy?->getExitHandlers()->getError()?->getRun() !== null)
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getWarning()?->getRun(), $required_policies, true))
|
||||
{
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getError()?->getRun(), $defined_polices, true))
|
||||
{
|
||||
throw new ConfigurationException('The execution policy \'' . $execution_policy?->getName() . '\' Error exit handler points to a undefined execution policy \'' . $execution_policy?->getExitHandlers()->getError()?->getRun() . '\'');
|
||||
}
|
||||
$required_policies[] = $execution_policy?->getExitHandlers()->getWarning()?->getRun();
|
||||
}
|
||||
}
|
||||
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getError()?->getRun(), $required_policies, true))
|
||||
{
|
||||
$required_policies[] = $execution_policy?->getExitHandlers()->getError()?->getRun();
|
||||
}
|
||||
if($execution_policy?->getExitHandlers()->getError()?->getRun() !== null)
|
||||
{
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getError()?->getRun(), $defined_polices, true))
|
||||
{
|
||||
throw new ConfigurationException('The execution policy \'' . $execution_policy?->getName() . '\' Error exit handler points to a undefined execution policy \'' . $execution_policy?->getExitHandlers()->getError()?->getRun() . '\'');
|
||||
}
|
||||
|
||||
if(!in_array($execution_policy?->getExitHandlers()->getError()?->getRun(), $required_policies, true))
|
||||
{
|
||||
$required_policies[] = $execution_policy?->getExitHandlers()->getError()?->getRun();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class Assembly implements BytecodeObjectInterface
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class Build implements BytecodeObjectInterface
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class BuildConfiguration implements BytecodeObjectInterface
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class Compiler implements BytecodeObjectInterface
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class Dependency implements BytecodeObjectInterface
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class Project implements BytecodeObjectInterface
|
||||
{
|
||||
|
|
|
@ -1,63 +1,67 @@
|
|||
<?php /*
|
||||
* Copyright (c) 2023.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/ /*
|
||||
* Copyright (c) Nosial 2022-2023.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/ /*
|
||||
* 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.
|
||||
*
|
||||
*/ /** @noinspection PhpMissingFieldTypeInspection */
|
||||
<?php
|
||||
|
||||
namespace ncc\Objects;
|
||||
/*
|
||||
* Copyright (c) 2023.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/ /*
|
||||
* Copyright (c) Nosial 2022-2023.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/ /*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace ncc\Objects;
|
||||
|
||||
class ProjectDetectionResults
|
||||
{
|
||||
|
@ -66,13 +70,46 @@ namespace ncc\Objects;
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
public $ProjectPath;
|
||||
private $project_path;
|
||||
|
||||
/**
|
||||
* The type of project that was detected
|
||||
*
|
||||
* @see ProjectType
|
||||
* @see project_type
|
||||
* @var string
|
||||
*/
|
||||
public $ProjectType;
|
||||
private $project_type;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectPath(): string
|
||||
{
|
||||
return $this->project_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $project_path
|
||||
*/
|
||||
public function setProjectPath(string $project_path): void
|
||||
{
|
||||
$this->project_path = $project_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectType(): string
|
||||
{
|
||||
return $this->project_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $project_type
|
||||
*/
|
||||
public function setProjectType(string $project_type): void
|
||||
{
|
||||
$this->project_type = $project_type;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,24 +1,24 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
|
@ -32,27 +32,27 @@
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $vendor;
|
||||
private $vendor;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $package;
|
||||
private $package;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $version;
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $branch;
|
||||
private $branch;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $source;
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* Public Constructor & String Parser
|
||||
|
@ -80,6 +80,86 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVendor(): string
|
||||
{
|
||||
return $this->vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $vendor
|
||||
*/
|
||||
public function setVendor(string $vendor): void
|
||||
{
|
||||
$this->vendor = $vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPackage(): string
|
||||
{
|
||||
return $this->package;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $package
|
||||
*/
|
||||
public function setPackage(string $package): void
|
||||
{
|
||||
$this->package = $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getVersion(): ?string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $version
|
||||
*/
|
||||
public function setVersion(?string $version): void
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBranch(): ?string
|
||||
{
|
||||
return $this->branch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $branch
|
||||
*/
|
||||
public function setBranch(?string $branch): void
|
||||
{
|
||||
$this->branch = $branch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSource(): string
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $source
|
||||
*/
|
||||
public function setSource(string $source): void
|
||||
{
|
||||
$this->source = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the input
|
||||
*
|
||||
|
|
|
@ -33,34 +33,99 @@
|
|||
*
|
||||
* @var Files
|
||||
*/
|
||||
public $Files;
|
||||
private $files;
|
||||
|
||||
/**
|
||||
* The version of the package returned by the query
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $Version;
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* The name of the release returned by the query
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $ReleaseName;
|
||||
private $release_name;
|
||||
|
||||
/**
|
||||
* The description of the release returned by the query
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $ReleaseDescription;
|
||||
private $release_description;
|
||||
|
||||
/**
|
||||
* Public Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->Files = new Files();
|
||||
$this->files = new Files();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Files
|
||||
*/
|
||||
public function getFiles(): Files
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Files $files
|
||||
*/
|
||||
public function setFiles(Files $files): void
|
||||
{
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getVersion(): ?string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $version
|
||||
*/
|
||||
public function setVersion(?string $version): void
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getReleaseName(): ?string
|
||||
{
|
||||
return $this->release_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $release_name
|
||||
*/
|
||||
public function setReleaseName(?string $release_name): void
|
||||
{
|
||||
$this->release_name = $release_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getReleaseDescription(): ?string
|
||||
{
|
||||
return $this->release_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $release_description
|
||||
*/
|
||||
public function setReleaseDescription(?string $release_description): void
|
||||
{
|
||||
$this->release_description = $release_description;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,24 +1,24 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
|
@ -57,6 +57,22 @@
|
|||
$this->entries = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVersion(): string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $version
|
||||
*/
|
||||
public function setVersion(string $version): void
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new entry to the vault
|
||||
*
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class Functions
|
||||
{
|
||||
|
@ -162,9 +162,9 @@
|
|||
*/
|
||||
public static function encodeJson(mixed $value, int $flags=0): string
|
||||
{
|
||||
$flags = ($flags & self::ESCAPE_UNICODE ? 0 : JSON_UNESCAPED_UNICODE)
|
||||
$flags = (($flags & self::ESCAPE_UNICODE) ? 0 : JSON_UNESCAPED_UNICODE)
|
||||
| JSON_UNESCAPED_SLASHES
|
||||
| ($flags & self::PRETTY ? JSON_PRETTY_PRINT : 0)
|
||||
| (($flags & self::PRETTY) ? JSON_PRETTY_PRINT : 0)
|
||||
| (defined('JSON_PRESERVE_ZERO_FRACTION') ? JSON_PRESERVE_ZERO_FRACTION : 0); // since PHP 5.6.6 & PECL JSON-C 1.3.7
|
||||
|
||||
try
|
||||
|
@ -643,15 +643,7 @@
|
|||
|
||||
if($unzip_executable !== null)
|
||||
{
|
||||
$supported_types = array_merge($supported_types, [
|
||||
'application/zip',
|
||||
'application/x-zip',
|
||||
'application/x-zip-compressed',
|
||||
'application/octet-stream',
|
||||
'application/x-compress',
|
||||
'application/x-compressed',
|
||||
'multipart/x-zip'
|
||||
]);
|
||||
array_push($supported_types, 'application/zip', 'application/x-zip', 'application/x-zip-compressed', 'application/octet-stream', 'application/x-compress', 'application/x-compressed', 'multipart/x-zip');
|
||||
}
|
||||
elseif(RuntimeCache::get('warning_zip_shown') !== true)
|
||||
{
|
||||
|
@ -661,12 +653,7 @@
|
|||
|
||||
if($tar_executable !== null)
|
||||
{
|
||||
$supported_types = array_merge($supported_types, [
|
||||
'application/x-tar',
|
||||
'application/x-gzip',
|
||||
'application/x-bzip2',
|
||||
'application/x-xz'
|
||||
]);
|
||||
array_push($supported_types, 'application/x-tar', 'application/x-gzip', 'application/x-bzip2', 'application/x-xz');
|
||||
}
|
||||
elseif(RuntimeCache::get('warning_tar_shown') !== true)
|
||||
{
|
||||
|
@ -719,8 +706,7 @@
|
|||
}
|
||||
|
||||
// Search files in the given directory recursively
|
||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
|
||||
foreach ($iterator as $file)
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $file)
|
||||
{
|
||||
if(in_array($file->getFilename(), $files, true))
|
||||
{
|
||||
|
@ -819,13 +805,13 @@
|
|||
// If the specified version is a release, download the source code
|
||||
if($release_results !== null)
|
||||
{
|
||||
$results->ReleaseName = ($release_results->ReleaseName ?? null);
|
||||
$results->ReleaseDescription = ($release_results->ReleaseDescription ?? null);
|
||||
$results->Files = self::mergeFilesResults($release_results->Files, ($results->Files ?? null));
|
||||
$results->setReleaseName($release_results->getReleaseName() ?? null);
|
||||
$results->setReleaseDescription($release_results->getReleaseDescription() ?? null);
|
||||
$results->setFiles(self::mergeFilesResults($release_results->getFiles(), ($results->getFiles() ?? null)));
|
||||
|
||||
if($release_results->Version !== null)
|
||||
if($release_results->getVersion() !== null)
|
||||
{
|
||||
$results->Version = $release_results->Version;
|
||||
$results->setVersion($release_results->getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -841,44 +827,44 @@
|
|||
|
||||
if($git_results !== null)
|
||||
{
|
||||
if($results->ReleaseName === null)
|
||||
if($results->getReleaseName() === null)
|
||||
{
|
||||
$results->ReleaseName = ($git_results->ReleaseName ?? null);
|
||||
$results->setReleaseName($git_results->getReleaseName() ?? null);
|
||||
}
|
||||
elseif($git_results->ReleaseName !== null)
|
||||
elseif($git_results->getReleaseName() !== null)
|
||||
{
|
||||
if(strlen($git_results->ReleaseName) > strlen($results->ReleaseName))
|
||||
if(strlen($git_results->getReleaseDescription()) > strlen($results->getReleaseDescription()))
|
||||
{
|
||||
$results->ReleaseName = $git_results->ReleaseName;
|
||||
$results->setReleaseName($git_results->getReleaseName());
|
||||
}
|
||||
}
|
||||
|
||||
if($results->ReleaseDescription === null)
|
||||
if($results->getReleaseDescription() === null)
|
||||
{
|
||||
$results->ReleaseDescription = ($git_results->ReleaseDescription ?? null);
|
||||
$results->setReleaseDescription($git_results->getReleaseDescription() ?? null);
|
||||
}
|
||||
elseif($git_results->ReleaseDescription !== null)
|
||||
elseif($git_results->getReleaseDescription() !== null)
|
||||
{
|
||||
if(strlen($git_results->ReleaseDescription) > strlen($results->ReleaseDescription))
|
||||
if(strlen($git_results->getReleaseDescription()) > strlen($results->getReleaseDescription()))
|
||||
{
|
||||
$results->ReleaseDescription = $git_results->ReleaseDescription;
|
||||
$results->setReleaseDescription($git_results->getReleaseDescription());
|
||||
}
|
||||
}
|
||||
|
||||
if($results->Version === null)
|
||||
if($results->getVersion() === null)
|
||||
{
|
||||
$results->Version = ($git_results->Version ?? null);
|
||||
$results->setVersion($git_results->getVersion() ?? null);
|
||||
}
|
||||
elseif($git_results->Version !== null)
|
||||
elseif($git_results->getVersion() !== null)
|
||||
{
|
||||
// Version compare
|
||||
if(VersionComparator::compareVersion($git_results->Version, $results->Version) > 0)
|
||||
if(VersionComparator::compareVersion($git_results->getVersion(), $results->getVersion()) > 0)
|
||||
{
|
||||
$results->Version = $git_results->Version;
|
||||
$results->setVersion($git_results->getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
$results->Files = self::mergeFilesResults($git_results->Files, ($results->Files ?? null));
|
||||
$results->setFiles(self::mergeFilesResults($git_results->getFiles(), ($results->getFiles() ?? null)));
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -893,44 +879,44 @@
|
|||
|
||||
if($ncc_package_results !== null)
|
||||
{
|
||||
if($results->ReleaseName === null)
|
||||
if($results->getReleaseName() === null)
|
||||
{
|
||||
$results->ReleaseName = ($ncc_package_results->ReleaseName ?? null);
|
||||
$results->setReleaseName($ncc_package_results->getReleaseName() ?? null);
|
||||
}
|
||||
elseif($ncc_package_results->ReleaseName !== null)
|
||||
elseif($ncc_package_results->getReleaseName() !== null)
|
||||
{
|
||||
if(strlen($ncc_package_results->ReleaseName) > strlen($results->ReleaseName))
|
||||
if(strlen($ncc_package_results->getReleaseName()) > strlen($results->getReleaseName()))
|
||||
{
|
||||
$results->ReleaseName = $ncc_package_results->ReleaseName;
|
||||
$results->setReleaseName($ncc_package_results->getReleaseName());
|
||||
}
|
||||
}
|
||||
|
||||
if($results->ReleaseDescription === null)
|
||||
if($results->getReleaseDescription() === null)
|
||||
{
|
||||
$results->ReleaseDescription = ($ncc_package_results->ReleaseDescription ?? null);
|
||||
$results->setReleaseDescription($ncc_package_results->getReleaseDescription() ?? null);
|
||||
}
|
||||
elseif($ncc_package_results->ReleaseDescription !== null)
|
||||
elseif($ncc_package_results->getReleaseDescription() !== null)
|
||||
{
|
||||
if(strlen($ncc_package_results->ReleaseDescription) > strlen($results->ReleaseDescription))
|
||||
if(strlen($ncc_package_results->getReleaseDescription()) > strlen($results->getReleaseDescription()))
|
||||
{
|
||||
$results->ReleaseDescription = $ncc_package_results->ReleaseDescription;
|
||||
$results->setReleaseDescription($ncc_package_results->getReleaseDescription());
|
||||
}
|
||||
}
|
||||
|
||||
if($results->Version === null)
|
||||
if($results->getVersion() === null)
|
||||
{
|
||||
$results->Version = ($ncc_package_results->Version ?? null);
|
||||
$results->setVersion($ncc_package_results->getVersion() ?? null);
|
||||
}
|
||||
elseif($ncc_package_results->Version !== null)
|
||||
elseif($ncc_package_results->getVersion() !== null)
|
||||
{
|
||||
// Version compare
|
||||
if(VersionComparator::compareVersion($ncc_package_results->Version, $results->Version) > 0)
|
||||
if(VersionComparator::compareVersion($ncc_package_results->getVersion(), $results->getVersion()) > 0)
|
||||
{
|
||||
$results->Version = $ncc_package_results->Version;
|
||||
$results->setVersion($ncc_package_results->getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
$results->Files = self::mergeFilesResults($ncc_package_results->Files, ($results->Files ?? null));
|
||||
$results->setFiles(self::mergeFilesResults($ncc_package_results->getFiles(), ($results->getFiles() ?? null)));
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
|
|
@ -304,7 +304,7 @@
|
|||
$project_file = Functions::searchDirectory($path, $project_files);
|
||||
|
||||
$project_detection_results = new ProjectDetectionResults();
|
||||
$project_detection_results->ProjectType = ProjectType::UNKNOWN;
|
||||
$project_detection_results->setProjectType(ProjectType::UNKNOWN);
|
||||
|
||||
if($project_file == null)
|
||||
{
|
||||
|
@ -315,15 +315,15 @@
|
|||
switch(basename($project_file))
|
||||
{
|
||||
case 'project.json':
|
||||
$project_detection_results->ProjectType = ProjectType::NCC;
|
||||
$project_detection_results->setProjectType(ProjectType::NCC);
|
||||
break;
|
||||
|
||||
case 'composer.json':
|
||||
$project_detection_results->ProjectType = ProjectType::COMPOSER;
|
||||
$project_detection_results->setProjectType(ProjectType::COMPOSER);
|
||||
break;
|
||||
}
|
||||
|
||||
$project_detection_results->ProjectPath = dirname($project_file);
|
||||
$project_detection_results->setProjectPath(dirname($project_file));
|
||||
return $project_detection_results;
|
||||
}
|
||||
}
|
|
@ -28,7 +28,7 @@ namespace ncc\Utilities;
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class Validate
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
/**
|
||||
* @author Zi Xing Narrakas
|
||||
* @copyright Copyright (C) 2022-2022. Nosial - All Rights Reserved.
|
||||
* @copyright Copyright (C) 2022-2023. Nosial - All Rights Reserved.
|
||||
*/
|
||||
class ncc
|
||||
{
|
||||
|
@ -73,12 +73,12 @@
|
|||
throw new RuntimeException('Unable to parse JSON contents of \'version.json\' in \'' . __DIR__ . '\'', $e);
|
||||
}
|
||||
|
||||
if(self::$version_information->Version === null)
|
||||
if(self::$version_information->getVersion() === null)
|
||||
{
|
||||
throw new RuntimeException('The version number is not specified in the version information file');
|
||||
}
|
||||
|
||||
if(self::$version_information->Branch === null)
|
||||
if(self::$version_information->getBranch() === null)
|
||||
{
|
||||
throw new RuntimeException('The version branch is not specified in the version information file');
|
||||
}
|
||||
|
@ -105,10 +105,10 @@
|
|||
|
||||
// Set version information about the current build
|
||||
$VersionInformation = self::getVersionInformation(true);
|
||||
define('NCC_VERSION_NUMBER', $VersionInformation->Version);
|
||||
define('NCC_VERSION_BRANCH', $VersionInformation->Branch);
|
||||
define('NCC_VERSION_UPDATE_SOURCE', $VersionInformation->UpdateSource);
|
||||
define('NCC_VERSION_FLAGS', $VersionInformation->Flags);
|
||||
define('NCC_VERSION_NUMBER', $VersionInformation->getVersion());
|
||||
define('NCC_VERSION_BRANCH', $VersionInformation->getBranch());
|
||||
define('NCC_VERSION_UPDATE_SOURCE', $VersionInformation->getUpdateSource());
|
||||
define('NCC_VERSION_FLAGS', $VersionInformation->getFlags());
|
||||
|
||||
define('NCC_INIT', 1);
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue