Skip to content

Commit 6b8b571

Browse files
author
Stewart Miles
authored
Merge pull request googlesamples#288 from pablo-wargaming/master
Allow appending to generated podfile before install runs
2 parents 28401e9 + 91e8010 commit 6b8b571

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,25 @@ The `CocoaPods` are either:
348348
The resolution strategy can be changed via the
349349
`Assets > Play Services Resolver > iOS Resolver > Settings` menu.
350350

351+
### Appending text to generated Podfile
352+
In order to modify the generated Podfile you can create a script like this:
353+
```
354+
using System.IO;
355+
public class PostProcessIOS : MonoBehaviour {
356+
[PostProcessBuildAttribute(45)]//must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50)
357+
private static void PostProcessBuild_iOS(BuildTarget target, string buildPath)
358+
{
359+
if (target == BuildTarget.iOS)
360+
{
361+
362+
using (StreamWriter sw = File.AppendText(buildPath + "/Podfile"))
363+
{
364+
//in this example I'm adding an app extension
365+
sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend");
366+
}
367+
}
368+
}
369+
```
351370
# Version Handler Usage
352371

353372
The Version Handler component of this plugin manages:

source/IOSResolver/src/IOSResolver.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,12 @@ protected override bool Read(string filename, Logger logger) {
388388
new SortedDictionary<string, Pod>();
389389

390390
// Order of post processing operations.
391-
private const int BUILD_ORDER_REFRESH_DEPENDENCIES = 1;
392-
private const int BUILD_ORDER_CHECK_COCOAPODS_INSTALL = 2;
393-
private const int BUILD_ORDER_PATCH_PROJECT = 3;
394-
private const int BUILD_ORDER_GEN_PODFILE = 4;
395-
private const int BUILD_ORDER_INSTALL_PODS = 5;
396-
private const int BUILD_ORDER_UPDATE_DEPS = 6;
391+
private const int BUILD_ORDER_REFRESH_DEPENDENCIES = 10;
392+
private const int BUILD_ORDER_CHECK_COCOAPODS_INSTALL = 20;
393+
private const int BUILD_ORDER_PATCH_PROJECT = 30;
394+
private const int BUILD_ORDER_GEN_PODFILE = 40;
395+
private const int BUILD_ORDER_INSTALL_PODS = 50;
396+
private const int BUILD_ORDER_UPDATE_DEPS = 60;
397397

398398
// This is appended to the Podfile filename to store a backup of the original Podfile.
399399
// ie. "Podfile_Unity".

0 commit comments

Comments
 (0)