openbakery / gradle-xcodePlugin

gradle plugin for building Xcode Projects for iOS, watchOS, macOS or tvOS
Apache License 2.0
457 stars 127 forks source link

Better messaging when Xcode project can't be found #380

Closed phatblat closed 6 years ago

phatblat commented 6 years ago

When applied to a project that doesn't contain an .xcodeproj file the current behaviour doesn't offer much help as to why the build failed.

Before

Task :xcodebuildConfig FAILED Caching disabled for task ':xcodebuildConfig': Caching has not been enabled for the task Task ':xcodebuildConfig' is not up-to-date because: Task has not declared any outputs.

:xcodebuildConfig (Thread[Task worker for ':',5,main]) completed. Took 0.001 secs.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':xcodebuildConfig'.

    0

Only if the --stacktrace option is added to the gradle command will the reason for the failure be shown, but in the middle of a couple screens worth of stack trace.

:xcodebuildConfig FAILED ... Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at org.openbakery.XcodeBuildPluginExtension.getProjectFile(XcodeBuildPluginExtension.groovy:457) at org.openbakery.XcodeBuildPluginExtension_Decorated.getProjectFile(Unknown Source)

After

:xcodebuildConfig FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':xcodebuildConfig'.

    java.io.FileNotFoundException: No Xcode project files were found in /Users/phatblat/dev/gradle/test-xcodePlugin

phatblat commented 6 years ago

I like that coveralls rule 👌🏻 I'll add a test to cover this case.