1818 */
1919
2020use Composer \InstalledVersions ;
21+ use TYPO3 \CMS \Core \Information \Typo3Version ;
2122use TYPO3 \TestingFramework \Core \Functional \FunctionalTestCase ;
2223
2324/**
@@ -166,9 +167,17 @@ private function processRootPackage(): void
166167 $ packageRealPath = $ this ->realPath ($ packagePath );
167168 $ info = $ this ->getPackageComposerJson ($ packagePath );
168169 $ packageType = $ info ['type ' ] ?? '' ;
169- $ extEmConf = $ this ->getExtEmConf ($ packagePath );
170+ $ extEmConf = null ;
171+ if ((new Typo3Version ())->getMajorVersion () >= 14 ) {
172+ if (isset ($ info ['extra ' ]['typo3/cms ' ]['Package ' ]['providesPackages ' ])) {
173+ $ extEmConf = null ;
174+ } else {
175+ $ extEmConf = $ this ->getExtEmConf ($ packagePath );
176+ }
177+ } else {
178+ $ extEmConf = $ this ->getExtEmConf ($ packagePath );
179+ }
170180 $ extensionKey = $ this ->determineExtensionKey ($ packagePath , $ info , $ extEmConf );
171-
172181 $ packageInfo = new PackageInfo (
173182 $ packageName ,
174183 $ packageType ,
@@ -253,6 +262,12 @@ private function getPackageFromPath(string $path): ?PackageInfo
253262 }
254263 $ info = $ this ->getPackageComposerJson ($ path );
255264 $ extEmConf = $ this ->getExtEmConf ($ path );
265+ // Remove ext_emconf for TYPO3 v14
266+ if ((new Typo3Version ())->getMajorVersion () >= 14
267+ && isset ($ info ['extra ' ]['typo3/cms ' ]['Package ' ]['providesPackages ' ])
268+ ) {
269+ $ extEmConf = null ;
270+ }
256271 $ extensionKey = $ this ->determineExtensionKey ($ path , $ info , $ extEmConf );
257272 $ packageName = $ info ['name ' ] ?? $ this ->normalizePackageName ($ extensionKey );
258273 $ packageType = $ info ['type ' ] ?? ($ extEmConf !== null ? 'typo3-cms-extension ' : '' );
@@ -262,13 +277,20 @@ private function getPackageFromPath(string $path): ?PackageInfo
262277 if ($ packageInfo = $ this ->getPackageInfo ($ extensionKey )) {
263278 return $ packageInfo ;
264279 }
280+ $ version = $ info ['version ' ] ?? $ extEmConf ['version ' ] ?? null ;
281+ // System extensions in TYPO3 mono-repository are exactly the same version as the root package. Use it.
282+ $ version ??= ($ this ->rootPackage ()->isMonoRepository ()) ? $ this ->rootPackage ()->getVersion () : null ;
283+ // If root package is a typo3 extension use the root package version assuming that we handle a fixture ext
284+ $ version ??= ($ this ->rootPackage ()->isExtension ()) ? $ this ->rootPackage ()->getVersion () : null ;
285+ // Use root package version, falling back to COMPOSER_ROOT_VERSION and hard coded `1.0.0` as last fallback
286+ $ version ??= $ this ->rootPackage ()->getVersion () ?: getenv ('COMPOSER_ROOT_VERSION ' ) ?: '1.0.0 ' ;
265287 $ packageInfo = new PackageInfo (
266288 $ packageName ,
267289 $ packageType ,
268290 $ path ,
269291 $ this ->realPath ($ path ),
270292 // System extensions in mono-repository are exactly the same version as the root package. Use it.
271- $ this -> rootPackage ()-> getVersion () ,
293+ $ version ,
272294 $ extensionKey ,
273295 $ info ,
274296 $ extEmConf ,
@@ -297,7 +319,14 @@ private function processMonoRepository(): void
297319 $ packageName = $ info ['name ' ] ?? '' ;
298320 $ packageType = $ info ['type ' ] ?? '' ;
299321 $ extEmConf = $ this ->getExtEmConf ($ packageRealPath );
322+ // Remove ext_emconf for TYPO3 v14
323+ if ((new Typo3Version ())->getMajorVersion () >= 14
324+ && isset ($ info ['extra ' ]['typo3/cms ' ]['Package ' ]['providesPackages ' ])
325+ ) {
326+ $ extEmConf = null ;
327+ }
300328 $ extensionKey = $ this ->determineExtensionKey ($ packageRealPath , $ info , $ extEmConf );
329+ $ version = null ;
301330 $ packageInfo = new PackageInfo (
302331 $ packageName ,
303332 $ packageType ,
@@ -332,15 +361,22 @@ private function processPackages(): void
332361 $ packagePath = $ this ->getPackageInstallPath ($ packageName );
333362 $ packageRealPath = $ this ->realPath ($ packagePath );
334363 $ info = $ this ->getPackageComposerJson ($ packagePath );
335- $ extEmConf = $ this ->getExtEmConf ($ packagePath );
364+ $ extEmConf = null ;
365+ if ((new Typo3Version ())->getMajorVersion () >= 14 ) {
366+ if (!isset ($ info ['extra ' ]['typo3/cms ' ]['Package ' ]['providesPackages ' ])) {
367+ $ extEmConf = $ this ->getExtEmConf ($ packagePath );
368+ }
369+ } else {
370+ $ extEmConf = $ this ->getExtEmConf ($ packagePath );
371+ }
336372 $ packageType = $ info ['type ' ] ?? '' ;
337373 $ extensionKey = $ this ->determineExtensionKey ($ packagePath , $ info , $ extEmConf );
338374 $ this ->addPackageInfo (new PackageInfo (
339375 $ packageName ,
340376 $ packageType ,
341377 $ packagePath ,
342378 $ packageRealPath ,
343- (string )($ version ['pretty_version ' ] ?? $ this ->prettifyVersion ($ extEmConf ['version ' ] ?? '' )),
379+ (string )($ version ['pretty_version ' ] ?? $ this ->prettifyVersion ($ extEmConf ['version ' ] ?? '1.0.0 ' )),
344380 $ extensionKey ,
345381 $ info ,
346382 $ extEmConf
0 commit comments