Skip to content

[BEAM-4584] Migrate build_rules.gradle to buildSrc plugin#5683

Merged
kennknowles merged 1 commit intoapache:masterfrom
kennknowles:buildSrc
Jun 21, 2018
Merged

[BEAM-4584] Migrate build_rules.gradle to buildSrc plugin#5683
kennknowles merged 1 commit intoapache:masterfrom
kennknowles:buildSrc

Conversation

@kennknowles
Copy link
Member

@kennknowles kennknowles commented Jun 19, 2018

This is a direct move of the code from build_rules.gradle to a binary plugin in the buildSrc directory. A proxy build_rules.gradle is left in place, but should be migrated away from on a module-by-module basis.

I deliberately did not do anything to refactor the logic. Making this a plugin might make it more natural to do refactors later. Personally, I think each "nature" is probably a natural choice for a separate plugin, and it should be very straightforward to do that.

NOTE: All I did was ensure that ./gradlew build ran. There are some failures (prior description underestimated them due to masking). I didn't yet run the publishing bits that are hidden behind conditionals. Those likely still need some project. added, etc. Just putting this up for early review.


Follow this checklist to help us incorporate your contribution quickly and easily:

  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

R: @lukecwik
CC: @yifanzou @alanmyrvold @pabloem

@kennknowles kennknowles requested a review from lukecwik June 19, 2018 03:37
@kennknowles
Copy link
Member Author

Yea, I'm pretty certain I've introduced an infinite loop w/ allocation here.

@kennknowles
Copy link
Member Author

Hmm, well Jenkins passed without any odd behavior though I had some unhappiness locally with heap space. It could be that I have simply never run a full ./gradlew build locally before, but always/only build modules I am editing.

Java - 34 minutes
Python - 18 minutes
Go - 3 minutes

@kennknowles
Copy link
Member Author

OK I did some more fixups until publishToMavenLocal ran. I had to provide -Ppublishing which seems redundant with just naming the task. If I set -PisRelease then I get gpg errors but I think that is just me.

@lukecwik
Copy link
Member

The publishToMavenLocal task only exists if the publishing plugin is applied and it is disabled by default because enabling publishing/signing prevents us from running parallel builds.

The gpg errors could because you have not setup a gpg agent correctly. Likely that your signing key requires a password and you haven't setup something to intercept the password request and prompt you for it or don't have a signing key.

@kennknowles
Copy link
Member Author

Can the task exist but not be part of :build? It still messes up parallel builds?

@kennknowles
Copy link
Member Author

(anyhow yea I probably don't have gpg set up right)

@lukecwik
Copy link
Member

To my knowledge, it did still break it for some reason. Not enough investigation was done though and disabling parallel was the easiest. With gradle 4.8, they added support for signing so upgrading may allow us to get rid of the broken plugins.

@kennknowles
Copy link
Member Author

run java postcommit

@kennknowles
Copy link
Member Author

run dataflow postrelease

@kennknowles
Copy link
Member Author

So, we have a job we can trigger "Run Gradle Publish" but that seems like something that should not exist. I guess if it is just a snapshot that will be wiped out it could be useful for PRs just like this one. But anyhow PTAL as I think this is pretty much alright and it is better to get it moving along as soon as possible after 2.5.0

Copy link
Member

@lukecwik lukecwik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tabs are really annoying


// Plugins for configuring _this build_ of the module
plugins {
id 'groovy'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please use spaces instead of tabs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Gross. Done. Noting that this is all autoformat.


/** This plugin adds methods to configure a module with Beam's defaults, called "natures".
*
* The natures available:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add <p> tag

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move comments to the line before instead of after

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


// A class defining the set of configurable properties accepted by containerImageName.
class ContainerImageNameConfiguration {
String root = null // Sets the docker repository root (optional).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: null is the default already so we don't need to explicitly set it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it explicit, but also this is a non-diff from build_rules.gradle.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its just noise since groovy/java developers know what the default values for unassigned variables are.

/** ***********************************************************************************************/
// Apply common properties/repositories and tasks to all projects.

project.group = 'org.apache.beam'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow-up PR consider using

project.with {
  group = 'org.apache.beam'
  ...
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged

@lukecwik
Copy link
Member

Only thing that is worth investigating is the

Could not determine the dependencies of task ':release:runJavaExamplesValidationTask'.
Task with path ':beam-runners-google-cloud-dataflow-java:runQuickstartJavaDataflow' not found in project ':release'.

in the Jenkins: ./gradlew :release:runJavaExamplesValidationTask

@kennknowles
Copy link
Member Author

It looks like runQuickstartJavaDataflow is a generated name. It also looks like it would be just as easy to pass it in to the place it is generated. It is indeed generated (log lines show) but not available as a task. So there's something wonky about that particular method.

@kennknowles
Copy link
Member Author

Good catch. The issue was that I had changed

task foo(type: X, ...)

into

project.task(name: 'foo', type: X, ...)

The whole first arg was a map that was being toStringed (or in some cases a map having a closure wrapping it being toStringed). The correct syntax is:

project.task('foo', type: X, ...)

And that is why we like types. I wonder if we can make this Kotlin without too much pain.

@kennknowles kennknowles force-pushed the buildSrc branch 3 times, most recently from bef6791 to 59ef085 Compare June 20, 2018 19:33
@kennknowles
Copy link
Member Author

Checkstyle failure in Flink runner. I'll update and merge the new build_rules changes in.

@kennknowles
Copy link
Member Author

Precommit failure due to Dataflow quota. I have tested publishToMavenLocal and a full build locally. I'll see about the DF issue.

@kennknowles
Copy link
Member Author

run java precommit

@kennknowles
Copy link
Member Author

We've established that Dataflow is having an outage for the apache-beam-testing project. We will sickbay those tests and move to fix.

@kennknowles kennknowles merged commit 16748b1 into apache:master Jun 21, 2018
@alanmyrvold
Copy link
Member

alanmyrvold commented Jun 22, 2018

I now see errors like:
A problem occurred evaluating project ':beam-sdks-go-container'.

No such property: rootProject for class: org.apache.beam.gradle.BeamModulePlugin

A problem occurred evaluating project ':beam-sdks-python-container'.

No such property: rootProject for class: org.apache.beam.gradle.BeamModulePlugin

This is causing failures in https://builds.apache.org/job/beam_PostCommit_Go_GradleBuild and https://builds.apache.org/job/beam_PostCommit_Py_ValCont

@kennknowles Can you take a look?

https://issues.apache.org/jira/browse/BEAM-4623

@kennknowles kennknowles deleted the buildSrc branch July 3, 2018 21:56
@lukecwik
Copy link
Member

lukecwik commented Jul 23, 2018

This broke the updateOfflineRepository task with Caused by: org.gradle.internal.typeconversion.UnsupportedNotationException: Cannot convert the provided notation to a File or URI: []. More details on https://issues.apache.org/jira/browse/BEAM-4846

charlesccychen pushed a commit to charlesccychen/beam that referenced this pull request Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants