Skip to content

Commit c3a7356

Browse files
authored
Merge pull request #738 from immutable/feat/sdk-295-ios-build-target
feat(audience-sample): enable iOS build target (SDK-295)
2 parents 40425bd + ec1de78 commit c3a7356

6 files changed

Lines changed: 274 additions & 10 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#nullable enable
2+
3+
using System;
4+
using UnityEditor;
5+
using UnityEngine;
6+
7+
namespace Immutable.Audience.Samples.SampleApp.Editor
8+
{
9+
// Invoked by CI via:
10+
// Unity -batchmode -buildTarget iOS \
11+
// -executeMethod Immutable.Audience.Samples.SampleApp.Editor.IosBuilder.Build \
12+
// -quit
13+
//
14+
// Optional CLI arg:
15+
// --buildPath <path> Output directory for the Xcode project (default: Builds/iOS)
16+
internal static class IosBuilder
17+
{
18+
private const string DefaultBuildPath = "Builds/iOS";
19+
20+
public static void Build()
21+
{
22+
string buildPath = GetArgValue("--buildPath") ?? DefaultBuildPath;
23+
24+
var options = new BuildPlayerOptions
25+
{
26+
scenes = new[] { "Assets/SampleApp/Scenes/SampleApp.unity" },
27+
locationPathName = buildPath,
28+
target = BuildTarget.iOS,
29+
targetGroup = BuildTargetGroup.iOS,
30+
options = BuildOptions.None,
31+
};
32+
33+
Debug.Log($"[IosBuilder] Building Xcode project → {buildPath}");
34+
35+
var report = BuildPipeline.BuildPlayer(options);
36+
var summary = report.summary;
37+
38+
if (summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
39+
{
40+
Debug.Log($"[IosBuilder] Build succeeded ({summary.totalSize / 1024 / 1024} MB).");
41+
}
42+
else
43+
{
44+
Debug.LogError($"[IosBuilder] Build failed: {summary.totalErrors} error(s).");
45+
EditorApplication.Exit(1);
46+
}
47+
}
48+
49+
private static string? GetArgValue(string flag)
50+
{
51+
var args = Environment.GetCommandLineArgs();
52+
for (int i = 0; i < args.Length - 1; i++)
53+
{
54+
if (args[i] == flag)
55+
return args[i + 1];
56+
}
57+
return null;
58+
}
59+
}
60+
}

examples/audience/Assets/Editor/IosBuilder.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/audience/Assets/Editor/ScriptingBackendOverride.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ namespace Immutable.Audience.Samples.SampleApp.Editor
1818
// Mono → Disabled (Mono studios rarely strip; High under Mono can
1919
// strip Net.Http SSL chain code paths).
2020
//
21-
// Supported targets: Standalone, Android.
21+
// Supported targets: Standalone, Android, iOS.
2222
//
2323
// Usage:
2424
// AUDIENCE_SCRIPTING_BACKEND=Mono2x Unity -batchmode -runTests ...
2525
// AUDIENCE_SCRIPTING_BACKEND=IL2CPP Unity -batchmode -buildTarget Android ...
26+
// AUDIENCE_SCRIPTING_BACKEND=IL2CPP Unity -batchmode -buildTarget iOS ...
2627
//
2728
// Unset means "respect ProjectSettings.asset as-is".
2829
internal sealed class ScriptingBackendOverride : IPreprocessBuildWithReport
@@ -45,7 +46,7 @@ public void OnPreprocessBuild(BuildReport report)
4546
};
4647

4748
var group = report.summary.platformGroup;
48-
if (group != BuildTargetGroup.Standalone && group != BuildTargetGroup.Android)
49+
if (group != BuildTargetGroup.Standalone && group != BuildTargetGroup.Android && group != BuildTargetGroup.iOS)
4950
return;
5051

5152
var currentBackend = PlayerSettings.GetScriptingBackend(group);

examples/audience/ProjectSettings/ProjectSettings.asset

