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

"PRODUCT_NAME was misdefined #7

Closed
hrabkin opened this issue Nov 2, 2020 · 17 comments
Closed

"PRODUCT_NAME was misdefined #7

hrabkin opened this issue Nov 2, 2020 · 17 comments

Comments

@hrabkin
Copy link

hrabkin commented Nov 2, 2020

"PRODUCT_NAME was misdefined: MySDK. Please, provide :product_name option"

Error

@bielikb
Copy link
Owner

bielikb commented Nov 2, 2020

Hi @GRyabkin,
could you please provide your project, including the fastlane setup, e.g. in form of a zip?

Thanks

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

@bielikb I don't think it's required. The error I receive happens inside fastlane action. I duplicated my issue in their repository

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

I have set Product name in build settings, here's my fastlane config:

  desc "Export xcframework"
  lane :export_xcframework do
    create_xcframework(
      workspace: 'MySDK.xcworkspace',
      scheme: 'MySDK',
      include_bitcode: false,
      destinations: ['iOS'],
      product_name: "MySDK",
      xcframework_output_directory: 'artifacts/MySDK'
    )
  end

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

Ohh, this action builds my xcframework in a folder where the action invoked ignoring xcframework_output_directory. That's bad

@bielikb
Copy link
Owner

bielikb commented Nov 2, 2020

Im owner of both repos, thanks for bringing your issue up. To proceed further I might need to know a little more about your setup.
You can try out the running example right on this repo.
Here's the lane that creates the xcframework and exports it in the dedicated export folder

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

@bielikb sorry, I can't send you my setup, but I can give you answers to questions if you have them. It's cool that the action works for some basic case

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

I have my Bundle name set as $(PRODUCT_NAME) maybe hardcoding this param helps but it's strange that it's not taken into account.

@bielikb
Copy link
Owner

bielikb commented Nov 2, 2020

Is it hard to reproduce your setup in form of a dummy project?

In terms of details, let's step back.

  1. What version of the fastlane plugin are you currently using?
  2. What version of Xcode IDE are you using?
  3. Is the target name that builds your dynamic framework the same as the "product name"?
  4. Have you tried to not include the product_name parameter in your lane?
  5. Does the fastlane plugin run fine from the terminal?
  6. Could you share the dump of the logs/any additional useful info?

Additionally you're welcome to adjust the functionality of the open sourced plugin, in that case, please follow the contribution guideline

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

@bielikb yes, this is a production setup which has many third-party-dependencies, also I have signed NDA.

  1. 2.160.0
  2. Version 12.0 (12A7209)
  3. Yes
  4. Yes (the same error)
  5. I run it from the terminal always
  6. The end looks like this (names are removed):
[20:35:17]: --------------------------------
[20:35:17]: --- Step: create_xcframework ---
[20:35:17]: --------------------------------
[20:35:17]: Overwriting SKIP_INSTALL and BUILD_LIBRARY_FOR_DISTRIBUTION options
[20:35:17]: For a more detailed xcodebuild log open /Users/mypc/Library/Logs/fastlane/xcbuild/2020-11-02/70589/xcodebuild.log
[20:35:17]: $ set -o pipefail && xcodebuild -workspace "MySDK.xcworkspace" -scheme "MySDK" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -destination "generic/platform=iOS" -archivePath "0_MySDK.xcarchive" archive | tee '/Users/mypc/Library/Logs/fastlane/xcbuild/2020-11-02/70589/xcodebuild.log' | xcpretty --color --simple
...
[20:40:10]: ▸ Archive Succeeded
[20:40:10]: For a more detailed xcodebuild log open /Users/mypc/Library/Logs/fastlane/xcbuild/2020-11-02/70589/xcodebuild.log
[20:40:10]: $ set -o pipefail && xcodebuild -workspace "MySDK.xcworkspace" -scheme "MySDK" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES -destination "generic/platform=iOS Simulator" -archivePath "1_MySDK.xcarchive" archive | tee '/Users/mypc/Library/Logs/fastlane/xcbuild/2020-11-02/70589/xcodebuild.log' | xcpretty --color --simple
....
[20:45:21]: ▸ Archive Succeeded
+------------------------------+------------------------+
|                     Lane Context                      |
+------------------------------+------------------------+
| DEFAULT_PLATFORM             | ios                    |
| PLATFORM_NAME                | ios                    |
| LANE_NAME                    | ios export_xcframework |
| XCODEBUILD_DERIVED_DATA_PATH |                        |
| XCODEBUILD_ARCHIVE           | 1_MySDK.xcarchive |
+------------------------------+------------------------+
[20:45:21]: ▸ PRODUCT_NAME was misdefined: `MySDK`. Please, provide :product_name option

+------+-------------------------------------+-------------+
|                     fastlane summary                     |
+------+-------------------------------------+-------------+
| Step | Action                              | Time (in s) |
+------+-------------------------------------+-------------+
| 1    | Verifying fastlane version          | 0           |
| 2    | default_platform                    | 0           |
| 3    | update_fastlane                     | 0           |
| 4    | Switch to ios preconditions lane    | 0           |
| 5    | cocoapods                           | 22          |
| 6    | (cd ../../custom && ./custom_script.sh) | 8           |
| 💥   | create_xcframework                  | 603         |
+------+-------------------------------------+-------------+

[20:45:21]: fastlane finished with errors

[!] ▸ PRODUCT_NAME was misdefined: `MySDK`. Please, provide :product_name option

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

@bielikb is it something with a default value for config item on line 242 in the file?

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

@bielikb also looks like -archivePath for xcodebuild command doesn't have xcframework_output_directory appended

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

@bielikb the error was generated by line 28 in the following file

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

@bielikb I would like to contribute. Do you happen to share some guides on how to test the action without deploying to the Fastlane repository?

@hrabkin
Copy link
Author

hrabkin commented Nov 2, 2020

@bielikb could it be just fixed by returning a value of @params[:product_name] after line 9 of the file

@hrabkin
Copy link
Author

hrabkin commented Nov 3, 2020

@bielikb today I had more time to test out your sample and compare the build settings of your sample and my framework. Well, I have figured out what was the cause of the problem. Installation directory of the framework I build was set to /Applications but in your sample $(LOCAL_LIBRARY_DIR)/Frameworks. This path used by xcodebuild create_xcframework to search for resulting binaries for combining.

I am happy I have resolved the issue, I should start to investigate your sample before digging into your code. Sorry, I did it in the late evening.

@hrabkin hrabkin closed this as completed Nov 3, 2020
@hrabkin
Copy link
Author

hrabkin commented Nov 3, 2020

Also, your script has a small issue: it places xcarchives at building time in the root project directory instead of output directory, and when the script succeeds copies them but if it fails they are left in the root directory.

@bielikb
Copy link
Owner

bielikb commented Nov 4, 2020

@GRyabkin Grand! Happy to hear your issue got resolved.
Ill cover the issue around xcarchives in one of the following releases ;)

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

No branches or pull requests

2 participants