func validateAppEngineAPIs()

in cmd/php/appengine/main.go [47:87]


func validateAppEngineAPIs(ctx *gcp.Context) error {
	composerExists, err := ctx.FileExists("composer.json")
	if err != nil {
		return err
	}
	if !composerExists {
		return nil
	}

	supportsApis, err := php.SupportsAppEngineApis(ctx)
	if err != nil {
		return err
	}

	dirDeps, err := directDeps(ctx)
	if err != nil {
		return err
	}

	if !supportsApis && appEngineInDeps(dirDeps) {
		ctx.Warnf("There is a direct dependency on App Engine APIs, but they are not enabled in app.yaml (set the app_engine_apis property)")
		return nil
	}

	aDeps, err := allDeps(ctx)
	if err != nil {
		return err
	}

	usingAppEngine := appEngineInDeps(aDeps)
	if supportsApis && !usingAppEngine {
		ctx.Warnf("App Engine APIs are enabled, but don't appear to be used, causing a possible performance penalty. Delete app_engine_apis from your app's yaml config file.")
		return nil
	}

	if !supportsApis && usingAppEngine {
		ctx.Warnf("There is an indirect dependency on App Engine APIs, but they are not enabled in app.yaml. You may see runtime errors trying to access these APIs. Set the app_engine_apis property.")
	}

	return nil
}