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

Implement colored output support for Tooling API and fix GRADLE-2687 (disable output to System.out/System.err when using Tooling API) #340

Merged
merged 3 commits into from Oct 14, 2014

Conversation

lhotari
Copy link
Contributor

@lhotari lhotari commented Oct 9, 2014

This PR includes 3 different changes:

  • fix for GRADLE-2687 (I haven't tested the fix, so it might not be a complete fix.)
  • force ANSI output in cli with -Dorg.gradle.ansi=true system property (disables any console detection)
  • adds "setColorOutput(boolean colorOutput)" to LongRunningOperation interface in Tooling API and add implementation for that

This PR is incomplete and lacks tests. Please provide guidance about how to continue. You are free to take over anything in this PR.
I'd just like to help getting these features to a stable Gradle version ASAP, since we'd like to use these features in the Grails 3 Gradle integration (uses Tooling API).
I'm a total newbie to Gradle source code, so my changes might be the wrong way to solve the problem.
However I tested manually that I got colored output from the Tooling API after these changes.

Regards,

Lari from the Grails team

@lhotari
Copy link
Contributor Author

lhotari commented Oct 9, 2014

I'll rebase the commits on top of master. They are currently off REL-2.1 . I've tagged this as https://github.com/lhotari/gradle/commits/ansi_support_REL_2.1 and will soon push the rebased commits.

@lhotari
Copy link
Contributor Author

lhotari commented Oct 9, 2014

The PR is now rebased on top of master.

@breskeby
Copy link
Contributor

Hey Lari,
thanks for the pull-request. We'll have a look at this soon. Would you mind to sign the CLA (http://www.gradleware.com/contributor-agreement/) in the meantime?

@lhotari
Copy link
Contributor Author

lhotari commented Oct 10, 2014

@breskeby I signed the CLA yesterday.

@radimk radimk merged commit 062e284 into gradle:master Oct 14, 2014
@radimk
Copy link
Contributor

radimk commented Oct 14, 2014

I reverted your changed to GradleConnector for the moment and integrated the rest. Adam will probably comment and request some additional changes (test coverage). Thanks for the contribution. This is going to be part of 2.3 (sorry I didn't merge into 2.2).

@bigdaz
Copy link
Member

bigdaz commented Oct 14, 2014

Adam may also want to revert the use of a system property for Gradle configuration. He's not overly fond of that sort of thing - is that strictly required, or would there be another way to achieve the same thing?

@radimk
Copy link
Contributor

radimk commented Oct 14, 2014

I believe it is possible to revert that part and the goal is still achieved.

On Tue, Oct 14, 2014 at 10:34 PM, Daz DeBoer notifications@github.com
wrote:

Adam may also want to revert the use of a system property for Gradle
configuration. He's not overly fond of that sort of thing - is that
strictly required, or would there be another way to achieve the same thing?


Reply to this email directly or view it on GitHub
#340 (comment).

@radimk
Copy link
Contributor

radimk commented Nov 20, 2014

I forgot to update this (not sure why GitHub did not do it automatically). It is merged it into master that will eventually become 2.3 though I did some changes there.

The main thing for me - disabling stdout/stderr - is still not completed. IIRC there are few logging entries sent to the default streams before the daemon redirects the output to passed streams. Also it seems that the addition to GradleConnector wasn't really used.

Would you mind to try our nightly builds and we can discuss next steps then?

@lhotari
Copy link
Contributor Author

lhotari commented Nov 20, 2014

Thanks for the update @radimk . I'll try the nightly build tomorrow.

@ldaley
Copy link
Member

ldaley commented Nov 21, 2014

@lhotari in all of those cases, those system properties are internal feature toggles and not expected to be used by Gradle users.

@lhotari
Copy link
Contributor Author

lhotari commented Nov 21, 2014

@radimk @alkemist I made a new PR #355 for replacing the system property usage with a command line option.

@lhotari
Copy link
Contributor Author

lhotari commented Nov 21, 2014

@radimk We are now using a 2.3 nightly snapshot in Grails 3 development (grails-core master branch).

This is the output that gets printed when a connector is created and connected:

16:30:03.745 [Connection worker] DEBUG o.g.t.i.provider.DefaultConnection - Tooling API provider 2.3-20141120230022+0000 created.
        16:30:07.519 [Connection worker] DEBUG o.g.t.i.provider.ProviderConnection - Configuring logging to level: INFO
Tooling API is using target Gradle version: 2.3-20141120230022+0000.

Starting Gradle daemon

Starting daemon process: workingDir = /Users/lari/.gradle/daemon/2.3-20141120230022+0000, daemonArgs: [/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=US, -Duser.language=en, -Duser.variant, -cp, /Users/lari/.gradle/wrapper/dists/gradle-2.3-20141120230022+0000-bin/czwou0fc7wx9p9rgavlsvmm07/gradle-2.3-20141120230022+0000/lib/gradle-launcher-2.3-20141120230022+0000.jar, org.gradle.launcher.daemon.bootstrap.GradleDaemon, 2.3-20141120230022+0000, /Users/lari/.gradle/daemon, 10800000, f37ba3bc-ab8b-487e-94a8-01ed844cab81, -XX:MaxPermSize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Xmx1024m, -Dfile.encoding=UTF-8, -Duser.country=US, -Duser.language=en, -Duser.variant]

Starting process 'Gradle build daemon'. Working directory: /Users/lari/.gradle/daemon/2.3-20141120230022+0000 Command: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /Users/lari/.gradle/wrapper/dists/gradle-2.3-20141120230022+0000-bin/czwou0fc7wx9p9rgavlsvmm07/gradle-2.3-20141120230022+0000/lib/gradle-launcher-2.3-20141120230022+0000.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 2.3-20141120230022+0000 /Users/lari/.gradle/daemon 10800000 f37ba3bc-ab8b-487e-94a8-01ed844cab81 -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant

Successfully started process 'Gradle build daemon'

An attempt to start the daemon took 0.603 secs.

Connected to daemon DaemonInfo{pid=35411, address=[fa03b9f4-a11e-46a8-b93e-7efa3c519756 port:38462, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=f37ba3bc-ab8b-487e-94a8-01ed844cab81,javaHome=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home,daemonRegistryDir=/Users/lari/.gradle/daemon,pid=35411,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=a5d2df1c-1eed-4d84-ac57-94cb3948ab43.1, currentDir=/Users/lari/workspace-grails3/NewSimple}.

Received result DaemonCommandResult[type=Success, value=org.gradle.tooling.internal.provider.BuildActionResult@7c41a150] from daemon DaemonInfo{pid=35411, address=[fa03b9f4-a11e-46a8-b93e-7efa3c519756 port:38462, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=f37ba3bc-ab8b-487e-94a8-01ed844cab81,javaHome=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home,daemonRegistryDir=/Users/lari/.gradle/daemon,pid=35411,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}.

output when running compileGroovy task

Tooling API is using target Gradle version: 2.3-20141120230022+0000.

Connected to daemon DaemonInfo{pid=35411, address=[fa03b9f4-a11e-46a8-b93e-7efa3c519756 port:38462, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], idle=true, context=DefaultDaemonContext[uid=f37ba3bc-ab8b-487e-94a8-01ed844cab81,javaHome=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home,daemonRegistryDir=/Users/lari/.gradle/daemon,pid=35411,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=cce56e8a-eddd-44d6-add2-3ca20a36c29b.1, currentDir=/Users/lari/workspace-grails3/NewSimple}.

The PluginContainer.apply(Class) method has been deprecated and is scheduled to be removed in Gradle 3.0. Please use the PluginAware.apply(Map) or PluginAware.apply(Closure) method instead.
:compileJava UP-TO-DATE
:compileGroovy

BUILD SUCCESSFUL

Total time: 3.657 secs
Received result DaemonCommandResult[type=Success, value=org.gradle.tooling.internal.provider.BuildActionResult@71b59bf6] from daemon DaemonInfo{pid=35411, address=[fa03b9f4-a11e-46a8-b93e-7efa3c519756 port:38462, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], idle=true, context=DefaultDaemonContext[uid=f37ba3bc-ab8b-487e-94a8-01ed844cab81,javaHome=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home,daemonRegistryDir=/Users/lari/.gradle/daemon,pid=35411,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}.

There are the extra connector logging statements.

What are the next steps?

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.

None yet

5 participants