How does a plugin code generation work?

See a generic article: How does the code generation work

Plugin declaration schema

https://github.com/magento/magento2/blob/22629abe10f9c640fe47b6081d57fedccdea8e0f/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd#L140-L145

1. Preparing the interception config

1.1

https://github.com/magento/magento2/blob/22629abe10f9c640fe47b6081d57fedccdea8e0f/lib/internal/Magento/Framework/Interception/Config/Config.php#L103

1.2

https://github.com/magento/magento2/blob/22629abe10f9c640fe47b6081d57fedccdea8e0f/lib/internal/Magento/Framework/Interception/Config/Config.php#L118

1.3

https://github.com/magento/magento2/blob/22629abe10f9c640fe47b6081d57fedccdea8e0f/lib/internal/Magento/Framework/Config/Reader/Filesystem.php#L158

1.4

https://github.com/magento/magento2/blob/22629abe10f9c640fe47b6081d57fedccdea8e0f/lib/internal/Magento/Framework/ObjectManager/Config/Mapper/Dom.php#L106-L123

2. Resolving an interceptor

2.1

https://github.com/magento/magento2/blob/22629abe10f9c640fe47b6081d57fedccdea8e0f/lib/internal/Magento/Framework/ObjectManager/ObjectManager.php#L71

2.2

https://github.com/magento/magento2/blob/22629abe10f9c640fe47b6081d57fedccdea8e0f/lib/internal/Magento/Framework/ObjectManager/Factory/Dynamic/Developer.php#L70

2.3

https://github.com/magento/magento2/blob/22629abe10f9c640fe47b6081d57fedccdea8e0f/lib/internal/Magento/Framework/Interception/ObjectManager/Config/Developer.php#L39-L41

See also:
https://github.com/magento/magento2/issues/2297

See also: