Skip to content

Conversation

@sbuerk
Copy link
Collaborator

@sbuerk sbuerk commented Oct 15, 2024

The typo3/testing-framework creates functional test instances
as "classic" mode instances, writing a PackageStates.php file
composed using composer information, provided and handled by the
internal ComposerPackageManager class. Extensions in the state
file are not sorted based on their dependencies and suggestions.

To mitigate this and having a correctly sorted extension state
file, the PackageCollection service has been introduced with
the goal to resort the extension state file after the initial
write to provide the correct sorted extension state.

The extension sorting within the state file is important, as the
TYPO3 Core uses this sorting to loop over extensions to collect
information from the extensions, for example TCA, TCAOverrides,
ext_localconf.php and other things. Package sorting is here very
important to allow extensions to reconfigure or change the stuff
from other extensions, which is guaranteed in normal "composer"
and "classic" mode instances.

For "classic" mode instances, only the ext_emconf.php file is
taken into account and "composer.json" as the source of thruth
for "composer" mode instances since TYPO3 v12, which made the
ext_emconf.php file obsolete for extensions only installed
with composer.

Many agencies removed the optional ext_emconf.php file for
project local path extensions like a sitepackage to remove
the maintenance burden, which is a valid case.

Sadly, the PackageCollection adopted from the TYPO3 Core
PackageManager did not reflected this case and failed for
extensions to properly sort only on extension dependencies
and keys due the mix of extension key and composer package
name handling. Extension depending on another extension
failed to be sorted correctly with following exception:

UnexpectedValueException: The package "extension_key"
depends on "composer/package-key" which is not present
in the system.

This change modifies the PackageCollection implementation
to take only TYPO3 extension and system extension into account
for dependency resolving and sorting, using ext_emconf.php
depends/suggest information as first source and falling back
to composer require and suggestion information.

Resolves: #541
Releases: main, 8

@sbuerk sbuerk marked this pull request as draft October 15, 2024 12:07
@sbuerk sbuerk force-pushed the main-541 branch 3 times, most recently from 05bd9fb to 8f2bb74 Compare November 27, 2024 14:23
@sbuerk sbuerk changed the title [BUGFIX] Prioritize composer.json to resolve extension-key [BUGFIX] Respect composer mode only extension in FunctionalTestCase Nov 27, 2024
The `typo3/testing-framework` creates functional test instances
as "classic" mode instances, writing a `PackageStates.php` file
composed using composer information, provided and handled by the
internal `ComposerPackageManager` class. Extensions in the state
file are not sorted based on their dependencies and suggestions.

To mitigate this and having a correctly sorted extension state
file, the `PackageCollection` service has been introduced with
the goal to resort the extension state file after the initial
write to provide the correct sorted extension state.

The extension sorting within the state file is important, as the
TYPO3 Core uses this sorting to loop over extensions to collect
information from the extensions, for example TCA, TCAOverrides,
ext_localconf.php and other things. Package sorting is here very
important to allow extensions to reconfigure or change the stuff
from other extensions, which is guaranteed in normal "composer"
and "classic" mode instances.

For "classic" mode instances, only the `ext_emconf.php` file is
taken into account and "composer.json" as the source of thruth
for "composer" mode instances since TYPO3 v12, which made the
`ext_emconf.php` file obsolete for extensions only installed
with composer.

Many agencies removed the optional `ext_emconf.php` file for
project local path extensions like a sitepackage to remove
the maintenance burden, which is a valid case.

Sadly, the `PackageCollection` adopted from the TYPO3 Core
`PackageManager` did not reflected this case and failed for
extensions to properly sort only on extension dependencies
and keys due the mix of extension key and composer package
name handling. Extension depending on another extension
failed to be sorted correctly with following exception:

    UnexpectedValueException: The package "extension_key"
    depends on "composer/package-key" which is not present
    in the system.

This change modifies the `PackageCollection` implementation
to take only TYPO3 extension and system extension into account
for dependency resolving and sorting, using `ext_emconf.php`
depends/suggest information as first source and falling back
to `composer` require and suggestion information.

Resolves: #541
Releases: main, 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for dependencies to TYPO3 Extensions without ext_emconf.php

3 participants