diff --git a/gradle/bomUtils.gradle b/gradle/bomUtils.gradle new file mode 100644 index 0000000000..5f77f74dc8 --- /dev/null +++ b/gradle/bomUtils.gradle @@ -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")} diff --git a/servicetalk-bom/build.gradle b/servicetalk-bom/build.gradle index c75d546f05..1a050bbe33 100644 --- a/servicetalk-bom/build.gradle +++ b/servicetalk-bom/build.gradle @@ -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. @@ -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) } diff --git a/servicetalk-dependencies/build.gradle b/servicetalk-dependencies/build.gradle index 7ab494d009..da919b06e3 100644 --- a/servicetalk-dependencies/build.gradle +++ b/servicetalk-dependencies/build.gradle @@ -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. @@ -16,6 +16,7 @@ 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" @@ -23,14 +24,9 @@ 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) }