Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joncardasis/cocoapods-user-defined-build-types
⚒ A cocoapods plugin that can selectively set build type per pod (static library, dynamic framework, etc.)
https://github.com/joncardasis/cocoapods-user-defined-build-types
build-types cocoapods cocoapods-plugin dynamic dynamic-frameworks framework library pod react-native static
Last synced: 3 days ago
JSON representation
⚒ A cocoapods plugin that can selectively set build type per pod (static library, dynamic framework, etc.)
- Host: GitHub
- URL: https://github.com/joncardasis/cocoapods-user-defined-build-types
- Owner: joncardasis
- License: mit
- Created: 2020-02-07T21:50:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-02T06:25:48.000Z (over 4 years ago)
- Last Synced: 2024-04-26T20:05:33.353Z (9 months ago)
- Topics: build-types, cocoapods, cocoapods-plugin, dynamic, dynamic-frameworks, framework, library, pod, react-native, static
- Language: Ruby
- Homepage:
- Size: 32.2 KB
- Stars: 134
- Watchers: 4
- Forks: 10
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cocoapods-user-defined-build-types
![Latest Version](https://img.shields.io/badge/Latest_supported_CocoaPods-1.9.1-gray.svg)Allow CocoaPods to mix dynamic/static libaries/frameworks.
This plugin allows for a Podfile to specify how each Pod (or multiple Pods) should be built (ex. *as a dynamic framework*).
## Installation
```Bash
$ gem install cocoapods-user-defined-build-types
```## Usage
```C
plugin 'cocoapods-user-defined-build-types'enable_user_defined_build_types!
target "CoffeeApp" do
pod 'Alamofire'
pod "SwiftyJSON", :build_type => :dynamic_framework
```
- Add `plugin 'cocoapods-user-defined-build-types'` to the top of your Podfile
- Add the `enable_user_defined_build_types!` directive to the top of your Podfile (removing `use_frameworks!` if present)
- Add a `build_type` option to one or more Pods to direct how they're built (ex. `:build_type => :dynamic_framework`)
- `pod install`Based on this configuration, CocoaPods will build your project such that `Alamofire` stays a static library (CocoaPods default) and is part of the umbrella `Pods-CoffeeApp` static library generated by CocoaPods. `SwiftyJSON` will become a dynamic framework and dynamically linked in CoffeeApp.
| SUPPORTED BUILD TYPES |
| --- |
| `dynamic_library` |
| `dynamic_framework` |
| `static_library` |
| `static_framework` |## Why
Cocoapod's `use_frameworks!` directive makes **all** integrated Pods build as dynamic frameworks.This can cause issues with certain Pods. You may want some pods to be static libraries and a single Pod to a dynamic framework. CocoaPods currently does not support this. The `cocoapods-user-defined-build-types` plugin allows for build types to be changed on a Pod-by-Pod basis, otherwise defaulting to CocoaPods default build type (static library).
This plugin was specifically built for React Native projects to be able to incorporate dynamic Swift Pods without needing to change other Pods.
## Verbose Logging
Having issues? Try enabling the plugin's verbose logging from the Podfile:
```C
plugin 'cocoapods-user-defined-build-types', {
verbose: true
}...
```For even more detailed logging, the development flag can be set in your terminal env: `export CP_DEV=1`.
## How
By overriding `Pod::Podfile::TargetDefinition`'s `build_type` function (from cocoapods-core) to return the specifed linking (static/dynamic) and packing (library/framework), we can change how Cococpods builts specific dependencies. Currently in core, there is support for multiple build type but the use_frameworks! directive is the only way to enable framework builds, and it is an all-or-nothing approach.## License
Available under the MIT license. See the LICENSE file for more info.