Assigning to project.ext.x works generally, and works great for internally managed properties like ‘title’, but the project ‘description’ property is very special in that assigning to project.ext.description has no effect and reading project.description still returns null.
I have a plugin that handles property settings generally. It tests if the parent object (‘project’ in this case) has an ‘ext’ member that is assignable from ExtraPropertiesExtension and assigns with parentObject.ext.x if so. So far that seems to work for everything other than this special ‘description’ property. Is there a better test I can do to check if a property should be set with parentObject.x instead of with parentObject.ext.x?
Following build file shows that only assigning directly to ‘project.description’ effects reading of ‘project.description’.
defaultTasks ‘echoDescription’
task echoDescription << {
project.ext.description=‘Coded val1’
println 'description set? ’ + project.hasProperty(‘description’)
println ‘description=(’ + project.description + ‘)’
project.ext.set(‘description’, ‘Coded val2’)
println 'description set? ’ + project.hasProperty(‘description’)
println ‘description=(’ + project.description + ‘)’
project.setProperty(‘description’, ‘Coded val3’)
println 'description set? ’ + project.hasProperty(‘description’)
println ‘description=(’ + project.description + ‘)’
}
task echoOther << {
project.ext.other=‘Coded val’
println 'other set? ’ + project.hasProperty(‘other’)
println ‘other=(’ + project.other + ‘)’
}
task echoTitle << {
project.ext.title=‘Coded val’
println 'title set? ’ + project.hasProperty(‘title’)
println ‘title=(’ + project.title + ‘)’
}