Skip to content

Conversation

rpalcolea
Copy link
Contributor

Context

Toolchain support for scala is/was missing

This takes inspiration from the groovy PR. Adds support for ScalaPlugin and ScalaDoc task

Some sample outputs:

Toolchain detection

Found the following JVMs:
    AdoptOpenJDK 11.0.10  - /Users/rperezalcolea/.gradle/jdks/jdk-11.0.10+9/Contents/Home
    Amazon Corretto JDK 1.8.0_265  - /Users/rperezalcolea/.sdkman/candidates/java/8.0.265-amzn
    Zulu JDK 1.8.0_265  - /Users/rperezalcolea/.sdkman/candidates/java/8.0.265-zulu
    Zulu JDK 1.8.0_242  - /Users/rperezalcolea/.sdkman/candidates/java/8.0.242-zulu
    Zulu JDK 1.8.0_252  - /Users/rperezalcolea/.sdkman/candidates/java/8.0.252-zulu
    Zulu JDK 11.0.7  - /Users/rperezalcolea/.sdkman/candidates/java/11.0.7-zulu
    Zulu JDK 11.0.11  - /Users/rperezalcolea/.sdkman/candidates/java/11.0.11-zulu
    Zulu JDK 11.0.10  - /Users/rperezalcolea/.sdkman/candidates/java/11.0.10-zulu
    Zulu JDK 11.0.6  - /Users/rperezalcolea/.sdkman/candidates/java/11.0.6-zulu
    Zulu JDK 13.0.2  - /Users/rperezalcolea/.sdkman/candidates/java/13.0.2-zulu
    Zulu JDK 14.0.1  - /Users/rperezalcolea/.sdkman/candidates/java/14.0.1-zulu
    Zulu JDK 16  - /Users/rperezalcolea/.sdkman/candidates/java/16.0.0-zulu
    Zulu JDK 16.0.1  - /Users/rperezalcolea/.sdkman/candidates/java/16.0.1-zulu
> Task :compileJava NO-SOURCE

Running compilation:

  501 14173 14115   0  6:34PM ??         0:01.20 /Users/rperezalcolea/.sdkman/candidates/java/16.0.0-zulu/bin/java @/Users/rperezalcolea/Projects/github/gradle/gradle/intTestHomeDir/distributions-jvm/.tmp/gradle-worker-classpath17437237116099633258txt -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Worker Daemon 1'

scaladoc

Successfully started process 'Gradle Worker Daemon 1'
Started Gradle worker daemon (0.381 secs) with fork options DaemonForkOptions{executable=/Users/rperezalcolea/.sdkman/candidates/java/16.0.0-zulu/bin/java, minHeapSize=null, maxHeapSize=null, jvmArgs=[], keepAliveMode=SESSION}.

Some screenshots
Screen Shot 2021-06-20 at 6 59 48 PM

Screen Shot 2021-06-20 at 6 34 28 PM
Screen Shot 2021-06-20 at 6 36 16 PM

opportunities

AbstractScalaCompile has methods such as configureCompatibilityOptions which could be re-used for groovy compilation. Currently the method exists in the language-java project. Maybe this should be moved to language-jvm so it is re-usable. But that might mean moving some internal compilation classes.

Happy to address this in this PR on in another

Contributor Checklist

  • Review Contribution Guidelines
  • Make sure that all commits are signed off to indicate that you agree to the terms of Developer Certificate of Origin.
  • Make sure all contributed code can be distributed under the terms of the Apache License 2.0, e.g. the code was written by yourself or the original code is licensed under a license compatible to Apache License 2.0.
  • Check "Allow edit from maintainers" option in pull request so that additional changes can be pushed by Gradle team
  • Provide integration tests (under <subproject>/src/integTest) to verify changes from a user perspective
  • Provide unit tests (under <subproject>/src/test) to verify logic
  • Update User Guide, DSL Reference, and Javadoc for public-facing changes
  • Ensure that tests pass sanity check: ./gradlew sanityCheck
  • Ensure that tests pass locally: ./gradlew <changed-subproject>:quickTest

Gradle Core Team Checklist

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation
  • Recognize contributor in release notes

@rpalcolea
Copy link
Contributor Author

heads up @ljacomet :)

@rpalcolea rpalcolea force-pushed the scala/toolchains-support branch 3 times, most recently from 746e8b8 to a32d71f Compare June 21, 2021 17:24
Copy link
Member

@ljacomet ljacomet left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this contribution.

Looks good to me, let's see what CI says 😉

