Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share bom inclusion closure to reduce code duplication #2307

Merged
merged 2 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions gradle/bomUtils.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright © 2022 Apple Inc. and the ServiceTalk project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

ext.bomInclusionClosure = {it -> !it.name.endsWith("-bom") && !it.name.endsWith("-dependencies") &&
!it.name.contains("examples") && !it.name.equals("grpc") && !it.name.equals("http")}
10 changes: 3 additions & 7 deletions servicetalk-bom/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2018-2019 Apple Inc. and the ServiceTalk project authors
* Copyright © 2018-2019, 2022 Apple Inc. and the ServiceTalk project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,15 +16,11 @@

apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-core"
apply plugin: "java-platform"
apply from: "../gradle/bomUtils.gradle"

description="ServiceTalk BOM that includes all modules"

// IMPORTANT: Ensure that the module list is consistent with `servicetalk-dependencies`
rootProject.subprojects.findAll { !it.name.endsWith("-bom") &&
!it.name.endsWith("-dependencies") &&
!it.name.contains("examples") &&
!it.name.equals("grpc") &&
!it.name.equals("http") }.each {
rootProject.subprojects.findAll { it -> bomInclusionClosure(it) }.each {
dependencies.constraints.add("api", it)
}

Expand Down
10 changes: 3 additions & 7 deletions servicetalk-dependencies/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2018-2019 Apple Inc. and the ServiceTalk project authors
* Copyright © 2018-2019, 2022 Apple Inc. and the ServiceTalk project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,21 +16,17 @@

apply plugin: "io.servicetalk.servicetalk-gradle-plugin-internal-core"
apply plugin: "java-platform"
apply from: "../gradle/bomUtils.gradle"

description = "ServiceTalk BOM that includes all modules and direct dependencies"

javaPlatform {
allowDependencies()
}

// IMPORTANT: Ensure that the module list is consistent with `servicetalk-bom`
// Include modules directly rather than by defining servicetalk bom as
// a platform to work around [MNG-6772](https://issues.apache.org/jira/browse/MNG-6772).
rootProject.subprojects.findAll { !it.name.endsWith("-bom") &&
!it.name.endsWith("-dependencies") &&
!it.name.contains("examples") &&
!it.name.equals("grpc") &&
!it.name.equals("http") }.each {
rootProject.subprojects.findAll { it -> bomInclusionClosure(it) }.each {
dependencies.constraints.add("api", it)
}

Expand Down