[ 
https://issues.apache.org/jira/browse/BEAM-6178?focusedWorklogId=173066&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-173066
 ]

ASF GitHub Bot logged work on BEAM-6178:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Dec/18 21:24
            Start Date: 07/Dec/18 21:24
    Worklog Time Spent: 10m 
      Work Description: garrettjonesgoogle 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_r239950345
 
 

 ##########
 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') {
 
 Review comment:
   When I was setting up the BOM for gax-java, I ran into several problems when 
trying to generate a BOM using Gradle's pom generation functionality instead of 
using plain xml.
   
   - The `packaging` setting was ignored. It defaults to `xml`, but should be 
`pom` for a module that only contains a `.pom` file. However, it's possible to 
use a messy hack for this (make your archive be a file with a `.pom` 
extension). 
   - It's not possible to have classifiers in the dependency declarations. 
However, this doesn't seem to be relevant for Beam.
   - The dependencies have to be explicitly listed in the build.gradle and 
can't be dynamically generated from other data (e.g. 
`rootProject.subprojects`). This wasn't a big deal for gax-java (only 3 
modules), but would be a pretty big potential source of error for Beam (modules 
could be easily omitted accidentally). 
   
   It seems to me that duplicating relatively unchanging content (e.g. 
copyright date, path to the license, e-mailing lists) is much more desirable to 
duplicating content that changes more quickly (the list of modules).
   
   

----------------------------------------------------------------
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: 173066)
    Time Spent: 3h 10m  (was: 3h)

> 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: 3h 10m
>  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)

Reply via email to