Mono-repo build with Gradle

$ gradle run> Task :other-module:run
com project: Hello World
$ gradle run> Task :other-module:run
com project: Hello World
> Task :my-project:module-b:run
oss project: Hello World
apply from: ‘oss-settings.gradledef fixPath
fixPath = { project ->
String relativeProjectPath = project.projectDir.path.replace(settingsDir.path, “”)
project.projectDir = new File(relativeProjectPath.replace(“/my-project/”, ‘’))
project.children.each fixPath
}
rootProject.children.each fixPath
dependencies {
compile project(‘:my-project:module-a’)
}
apply from: ‘sub-tree/oss-settings.gradledef fixPath
fixPath = { project ->
String relativeProjectPath = project.projectDir.path.replace(settingsDir.path, “”)
project.projectDir = new File(relativeProjectPath.replace(“/my-project/”, ‘sub-tree/’))
project.children.each fixPath
}
rootProject.children.each fixPath
include ‘:my-project’
project(‘:my-project’).projectDir = “$rootDir/sub-tree” as File
include ‘:other-module’
$ gradle run> Task :my-project:run
oss project: Hello World
$ gradle run> Task :other-module:run
com project: Hello World
> Task :my-project:module-b:run
oss project: Hello World
apply plugin: ‘groovy’
apply plugin: ‘java-gradle-plugin’
gradlePlugin {
plugins {
ossPlugin {
id = “oss-plugin”
implementationClass = “OSSPlugin”
}
}
}
dependencies {
runtime subprojects
}
include ‘:oss-buildSrc’
project(‘:oss-buildSrc’).projectDir = “$rootDir/../sub-tree/buildSrc” as File
> Task :my-project:module-b:customOSSTask
OSSPlugin is applied
> Task :other-module:customComTask
ComPlugin is applied
> Task :other-module:customOSSTask
OSSPlugin is applied
> Task :my-project:module-b:customOSSTask
OSSPlugin is applied

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store