The only missing bit is documentation. Could you take care of it as well?

Signed-off-by: Roberto Perez Alcolea <[email protected]>
@rpalcolea rpalcolea force-pushed the scala/toolchains-support branch from a32d71f to 5bdd1d6 Compare July 2, 2021 16:40
@rpalcolea
Copy link
Contributor Author

Hi @ljacomet ,

Fixed missing @Incubating annotation which broke the API. Also added changes to XMLs and adocs

@rpalcolea rpalcolea requested a review from ljacomet July 2, 2021 16:49
@rpalcolea
Copy link
Contributor Author

Hi @ljacomet

It seems CI is failing with https://ge.gradle.org/s/zpm6tl2lhkeyg

  | org.gradle.execution.taskpath.ProjectFinderByTaskPath$ProjectLookupException: Project 'functional' not found in root project 'gradle'. |  
-- | -- | --

doesn't seem related to my changes

Either way, I updated the branch with latest on master

@gradle gradle deleted a comment from ljacomet Jul 5, 2021
Copy link
Member

@ljacomet ljacomet left a comment

Choose a reason for hiding this comment

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

Let's get this merged! 🎉

@gradle gradle deleted a comment from ljacomet Jul 5, 2021
@gradle gradle deleted a comment from ljacomet Jul 5, 2021
@gradle gradle deleted a comment from ljacomet Jul 5, 2021
@gradle gradle deleted a comment from blindpirate Jul 5, 2021
@blindpirate
Copy link
Collaborator

@rpalcolea @ljacomet Note there is an error in asciidoc check:

# Valid links are:
# * Inside the same file: <<(#)section-name(,text)>>
# * To a different file: <<other-file(.adoc)#section-name,text>> - Note that the # and section are mandatory, otherwise the link is invalid in the single page output
#
# The checker does not handle implicit section names, so they must be explicit and declared as: [[section-name]]
ERROR: scala_plugin.adoc:63 Missing section reference for link to toolchains.adoc
    The `ScalaCompile` and `ScalaDoc` tasks can also leverage the <<toolchains.adoc#,Java toolchain support>>.

@gradle gradle deleted a comment from ljacomet Jul 6, 2021
@rpalcolea
Copy link
Contributor Author

Hi @blindpirate, good call

I think 026f765 should take care of it

VFS> Statistics since last build:
VFS> > Stat: Executed stat() x 0. getUnixMode() x 0
VFS> > FileHasher: Hashed 0 files (0 bytes)
VFS> > DirectorySnapshotter: Snapshot 0 directory hierarchies (visited 0 directories, 0 files and 0 failed files)
Received 35 file system events since last build while watching 1 hierarchies
Virtual file system retained information about 31052 files, 2023 directories and 84 missing files since last build
Type-safe project accessors is an incubating feature.

BUILD SUCCESSFUL in 11s
259 actionable tasks: 21 executed, 238 up-to-date
Received 33 file system events during the current build while watching 1 hierarchies
Virtual file system retains information about 31052 files, 2023 directories and 84 missing files until next build
VFS> Statistics during current build:
VFS> > Stat: Executed stat() x 1,076. getUnixMode() x 0
VFS> > FileHasher: Hashed 0 files (0 bytes)
VFS> > DirectorySnapshotter: Snapshot 2 directory hierarchies (visited 13 directories, 52 files and 0 failed files)

bot-gradle added a commit that referenced this pull request Jul 6, 2021
Add toolchain support for Scala plugin
@bot-gradle
Copy link
Collaborator

Pre-tested commit build cancelled.

@gradle gradle deleted a comment from bot-gradle Jul 6, 2021
@gradle gradle deleted a comment from bot-gradle Jul 6, 2021
@blindpirate
Copy link
Collaborator

Thanks @rpalcolea

There's some issues in CI, I'll take care of it.

@bot-gradle test and merge

@gradle gradle deleted a comment from blindpirate Jul 6, 2021
@gradle gradle deleted a comment from bot-gradle Jul 6, 2021
@gradle gradle deleted a comment from bot-gradle Jul 6, 2021
@blindpirate
Copy link
Collaborator

@bot-gradle test and merge

@bot-gradle
Copy link
Collaborator

Your PR is queued. See the queue page for details.

@bot-gradle
Copy link
Collaborator

Pre-tested commit build cancelled.

@bot-gradle
Copy link
Collaborator

OK, I've already triggered a build for you.

@bot-gradle bot-gradle merged commit 194a47b into gradle:master Jul 6, 2021
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