Skip to content

Commit

Permalink
BIGTOP-4061: Improve support for Maven parallel build parameters (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiangC authored Jan 31, 2024
1 parent fc93b76 commit d250ead
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ __On all systems, Building Apache Bigtop requires certain set of tools__

* __Enabling Parallel Build for packages(BIGTOP-4044)__

Apache Bigtop defaults to non-parallel builds. Use -PbuildThreads=2C to activate Maven's parallel build feature and expedite compilation for compatible components.

Append a digit and 'C' to -PbuildThreads= to set the CPU core count for concurrent builds.
Apache Bigtop defaults to non-parallel builds. Use -PbuildThreads with a number or a combination of numbers followed by 'C', such as '-PbuildThreads=2' or '-PbuildThreads=2C', to specify the number of CPU cores for Maven's parallel build feature, which can speed up the compilation process for compatible components.

Consult the bigtop.bom file to verify component compatibility with parallel builds; those marked with maven_parallel_build = true support this option.

Expand Down
14 changes: 9 additions & 5 deletions packages.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def generatePatch(String threadCount, String path) {
--- a/.mvn/maven.config
+++ b/.mvn/maven.config
@@ -0,0 +1 @@
+-T${threadCount}
+-T ${threadCount}
\\ No newline at end of file
""".stripIndent()

Expand All @@ -97,6 +97,10 @@ def generatePatch(String threadCount, String path) {
}
}

def isValidMavenBuildThreads(threads) {
return threads.matches("\\d+C") || threads.matches("\\d+")
}

/**
* To avoid breaking the compat with existing packages let's use the old style names
*/
Expand Down Expand Up @@ -453,8 +457,8 @@ def genTasks = { target ->
into "$DEB_BLD_DIR/debian"
}
if (MAVEN_BUILD_THREADS && ENABLE_MAVEN_PARALLEL_BUILD) {
if (!MAVEN_BUILD_THREADS.matches("\\d+C")) {
throw new GradleException("Invalid MAVEN_BUILD_THREADS parameter. It must be a combination of numbers and 'C', such as '2C'.")
if (!isValidMavenBuildThreads(MAVEN_BUILD_THREADS)) {
throw new GradleException("Invalid MAVEN_BUILD_THREADS parameter. It must be either a number or a combination of numbers followed by 'C', such as '2' or '2C'.")
}
generatePatch(MAVEN_BUILD_THREADS, "$DEB_BLD_DIR/debian")
}
Expand Down Expand Up @@ -642,8 +646,8 @@ def genTasks = { target ->
into "$PKG_BUILD_DIR/rpm/SOURCES"
}
if (MAVEN_BUILD_THREADS && ENABLE_MAVEN_PARALLEL_BUILD) {
if (!MAVEN_BUILD_THREADS.matches("\\d+C")) {
throw new GradleException("Invalid MAVEN_BUILD_THREADS parameter. It must be a combination of numbers and 'C', such as '2C'.")
if (!isValidMavenBuildThreads(MAVEN_BUILD_THREADS)) {
throw new GradleException("Invalid MAVEN_BUILD_THREADS parameter. It must be either a number or a combination of numbers followed by 'C', such as '2' or '2C'.")
}
generatePatch(MAVEN_BUILD_THREADS, "$PKG_BUILD_DIR/rpm/SOURCES")
}
Expand Down

0 comments on commit d250ead

Please sign in to comment.