ysb33r / ivypot-gradle-plugin

Ivypot is a Gradle plugin to help managing a local off-line repository for builds in restricted environments
Apache License 2.0
45 stars 14 forks source link

Simplify multi-project support #25

Closed ysb33r closed 7 years ago

ysb33r commented 7 years ago

This example by @galmor shows the pain that one has to go through in 0.5 to load in dependencies from every subproject.

In the end of day the following code needs to be rolled-up into the plugin

ext {
  thisProject = project.name
  addConfigurationsFor = { Project forProj ->
    if( forProj != project ) {
      forProj.configurations.each { Configuration c->
        logger.info "${forProj.name}: ${c.name}"
        String configName = "${forProj.name}_${c.name}_deps"
        project.configurations.create configName
        project.syncRemoteRepositories.configurations configName
        c.dependencies.each { Dependency d ->
          if (!(d instanceof ProjectDependency)) {
            logger.info "Found ${d} in ${forProj.name}. Adding to ${configName}"
            project.dependencies.add configName, d
          }
        }
      }
      forProj.childProjects.each { String projName, Project p ->
        addConfigurationsFor(p)
      }
    }
  }
}

addConfigurationsFor(rootProject)
ysb33r commented 7 years ago

Released as part of 0.6