Coder Social home page Coder Social logo

bazel-ios / cocoapods-bazel Goto Github PK

View Code? Open in Web Editor NEW
109.0 12.0 21.0 7.09 MB

A Cocoapods plugin for automatically generating Bazel BUILD files

License: Apache License 2.0

Ruby 63.42% Shell 0.09% Starlark 32.61% Swift 1.49% C 0.51% Objective-C 1.87%

cocoapods-bazel's Introduction

Cocoapods::Bazel

Cocoapods::Bazel is a Cocoapods plugin that makes it easy to use Bazel instead of Xcode to build your iOS project. It automatically generates Bazel's BUILD files.

cocoapods-bazel can be setup to translate CocoaPod targets to provided Bazel rules. For example, you can use cocaopods-bazel to load framework targets using rules_ios. It's also flexible enough to allow users to use their own custom rules if needed.

⚠️ This is alpha software. We are developing this plugin in the open so you should only use it if you know what you are doing and are willing to help develop it.

Installation

Add this line to your application's Gemfile:

gem 'cocoapods-bazel'

And then execute:

bundle install

Or install it yourself as:

gem install cocoapods-bazel

Usage

This plugin will run extra steps after post_install to generate BUILD files for Bazel.

To enable the plugin, you can add something like the following section to your Podfile:

plugin 'cocoapods-bazel', {
  rules: {
    'apple_framework' => { load: '@build_bazel_rules_ios//rules:framework.bzl', rule: 'apple_framework' }.freeze,
    'ios_application' => { load: '@build_bazel_rules_ios//rules:app.bzl', rule: 'ios_application' }.freeze,
    'ios_unit_test' => { load: '@build_bazel_rules_ios//rules:test.bzl', rule: 'ios_unit_test' }.freeze
  }.freeze,
}

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Experimental Features

There are some experimental features that are opt-in and can be enabled adding the plugin to the Podfile. Some of these features intentionally break the contract with the .podspecs specification in order to create BUILD files that are easier to maintain and/or evolve using Bazel features that don't have a direct relationship with what cocoapods does. You'll find the keys to enable such features and a brief explanation/motivation for each in Bazel::Config::EXPERIMENTAL_FEATURES (lib/cocoapods/bazel/config.rb).

Note that tests for the experimental features are located under spec/integration/experimental_features and these should mostly replicate the tests under spec/integration/monorepo but with the features on. Also it's a place to create tests specific to a experimental feature that not necessarily will affect the default usage of cocoapods-bazel.

BUILD file formatting

When the BUILD.bazel files are generated you may choose to have cocoapods-bazel format the files using buildifier. This formatting is enabled by default if a buildifier executable is found using which buildifier.

You can disable buildifier formatting with buildifier: false in the options of the cocoapods-bazel plugin.

Additionally, if you'd like to use a custom buildifier executable you can provide the cocoapods-bazel plugin options with an array of arguments to execute to format files.

For example, if you have buildifier runnable target you've defined in Bazel with the name buildifier you can run this specific version with: buildifier: ['bazel', 'run', 'buildifier', '--']. (Note the -- allows bazel to forward arguments to the buildifier target).

Contributing

Bug reports and pull requests are welcome on GitHub here.

License

The gem is available as open source under the terms of the Apache License 2.0.

cocoapods-bazel's People

Contributors

acecilia avatar amberdixon avatar chenxiao0228 avatar congt avatar dependabot[bot] avatar dierksen avatar ethan-gates avatar gyfelton avatar jerrymarino avatar jszumski avatar justinseanmartin avatar luispadron avatar ndizazzo avatar ob avatar segiddins avatar sergeykhliustin avatar thiagohmcruz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocoapods-bazel's Issues

cocoapods-bazel chokes on relative imports

I took a basic react-native template for a ride, which has the following podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'ReactNativeBazel' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'ReactNativeBazelTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
  end
end

plugin 'cocoapods-bazel', {
  rules: {
    'apple_framework' => { load: '@build_bazel_rules_ios//rules:framework.bzl', rule: 'apple_framework' }.freeze,
    'ios_application' => { load: '@build_bazel_rules_ios//rules:app.bzl', rule: 'ios_application' }.freeze,
    'ios_unit_test' => { load: '@build_bazel_rules_ios//rules:test.bzl', rule: 'ios_unit_test' }.freeze
  }.freeze,
}

