Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Gradle to 5.5 version #4567

Merged
merged 21 commits into from
Aug 12, 2019
Merged

Conversation

chetanmeh
Copy link
Member

Updates Gradle to 5.5 version and also updates Gradle Scoverage plugin to 3.1.5

Description

For enabling running and building on JDK 11 (#4217) we need to move to Gradle 5.x version which officially supports JDK 11. In doing so we would need to update the Gradle Scoverage plugin to 3.1.5 as existing version was not compatible

Benefits

  1. Enables building on JDK 11
  2. Gradle 5.x has better support for Maven publishing. We would now be needing that to publish the standalone jar

Scoverage Version Impact

Newer soverage plugin has a different model of working and does not produce a jar of instrumented classes which impacts our logic for coverage collection for code running within container (#3685). To make it work we now copy the instrumented classes within container and remove existing packaged jars from the lib

Related issue and scope

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@codecov-io
Copy link

codecov-io commented Aug 6, 2019

Codecov Report

Merging #4567 into master will decrease coverage by 5.75%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4567      +/-   ##
==========================================
- Coverage   84.52%   78.76%   -5.76%     
==========================================
  Files         183      183              
  Lines        8252     8252              
  Branches      558      558              
==========================================
- Hits         6975     6500     -475     
- Misses       1277     1752     +475
Impacted Files Coverage Δ
...core/database/cosmosdb/RxObservableImplicits.scala 0% <0%> (-100%) ⬇️
...ore/database/cosmosdb/cache/CacheInvalidator.scala 0% <0%> (-100%) ⬇️
...core/database/cosmosdb/CosmosDBArtifactStore.scala 0% <0%> (-95.89%) ⬇️
...tabase/cosmosdb/cache/CacheInvalidatorConfig.scala 0% <0%> (-94.74%) ⬇️
...sk/core/database/cosmosdb/CosmosDBViewMapper.scala 0% <0%> (-92.6%) ⬇️
...e/database/cosmosdb/cache/ChangeFeedListener.scala 0% <0%> (-86.67%) ⬇️
...e/database/cosmosdb/cache/KafkaEventProducer.scala 0% <0%> (-76.48%) ⬇️
...whisk/core/database/cosmosdb/CosmosDBSupport.scala 0% <0%> (-74.08%) ⬇️
...a/org/apache/openwhisk/common/ExecutorCloser.scala 0% <0%> (-66.67%) ⬇️
...abase/cosmosdb/CosmosDBArtifactStoreProvider.scala 4% <0%> (-52%) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce45d54...f663b0e. Read the comment docs.

* Task to generate coverage xml report. Requires the
* tests to be executed prior to its invocation
*/
task reportCoverage(type: ScoverageReport) {
Copy link
Member Author

@chetanmeh chetanmeh Aug 6, 2019

Choose a reason for hiding this comment

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

The new version now creates task like report<Test Task Name>Scoverage as entry task. This task in turn adapts the compile task to use the instrumented classes. This works fine for conventional cases where tests are part of same module.

However in our case as we have a separate test module and further to capture coverage of code running within container (as part of integration test) we copy the coverage metrics files manually we cannot use default tasks.

Hence the report task duplicate bit of logic from actual task and clones the config from generated reportTestCoverage task

@@ -250,8 +255,33 @@ gradle.projectsEvaluated {
showStandardStreams = true
exceptionFormat = 'full'
}
maxHeapSize = "1024m" //Gradle 5.5 defaults to 512MB which is low
Copy link
Member Author

Choose a reason for hiding this comment

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

With Gradle 5.0 it now defaults to 512M of heap. Due to this OOM was seen in test runs on Travis (which has 7 GB memory). Hence specifying the size explicitly to 1024 MB now

All workers, including compilers and test executors, now start with 512MB of heap. The previous default was 1/4th of physical memory. Large projects may have to increase this setting on the relevant tasks, e.g. JavaCompile or Test.

@@ -17,6 +17,6 @@

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
Copy link
Member Author

Choose a reason for hiding this comment

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

Switching to 5.5.1 and also to all mode so as to enable code assists in IDE

@@ -43,13 +43,6 @@ gradle.ext.scalafmt = [
config: new File(rootProject.projectDir, '.scalafmt.conf')
]

gradle.ext.scoverage = [
Copy link
Member Author

Choose a reason for hiding this comment

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

Now scoverage plugin internally adapts the classpath with required dependencies. So no need to explicitly add them

* Aggregates the scoverage xml reports from various modules into a
* single report
*/
task aggregateCoverage(type: JavaExec, dependsOn: reportCoverage) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This task was never used as we rely on codecov to perform actual aggregation

@chetanmeh chetanmeh marked this pull request as ready for review August 6, 2019 08:57
@chetanmeh
Copy link
Member Author

This PR is now ready for review

@chetanmeh
Copy link
Member Author

chetanmeh commented Aug 9, 2019

@dgrove-oss @rabbah Can you review this PR. Once merged we can then work on publishing Maven artifacts from core repo (#4579).

Not sure if any PG run is needed as it would impact the build process

@chetanmeh chetanmeh requested a review from dgrove-oss August 9, 2019 04:28
@@ -30,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
Copy link
Member

Choose a reason for hiding this comment

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

is this too low?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

If a different heap size is appropriate, we can change it. It's fine for us to diverge from the upstream gradlew[.bat] as needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

For now build seems to work fine. If we see any issue then we can change. I believe Gradle wrapper internally forks a new jvm process so it needs bare minimum memory for its work

@rabbah
Copy link
Member

rabbah commented Aug 9, 2019

No issues on my side using this patch.

Copy link
Member

@dgrove-oss dgrove-oss left a comment

Choose a reason for hiding this comment

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

Looks fine to me. Only comment was on heapsize argument in default JVM args in gradlew; feel free to deviate from upstream version to set a default appropriate to this project if you want.

@chetanmeh chetanmeh merged commit d9de97d into apache:master Aug 12, 2019
@chetanmeh chetanmeh deleted the gradle-update-5x branch August 12, 2019 16:05
BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
Updates Gradle to 5.5 to enable work with JDK 11. Along with that it also upgrades the scoverage plugin as the older version does not work with Gradle 5.

Due to various changes in how scoverage works we needed to adapt the way how instrumented classes are included in test runs
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.

4 participants