Lines changed: 198 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PlayerSettings:
1212
targetDevice: 2
1313
useOnDemandResources: 0
1414
accelerometerFrequency: 60
15-
companyName: DefaultCompany
15+
companyName: Immutable
1616
productName: audience
1717
defaultCursor: {fileID: 0}
1818
cursorHotspot: {x: 0, y: 0}
@@ -157,7 +157,9 @@ PlayerSettings:
157157
resetResolutionOnWindowResize: 0
158158
androidSupportedAspectRatio: 1
159159
androidMaxAspectRatio: 2.1
160-
applicationIdentifier: {}
160+
applicationIdentifier:
161+
iPhone: com.immutable.audience
162+
Android: com.immutable.audience
161163
buildNumber:
162164
Standalone: 0
163165
iPhone: 0
@@ -179,7 +181,7 @@ PlayerSettings:
179181
StripUnusedMeshComponents: 1
180182
VertexChannelCompressionMask: 4054
181183
iPhoneSdkVersion: 988
182-
iOSTargetOSVersionString: 12.0
184+
iOSTargetOSVersionString: 13.0
183185
tvOSSdkVersion: 0
184186
tvOSRequireExtendedGameController: 0
185187
tvOSTargetOSVersionString: 12.0
@@ -232,7 +234,7 @@ PlayerSettings:
232234
tvOSManualSigningProvisioningProfileID:
233235
iOSManualSigningProvisioningProfileType: 0
234236
tvOSManualSigningProvisioningProfileType: 0
235-
appleEnableAutomaticSigning: 0
237+
appleEnableAutomaticSigning: 1
236238
iOSRequireARKit: 0
237239
iOSAutomaticallyDetectAndAddCapabilities: 1
238240
appleEnableProMotion: 0
@@ -272,7 +274,196 @@ PlayerSettings:
272274
AndroidValidateAppBundleSize: 1
273275
AndroidAppBundleSizeToValidate: 150
274276
m_BuildTargetIcons: []
275-
m_BuildTargetPlatformIcons: []
277+
m_BuildTargetPlatformIcons:
278+
- m_BuildTarget: iPhone
279+
m_Icons:
280+
- m_Textures: []
281+
m_Width: 180
282+
m_Height: 180
283+
m_Kind: 0
284+
m_SubKind: iPhone
285+
- m_Textures: []
286+
m_Width: 120
287+
m_Height: 120
288+
m_Kind: 0
289+
m_SubKind: iPhone
290+
- m_Textures: []
291+
m_Width: 167
292+
m_Height: 167
293+
m_Kind: 0
294+
m_SubKind: iPad
295+
- m_Textures: []
296+
m_Width: 152
297+
m_Height: 152
298+
m_Kind: 0
299+
m_SubKind: iPad
300+
- m_Textures: []
301+
m_Width: 76
302+
m_Height: 76
303+
m_Kind: 0
304+
m_SubKind: iPad
305+
- m_Textures: []
306+
m_Width: 120
307+
m_Height: 120
308+
m_Kind: 3
309+
m_SubKind: iPhone
310+
- m_Textures: []
311+
m_Width: 80
312+
m_Height: 80
313+
m_Kind: 3
314+
m_SubKind: iPhone
315+
- m_Textures: []
316+
m_Width: 80
317+
m_Height: 80
318+
m_Kind: 3
319+
m_SubKind: iPad
320+
- m_Textures: []
321+
m_Width: 40
322+
m_Height: 40
323+
m_Kind: 3
324+
m_SubKind: iPad
325+
- m_Textures: []
326+
m_Width: 87
327+
m_Height: 87
328+
m_Kind: 1
329+
m_SubKind: iPhone
330+
- m_Textures: []
331+
m_Width: 58
332+
m_Height: 58
333+
m_Kind: 1
334+
m_SubKind: iPhone
335+
- m_Textures: []
336+
m_Width: 29
337+
m_Height: 29
338+
m_Kind: 1
339+
m_SubKind: iPhone
340+
- m_Textures: []
341+
m_Width: 58
342+
m_Height: 58
343+
m_Kind: 1
344+
m_SubKind: iPad
345+
- m_Textures: []
346+
m_Width: 29
347+
m_Height: 29
348+
m_Kind: 1
349+
m_SubKind: iPad
350+
- m_Textures: []
351+
m_Width: 60
352+
m_Height: 60
353+
m_Kind: 2
354+
m_SubKind: iPhone
355+
- m_Textures: []
356+
m_Width: 40
357+
m_Height: 40
358+
m_Kind: 2
359+
m_SubKind: iPhone
360+
- m_Textures: []
361+
m_Width: 40
362+
m_Height: 40
363+
m_Kind: 2
364+
m_SubKind: iPad
365+
- m_Textures: []
366+
m_Width: 20
367+
m_Height: 20
368+
m_Kind: 2
369+
m_SubKind: iPad
370+
- m_Textures: []
371+
m_Width: 1024
372+
m_Height: 1024
373+
m_Kind: 4
374+
m_SubKind: App Store
375+
- m_BuildTarget: Android
376+
m_Icons:
377+
- m_Textures: []
378+
m_Width: 432
379+
m_Height: 432
380+
m_Kind: 2
381+
m_SubKind:
382+
- m_Textures: []
383+
m_Width: 324
384+
m_Height: 324
385+
m_Kind: 2
386+
m_SubKind:
387+
- m_Textures: []
388+
m_Width: 216
389+
m_Height: 216
390+
m_Kind: 2
391+
m_SubKind:
392+
- m_Textures: []
393+
m_Width: 162
394+
m_Height: 162
395+
m_Kind: 2
396+
m_SubKind:
397+
- m_Textures: []
398+
m_Width: 108
399+
m_Height: 108
400+
m_Kind: 2
401+
m_SubKind:
402+
- m_Textures: []
403+
m_Width: 81
404+
m_Height: 81
405+
m_Kind: 2
406+
m_SubKind:
407+
- m_Textures: []
408+
m_Width: 192
409+
m_Height: 192
410+
m_Kind: 1
411+
m_SubKind:
412+
- m_Textures: []
413+
m_Width: 144
414+
m_Height: 144
415+
m_Kind: 1
416+
m_SubKind:
417+
- m_Textures: []
418+
m_Width: 96
419+
m_Height: 96
420+
m_Kind: 1
421+
m_SubKind:
422+
- m_Textures: []
423+
m_Width: 72
424+
m_Height: 72
425+
m_Kind: 1
426+
m_SubKind:
427+
- m_Textures: []
428+
m_Width: 48
429+
m_Height: 48
430+
m_Kind: 1
431+
m_SubKind:
432+
- m_Textures: []
433+
m_Width: 36
434+
m_Height: 36
435+
m_Kind: 1
436+
m_SubKind:
437+
- m_Textures: []
438+
m_Width: 192
439+
m_Height: 192
440+
m_Kind: 0
441+
m_SubKind:
442+
- m_Textures: []
443+
m_Width: 144
444+
m_Height: 144
445+
m_Kind: 0
446+
m_SubKind:
447+
- m_Textures: []
448+
m_Width: 96
449+
m_Height: 96
450+
m_Kind: 0
451+
m_SubKind:
452+
- m_Textures: []
453+
m_Width: 72
454+
m_Height: 72
455+
m_Kind: 0
456+
m_SubKind:
457+
- m_Textures: []
458+
m_Width: 48
459+
m_Height: 48
460+
m_Kind: 0
461+
m_SubKind:
462+
- m_Textures: []
463+
m_Width: 36
464+
m_Height: 36
465+
m_Kind: 0
466+
m_SubKind:
276467
m_BuildTargetBatching:
277468
- m_BuildTarget: Standalone
278469
m_StaticBatching: 1
@@ -623,6 +814,7 @@ PlayerSettings:
623814
scriptingBackend:
624815
Android: 1
625816
Standalone: 1
817+
iPhone: 1
626818
il2cppCompilerConfiguration: {}
627819
managedStrippingLevel:
628820
EmbeddedLinux: 1
@@ -637,7 +829,7 @@ PlayerSettings:
637829
WebGL: 1
638830
Windows Store Apps: 1
639831
XboxOne: 1
640-
iPhone: 1
832+
iPhone: 3
641833
tvOS: 1
642834
incrementalIl2cppBuild: {}
643835
suppressCommonWarnings: 1

src/Packages/Audience/Runtime/Unity/com.immutable.audience.unity.asmdef

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Immutable.Audience.Unity",
33
"rootNamespace": "Immutable.Audience.Unity",
44
"references": ["Immutable.Audience.Runtime"],
5-
"includePlatforms": ["Android", "Editor", "macOSStandalone", "WindowsStandalone64"],
5+
"includePlatforms": ["Android", "Editor", "iOS", "macOSStandalone", "WindowsStandalone64"],
66
"excludePlatforms": [],
77
"allowUnsafeCode": false,
88
"overrideReferences": false,

src/Packages/Audience/Runtime/com.immutable.audience.asmdef

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Immutable.Audience.Runtime",
33
"rootNamespace": "Immutable.Audience",
44
"references": [],
5-
"includePlatforms": ["Android", "Editor", "macOSStandalone", "WindowsStandalone64"],
5+
"includePlatforms": ["Android", "Editor", "iOS", "macOSStandalone", "WindowsStandalone64"],
66
"excludePlatforms": [],
77
"allowUnsafeCode": false,
88
"overrideReferences": false,

0 commit comments

Comments
 (0)