Closed loosebazooka closed 8 years ago
Is this feature somewhere in Gradle docs?
It's just what a developer at the gradle conference said was an option while they transition things.
Can you just do this?
project.getExtensions().add("archive", war.getArchivePath());
and to retrieve it...
app.getStage().setArtifact((File)extensionContainer.getByName("archive"));
This way you don't need the ProjectModelExtension
class.
It looks like it would technically work, but I don't think gradle expects anyone to call "add" directly because it doesn't use gradle's object instantiator to instantiate the object as a gradle object. The gradle source only seems to be using it in tests and during creation of extensions via create. Also, this way the typing is explicit and can just be extended if we need to move other data between project and model space.
It's a public method. So, I would assume it's fair game to use. The only reason I would prefer it at this point is because it's more concise and makes the code easier to understand.
@meltsufin use gradle objects for data sharing.