[
https://issues.apache.org/jira/browse/BEAM-6178?focusedWorklogId=174219&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-174219
]
ASF GitHub Bot logged work on BEAM-6178:
----------------------------------------
Author: ASF GitHub Bot
Created on: 11/Dec/18 18:59
Start Date: 11/Dec/18 18:59
Worklog Time Spent: 10m
Work Description: swegner commented on a change in pull request #7197:
[BEAM-6178] Adding beam-sdks-java-bom, adding exportJavadoc flag for
applyJavaNature
URL: https://github.com/apache/beam/pull/7197#discussion_r240747854
##########
File path: sdks/java/bom/build.gradle
##########
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+apply plugin: org.apache.beam.gradle.BeamModulePlugin
+
+apply plugin: "java"
+apply plugin: "maven-publish"
+
+def isRelease(Project project) {
+ return project.hasProperty('isRelease')
+}
+
+ext {
+ mavenJavaDir = "$project.buildDir/publications/mavenJava"
+ mavenJavaBomOutputFile = file(mavenJavaDir + "/pom-default.xml")
+}
+
+for (String projName : rootProject.ext.allProjectNames) {
+ if (!projName.equals(':' + project.name)) {
+ evaluationDependsOn(projName)
+ }
+}
+
+// Copy our pom.xml to the location where a generated POM would go
+task copyPom() {
+ doLast {
+ def moduleNames = new ArrayList<>()
+ for (String projName : rootProject.ext.allProjectNames) {
+ def subproject = project(projName)
+ if (subproject.ext.properties.containsKey('includeInJavaBom') &&
+ subproject.ext.properties.includeInJavaBom) {
+ moduleNames.add(subproject.name)
+ }
+ }
+
+ new File(mavenJavaDir).mkdirs()
+ copy {
+ from 'pom.xml.template'
+ into mavenJavaDir
+ rename 'pom.xml.template', 'pom-default.xml'
+ expand(version: project.version, modules: moduleNames)
+ }
+ }
+}
+
+assemble.dependsOn copyPom
+
+// We want to use our own pom.xml instead of the generated one, so we disable
+// the pom.xml generation and have the publish tasks depend on `copyPom`
instead.
+tasks.whenTaskAdded { task ->
+ if (task.name == 'generatePomFileForMavenJavaPublication') {
+ task.enabled = false
+ } else if (task.name == 'publishMavenJavaPublicationToMavenLocal') {
+ task.dependsOn copyPom
+ } else if (task.name == 'publishMavenJavaPublicationToMavenRepository') {
+ task.dependsOn copyPom
+ }
+}
+
+jar.enabled = false
+
+// Remove the default jar archive which is added by the 'java' plugin.
+configurations.archives.artifacts.with { archives ->
+ def artifacts = []
+ archives.each {
+ if (it.file =~ 'jar') {
+ // We can't just call `archives.remove(it)` here because it triggers
+ // a `ConcurrentModificationException`, so we add matching artifacts
+ // to another list, then remove those elements outside of this iteration.
+ artifacts.add(it)
+ }
+ }
+ artifacts.each {
+ archives.remove(it)
+ }
+}
+
+artifacts {
+ archives(mavenJavaBomOutputFile) {
+ builtBy copyPom
+ }
+}
+
+afterEvaluate {
+ // We can't use the `publishing` section from applyJavaNature because
+ // we don't want all the Java artifacts, and we want to use our own pom.xml
+ // instead of the generated one.
+ publishing {
+ publications {
+ mavenJava(MavenPublication) {
Review comment:
Sounds good; please follow-up in a subsequent PR.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 174219)
Time Spent: 4.5h (was: 4h 20m)
> Create BOM for Beam
> -------------------
>
> Key: BEAM-6178
> URL: https://issues.apache.org/jira/browse/BEAM-6178
> Project: Beam
> Issue Type: Improvement
> Components: build-system
> Affects Versions: 2.10.0
> Reporter: Garrett Jones
> Assignee: Garrett Jones
> Priority: Critical
> Time Spent: 4.5h
> Remaining Estimate: 0h
>
> Add a module to Beam which generates a BOM for Beam modules.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)