The podfile resides at ./ios/Podfile from the project's WORKSPACE. When I run pod install it generates the BUILD files everywhere, including the top-level node_modules/, but the labels in those are broken, e.g.:

ERROR: /Users/farcaller/src/rn-bazel/ReactNativeBazel/node_modules/react-native/Libraries/ActionSheetIOS/BUILD.bazel:3:16: //node_modules/react-native/Libraries/ActionSheetIOS:React-RCTActionSheet_objc: invalid label '//../node_modules/react-native:React-Core' in element 0 of attribute 'deps' in 'objc_library' rule: invalid package name '../node_modules/react-native': package name component contains only '.' characters

via

load("@build_bazel_rules_ios//rules:framework.bzl", "apple_framework")

apple_framework(
    name = "React-RCTActionSheet",
    srcs = glob(["*.m"]),
    module_name = "RCTActionSheet",
    platforms = {"ios": "10.0"},
    visibility = ["//visibility:public"],
    deps = ["//../node_modules/react-native:React-Core"],
)

Can't install cocoapods-bazel

Screen Shot 2022-07-27 at 4 59 02 PM

When trying to install I receive an error:

ERROR:  While executing gem ... (NoMethodError)
    undefined method `request' for nil:NilClass

    [@failed_dep.dependency, @activated.request.dependency]

[Tutorial Question]BUILD file not found in any of the following directories

run: bazel build //ios-app:ios-app

ERROR: /tutorial/ios-app/BUILD:14:16: no such package 'Pods/AgoraAudio_iOS': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it as a package.
 - /tutorial/Pods/AgoraAudio_iOS and referenced by '//ios-app:ios-app_objc'
ERROR: Analysis of target '//ios-app:ios-app' failed; build aborted: Analysis failed
INFO: Elapsed time: 22.698s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (36 packages loaded, 128 targets configured)
    currently loading: @local_config_cc//
├── README.md
├── WORKSPACE
├── appengine.BUILD
├── backend
├── bazel-bin -> /private/var/tmp/_bazel_cc/fe3145c93c0cfda8271c29935d89fd9a/execroot/__main__/bazel-out/darwin-fastbuild/bin
├── bazel-out -> /private/var/tmp/_bazel_cc/fe3145c93c0cfda8271c29935d89fd9a/execroot/__main__/bazel-out
├── bazel-testlogs -> /private/var/tmp/_bazel_cc/fe3145c93c0cfda8271c29935d89fd9a/execroot/__main__/bazel-out/darwin-fastbuild/testlogs
├── bazel-tutorial -> /private/var/tmp/_bazel_cc/fe3145c93c0cfda8271c29935d89fd9a/execroot/__main__
└── ios-app
    ├── BUILD
    ├── Pods
    │   └── AgoraAudio_iOS
    │       ├── AgoraAIDenoiseExtension.framework
    │       ├── AgoraCore.framework
    │       ├── AgoraRtcKit.framework
    │       ├── AgoraSoundTouch.framework
    │       ├── Agorafdkaac.framework
    │       └── BUILD.bazel
    └── UrlGet
        ├── AppDelegate.h
        ├── AppDelegate.m
        ├── UrlGet-Info.plist
        ├── UrlGetViewController.h
        ├── UrlGetViewController.m
        ├── UrlGetViewController.xib
        └── main.m
  • ios-app/BUILD
load("@build_bazel_rules_ios//rules:app.bzl", "ios_application")

objc_library(
    name = "UrlGetClasses",
    srcs = [
         "UrlGet/AppDelegate.m",
         "UrlGet/UrlGetViewController.m",
         "UrlGet/main.m",
    ],
    hdrs = glob(["UrlGet/*.h"]),
    data = ["UrlGet/UrlGetViewController.xib"],
)

ios_application(
    name = "ios-app",
    bundle_id = "Google.UrlGet",
    families = [
        "iphone",
        "ipad",
    ],
    minimum_os_version = "9.0",
    infoplists = [":UrlGet/UrlGet-Info.plist"],
    visibility = ["//visibility:public"],
    deps = [
        ":UrlGetClasses",
        "//Pods/AgoraAudio_iOS"
        ],
)
  • Pods/AgoraAudio_iOS/BUILD
load("@build_bazel_rules_ios//rules:framework.bzl", "apple_framework")

apple_framework(
    name = "AgoraAudio_iOS",
    platforms = {"ios": "8.0"},
    vendored_dynamic_frameworks = [
        "AgoraAIDenoiseExtension.framework",
        "AgoraCore.framework",
        "AgoraRtcKit.framework",
        "AgoraSoundTouch.framework",
        "Agorafdkaac.framework",
    ],
    visibility = ["//visibility:public"],
)

NoMethodError ruby or cocoa pods

Hello! When I used this plugin, I get this error.

NoMethodError - undefined method `sub' for <Pod::Version version=0.2.7.6>:Pod::Version
/Users/user/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/bundler/gems/cocoapods-bazel-61eda975362f/lib/cocoapods/bazel/xcconfig_resolver.rb:11:in `block in resolved_build_setting_value'

Can't build `SDWebImage/libwebp-Xcode`

Hi,
I'm considering to use this tool instead of the way that use binaries of the CocoaPods library built using xcodebuild.

However, I encountered a situation where I couldn't build the library I use.
So far, the library I have found that can't build is SDWebImage/libwebp-Xcode.

Screen Shot 2020-05-14 at 19 25 33

I'm also concerned about whether I can install the Firebase iOS SDK, although I haven't tried it yet.

It would be very helpful if you could do some investigation.
Thanks.

An compiling error

Hi,
I am glad you build such a wonderful tool!
However, I met the following error when compiling
image
I successfully built the workspace, and added the dependency into my app BUILD.bazel
image
I also added the followind codes in my WORKSPACE, but the compiling error occurs. Thanks for your help!
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "build_bazel_rules_ios",
remote = "https://github.com/bazel-ios/rules_ios.git",
branch = "master",
)

load(
"@build_bazel_rules_ios//rules:repositories.bzl",
"rules_ios_dependencies"
)

rules_ios_dependencies()

load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)

apple_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)

apple_support_dependencies()

load(
"@com_google_protobuf//:protobuf_deps.bzl",
"protobuf_deps",
)

protobuf_deps()

not found cocoapods-bazel

using Gemfile with

gem 'cocoapods-bazel'

after run 'bundle install' , there an error occurs

Could not find gem 'cocoapods-bazel' in any of the gem sources listed in your Gemfile.

Generating two frameworks for different versions of ios

For fetal pods in swift (most) it is generating two frameworks with the same configuration, but it is setting version under different name.

Exemple:

load("@build_bazel_rules_ios//rules:framework.bzl", "apple_framework")

apple_framework(
    name = "IQKeyboardManagerSwift-iOS10.3",
    srcs = glob(["IQKeyboardManagerSwift/**/*.swift"]),
    module_name = "IQKeyboardManagerSwift",
    platforms = {"ios": "8.0"},
    sdk_frameworks = [
        "CoreGraphics",
        "Foundation",
        "QuartzCore",
        "UIKit",
    ],
    swift_version = "5.3",
    visibility = ["//visibility:public"],
)

apple_framework(
    name = "IQKeyboardManagerSwift-iOS13.0",
    srcs = glob(["IQKeyboardManagerSwift/**/*.swift"]),
    module_name = "IQKeyboardManagerSwift",
    platforms = {"ios": "8.0"},
    sdk_frameworks = [
        "CoreGraphics",
        "Foundation",
        "QuartzCore",
        "UIKit",
    ],
    swift_version = "5.3",
    visibility = ["//visibility:public"],
)

If set one name occurred error on build:

conflicts with existing resources_filegroup rule

data attribute doesn't include files in bundle

if my spec contains something like:

app_spec.resources = "Resources/**/*.xcassets"

The generated BUILD has:

data = glob(["Resources/**/*.xcassets"])

however, those assets are not included in the bundle when building the app

If i switch the generated BUILD to use:

resources = glob(["Resources/**/*.xcassets"])

The asset catalogs are correctly included in the app

Why is data used and not resources?

sim_arm64 Slice missing for XCFrameworks

Hi,

I am trying to Integrate FBSDKCoreKit (https://github.com/facebook/facebook-ios-sdk) Cocoapod into Bazel Project, FBSDKCoreKit is distributed as XCFramework, and when the plugin generates BUILD file its missing sim_arm64 in supported_archs .

Here is the generated BUILD file containing only simulator Slice for FBSDKCoreKit, As it can be seen sim_arm64 is missing supported_archs.

apple_framework(
    name = "FBSDKCoreKit",
    platforms = {"ios": "10.0"},
    vendored_xcframeworks = [
        {
            "name": "FBSDKCoreKit",
            "slices": [
                {
                    "identifier": "ios-arm64_i386_x86_64-simulator",
                    "platform": "ios",
                    "platform_variant": "simulator",
                    "supported_archs": [
                        "arm64",
                        "i386",
                        "x86_64",
                    ],
                    "path": "XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_i386_x86_64-simulator/FBSDKCoreKit.framework",
                    "build_type": {
                        "linkage": "dynamic",
                        "packaging": "framework",
                    },
                },
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//Pods/FBAEMKit",
        "//Pods/FBSDKCoreKit_Basics",
    ],
)

With this BUILD file, when I run bazel build --ios_multi_cpus=sim_arm64 //target , Build fails with a missing Slice error

Pods/FBSDKCoreKit/BUILD.bazel:3:16: configurable attribute "actual" in //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframeworkdefault_vfs doesn't match this configuration. Would a default condition help?

Conditions checked:
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-tvos_simulator_arm64
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-tvos_simulator_x86_64
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-ios_simulator_i386
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-ios_simulator_x86_64
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-ios_arm64
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-ios_armv7
 //Pods/FBSDKCoreKit:FBSDKCoreKit-import-FBSDKCoreKit.xcframework-tvos_arm64

Undefined symbols for architecture x86_64

pod 'MMKV'

BUILD.bazel
load("@build_bazel_rules_ios//rules:framework.bzl", "apple_framework")

apple_framework(
    name = "MMKV",
    srcs = glob([
        "iOS/MMKV/MMKV/**/*.h",
        "iOS/MMKV/MMKV/**/*.hh",
        "iOS/MMKV/MMKV/**/*.m",
        "iOS/MMKV/MMKV/**/*.mm",
        "iOS/MMKV/MMKV/**/*.swift",
        "iOS/MMKV/MMKV/**/*.c",
        "iOS/MMKV/MMKV/**/*.cc",
        "iOS/MMKV/MMKV/**/*.cpp",
        "iOS/MMKV/MMKV/*.h",
        "iOS/MMKV/MMKV/*.mm",
        "iOS/MMKV/MMKV/*.hpp",
    ]),
    platforms = {"ios": "8.0"},
    public_headers = [
        "iOS/MMKV/MMKV/MMKV.h",
        "iOS/MMKV/MMKV/MMKVHandler.h",
    ],
    sdk_dylibs = [
        "c++",
        "z",
    ],
    sdk_frameworks = ["CoreFoundation"],
    visibility = ["//visibility:public"],
    xcconfig = {
        "CLANG_CXX_LANGUAGE_STANDARD": "gnu++17",
        "CLANG_CXX_LIBRARY": "libc++",
        "CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF": "NO",
    },
    deps = ["//Pods/MMKVCore"],
)
output
Undefined symbols for architecture x86_64:
  "_MMKVLogWithLevel(mmkv::MMKVLogLevel, char const*, char const*, int, char const*, ...)", referenced from:
      +[MMKV initialize] in libMMKV_objc.a(libMMKV.o)
      +[MMKV initializeMMKV:logLevel:] in libMMKV_objc.a(libMMKV.o)
      +[MMKV initializeMMKV:groupDir:logLevel:] in libMMKV_objc.a(libMMKV.o)
      +[MMKV mmkvWithID:cryptKey:relativePath:mode:] in libMMKV_objc.a(libMMKV.o)
      -[MMKV onMemoryWarning] in libMMKV_objc.a(libMMKV.o)
      +[MMKV didEnterBackground] in libMMKV_objc.a(libMMKV.o)
      +[MMKV didBecomeActive] in libMMKV_objc.a(libMMKV.o)
      ...
  "mmkv::ThreadLock::initialize()", referenced from:
      +[MMKV initialize] in libMMKV_objc.a(libMMKV.o)
  "mmkv::ThreadLock::lock()", referenced from:
      mmkv::ScopedLock<mmkv::ThreadLock>::lock() in libMMKV_objc.a(libMMKV.o)
  "mmkv::ThreadLock::unlock()", referenced from:
      mmkv::ScopedLock<mmkv::ThreadLock>::unlock() in libMMKV_objc.a(libMMKV.o)
  "mmkv::ThreadLock::ThreadLock()", referenced from:
      +[MMKV initialize] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::actualSize()", referenced from:
      -[MMKV actualSize] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::mmkvWithID(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, mmkv::MMKVMode, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)", referenced from:
      -[MMKV initWithMMapID:cryptKey:relativePath:mode:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::containsKey(NSString*)", referenced from:
      -[MMKV containsKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::isFileValid(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)", referenced from:
      +[MMKV isFileValid:relativePath:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::minimalInit(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
      +[MMKV initialize] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::setLogLevel(mmkv::MMKVLogLevel)", referenced from:
      +[MMKV setLogLevel:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getValueSize(NSString*, bool)", referenced from:
      -[MMKV getValueSizeForKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::enumerateKeys(void (NSString*, bool*) block_pointer)", referenced from:
      -[MMKV enumerateKeys:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::initializeMMKV(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, mmkv::MMKVLogLevel)", referenced from:
      +[MMKV initializeMMKV:logLevel:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::clearMemoryCache()", referenced from:
      -[MMKV clearMemoryCache] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::removeValueForKey(NSString*)", referenced from:
      -[MMKV removeValueForKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::setIsInBackground(bool)", referenced from:
      +[MMKV initialize] in libMMKV_objc.a(libMMKV.o)
      +[MMKV didEnterBackground] in libMMKV_objc.a(libMMKV.o)
      +[MMKV didBecomeActive] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::checkReSetCryptKey(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const*)", referenced from:
      -[MMKV checkReSetCryptKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::registerLogHandler(void (*)(mmkv::MMKVLogLevel, char const*, int, char const*, NSString*))", referenced from:
      +[MMKV registerHandler:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::writeValueToBuffer(NSString*, void*, int)", referenced from:
      -[MMKV writeValueForKey:toBuffer:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::checkContentChanged()", referenced from:
      -[MMKV checkContentChanged] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::removeValuesForKeys(NSArray*)", referenced from:
      -[MMKV removeValuesForKeys:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::registerErrorHandler(mmkv::MMKVRecoverStrategic (*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, mmkv::MMKVErrorType))", referenced from:
      +[MMKV registerHandler:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::unRegisterLogHandler()", referenced from:
      +[MMKV unregiserHandler] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::unRegisterErrorHandler()", referenced from:
      +[MMKV unregiserHandler] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::registerContentChangeHandler(void (*)(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))", referenced from:
      +[MMKV registerHandler:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::unRegisterContentChangeHandler()", referenced from:
      +[MMKV unregiserHandler] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::set(NSObject<NSCoding>*, NSString*)", referenced from:
      -[MMKV setObject:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::set(bool, NSString*)", referenced from:
      -[MMKV setBool:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::set(double, NSString*)", referenced from:
      -[MMKV setDouble:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::set(float, NSString*)", referenced from:
      -[MMKV setFloat:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::set(int, NSString*)", referenced from:
      -[MMKV setInt32:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::set(unsigned int, NSString*)", referenced from:
      -[MMKV setUInt32:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::set(long long, NSString*)", referenced from:
      -[MMKV setInt64:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::set(unsigned long long, NSString*)", referenced from:
      -[MMKV setUInt64:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::sync(mmkv::SyncFlag)", referenced from:
      -[MMKV sync] in libMMKV_objc.a(libMMKV.o)
      -[MMKV async] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::trim()", referenced from:
      -[MMKV trim] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::close()", referenced from:
      -[MMKV close] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::count()", referenced from:
      -[MMKV count] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::reKey(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      -[MMKV reKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::mmapID()", referenced from:
      -[MMKV initWithMMapID:cryptKey:relativePath:mode:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::onExit()", referenced from:
      +[MMKV onAppTerminate] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::allKeys()", referenced from:
      -[MMKV allKeys] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getBool(NSString*, bool)", referenced from:
      -[MMKV getBoolForKey:defaultValue:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::clearAll()", referenced from:
      -[MMKV clearAll] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::cryptKey()", referenced from:
      -[MMKV cryptKey] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getFloat(NSString*, float)", referenced from:
      -[MMKV getFloatForKey:defaultValue:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getInt32(NSString*, int)", referenced from:
      -[MMKV getInt32ForKey:defaultValue:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getInt64(NSString*, long long)", referenced from:
      -[MMKV getInt64ForKey:defaultValue:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getDouble(NSString*, double)", referenced from:
      -[MMKV getDoubleForKey:defaultValue:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getObject(NSString*, objc_class*)", referenced from:
      -[MMKV getObjectOfClass:forKey:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getUInt32(NSString*, unsigned int)", referenced from:
      -[MMKV getUInt32ForKey:defaultValue:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::getUInt64(NSString*, unsigned long long)", referenced from:
      -[MMKV getUInt64ForKey:defaultValue:] in libMMKV_objc.a(libMMKV.o)
  "mmkv::MMKV::totalSize()", referenced from:
      -[MMKV totalSize] in libMMKV_objc.a(libMMKV.o)
  "openssl::MD5(unsigned char const*, unsigned long, unsigned char*)", referenced from:
      md5(NSString*) in libMMKV_objc.a(libMMKV.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in child process '/usr/bin/xcrun'. 1

failed to install CocoaAsyncSocket

I'm trying to build react native with this project, and it fails with an error regarding a missing release configuration:

Error

ArgumentError - No build settings for CocoaAsyncSocket (7.6.5) (configuration :release) (known configurations [:debug])
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-1.14.2/lib/cocoapods/target/pod_target.rb:1049:in `build_settings_for_spec'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel/target.rb:158:in `pod_target_xcconfig'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel/target.rb:172:in `resolved_value_by_build_setting'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel/target.rb:106:in `product_module_name'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel/target.rb:285:in `block in to_rule_kwargs'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel/target.rb:16:in `initialize'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel/target.rb:282:in `new'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel/target.rb:282:in `to_rule_kwargs'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel.rb:64:in `block (3 levels) in post_install'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel.rb:61:in `each'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel.rb:61:in `block (2 levels) in post_install'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel.rb:27:in `each'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel.rb:27:in `block in post_install'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-1.14.2/lib/cocoapods/user_interface.rb:86:in `titled_section'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods/bazel.rb:19:in `post_install'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-bazel-0.1.5/lib/cocoapods_plugin.rb:20:in `block in <class:Installer>'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-1.14.2/lib/cocoapods/installer.rb:173:in `install!'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-1.14.2/lib/cocoapods/command/install.rb:52:in `run'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-1.14.2/lib/cocoapods/command.rb:52:in `run'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/gems/cocoapods-1.14.2/bin/pod:55:in `<top (required)>'
/Users/josephprice/dev/prompter/bundle/ruby/3.1.0/bin/pod:25:in `load'

Stack

   CocoaPods : 1.14.2
        Ruby : ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-darwin22]
    RubyGems : 3.4.20
        Host : macOS 13.5 (22G74)
       Xcode : 15.0.1 (15A507)
         Git : git version 2.40.1
Ruby lib dir : /nix/store/y78vyxrlj2038p1fcs18inflz4w5gmh0-ruby-3.1.4/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-bazel       : 0.1.5
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

apple_framework failed to compile

Queuing Tulsi build...
<*> Parsing options completed in 0.122 ms
Running "/Users/mac/.bazel/bin/bazel build --verbose_failures --bes_outerr_buffer_size=0 --apple_platform_type=ios --cpu=ios_x86_64 --watchos_cpus=i386 --announce_rc '--override_repository=tulsi=/Users/mac/Library/Application Support/Tulsi/0.20220209.88/Bazel' --compilation_mode=dbg --define=apple.add_debugger_entitlement=1 --define=apple.propagate_embedded_extra_outputs=1 --define=apple.experimental.tree_artifact_outputs=1 --features=debug_prefix_map_pwd_is_dot --tool_tag=tulsi:bazel_build --build_event_json_file=/Users/mac/Documents/xunlei/FORK/ios-bazel-example/NewApp.xcodeproj/.tulsi/79316_build_events.json --noexperimental_build_event_json_file_path_conversion --aspects @tulsi//:tulsi/tulsi_aspects.bzl%tulsi_outputs_aspect --output_groups=+tulsi_outputs //:NewsApplication", patching output for workspace root at "/Users/mac/Documents/xunlei/FORK/ios-bazel-example" with project path at "/Users/mac/Documents/xunlei/FORK/ios-bazel-example".
note: Options provided by the client:
  Inherited 'common' options: --isatty=0 --terminal_columns=80
note: Reading rc options for 'build' from /Users/mac/Documents/xunlei/FORK/ios-bazel-example/.bazelrc:
  'build' options: --apple_platform_type=ios --verbose_failures --strategy=SwiftCompile=standalone --apple_generate_dsym
Loading: 
Loading: 0 packages loaded
Analyzing: target //:NewsApplication (1 packages loaded, 0 targets configured)
/Users/mac/Documents/xunlei/FORK/ios-bazel-example/Pods/MBProgressHUD/BUILD.bazel:3:16: error: in @tulsi//:tulsi/tulsi_aspects.bzl%tulsi_outputs_aspect aspect on apple_framework_packaging rule //Pods/MBProgressHUD:MBProgressHUD: 
Traceback (most recent call last):
	File "/private/var/tmp/_bazel_mac/bc1c6640115027b0e8599f0594bf3ae0/external/tulsi/tulsi/tulsi_aspects.bzl", line 1135, column 39, in _tulsi_outputs_aspect
		artifact = bundle_info.archive.path
Error: 'NoneType' value has no field or method 'path'
error: Analysis of aspects '[@tulsi//:tulsi/tulsi_aspects.bzl%tulsi_outputs_aspect] on //:NewsApplication' failed; build aborted: Analysis of target '//Pods/MBProgressHUD:MBProgressHUD' failed
note: Elapsed time: 0.304s
note: 0 processes.
error: Build did NOT complete successfully (2 packages loaded, 278 targets configured)
<*> Running Bazel completed in 420.422 ms
/Users/mac/Documents/xunlei/FORK/ios-bazel-example/NewApp.xcodeproj/.tulsi/Scripts/bazel_build.py:590: error: Bazel build failed with exit code 1. Please check the build log in Report Navigator (⌘9) for more information.
<*> Everything completed in 441.122 ms

How is it different from podToBuild?
https://github.com/pinterest/PodToBUILD

Symbols not found issue on M1 mac with objective-c pod

Hi! I'm trying to test out cocoapods-bazel to integrate pods into a project. It seems to work fine for swift pods, but it spits out ld: symbol(s) not found for architecture arm64 when I try to install SDWebImage. I tried to use another Pod that is pure swift and it seemed to work fine there. I couldn't find a pod with mixed sources to test, so not sure how it would work there.

Here is a project for repro: https://github.com/tejassharma96/basic-bazel-app
Repro steps (on m1, not sure if this issue exists on intel macs):

  • bundle install
  • bundle exec pod install
  • bazelisk build //:ios-app

Would appreciate any help here and info on what I might be doing wrong here. Thanks!

[Question] How to exclude the generation of BUILD for 'Development Pods'

Hi! I'm trying to test out cocoapods-bazel to integrate pods into a project. Thanks, it's beneficial for me.

But my project has some 'Development Pods,' and I don't want to generate BUILD files. If I force this wrong, there will be some errors.

So, how do we exclude certain pods when cocoapods-bazel generates BUILD files?

compiler_flags from pod spec not propagated to build file

The compiler_flags attribute in pod specs are ignored by cocoapods-bazel, which can result in that pod failing to build under Bazel. For example, the CNIODarwin pod requires -D__APPLE_USE_RFC_3542=1 in order to compile successfully on macOS.

The following addition to the Podfile serves as a temporary workaround:

pre_install do |installer|
  cniodarwin = installer.pod_targets.detect { |t| t.name == 'CNIODarwin' }
  cniodarwin.spec_consumers.each do |c|
    compiler_flags = c.spec.attributes_hash['compiler_flags']
    c.spec.attributes_hash['pod_target_xcconfig'] = {'OTHER_CFLAGS' => compiler_flags}
  end
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.