Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1] Add Composer plugin to correctly autoload PHP CSS Parser dependency #6472

Merged
merged 3 commits into from
Jul 21, 2021
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
8 changes: 5 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = function( grunt ) {
'assets',
'back-compat',
'includes',
'php-css-parser-install-composer-plugin',
'src',
'templates',
'vendor',
Expand All @@ -20,10 +21,11 @@ module.exports = function( grunt ) {
/.*\/src\/.*/,
];

// These will be removed from the vendor directory after installing but prior to creating a ZIP.
// These will be removed from the build directory after installing but prior to creating a ZIP.
// ⚠️ Warning: These paths are passed straight to rm command in the shell, without any escaping.
const productionVendorExcludedFilePatterns = [
const productionInstallExcludedFilePatterns = [
'composer.*',
'php-css-parser-install-composer-plugin/*',
'vendor/*/*/.editorconfig',
'vendor/*/*/.git',
'vendor/*/*/.github',
Expand Down Expand Up @@ -84,7 +86,7 @@ module.exports = function( grunt ) {
'cd build',
'composer install --no-dev -o',
'composer remove cweagans/composer-patches --update-no-dev -o',
'rm -rf ' + productionVendorExcludedFilePatterns.join( ' ' ),
'rm -rf ' + productionInstallExcludedFilePatterns.join( ' ' ),
].join( ' && ' ),
},
create_build_zip: {
Expand Down
4 changes: 2 additions & 2 deletions bin/ci/after-wp-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if [[ $(php -r "echo PHP_VERSION;") == 8.0* ]]; then
DIFF=$(
cat <<-EOF
diff --git a/composer.json b/composer.json
index 5a150f830..f670267f8 100644
index 5934aedec..2977df4a9 100644
--- a/composer.json
+++ b/composer.json
@@ -86,7 +86,17 @@
Expand All @@ -70,7 +70,7 @@ index 5a150f830..f670267f8 100644
+ "vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php"
]
},
"minimum-stability": "dev",
"repositories": [
EOF
)

Expand Down
2 changes: 1 addition & 1 deletion bin/local-env/install-wordpress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ wp plugin activate amp --quiet

# Install & activate Gutenberg plugin.
echo -e $(status_message "Installing and activating Gutenberg plugin...")
wp plugin install gutenberg --activate --force --quiet
wp plugin install gutenberg --activate --force --quiet --version=11.0.0

# Set pretty permalinks.
echo -e $(status_message "Setting permalink structure...")
Expand Down
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"sabberworm/php-css-parser": "dev-master#bfdd976"
},
"require-dev": {
"ampproject/php-css-parser-install-plugin": "*",
"automattic/vipwpcs": "^2.2",
"civicrm/composer-downloads-plugin": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "0.7.1",
Expand Down Expand Up @@ -88,6 +89,12 @@
"docs/includes/register-wp-cli-commands.php"
]
},
"repositories": [
{
"type": "path",
"url": "./php-css-parser-install-composer-plugin"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
Expand Down
102 changes: 67 additions & 35 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions php-css-parser-install-composer-plugin/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "ampproject/php-css-parser-install-plugin",
"type": "composer-plugin",
"license": "GPL-2.0-or-later",
"require": {
"composer-plugin-api": "^2.0"
},
"require-dev": {
"composer/composer": "^2.0"
},
"autoload": {
"psr-4": {
"AmpProject\\AmpWP\\PhpCssParserInstall\\": "./src"
}
},
"extra": {
"class": "AmpProject\\AmpWP\\PhpCssParserInstall\\Plugin"
}
}
Loading