Gradle plugin to simplify managing multiple git repositories.
./gradlew build
# publish
./gradlew publishPlugins
// file: build.gradle
plugins {
id 'com.brightsparklabs.gradle.multi-git'
}
Use the following configuration block to configure the plugin:
// file: build.gradle
multiGitPluginConfig {
repositoriesDir = new File('subprojects')
repositories = [
'project-alpha': ['git@github.com:brightsparklabs/project-alpha.git', 4],
'project-bravo': 'git@github.com:brightsparklabs/project-bravo.git',
]
}
Where:
repositoriesDir
is the directory to checkout the git repositories to.repositories
is a map ofrepository name
torepository location
. Each repository will be checked out to therepositoriesDir
. If you want a shallow clone of your repository, map a list torepository name
containingrepository location
and the depth level.
The tasks added by the plugin can be found by running:
./gradlew tasks
The following methods are added to the project:
gitExec(repoName, gitArgs)
- Executes a git command on the specified git repository.
- Arguments:
repoName
: Name of the git repository to execute the command on.gitArgs
: Array of arguments to append to the 'git' command.- E.g.
['checkout', 'master']
- E.g.
gitExecAllRepos(gitArgs)
- Executes a git command on all git repositories.
- Arguments:
gitArgs
: Array of arguments to append to the 'git' command.- E.g.
['checkout', 'master']
- E.g.
Refer to the LICENSE
file for details.