Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/autocheckers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- 'composer.json'
- 'composer.lock'
- '**.php'
- build/autoloaderchecker.sh

autoloader:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -66,9 +67,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up dependencies
run: composer i
Copy link
Contributor Author

@kesselb kesselb Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running composer install will install the dev dependencies again and therefore needs to go. I'm not so sure anymore, but still think that our state in github should not contain the composer-bin-plugin.

The drone workflow did not run composer install (see #43514 and https://github.com/nextcloud/server/blob/master/autotest-checkers.sh).

Requested @susnux as reviewer for a third look if that makes sense.


- name: Check auto loaders
run: bash ./build/autoloaderchecker.sh

Expand Down
7 changes: 7 additions & 0 deletions build/autoloaderchecker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ echo
echo "Regenerating main autoloader"
$COMPOSER_COMMAND dump-autoload -d $REPODIR

FOUND_COMPOSER_BIN=$(grep --recursive --fixed-strings 'Bamarni\\Composer\\Bin' $REPODIR/lib/composer/composer/)
if [ -n "$FOUND_COMPOSER_BIN" ]; then
echo "The main autoloader contains the composer bin plugin"
echo "Run composer again with --no-dev and commit the result"
exit 1
fi

for app in ${REPODIR}/apps/*; do
if git check-ignore ${app} -q ; then
echo
Expand Down
5 changes: 1 addition & 4 deletions lib/composer/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
throw new RuntimeException($err);
}

require_once __DIR__ . '/composer/autoload_real.php';
Expand Down
27 changes: 23 additions & 4 deletions lib/composer/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class InstalledVersions
*/
private static $installed;

/**
* @var bool
*/
private static $installedIsLocalDir;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is coming in from the latest composer 2.8 update (composer/composer#12269). build/autoloaderchecker.sh only looks for changes to autoload_classmap and therefore our CI is not red since the latest composer bump.


/**
* @var bool|null
*/
Expand Down Expand Up @@ -309,6 +314,12 @@ public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();

// when using reload, we disable the duplicate protection to ensure that self::$installed data is
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
// so we have to assume it does not, and that may result in duplicate data being returned when listing
// all installed packages for example
self::$installedIsLocalDir = false;
}

/**
Expand All @@ -322,19 +333,27 @@ private static function getInstalled()
}

$installed = array();
$copiedLocalDir = false;

if (self::$canGetVendors) {
$selfDir = strtr(__DIR__, '\\', '/');
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
$vendorDir = strtr($vendorDir, '\\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
self::$installed = $required;
self::$installedIsLocalDir = true;
}
}
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
$copiedLocalDir = true;
}
}
}

Expand All @@ -350,7 +369,7 @@ private static function getInstalled()
}
}

if (self::$installed !== array()) {
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}

Expand Down
1 change: 0 additions & 1 deletion lib/composer/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
'OC\\' => array($baseDir . '/lib/private'),
'OCP\\' => array($baseDir . '/lib/public'),
'NCU\\' => array($baseDir . '/lib/unstable'),
'Bamarni\\Composer\\Bin\\' => array($vendorDir . '/bamarni/composer-bin-plugin/src'),
'' => array($baseDir . '/lib/private/legacy'),
);
8 changes: 0 additions & 8 deletions lib/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
array (
'NCU\\' => 4,
),
'B' =>
array (
'Bamarni\\Composer\\Bin\\' => 21,
),
);

public static $prefixDirsPsr4 = array (
Expand All @@ -44,10 +40,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
array (
0 => __DIR__ . '/../../..' . '/lib/unstable',
),
'Bamarni\\Composer\\Bin\\' =>
array (
0 => __DIR__ . '/..' . '/bamarni/composer-bin-plugin/src',
),
);

public static $fallbackDirsPsr4 = array (
Expand Down
69 changes: 3 additions & 66 deletions lib/composer/composer/installed.json
Original file line number Diff line number Diff line change
@@ -1,68 +1,5 @@
{
"packages": [
{
"name": "bamarni/composer-bin-plugin",
"version": "1.8.2",
"version_normalized": "1.8.2.0",
"source": {
"type": "git",
"url": "https://github.com/bamarni/composer-bin-plugin.git",
"reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bamarni/composer-bin-plugin/zipball/92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880",
"reference": "92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880",
"shasum": ""
},
"require": {
"composer-plugin-api": "^2.0",
"php": "^7.2.5 || ^8.0"
},
"require-dev": {
"composer/composer": "^2.0",
"ext-json": "*",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-phpunit": "^1.1",
"phpunit/phpunit": "^8.5 || ^9.5",
"symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
"symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0",
"symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0 || ^6.0"
},
"time": "2022-10-31T08:38:03+00:00",
"type": "composer-plugin",
"extra": {
"class": "Bamarni\\Composer\\Bin\\BamarniBinPlugin"
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Bamarni\\Composer\\Bin\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "No conflicts for your bin dependencies",
"keywords": [
"composer",
"conflict",
"dependency",
"executable",
"isolation",
"tool"
],
"support": {
"issues": "https://github.com/bamarni/composer-bin-plugin/issues",
"source": "https://github.com/bamarni/composer-bin-plugin/tree/1.8.2"
},
"install-path": "../bamarni/composer-bin-plugin"
}
],
"dev": true,
"dev-package-names": [
"bamarni/composer-bin-plugin"
]
"packages": [],
"dev": false,
"dev-package-names": []
}
15 changes: 3 additions & 12 deletions lib/composer/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,21 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'ee76fe192de8656d216b4079a6c50dda3fc9cdb1',
'reference' => 'b7422ba97b7b42a9955a52031a32457ca521d740',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
'dev' => true,
'dev' => false,
),
'versions' => array(
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'ee76fe192de8656d216b4079a6c50dda3fc9cdb1',
'reference' => 'b7422ba97b7b42a9955a52031a32457ca521d740',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
'dev_requirement' => false,
),
'bamarni/composer-bin-plugin' => array(
'pretty_version' => '1.8.2',
'version' => '1.8.2.0',
'reference' => '92fd7b1e6e9cdae19b0d57369d8ad31a37b6a880',
'type' => 'composer-plugin',
'install_path' => __DIR__ . '/../bamarni/composer-bin-plugin',
'aliases' => array(),
'dev_requirement' => true,
),
),
);
Loading