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',
'project-bravo': [
url: 'git@github.com:brightsparklabs/project-bravo.git',
options: ['--depth', '3', '--branch', 'develop']
],
]
}Where:
repositoriesDiris the directory to checkout the git repositories to.repositoriesis a map ofrepository nametorepository location.- Entries in
repositoriestake the repository URL, or a map including:url: the repository URLoptions: clone options, e.g.['--depth', '1', '--branch', 'stable']
The tasks added by the plugin can be found by running:
./gradlew tasksThe 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.