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

XCode beta 14 build produces an unexpected warning #11477

Open
1 task done
pavel-ship-it opened this issue Jul 22, 2022 · 7 comments
Open
1 task done

XCode beta 14 build produces an unexpected warning #11477

pavel-ship-it opened this issue Jul 22, 2022 · 7 comments
Milestone

Comments

@pavel-ship-it
Copy link

Report

Cocoapods produces the warning in XCode beta 14

warning build: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.

What did you do?

I created a default iOS project in XCode Version 13.4.1 (13F100)
In Podfile I import pod "RealmSwift" and run pod install
I build the project in XCode Version 14.0 beta 3 (14A5270f)

What did you expect to happen?

No warnings.

What happened instead?

I see the warning.
The project's build is still working as expected.

CocoaPods Environment

Stack

   CocoaPods : 1.11.3
        Ruby : ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
    RubyGems : 3.3.11
        Host : macOS 12.4 (21F79)
       Xcode : 13.4.1 (13F100)
         Git : git version 2.32.1 (Apple Git-133)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.1.2/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /opt/homebrew/Cellar/cocoapods/1.11.3/libexec/bin/pod

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0
@VilemKurz
Copy link

For those who encounter this on their own shell script build phases, manually added in a podfile (e.g. in a post_install hook), add
phase.always_out_of_date = "1"
into your phase definition. It will make the script phase to run on each build (as was before - no change here) but it will explicitly let Xcode know that it is your intention. Thus the warning goes away.

@anton-plebanovich
Copy link

Workaround for Realm but any other pod may be used:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'Realm'
      create_symlink_phase = target.shell_script_build_phases.find { |x| x.name == 'Create Symlinks to Header Folders' }
      create_symlink_phase.always_out_of_date = "1"
    end
  end
end

@rogerluan
Copy link

rogerluan commented Nov 2, 2022

I posted a more scalable solution than the one above, here: #11444 (comment) (handles CocoaPods Run Scripts that are added to your main xcodeproj, and there's also no hardcoded references to target names)

This should really be fixed within CocoaPods itself, though. Our post_install/post_integrate solutions are temporary workarounds

@dnkoutso dnkoutso modified the milestones: 1.12.0, 1.12.1 Feb 27, 2023
@grigorye
Copy link

Just to mention it, I am in a situation where I can not employ Podfile hooks (using cocoapods-generate for standalone modules), but have control over the podspecs employed (actually, injecting some (SwiftLint-like) script phases into every development pod). As a workaround, I figured out that $(MODULE_CACHE_DIR)/Session.modulevalidation is updated on every build (under Xcode 14.2), at least for Obj-C and Swift targets. So, it should be possible to add that file as an input for the build phase in question (to always trigger the run) in combination with some "never generated" file as an output (to suppress the warning).

s.script_phases += [
  {
    name: 'My phase',
    input_files: [
      '$(MODULE_CACHE_DIR)/Session.modulevalidation'
    ],
    output_files: [
      '$(DERIVED_SOURCES_DIR)/MyPhaseOutput-never-generated.stamp'
    ],
    script: 'xxx'
  }
]

@rogerluan
Copy link

rogerluan commented Mar 29, 2023

Oh gosh ☝️ 🤯
Nice investigation work haha

@dnkoutso dnkoutso modified the milestones: 1.12.1, 1.13.0 Apr 18, 2023
@dnkoutso dnkoutso modified the milestones: 1.13.0, 1.14.0 Sep 22, 2023
@MuhammadRafeh
Copy link

The solution did not worked for me.

@Upsite-cor
Copy link

Did not work for me either. I'm having this issue with react native

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

8 participants