How to configure from a subproject only if it is part of the compilation

I created a plugin XYZthat should introduce configuration in all projects (from the root).

My project is a native C ++ project for Visual Studio. Therefore, Java dependencies are not available ...

Here is my layout, both options use a common lib projLib. projVariant1uses the plugin but projVariant2does not work.

myRoot
 - projLib
 - projVariant1 <- uses the plugin
 - projVariant2

The string projVariant1should contain: myRoot#XYZ, projLib#XYZ,projVariant1#XYZ

The string projVariant2should produce: myRoot, projLib,projVariant2

My idea is to do something like this (pseudocode):

def applyPluginXYZ(Project p) {
    p.if_part_of_compilation { // <-- this does not exist
        p.rootProject.subprojects {
            // apply change
        }
    }
}

projVariant1 build.gradle:

apply plugin: 'cpp'
applyPluginXYZ(project)
0
source share

Source: https://habr.com/ru/post/1621844/


All Articles