xenoterracide
xenoterracide

Reputation: 16865

How can I git clone in a composite gradle project?

So I tried adding this to my "composite" project

plugins {
    id 'com.brightsparklabs.gradle.multi-git' version '1.3.0'
}
multiGitPluginConfig {
    repositoriesDir = new File( '.' )
    repositories = [
            'a': '[email protected]:xenworks/a.git',
            'b': '[email protected]:xenworks/b.git',
    ]
}

problem is in settings.gradle

rootProject.name = 'composite'
includeBuild( 'a' )
includeBuild( 'b' )

if "a" or "b" are missing any of the git commands on gradle will fail to work, so I can't do ./gradlew gitClone. This particular plugin isn't a requirement, I'm just trying to figure out how to have a "main" repo, that I can then use to clone all of it's dependencies, and yet keep those as independent libraries.

Upvotes: 0

Views: 129

Answers (1)

gildor
gildor

Reputation: 1894

You can add if condition that checks that project is available locally. Something like:

if (file("relative/dir/with/project/a").exists()) {
  includeBuild( 'a' )
}

Upvotes: 1

Related Questions