I have the following plan for refactoring inter-project dependencies.
- For the project other projects depend on:
For every configuration that contains artifacts to be published,
Gradle creates a 'publish<ConfigurationName>Artifacts' task (just a
working name) belonging to this configuration. This task published the
project artifacts (i.e. the archives _produced_ by this project) to
the internal repository.
- For the projects dependent on other projects
Configuration objects will also be tasks. Executing such a task has
one and only one purpose: To make sure that all artifacts of the
configuration exists. For external artifacts we have to assume that
they exists. For internal artifacts (i.e. project dependencies) we
have to build them. If a configuration task has only external
dependencies, executing the task does nothing. If a project dependency
is added to a configuration, this will create a dependsOn relation
between the configuration task and the
'publish<ConfigurationName>Artifacts' task of the other project. The
existing configuration API works as before.
With this we can get rid of the ugly linkConfWithTask mechanism. Our
API will become lighter and easier to understand. If a user wants to
resolve a configuration with project dependencies in her own task, she
can do:
dependencies {
compile "junit:junit:4.4", project(':api")
}
createTask('printDependencies', dependsOn: dependencies.compile) {
println(dependencies.compile.resolve())
}
It also solves a problem Adam has pointed out a while ago, that right
now all the artifacts of the dependent project are build. With the
above approach only the artifacts belonging to the configuration are
build.
- Hans
--
Hans Dockter
Gradle Project lead
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email