openbakery / gradle-xcodePlugin

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

PackageTask xcodebuild parameters set #456

Closed jussisalmi closed 6 months ago

jussisalmi commented 2 years ago

PackageTask xcodebuild parameters set

renep commented 2 years ago

Can you please describe what you problem so that I understand what this change should solve?

jussisalmi commented 2 years ago

Of course. At least when a project has Swift enabled Xcodebuild.loadBuildSettings() gets called in the Package task. The call works fine as long as xcodebuild command finds project, workspace or package from the current working directory.

Currently, both parameters.scheme and parameters.workspace are null when the loadBuildSettings method gets executed. It happens, because Package task gives a newly created instance of the XcodebuildParameters to Xcodebuild constructor. Therefore, when project, workspace or package isn't located in the current working directory xcodebuild gives the error below.

xcodebuild: error: The directory does not contain an Xcode project, workspace or package.

Package task should give the parameters defined for the project to have the correct scheme and workspace for the loadBuildSettings method.

jussisalmi commented 6 months ago

Hi! Would you be able to consider merging this PR. It's quite obvious bug since the build params don't get propagated down the call path.

renep commented 6 months ago

Sorry but I have reverted your pull request in the latest release. The problem was that the Unit Test caused a NullPointerException and did not pass. Maybe this is related to my setup, but I have not investigated in detail. I use Java11 now for building the plugin, because I have not yet found time to migrate to newer Java and to a newer gradle. I hope I find time to address this soon. So please send be this pull request again.