@@ -17,6 +17,7 @@ public class BuildSettingsCommandLineParser : CommandLineParserBase<(BuildSettin
1717 public const string BuildTargetPathArgKey = "-buildTargetPath" ;
1818
1919 public const string StreamBase64TestDataArgKey = "-streamBase64TestDataSet" ;
20+ public const string TestDataSetIndexArgKey = "-testDataSetIndex" ;
2021
2122 protected override ( BuildSettings buildSettings , AuthCredentials authCredentials ) Parse (
2223 IDictionary < string , string > args )
@@ -53,39 +54,56 @@ protected override (BuildSettings buildSettings, AuthCredentials authCredentials
5354 var scriptingImplementation = GetScriptingImplementation ( scriptingBackend ) ;
5455 var targetPath = args [ BuildTargetPathArgKey ] ;
5556
56- var testAuthDataSet = ParseTestAuthDataSetArg ( args ) ;
57+ var testAuthDataSet = ParseTestAuthDataSetArg ( args , out var optionalTestDataIndex ) ;
5758
5859 return ( new BuildSettings ( buildTargetGroup , apiCompatibilityLevel , scriptingImplementation , targetPath ) ,
59- testAuthDataSet . GetAdminData ( ) ) ;
60+ testAuthDataSet . GetAdminData ( forceIndex : optionalTestDataIndex ) ) ;
61+
62+
6063 }
6164
62- public TestAuthDataSet ParseTestAuthDataSetArg ( IDictionary < string , string > args )
65+ public TestAuthDataSet ParseTestAuthDataSetArg ( IDictionary < string , string > args , out int ? forceDataSetIndex )
6366 {
6467 if ( ! args . ContainsKey ( StreamBase64TestDataArgKey ) )
6568 {
6669 throw new ArgumentException ( $ "Missing argument: `{ StreamBase64TestDataArgKey } `") ;
6770 }
6871
72+ forceDataSetIndex = GetOptionalTestDataIndex ( ) ;
6973 var rawTestDataSet = GetTestDataSet ( args ) ;
7074 var serializer = new NewtonsoftJsonSerializer ( ) ;
7175 return serializer . Deserialize < TestAuthDataSet > ( rawTestDataSet ) ;
76+
77+ int ? GetOptionalTestDataIndex ( )
78+ {
79+ if ( ! args . TryGetValue ( TestDataSetIndexArgKey , out var arg ) )
80+ {
81+ return default ;
82+ }
83+
84+ return int . Parse ( arg ) ;
85+ }
7286 }
7387
74- private BuildTargetGroup GetBuildTargetGroup ( BuildTargetPlatform targetPlatform )
88+ private static BuildTargetGroup GetBuildTargetGroup ( BuildTargetPlatform targetPlatform )
7589 {
76- if ( targetPlatform == BuildTargetPlatform . Standalone )
90+ switch ( targetPlatform )
7791 {
78- return BuildTargetGroup . Standalone ;
79- }
80-
92+ case BuildTargetPlatform . Standalone : return BuildTargetGroup . Standalone ;
93+ case BuildTargetPlatform . Mobile :
8194#if UNITY_STANDALONE_OSX
82- return BuildTargetGroup . iOS ;
95+ return BuildTargetGroup . iOS ;
8396#else
84- return BuildTargetGroup . Android ;
97+ return BuildTargetGroup . Android ;
8598#endif
99+ case BuildTargetPlatform . Android : return BuildTargetGroup . Android ;
100+ case BuildTargetPlatform . IOS : return BuildTargetGroup . iOS ;
101+ default :
102+ throw new ArgumentOutOfRangeException ( nameof ( targetPlatform ) , targetPlatform , null ) ;
103+ }
86104 }
87105
88- private ApiCompatibilityLevel GetApiCompatibilityLevel ( ApiCompatibility apiCompatibility )
106+ private static ApiCompatibilityLevel GetApiCompatibilityLevel ( ApiCompatibility apiCompatibility )
89107 {
90108#if UNITY_2021
91109 switch ( apiCompatibility )
@@ -108,7 +126,7 @@ private ApiCompatibilityLevel GetApiCompatibilityLevel(ApiCompatibility apiCompa
108126#endif
109127 }
110128
111- private ScriptingImplementation GetScriptingImplementation ( ScriptingBackend scriptingBackend )
129+ private static ScriptingImplementation GetScriptingImplementation ( ScriptingBackend scriptingBackend )
112130 {
113131 switch ( scriptingBackend )
114132 {
@@ -119,7 +137,7 @@ private ScriptingImplementation GetScriptingImplementation(ScriptingBackend scri
119137 }
120138 }
121139
122- private string GetTestDataSet ( IDictionary < string , string > args )
140+ private static string GetTestDataSet ( IDictionary < string , string > args )
123141 {
124142 var decodedBytes = Convert . FromBase64String ( args [ StreamBase64TestDataArgKey ] ) ;
125143 return Encoding . UTF8 . GetString ( decodedBytes ) ;
0 commit comments