Fixed issue where all development dependencies were not correctly being added to debug builds in composer projects,

instead these dependencies were added globally to the build configuration. This issue was fixed by adding all the
   development dependencies to the debug build configurations only.

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

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

These changes enhance the accuracy of dependency management and improve the robustness of package validation.
This commit is contained in:
Netkas 2023-10-25 17:57:51 -04:00
parent 7befd995e7
commit 76f12bb0a3
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
3 changed files with 8 additions and 6 deletions

View file

@ -195,7 +195,7 @@
}
}
if($this->data_length === null)
if($this->data_length === null || $this->data_length === 0)
{
throw new IOException(sprintf('File \'%s\' is not a valid package file (missing end of package)', $file_path));
}

View file

@ -496,6 +496,7 @@
// Create the build configuration
$build = new ProjectConfiguration\Build('auto_src');
$build->setDefaultConfiguration('release_ncc');
$require_dev = [];
// Process dependencies
if($composer_json->getRequire() !== null)
@ -516,7 +517,6 @@
}
// Process developer dependencies
$require_dev = [];
if($composer_json->getRequireDev() !== null)
{
/** @var ComposerJson\PackageLink $package_link */
@ -528,10 +528,9 @@
}
$source = sprintf('%s=%s@packagist', $package_link->getPackageName(), $package_link->getVersion());
$build->addDependency(new ProjectConfiguration\Dependency(
$require_dev[] = new ProjectConfiguration\Dependency(
Resolver::composerNameToPackage($package_link->getPackageName()), $source, $package_link->getVersion()
));
$require_dev[] = $package_link->getPackageName();
);
}
}