gradle / gradle-native

The home of Gradle's support for natively compiled languages
https://blog.gradle.org/introducing-the-new-cpp-plugins
Apache License 2.0
92 stars 8 forks source link

Gradle output is broken when used through Xcode 10 and above #946

Closed lacasseio closed 5 years ago

lacasseio commented 5 years ago

It could also be an issue arising from how we detect rich vs plain console.

Expected Behavior

The new behavior breaks the output scraping used during the tests.

Current Behavior

The Gradle output when using Xcode 10 looks like the following. Notice how some lines are split in half compared to a normal output.

Starting a Gradle Daemon (subsequent builds will be faster)

> Task :compileDebugSwift
 FAILED

/Users/daniel/gradle/gradle-trees/alpha/build/tmp/test files/XcodeErrorIntegrationTest/fails_to_build_when...is_broken/awifq/src/main/swift/broken.swift:1:1: error: use of unresolved identifier 'broken'

broken!
^~~~~~

FAILURE: 
Build failed with an exception.

* What went wrong:

Execution failed for task ':compileDebugSwift'.

> A build operation failed.
      Swift compiler failed while compiling swift file(s).

  See the complete log at: file:///Users/daniel/gradle/gradle-trees/alpha/build/tmp/test%20files/XcodeErrorIntegrationTest/fails_to_build_when...is_broken/awifq/build/tmp/compileDebugSwift/output.txt

   > 
Swift compiler failed while compiling swift file(s).

* Try:

Run with 
--stacktrace
 option to get the stack trace. Run with --info
 or 
--debug
 option to get more log output. Run with 
--scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
1 actionable task: 1 executed

The following tests are affected by this new behavior: Screen Shot 2018-11-28 at 10.02.32 AM.png

Context

Steps to Reproduce (for bugs)

Your Environment

big-guy commented 5 years ago

@lacasseio does this only happen sometimes or fail in multiple ways? When I run just XcodeErrorIntegrationTest locally, I don't see a failure from the IDE or on the command-line.

I'm on macOS 10.14.1 and I have:

$ xcodebuild -version
Xcode 10.1
Build version 10B61

However, I do see failures with XcodeMultipleSwiftProjectIntegrationTest and XcodeSingleSwiftProjectIntegrationTest, but they don't look like problems with the console output. produces reasonable message when xcode uses outdated xcode configuration does look console output related.

lacasseio commented 5 years ago

There’s another error that seems to be happening with some Swift tests related to asserting what intermediate files are being generated. It fails on a .swiftdeps~moduleonly file and could figure out. I was going to look a bit more into it today. The scrambled output seems to be repeatable, but I didn't try to see if it was flaky in any way.

I'm on macOS 10.13.6 and I have:

xcodebuild -version
Xcode 10.1
Build version 10B61
lacasseio commented 5 years ago

Now this seems to be flaky on my machine...

lacasseio commented 5 years ago

Since I'm still getting the error despite the change, I did another research and found this: https://gitlab.kitware.com/cmake/cmake/issues/18088 and the fix seems to be https://gitlab.kitware.com/cmake/cmake/merge_requests/2151/diffs at the moment. If we confirm this fix, we will need to split out an issue to support the new Xcode build system.

lacasseio commented 5 years ago

I can confirm it works. I will roll the previous change in favor of this new one instead and open another issue to priotize a better Xcode 10 support. At the same time, we may loose support for previous IDE version support but given everything is delegated to Gradle, I would say it's alright. //cc @big-guy What do you think?

lacasseio commented 5 years ago

Issue https://github.com/gradle/gradle-native/issues/956 was opened to properly move away from the legacy build system.