@@ -34,6 +34,7 @@ public class AndroidBuildConfig : BuildConfigBase
34
34
/// <para>예를들어 UnityProject/Asset 폴더 밑에 example.keystore가 있으면 "/example.keystore" 입니다.</para>
35
35
/// </summary>
36
36
[ SerializeField ]
37
+ [ Tooltip ( "Keystore 파일의 경로입니다. `파일경로/파일명.keystore` 까지 쓰셔야 합니다." ) ]
37
38
protected string keystorePath ;
38
39
39
40
/// <summary>
@@ -54,6 +55,12 @@ public class AndroidBuildConfig : BuildConfigBase
54
55
[ SerializeField ]
55
56
protected int bundleVersionCode ;
56
57
58
+ /// <summary>
59
+ /// 안드로이드 앱번들(.aab)로 빌드할 지, false면 apk로 빌드
60
+ /// </summary>
61
+ [ SerializeField ]
62
+ protected bool aabBuild ;
63
+
57
64
///<inheritdoc cref="IBuildConfig.ResetSetting"/>
58
65
public override void ResetSetting ( BuildConfigBase config )
59
66
{
@@ -75,25 +82,33 @@ public override void OnPreBuild(IDictionary<string, string> commandLine, ref Bui
75
82
PlayerSettings . Android . keyaliasName = keyaliasName ;
76
83
PlayerSettings . Android . keyaliasPass = keyaliasPassword ;
77
84
78
- PlayerSettings . Android . keystoreName = Application . dataPath + keystorePath ;
85
+ PlayerSettings . Android . keystoreName = keystorePath ;
79
86
PlayerSettings . Android . keystorePass = keystorePassword ;
80
87
PlayerSettings . Android . bundleVersionCode = bundleVersionCode ;
81
88
89
+ EditorUserBuildSettings . buildAppBundle = aabBuild ;
90
+
82
91
PlayerSettings . SetScriptingBackend ( BuildTargetGroup . Android , scriptingBackEnd ) ;
83
92
84
93
Debug . LogFormat ( $ "OnPreBuild [Android]\n " +
85
- $ "PackageName : { PlayerSettings . applicationIdentifier } \n " +
86
- $ "keyaliasName : { PlayerSettings . Android . keyaliasName } , keyaliasPass : { PlayerSettings . Android . keyaliasPass } \n " +
87
- $ "keystoreName : { PlayerSettings . Android . keystoreName } , keystorePass : { PlayerSettings . Android . keystorePass } \n ") ;
94
+ $ "PackageName:{ PlayerSettings . applicationIdentifier } \n " +
95
+ $ "keyaliasName:{ PlayerSettings . Android . keyaliasName } , keyaliasPass:{ PlayerSettings . Android . keyaliasPass } \n " +
96
+ $ "keystoreName:{ PlayerSettings . Android . keystoreName } , keystorePass:{ PlayerSettings . Android . keystorePass } \n " +
97
+ $ "aabBuild:{ aabBuild } ") ;
88
98
}
89
99
90
100
///<inheritdoc cref="IBuildConfig.GetBuildPath"/>
91
101
public override string GetBuildPath ( )
92
102
{
93
- return base . GetBuildPath ( )
103
+ string extensionName = EditorUserBuildSettings . buildAppBundle ? ".aab" : ".apk" ;
104
+ return base . GetBuildPath ( ) + extensionName ;
105
+ }
106
+
107
+ public override string ReplaceStrings ( string replaceTarget )
108
+ {
109
+ return base . ReplaceStrings ( replaceTarget )
94
110
. Replace ( "{scriptingBackEnd}" , scriptingBackEnd . ToString ( ) )
95
- . Replace ( "{bundleVersionCode}" , bundleVersionCode . ToString ( ) )
96
- + ".apk" ;
111
+ . Replace ( "{bundleVersionCode}" , bundleVersionCode . ToString ( ) ) ;
97
112
}
98
113
}
99
114
@@ -117,34 +132,22 @@ public override void OnInspectorGUI()
117
132
if ( GUILayout . Button ( "Reset to Current EditorSetting" ) )
118
133
{
119
134
config . ResetSetting ( config ) ;
135
+ AssetDatabase . SaveAssets ( ) ;
136
+ AssetDatabase . Refresh ( ) ;
137
+ EditorUtility . SetDirty ( config ) ;
120
138
}
121
139
122
140
if ( GUILayout . Button ( "Build!" ) )
123
141
{
124
142
UnityBuilder . Build ( config ) ;
125
143
}
126
144
127
- _commandLine = EditorGUILayout . TextField ( "commandLine" , _commandLine ) ;
145
+ EditorGUILayout . Space ( ) ;
146
+ EditorGUILayout . LabelField ( "or with command line" ) ;
147
+ _commandLine = EditorGUILayout . TextArea ( _commandLine ) ;
128
148
if ( GUILayout . Button ( $ "Build with \' { _commandLine } \' ") )
129
149
{
130
- string [ ] commands = _commandLine . Split ( ' ' ) ;
131
- for ( int i = 0 ; i < commands . Length ; i ++ )
132
- {
133
- string command = commands [ i ] ;
134
- bool hasNextCommand = i + 1 < commands . Length ;
135
- if ( command . StartsWith ( "-" ) )
136
- {
137
- if ( hasNextCommand )
138
- {
139
- Environment . SetEnvironmentVariable ( command , commands [ i + 1 ] ) ;
140
- }
141
- else
142
- {
143
- Environment . SetEnvironmentVariable ( command , "" ) ;
144
- }
145
- }
146
- }
147
-
150
+ UnityBuilder . AddCommandLine ( _commandLine ) ;
148
151
UnityBuilder . Build ( ) ;
149
152
}
150
153
}
0 commit comments