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

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

                Author: ASF GitHub Bot
            Created on: 20/Jun/18 18:36
            Start Date: 20/Jun/18 18:36
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #5683: 
[BEAM-4584] Migrate build_rules.gradle to buildSrc plugin
URL: https://github.com/apache/beam/pull/5683#discussion_r196899581
 
 

 ##########
 File path: 
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
 ##########
 @@ -0,0 +1,1297 @@
+/*
+ * 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.
+ */
+
+package org.apache.beam.gradle
+
+import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.quality.Checkstyle
+import org.gradle.api.plugins.quality.FindBugs
+import org.gradle.api.publish.maven.MavenPublication
+import org.gradle.api.tasks.Exec
+import org.gradle.api.tasks.JavaExec
+import org.gradle.api.tasks.bundling.Jar
+import org.gradle.api.tasks.compile.JavaCompile
+import org.gradle.api.tasks.testing.Test
+import org.gradle.testing.jacoco.tasks.JacocoReport
+
+/** This plugin adds methods to configure a module with Beam's defaults, 
called "natures".
+ *
+ * The natures available:
+ *
+ * <ul>
+ *   <li>Java   - Configures plugins commonly found in Java projects
+ *   <li>Go     - Configures plugins commonly found in Go projects
+ *   <li>Docker - Configures plugins commonly used to build Docker containers
+ *   <li>Grpc   - Configures plugins commonly used to generate source from 
protos
+ *   <li>Avro   - Configures plugins commonly used to generate source from 
Avro specifications
+ * </ul>
+ *
+ * <p>For example, see applyJavaNature.
+ */
+class BeamModulePlugin implements Plugin<Project> {
+
+       // A class defining the set of configurable properties accepted by 
applyJavaNature
+       class JavaNatureConfiguration {
+               double javaVersion = 1.8
+               // Controls the JDK source language and target compatibility
+               boolean enableFindbugs = true
+               // Controls whether the findbugs plugin is enabled and 
configured
+               boolean enableErrorProne = true
+               // Controls whether the errorprone plugin is enabled and 
configured
+               boolean failOnWarning = false
+               // Controls whether compiler warnings are treated as errors
+
+               //TODO(https://issues.apache.org/jira/browse/BEAM-4394): Should 
this default to true?
+               boolean enableSpotless = false // Controls whether spotless 
plugin enforces autoformat
+               boolean testShadowJar = false  // Controls whether tests are 
run with shadowJar
+
+               // The shadowJar / shadowTestJar tasks execute the following 
closure to configure themselves.
+               // Users can compose their closure with the default closure via:
+               // DEFAULT_SHADOW_CLOSURE << {
+               //    dependencies {
+               //      include(...)
+               //    }
+               //    relocate(...)
+               // }
+               Closure shadowClosure;
+       }
+
+       // A class defining the set of configurable properties for 
createJavaExamplesArchetypeValidationTask
+       class JavaExamplesArchetypeValidationConfiguration {
+               // Type [Quickstart, MobileGaming] for the postrelease 
validation is required.
+               // Used both for the test name run${type}Java${runner}
+               // and also for the script name, 
${type}-java-${runner}.toLowerCase().
+               String type
+
+               // runner [Direct, Dataflow, Spark, Flink, FlinkLocal, Apex]
+               String runner
+
+               // gcpProject sets the gcpProject argument when executing 
examples.
+               String gcpProject
+
+               // gcsBucket sets the gcsProject argument when executing 
examples.
+               String gcsBucket
+
+               // bqDataset sets the BigQuery Dataset when executing 
mobile-gaming examples
+               String bqDataset
+
+               // pubsubTopic sets topics when executing streaming pipelines
+               String pubsubTopic
+       }
+
+       // Reads and contains all necessary performance test parameters
+       class JavaPerformanceTestConfiguration {
+
+               /* Optional properties (set only if needed in your case): */
+
+               // Path to PerfKitBenchmarker application (pkb.py).
+               // It is only required when running Performance Tests with 
PerfKitBenchmarker
+               String pkbLocation = System.getProperty('pkbLocation')
+
+               // Data Processing Backend's log level.
+               String logLevel = System.getProperty('logLevel', 'INFO')
+
+               // Path to gradle binary.
+               String gradleBinary = System.getProperty('gradleBinary', 
'./gradlew')
+
+               // If benchmark is official or not.
+               // Official benchmark results are meant to be displayed on 
PerfKitExplorer dashboards.
+               String isOfficial = System.getProperty('official', 'false')
+
+               // Specifies names of benchmarks to be run by 
PerfKitBenchmarker.
+               String benchmarks = System.getProperty('benchmarks', 
'beam_integration_benchmark')
+
+               // If beam is not "prebuilt" then PerfKitBenchmarker runs the 
build task before running the tests.
+               String beamPrebuilt = System.getProperty('beamPrebuilt', 'true')
+
+               // Beam's sdk to be used by PerfKitBenchmarker.
+               String beamSdk = System.getProperty('beamSdk', 'java')
+
+               // Timeout (in seconds) after which PerfKitBenchmarker will 
stop executing the benchmark (and will fail).
+               String timeout = System.getProperty('itTimeout', '1200')
+
+               // Path to kubernetes configuration file.
+               String kubeconfig = System.getProperty('kubeconfig', 
System.getProperty('user.home') + '/.kube/config')
+
+               // Path to kubernetes executable.
+               String kubectl = System.getProperty('kubectl', 'kubectl')
+
+               // Paths to files with kubernetes infrastructure to setup 
before the test runs.
+               // PerfKitBenchmarker will have trouble reading 'null' path. It 
expects empty string if no scripts are expected.
+               String kubernetesScripts = 
System.getProperty('kubernetesScripts', '')
+
+               // Path to file with 'dynamic' and 'static' pipeline options.
+               // that will be appended by PerfKitBenchmarker to the test 
running command.
+               // PerfKitBenchmarker will have trouble reading 'null' path. It 
expects empty string if no config file is expected.
+               String optionsConfigFile = System.getProperty('beamITOptions', 
'')
+
+               // Any additional properties to be appended to benchmark 
execution command.
+               String extraProperties = 
System.getProperty('beamExtraProperties', '')
+
+               // Runner which will be used for running the tests. Possible 
values: dataflow/direct.
+               // PerfKitBenchmarker will have trouble reading 'null' value. 
It expects empty string if no config file is expected.
+               String runner = System.getProperty('integrationTestRunner', '')
+
+               // Filesystem which will be used for running the tests. 
Possible values: hdfs.
+               // if not specified runner's local filesystem will be used.
+               String filesystem = System.getProperty('filesystem')
+
+               /* Always required properties: */
+
+               // Pipeline options to be used by the tested pipeline.
+               String integrationTestPipelineOptions = 
System.getProperty('integrationTestPipelineOptions')
+
+               // Fully qualified name of the test to be run, eg:
+               // 'org.apache.beam.sdks.java.io.jdbc.JdbcIOIT'.
+               String integrationTest = System.getProperty('integrationTest')
+
+               // Relative path to module where the test is, eg. 
'sdks/java/io/jdbc.
+               String itModule = System.getProperty('itModule')
+       }
+
+       // A class defining the set of configurable properties accepted by 
containerImageName.
+       class ContainerImageNameConfiguration {
+               String root = null // Sets the docker repository root 
(optional).
 
 Review comment:
   Its just noise since groovy/java developers know what the default values for 
unassigned variables are.

----------------------------------------------------------------
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: 113867)
    Time Spent: 3h 50m  (was: 3h 40m)

> Use a "binary plugin" in buildSrc instead of "script plugin" in 
> build_rules.gradle
> ----------------------------------------------------------------------------------
>
>                 Key: BEAM-4584
>                 URL: https://issues.apache.org/jira/browse/BEAM-4584
>             Project: Beam
>          Issue Type: Improvement
>          Components: build-system
>            Reporter: Kenneth Knowles
>            Assignee: Kenneth Knowles
>            Priority: Major
>          Time Spent: 3h 50m
>  Remaining Estimate: 0h
>
> This is a best practice recommended by the Gradle documentation. It is 
> expected to speed things up, and makes dependency management and testing 
> slightly better.
> In terms of code, it is not much different, though some things that were 
> previously implicit in the top-level groovy DSL will need to be made explicit 
> in the plugin definition.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to