Commit 879ec6dc authored by Helmut Hummel's avatar Helmut Hummel Committed by Benni Mack
Browse files

[!!!][TASK] Upgrade to composer installers 2.0.0

With this step, the typo3/cms package will not be
installable anymore with composer, but only the
single subtree splitted packages like typo3/cms-core.

To ease the usage, a new package typo3/minimal is
introduced, which has dependencies to all required
TYPO3 extensions, so that composer users can't install
an incomplete code base, at least not when using this package.

composer command used:

composer require typo3/cms-composer-installers ^2.0

Releases: master
Resolves: #83302
Change-Id: Ia1009f62d97be611a03cec5dd437b56cd7866eeb
Reviewed-on: https://review.typo3.org/55049


Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent a9326c52
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "ee8fd70e59c3f86ff7728b866e54149c",
"content-hash": "f97dca50e21002a44cc3ede3fee3f025",
"packages": [
{
"name": "cogpowered/finediff",
......@@ -1524,16 +1524,16 @@
},
{
"name": "typo3/cms-composer-installers",
"version": "1.4.5",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/TYPO3/CmsComposerInstallers.git",
"reference": "0ef630f82f12aa611fb44a3e1e5491fc98b97e78"
"reference": "68a206451b8d479049a8886bdb0001134bfe03ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/TYPO3/CmsComposerInstallers/zipball/0ef630f82f12aa611fb44a3e1e5491fc98b97e78",
"reference": "0ef630f82f12aa611fb44a3e1e5491fc98b97e78",
"url": "https://api.github.com/repos/TYPO3/CmsComposerInstallers/zipball/68a206451b8d479049a8886bdb0001134bfe03ac",
"reference": "68a206451b8d479049a8886bdb0001134bfe03ac",
"shasum": ""
},
"require": {
......@@ -1554,7 +1554,7 @@
"extra": {
"class": "TYPO3\\CMS\\Composer\\Installer\\Plugin",
"branch-alias": {
"dev-master": "1.4.x-dev"
"dev-master": "2.0.x-dev"
}
},
"autoload": {
......@@ -1568,16 +1568,14 @@
],
"authors": [
{
"name": "Christian Opitz",
"email": "christian.opitz@netresearch.de"
},
{
"name": "Lars Peipmann",
"email": "lars@peipmann.de"
"name": "The TYPO3 Community",
"homepage": "https://typo3.org/community/",
"role": "Contributor"
},
{
"name": "Helmut Hummel",
"email": "info@helhum.io"
"name": "TYPO3 CMS Core Team",
"homepage": "https://forge.typo3.org/projects/typo3cms-core",
"role": "Developer"
}
],
"description": "TYPO3 CMS Installers",
......@@ -1589,7 +1587,7 @@
"installer",
"typo3"
],
"time": "2017-11-06T11:44:16+00:00"
"time": "2017-12-12T14:04:22+00:00"
},
{
"name": "typo3fluid/fluid",
......
<?php
declare(strict_types=1);
namespace TYPO3\CMS\Core\Composer;
/*
* This file is part of the TYPO3 project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Composer\Script\Event;
use Composer\Semver\Constraint\EmptyConstraint;
use TYPO3\CMS\Composer\Plugin\Core\InstallerScriptsRegistration;
use TYPO3\CMS\Composer\Plugin\Core\ScriptDispatcher;
use TYPO3\CMS\Core\Composer\InstallerScripts\WebDirectory;
/**
* Hook into Composer build to set up TYPO3 web directory if necessary
*/
class InstallerScripts implements InstallerScriptsRegistration
{
/**
* @param Event $event
* @param ScriptDispatcher $scriptDispatcher
*/
public static function register(Event $event, ScriptDispatcher $scriptDispatcher)
{
if (null !== $event->getComposer()->getRepositoryManager()->getLocalRepository()->findPackage('typo3/cms', new EmptyConstraint())) {
$scriptDispatcher->addInstallerScript(
new WebDirectory(),
60
);
}
}
}
<?php
declare(strict_types=1);
namespace TYPO3\CMS\Core\Composer\InstallerScripts;
/*
* This file is part of the TYPO3 project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Script\Event;
use Composer\Semver\Constraint\EmptyConstraint;
use TYPO3\CMS\Composer\Plugin\Config;
use TYPO3\CMS\Composer\Plugin\Core\InstallerScript;
use TYPO3\CMS\Composer\Plugin\Util\Filesystem;
/**
* Setting up TYPO3 web directory
*/
class WebDirectory implements InstallerScript
{
/**
* @var string
*/
private static $typo3Dir = '/typo3';
/**
* @var string
*/
private static $systemExtensionsDir = '/sysext';
/**
* @var IOInterface
*/
private $io;
/**
* @var Composer
*/
private $composer;
/**
* @var Filesystem
*/
private $filesystem;
/**
* @var Config
*/
private $pluginConfig;
/**
* Prepare the web directory with symlinks
*
* @param Event $event
* @return bool
*/
public function run(Event $event): bool
{
$this->io = $event->getIO();
$this->composer = $event->getComposer();
$this->filesystem = new Filesystem();
$this->pluginConfig = Config::load($this->composer);
$symlinks = $this->initializeSymlinks();
if ($this->filesystem->someFilesExist($symlinks)) {
$this->filesystem->removeSymlinks($symlinks);
}
$this->filesystem->establishSymlinks($symlinks);
return true;
}
/**
* Initialize symlinks from configuration
* @return array
*/
private function initializeSymlinks(): array
{
$webDir = $this->filesystem->normalizePath($this->pluginConfig->get('web-dir'));
$backendDir = $webDir . self::$typo3Dir;
// Ensure we delete a previously existing symlink to typo3 folder in web directory
if ($this->filesystem->isSymlinkedDirectory($backendDir)) {
$this->filesystem->removeDirectory($backendDir);
}
$this->filesystem->ensureDirectoryExists($backendDir);
$localRepository = $this->composer->getRepositoryManager()->getLocalRepository();
$package = $localRepository->findPackage('typo3/cms', new EmptyConstraint());
$sourcesDir = $this->composer->getInstallationManager()->getInstallPath($package);
return [
$sourcesDir . self::$typo3Dir . self::$systemExtensionsDir => $backendDir . self::$systemExtensionsDir,
];
}
}
.. include:: ../../Includes.txt
===============================================================
Breaking: #83302 - Composer restricts installation of typo3/cms
===============================================================
See :issue:`83302`
Description
===========
When running a composer-based TYPO3 instance, it is not possible anymore to require the whole
TYPO3 Core via `composer require typo3/cms`. This package is solely used for Core-development purposes
from now on.
Instead, all system extensions maintained by the TYPO3 Core Team must be required individually.
Some examples:
* `composer require typo3/cms-core:^9`
* `composer require typo3/cms-fluid-styled-content:^9`
* `composer require typo3/cms-extbase:^9`
* `composer require typo3/cms-workspaces:^9`
* `composer require typo3/cms-sys-note:^9`
For convenience, TYPO3 projects can simply require `composer require typo3/minimal` to get the main
system extensions that are needed for a running TYPO3 instance, and add custom system extensions
as mentioned above.
Impact
======
Installing or updating the composer package `typo3/cms` will show an error for TYPO3 v9.
Affected Installations
======================
Composer-based TYPO3 installations that previously required `typo3/cms` in the projects'
`composer.json` file or in any required extension `composer.json` file.
Migration
=========
Extension authors should specifically define their dependencies of system extensions in their
`composer.json` file, if they have previously added `typo3/cms`.
Site administrators / developers should require only the necessary `typo3/cms-*` packages that they
have installed in their projects. In order to find out, which system extensions have been installed,
have a look at `typo3conf/PackageStates.php` and look for all extensions that are located under
`typo3/sysext/`.
.. index:: CLI, NotScanned
......@@ -26,7 +26,7 @@
"doctrine/annotations": "^1.3",
"typo3/cms-cli": "^1.0",
"typo3/class-alias-loader": "^1.0",
"typo3/cms-composer-installers": "^1.4",
"typo3/cms-composer-installers": "^2.0",
"psr/http-message": "~1.0",
"cogpowered/finediff": "~0.3.1",
"mso/idna-convert": "^1.1.0",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment