openbakery / gradle-xcodePlugin

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

Cannot create IPA #423

Closed renep closed 3 years ago

renep commented 4 years ago

Thank you renep :)

Now the container "*.xcarchive" includes the Swiftsupport folder but when the plugin is trying to build the package the execution fails.

14:48:19.950 [DEBUG] [org.openbakery.CommandRunner] Run command: '/usr/libexec/PlistBuddy __MYWORKSPACE__/build/dev/build/package/Payload/__MYAPP__.app/Info.plist -c Print :CFBundleExecutable' 14:48:19.950 [DEBUG] [org.openbakery.CommandRunner] with working directory: . (__MYWORKSPACE__/.) 14:48:19.960 [DEBUG] [org.openbakery.CommandRunner] Run command: 'xcodebuild clean -showBuildSettings' 14:48:19.960 [DEBUG] [org.openbakery.CommandRunner] with working directory: __MYWORKSPACE__/build/dev (__MYWORKSPACE__/build/dev) 14:48:20.822 [DEBUG] [org.openbakery.CommandRunner] Exit Code: 66 .... 14:48:20.882 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Command failed to run (exit code 66): 'xcodebuild clean -showBuildSettings' 14:48:20.882 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Tail of output: 14:48:20.882 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] xcodebuild: error: The directory __MYWORKSPACE__/build/dev does not contain an Xcode project, workspace or package.

I don't know why is changing my working directory.

This is the stack:

14:48:20.887 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.CommandRunner.run(CommandRunner.groovy:98) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.CommandRunner$run$2.callCurrent(Unknown Source) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.CommandRunner.runWithResult(CommandRunner.groovy:203) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.CommandRunner$runWithResult$1.callCurrent(Unknown Source) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.CommandRunner.runWithResult(CommandRunner.groovy:192) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.CommandRunner$runWithResult$0.call(Unknown Source) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.xcode.Xcodebuild.loadBuildSettings(Xcodebuild.groovy:329) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.xcode.Xcodebuild.getBuildSetting(Xcodebuild.groovy:335) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.xcode.Xcodebuild.getToolchainDirectory(Xcodebuild.groovy:302) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.tools.Lipo.getLipoCommand(Lipo.kt:59) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.tools.Lipo.getArchs(Lipo.kt:20) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.assemble.AppPackage.updateArchsForSwiftLibs(AppPackage.kt:127) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.assemble.AppPackage.addSwiftSupport(AppPackage.kt:120) 14:48:20.888 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.assemble.AppPackage$addSwiftSupport.call(Unknown Source) 14:48:20.889 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.openbakery.packaging.PackageTask.packageApplication(PackageTask.groovy:121) 14:48:20.889 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)

Surely the problem it's in my config but:

When I execute in my terminal ''xcodebuild clean -showBuildSettings -workspace MYWORKSPACE/MYAPP.xcworkspace -scheme dev" from "MYWORKSPACE/build/dev" seems to work.

https://github.com/openbakery/gradle-xcodePlugin/blob/develop/plugin/src/main/groovy/org/openbakery/packaging/PackageTask.groovy#L117 -> These empty params could be the problem? (I don't know the library deeply. I'm just trying to help)

Thank you :)

Originally posted by @jorgepf in https://github.com/openbakery/gradle-xcodePlugin/issues/416#issuecomment-546382822

renep commented 4 years ago

@jorgepf

I have created a new issue for this, because I think it has nothing to do with #416. I don't think there is an issue with the gradle xcode plugin, because I myself use it so build apps and submit it to the appstore using the latest Xcode version.

So I need more input to get a hint what is wrong. What task did you execute in which order? The archive task must be executed prior to the package task. Also you build.gradle config would be nice.

jorgepf commented 4 years ago

ok! :)

Yes, I'm executing archive before package but my project have two special configurations that I can't modify:

If you create a project with that configuration maybe you could reproduce the error.

Analysing the command xcodebuild clean -showBuildSettings if I don't add the parameters scheme and workspace only works if I execute the command in __MYWORKSPACE__ folder. If I try to execute it in _MYWORKSPACE_/build/dev it gives me the error.

So I need the scheme and the workspace parameters in the command but it's imposible with this initialisation. https://github.com/openbakery/gradle-xcodePlugin/blob/develop/plugin/src/main/groovy/org/openbakery/packaging/PackageTask.groovy#L117

Changing new XcodebuildParameters() to project.xcodebuild.getXcodebuildParameters() in https://github.com/openbakery/gradle-xcodePlugin/blob/develop/plugin/src/main/groovy/org/openbakery/packaging/PackageTask.groovy#L117 works perfect in my project because I receive the parameters in https://github.com/openbakery/gradle-xcodePlugin/blob/develop/libxcode/src/main/groovy/org/openbakery/xcode/Xcodebuild.groovy#L322, but I don't know if it's a problem in other configurations.

jorgepalacio commented 4 years ago

@renep any news?

renep commented 4 years ago

No, I have not found time to investigate this in detail. What would be nice if you could create an example project where I can reproduce this issue. This would give me a headstart and would speed up things ;-)