Просмотр исходного кода

Add Carthage instructions for FLEX exclusion from release builds

Samuel Défago лет назад: 9
Родитель
Сommit
7f3af90645
1 измененных файлов с 26 добавлено и 3 удалено
  1. 26 3
      README.md

+ 26 - 3
README.md

@@ -124,8 +124,14 @@ Alternatively, you can manually add the files in `Classes/` to your Xcode projec
 
 
 ## Excluding FLEX from Release (App Store) Builds
-*Note: CocoaPods handles this automatically if you only specify the Debug configuration for FLEX in your Podfile.*
-FLEX makes it easy to explore the internals of your app, so it is not something you should expose to your users. Fortunately, it is easy to exclude FLEX files from Release builds. In Xcode, navigate to the "Build Settings" tab of your project. Click the plus and select `Add User-Defined Setting`.
+
+FLEX makes it easy to explore the internals of your app, so it is not something you should expose to your users. Fortunately, it is easy to exclude FLEX files from Release builds. The strategies differ depending on how you integrated FLEX in your project, and are described below.
+
+At the places in your code where you integrate FLEX, do a `#if DEBUG` check to ensure the tool is only accessible in your `Debug` builds and to avoid errors in your `Release` builds. For more help with integrating FLEX, see the example project.
+
+### FLEX files added manually to a project
+
+In Xcode, navigate to the "Build Settings" tab of your project. Click the plus and select `Add User-Defined Setting`.
 
 ![Add User-Defined Setting](http://engineering.flipboard.com/assets/flex/flex-readme-exclude-1.png)
 
@@ -133,8 +139,25 @@ Name the setting `EXCLUDED_SOURCE_FILE_NAMES`. For your `Release` configuration,
 
 ![EXCLUDED_SOURCE_FILE_NAMES](http://engineering.flipboard.com/assets/flex/flex-readme-exclude-2.png)
 
-At the places in your code where you integrate FLEX, do a `#if DEBUG` check to ensure the tool is only accessible in your `Debug` builds and to avoid errors in your `Release` builds. For more help with integrating FLEX, see the example project.
+### FLEX added with CocoaPods
+
+CocoaPods automatically excludes FLEX from release builds if you only specify the Debug configuration for FLEX in your Podfile.
+
+### FLEX added with Carthage
+
+If you are using Carthage, only including the `FLEX.framework` in debug builds is easy:
+
+1. Do NOT add `FLEX.framework` to the embedded binaries of your target, as it would otherwise be included in all builds (therefore also in release ones).
+1. Instead, add `$(PROJECT_DIR)/Carthage/Build/iOS` to your target _Framework Search Paths_ (this setting might already be present if you already included other frameworks with Carthage). This makes it possible to import the FLEX framework from your source files. It does not harm if this setting is added for all configurations, but it should at least be added for the debug one. 
+1. Add a _Run Script Phase_ to your target (inserting it after the existing `Link Binary with Libraries` phase, for example), and which will embed `FLEX.framework` in debug builds only:
 
+	```shell
+	if [ "$CONFIGURATION" == "Debug" ]; then
+	  /usr/local/bin/carthage copy-frameworks
+	fi
+	```
+	
+	Finally, add `$(SRCROOT)/Carthage/Build/iOS/FLEX.framework` as input file of this script phase.
 
 ## Additional Notes
 - When setting fields of type `id` or values in `NSUserDefaults`, FLEX attempts to parse the input string as `JSON`. This allows you to use a combination of strings, numbers, arrays, and dictionaries. If you want to set a string value, it must be wrapped in quotes. For ivars or properties that are explicitly typed as `NSStrings`, quotes are not required.