Accessing external properties from a plugin

Hello,

We have a multi-project build that loads a gradle file using “apply”.

I need to be able, in that plugin, to access a property set in a separate build.gradle.

The layout and contents of a simple example:

dir1:
…build.gradle
…settings.gradle
…dir4:
…build.gradle <---- set it here
dir2:
…foo.gradle <---- use it here

dir1/settings.xml:
include ‘:dir4’

dir1/build.xml:
apply from : ‘…/dir2/foo.gradle’

task DOIT << {
println “Just Did it!”
}

dir4/build.xml:
ext.set(‘DIR4_EXTVAR’, ‘DIR4_EXTVAR_VALUE’)
println ":dir4:DIR4_EXTVAR = " + DIR4_EXTVAR

dir2/foo.gradle:
println "DIR3: EXTVAR = " + project(’:dir4’).get(‘EXTVAR’)

I am sure that this is either order of elaboration or configtime vs runtime. Good examples to study will be fine…I understand that this is too basic for words!

All apologies to anyone who actually read that thing.

The value that I am trying to pass is also the output of a task and so I ought
to be able to define proper output there (it is a Copy task) and use that to get
the value I need.

I am just not finding a lot of basic stuff on gradle…the big things I can work on…