Skip to content
New issue

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

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

Already on GitHub? # to your account

Cleaning up unused services - optimize-autoloader #1893

Open
michalbundyra opened this issue Jul 24, 2020 · 2 comments
Open

Cleaning up unused services - optimize-autoloader #1893

michalbundyra opened this issue Jul 24, 2020 · 2 comments
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@michalbundyra
Copy link

First - nice feature, in version 2.7 to clean up unused services.
Instructions from README.md are fine for dev env, on prod, with "typical" usage is not working.

Environment details

  • OS: any
  • PHP version: any
  • Package name and version: google/apiclient 2.7

Steps to reproduce

  1. Create repository with composer.json (use the one from README.md or see below)
  2. Run composer update -o (note -o flag to optimize autoloader)
  3. Check vendor/composer/autoload_classmap.php (it still contains all services)

Also, another case, for prod deploy, is to run composer install -o when we have present composer.lock.
Even if there is no vendor the command to clear services is not gonna run (unless we add also: "post-install-cmd": "Google_Task_Composer::cleanup")

The problem is that services are removed after building the autoload files, so we need to re-run dump-autoload, to get these files updated. I think it should be noted in README if it cannot be solved by the script.

Code example

composer.json content (the same as in README.md):

{
    "require": {
        "google/apiclient": "^2.7"
    },
    "scripts": {
        "post-update-cmd": "Google_Task_Composer::cleanup"
    },
    "extra": {
        "google/apiclient-services": [
            "Drive",
            "YouTube"
        ]
    }
}
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jul 25, 2020
@dwsupplee dwsupplee added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Jul 28, 2020
@googleapis googleapis deleted a comment Aug 11, 2020
@audas
Copy link

audas commented Sep 18, 2020

Removed ALL services except Youtube and Drive ?

"require": {
    "google/apiclient": "^2.7"
},
"scripts": {
    "post-update-cmd": "Google_Task_Composer::cleanup"
},
"extra": {
    "google/apiclient-services": [
        "Calendar",
		"Iam",
		"IAMCredentials",
		"Oauth2",
		"SearchConsole",
        "YouTube"
    ]
}

@php-
Copy link

php- commented Jun 19, 2022

I tried the following, but it does not work:

	"extra": {
        "google/apiclient-services": [
            "Analytics",
            "AnalyticsReporting"
        ]
    }

I'm having issues with: Class "Google_Service_AnalyticsReporting" not found, form this guide

Finally composer saying:
[InvalidArgumentException] Google service "AnalyticsReporting" does not exist or was removed previously

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

5 participants