com.amanotes.gdk 0.2.50 → 0.2.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/Editor/Extra/GDKCIBuildCommand.cs +312 -0
- package/Editor/Extra/GDKCIBuildCommand.cs.meta +3 -0
- package/Editor/Extra/{GDKAutoBuild.cs → GDKLocalBuild.cs} +49 -34
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/PostProcessor.unitypackage +0 -0
- package/Extra/{AndroidPostProcessor.unitypackage.meta → PostProcessor.unitypackage.meta} +1 -1
- package/Extra/SDKVersionTracking.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/FirebaseAnalyticsAdapter.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Runtime/AmaGDK.Adapters.cs +1 -1
- package/Runtime/AmaGDK.Ads.cs +17 -17
- package/Runtime/AmaGDK.Analytics.cs +316 -151
- package/Runtime/AmaGDK.UserProfile.cs +36 -32
- package/Runtime/AmaGDK.cs +2 -2
- package/Runtime/Internal/AmaGDK.Internal.cs +24 -0
- package/Runtime/Internal/AmaGDK.Utils.cs +27 -1
- package/package.json +1 -1
- package/Extra/AndroidPostProcessor.unitypackage +0 -0
- /package/Editor/Extra/{GDKAutoBuild.cs.meta → GDKLocalBuild.cs.meta} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.52 - 2024-02-27]
|
|
4
|
+
- Change post processing order
|
|
5
|
+
- Remove GDKInstaller after installed
|
|
6
|
+
- Enable pipeline execution for branches with active merge requests
|
|
7
|
+
- [Fix] Non-fatal exceptions relate to Analytics and Ads
|
|
8
|
+
- Update Google Sheet Id default
|
|
9
|
+
- Optimize GC for Analytics
|
|
10
|
+
|
|
11
|
+
## [0.2.51 - 2024-02-20]
|
|
12
|
+
- Change Google Mobile Ads SDK version , iosPod 10.5.0
|
|
13
|
+
|
|
3
14
|
## [0.2.50 - 2024-02-20]
|
|
4
15
|
- New feature: Modify Android post processor
|
|
5
16
|
- [Fix] remove installer should be skipped in DEV mode
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
using System.Linq;
|
|
3
|
+
using System;
|
|
4
|
+
using System.IO;
|
|
5
|
+
|
|
6
|
+
namespace Amanotes.Core
|
|
7
|
+
{
|
|
8
|
+
public static class GDKCIBuildCommand
|
|
9
|
+
{
|
|
10
|
+
private const string KEYSTORE_PASS = "KEYSTORE_PASS";
|
|
11
|
+
private const string KEY_ALIAS_PASS = "KEY_ALIAS_PASS";
|
|
12
|
+
private const string KEY_ALIAS_NAME = "KEY_ALIAS_NAME";
|
|
13
|
+
private const string KEYSTORE = "keystore.keystore";
|
|
14
|
+
private const string BUILD_OPTIONS_ENV_VAR = "BuildOptions";
|
|
15
|
+
private const string ANDROID_BUNDLE_VERSION_CODE = "VERSION_BUILD_VAR";
|
|
16
|
+
private const string ANDROID_APP_BUNDLE = "BUILD_APP_BUNDLE";
|
|
17
|
+
private const string SCRIPTING_BACKEND_ENV_VAR = "SCRIPTING_BACKEND";
|
|
18
|
+
private const string VERSION_NUMBER_VAR = "VERSION_NUMBER_VAR";
|
|
19
|
+
private const string VERSION_iOS = "VERSION_BUILD_VAR";
|
|
20
|
+
|
|
21
|
+
static string GetArgument(string name)
|
|
22
|
+
{
|
|
23
|
+
string[] args = Environment.GetCommandLineArgs();
|
|
24
|
+
for (int i = 0; i < args.Length; i++)
|
|
25
|
+
{
|
|
26
|
+
if (args[i].Contains(name))
|
|
27
|
+
{
|
|
28
|
+
return args[i + 1];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static string[] GetEnabledScenes()
|
|
35
|
+
{
|
|
36
|
+
return (
|
|
37
|
+
from scene in EditorBuildSettings.scenes
|
|
38
|
+
where scene.enabled
|
|
39
|
+
where !string.IsNullOrEmpty(scene.path)
|
|
40
|
+
select scene.path
|
|
41
|
+
).ToArray();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static BuildTarget GetBuildTarget()
|
|
45
|
+
{
|
|
46
|
+
string buildTargetName = GetArgument("customBuildTarget");
|
|
47
|
+
Console.WriteLine(":: Received customBuildTarget " + buildTargetName);
|
|
48
|
+
|
|
49
|
+
if (buildTargetName.ToLower() == "android")
|
|
50
|
+
{
|
|
51
|
+
#if !UNITY_5_6_OR_NEWER
|
|
52
|
+
// https://issuetracker.unity3d.com/issues/buildoptions-dot-acceptexternalmodificationstoplayer-causes-unityexception-unknown-project-type-0
|
|
53
|
+
// Fixed in Unity 5.6.0
|
|
54
|
+
// side effect to fix android build system:
|
|
55
|
+
EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Internal;
|
|
56
|
+
#endif
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (buildTargetName.TryConvertToEnum(out BuildTarget target))
|
|
60
|
+
return target;
|
|
61
|
+
|
|
62
|
+
Console.WriteLine($":: {nameof(buildTargetName)} \"{buildTargetName}\" not defined on enum {nameof(BuildTarget)}, using {nameof(BuildTarget.NoTarget)} enum to build");
|
|
63
|
+
|
|
64
|
+
return BuildTarget.NoTarget;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static string GetBuildPath()
|
|
68
|
+
{
|
|
69
|
+
string buildPath = GetArgument("customBuildPath");
|
|
70
|
+
Console.WriteLine(":: Received customBuildPath " + buildPath);
|
|
71
|
+
if (buildPath == "")
|
|
72
|
+
{
|
|
73
|
+
throw new Exception("customBuildPath argument is missing");
|
|
74
|
+
}
|
|
75
|
+
return buildPath;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static string GetBuildName()
|
|
79
|
+
{
|
|
80
|
+
string buildName = GetArgument("customBuildName");
|
|
81
|
+
Console.WriteLine(":: Received customBuildName " + buildName);
|
|
82
|
+
if (buildName == "")
|
|
83
|
+
{
|
|
84
|
+
throw new Exception("customBuildName argument is missing");
|
|
85
|
+
}
|
|
86
|
+
return buildName;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static string GetFixedBuildPath(BuildTarget buildTarget, string buildPath, string buildName)
|
|
90
|
+
{
|
|
91
|
+
if (buildTarget.ToString().ToLower().Contains("windows"))
|
|
92
|
+
{
|
|
93
|
+
buildName += ".exe";
|
|
94
|
+
}
|
|
95
|
+
else if (buildTarget == BuildTarget.Android)
|
|
96
|
+
{
|
|
97
|
+
#if UNITY_2018_3_OR_NEWER
|
|
98
|
+
buildName += EditorUserBuildSettings.buildAppBundle ? ".aab" : ".apk";
|
|
99
|
+
#else
|
|
100
|
+
buildName += ".apk";
|
|
101
|
+
#endif
|
|
102
|
+
}
|
|
103
|
+
return buildPath + buildName;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static BuildOptions GetBuildOptions()
|
|
107
|
+
{
|
|
108
|
+
if (TryGetEnv(BUILD_OPTIONS_ENV_VAR, out string envVar))
|
|
109
|
+
{
|
|
110
|
+
string[] allOptionVars = envVar.Split(',');
|
|
111
|
+
BuildOptions allOptions = BuildOptions.None;
|
|
112
|
+
BuildOptions option;
|
|
113
|
+
string optionVar;
|
|
114
|
+
int length = allOptionVars.Length;
|
|
115
|
+
|
|
116
|
+
Console.WriteLine($":: Detecting {BUILD_OPTIONS_ENV_VAR} env var with {length} elements ({envVar})");
|
|
117
|
+
|
|
118
|
+
for (int i = 0; i < length; i++)
|
|
119
|
+
{
|
|
120
|
+
optionVar = allOptionVars[i];
|
|
121
|
+
|
|
122
|
+
if (optionVar.TryConvertToEnum(out option))
|
|
123
|
+
{
|
|
124
|
+
allOptions |= option;
|
|
125
|
+
}
|
|
126
|
+
else
|
|
127
|
+
{
|
|
128
|
+
Console.WriteLine($":: Cannot convert {optionVar} to {nameof(BuildOptions)} enum, skipping it.");
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return allOptions;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return BuildOptions.None;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// https://stackoverflow.com/questions/1082532/how-to-tryparse-for-enum-value
|
|
139
|
+
static bool TryConvertToEnum<TEnum>(this string strEnumValue, out TEnum value)
|
|
140
|
+
{
|
|
141
|
+
if (!Enum.IsDefined(typeof(TEnum), strEnumValue))
|
|
142
|
+
{
|
|
143
|
+
value = default;
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
value = (TEnum)Enum.Parse(typeof(TEnum), strEnumValue);
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static bool TryGetEnv(string key, out string value)
|
|
152
|
+
{
|
|
153
|
+
value = Environment.GetEnvironmentVariable(key);
|
|
154
|
+
return !string.IsNullOrEmpty(value);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
static void SetScriptingBackendFromEnv(BuildTarget platform)
|
|
158
|
+
{
|
|
159
|
+
var targetGroup = BuildPipeline.GetBuildTargetGroup(platform);
|
|
160
|
+
if (TryGetEnv(SCRIPTING_BACKEND_ENV_VAR, out string scriptingBackend))
|
|
161
|
+
{
|
|
162
|
+
if (scriptingBackend.TryConvertToEnum(out ScriptingImplementation backend))
|
|
163
|
+
{
|
|
164
|
+
Console.WriteLine($":: Setting ScriptingBackend to {backend}");
|
|
165
|
+
PlayerSettings.SetScriptingBackend(targetGroup, backend);
|
|
166
|
+
}
|
|
167
|
+
else
|
|
168
|
+
{
|
|
169
|
+
string possibleValues = string.Join(", ", Enum.GetValues(typeof(ScriptingImplementation)).Cast<ScriptingImplementation>());
|
|
170
|
+
throw new Exception($"Could not find '{scriptingBackend}' in ScriptingImplementation enum. Possible values are: {possibleValues}");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
else
|
|
174
|
+
{
|
|
175
|
+
var defaultBackend = PlayerSettings.GetDefaultScriptingBackend(targetGroup);
|
|
176
|
+
Console.WriteLine($":: Using project's configured ScriptingBackend (should be {defaultBackend} for targetGroup {targetGroup}");
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public static void PerformBuild()
|
|
181
|
+
{
|
|
182
|
+
var buildTarget = GetBuildTarget();
|
|
183
|
+
|
|
184
|
+
Console.WriteLine(":: Performing build");
|
|
185
|
+
if (TryGetEnv(VERSION_NUMBER_VAR, out var bundleVersionNumber))
|
|
186
|
+
{
|
|
187
|
+
if (buildTarget == BuildTarget.iOS)
|
|
188
|
+
{
|
|
189
|
+
bundleVersionNumber = GetIosVersion();
|
|
190
|
+
}
|
|
191
|
+
Console.WriteLine($":: Setting bundleVersionNumber to '{bundleVersionNumber}' (Length: {bundleVersionNumber.Length})");
|
|
192
|
+
PlayerSettings.bundleVersion = bundleVersionNumber;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (buildTarget == BuildTarget.Android)
|
|
196
|
+
{
|
|
197
|
+
HandleAndroidAppBundle();
|
|
198
|
+
HandleAndroidBundleVersionCode();
|
|
199
|
+
HandleAndroidKeystore();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
var buildPath = GetBuildPath();
|
|
203
|
+
var buildName = GetBuildName();
|
|
204
|
+
var buildOptions = GetBuildOptions();
|
|
205
|
+
var fixedBuildPath = GetFixedBuildPath(buildTarget, buildPath, buildName);
|
|
206
|
+
|
|
207
|
+
SetScriptingBackendFromEnv(buildTarget);
|
|
208
|
+
|
|
209
|
+
var buildReport = BuildPipeline.BuildPlayer(GetEnabledScenes(), fixedBuildPath, buildTarget, buildOptions);
|
|
210
|
+
|
|
211
|
+
if (buildReport.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
|
212
|
+
throw new Exception($"Build ended with {buildReport.summary.result} status");
|
|
213
|
+
|
|
214
|
+
Console.WriteLine(":: Done with build");
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private static void HandleAndroidAppBundle()
|
|
218
|
+
{
|
|
219
|
+
if (TryGetEnv(ANDROID_APP_BUNDLE, out string value))
|
|
220
|
+
{
|
|
221
|
+
#if UNITY_2018_3_OR_NEWER
|
|
222
|
+
if (bool.TryParse(value, out bool buildAppBundle))
|
|
223
|
+
{
|
|
224
|
+
EditorUserBuildSettings.buildAppBundle = buildAppBundle;
|
|
225
|
+
Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected, set buildAppBundle to {value}.");
|
|
226
|
+
}
|
|
227
|
+
else
|
|
228
|
+
{
|
|
229
|
+
Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected but the value \"{value}\" is not a boolean.");
|
|
230
|
+
}
|
|
231
|
+
#else
|
|
232
|
+
Console.WriteLine($":: {ANDROID_APP_BUNDLE} env var detected but does not work with lower Unity version than 2018.3");
|
|
233
|
+
#endif
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private static void HandleAndroidBundleVersionCode()
|
|
238
|
+
{
|
|
239
|
+
if (TryGetEnv(ANDROID_BUNDLE_VERSION_CODE, out string value))
|
|
240
|
+
{
|
|
241
|
+
if (int.TryParse(value, out int version))
|
|
242
|
+
{
|
|
243
|
+
PlayerSettings.Android.bundleVersionCode = version;
|
|
244
|
+
Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected, set the bundle version code to {value}.");
|
|
245
|
+
}
|
|
246
|
+
else
|
|
247
|
+
Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected but the version value \"{value}\" is not an integer.");
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
private static string GetIosVersion()
|
|
252
|
+
{
|
|
253
|
+
if (TryGetEnv(VERSION_iOS, out string value))
|
|
254
|
+
{
|
|
255
|
+
if (int.TryParse(value, out int version))
|
|
256
|
+
{
|
|
257
|
+
Console.WriteLine($":: {VERSION_iOS} env var detected, set the version to {value}.");
|
|
258
|
+
return version.ToString();
|
|
259
|
+
}
|
|
260
|
+
else
|
|
261
|
+
Console.WriteLine($":: {VERSION_iOS} env var detected but the version value \"{value}\" is not an integer.");
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
throw new ArgumentNullException(nameof(value), $":: Error finding {VERSION_iOS} env var");
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private static void HandleAndroidKeystore()
|
|
268
|
+
{
|
|
269
|
+
#if UNITY_2019_1_OR_NEWER
|
|
270
|
+
PlayerSettings.Android.useCustomKeystore = false;
|
|
271
|
+
#endif
|
|
272
|
+
|
|
273
|
+
if (!File.Exists(KEYSTORE))
|
|
274
|
+
{
|
|
275
|
+
Console.WriteLine($":: {KEYSTORE} not found, skipping setup, using Unity's default keystore");
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
PlayerSettings.Android.keystoreName = KEYSTORE;
|
|
280
|
+
|
|
281
|
+
string keystorePass;
|
|
282
|
+
string keystoreAliasPass;
|
|
283
|
+
|
|
284
|
+
if (TryGetEnv(KEY_ALIAS_NAME, out string keyaliasName))
|
|
285
|
+
{
|
|
286
|
+
PlayerSettings.Android.keyaliasName = keyaliasName;
|
|
287
|
+
Console.WriteLine($":: using ${KEY_ALIAS_NAME} env var on PlayerSettings");
|
|
288
|
+
}
|
|
289
|
+
else
|
|
290
|
+
{
|
|
291
|
+
Console.WriteLine($":: ${KEY_ALIAS_NAME} env var not set, using Project's PlayerSettings");
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (!TryGetEnv(KEYSTORE_PASS, out keystorePass))
|
|
295
|
+
{
|
|
296
|
+
Console.WriteLine($":: ${KEYSTORE_PASS} env var not set, skipping setup, using Unity's default keystore");
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (!TryGetEnv(KEY_ALIAS_PASS, out keystoreAliasPass))
|
|
301
|
+
{
|
|
302
|
+
Console.WriteLine($":: ${KEY_ALIAS_PASS} env var not set, skipping setup, using Unity's default keystore");
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
#if UNITY_2019_1_OR_NEWER
|
|
306
|
+
PlayerSettings.Android.useCustomKeystore = true;
|
|
307
|
+
#endif
|
|
308
|
+
PlayerSettings.Android.keystorePass = keystorePass;
|
|
309
|
+
PlayerSettings.Android.keyaliasPass = keystoreAliasPass;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
@@ -11,13 +11,25 @@ using UnityObject = UnityEngine.Object;
|
|
|
11
11
|
|
|
12
12
|
namespace Amanotes.Editor
|
|
13
13
|
{
|
|
14
|
-
[CreateAssetMenu(menuName = "
|
|
15
|
-
public class
|
|
14
|
+
[CreateAssetMenu(menuName = "Ama GDK/Build Config", fileName = "LocalBuild")]
|
|
15
|
+
public class GDKLocalBuild : ScriptableObject
|
|
16
16
|
{
|
|
17
17
|
private const string DEFAULT_BUILD_FOLDER = "../../_Build";
|
|
18
18
|
|
|
19
19
|
public KeystoreInfo keystore;
|
|
20
|
-
|
|
20
|
+
[SerializeField] private string relativeBuildFolder = DEFAULT_BUILD_FOLDER;
|
|
21
|
+
|
|
22
|
+
private string _buildFolder;
|
|
23
|
+
public string buildFolder
|
|
24
|
+
{
|
|
25
|
+
get
|
|
26
|
+
{
|
|
27
|
+
if (!string.IsNullOrEmpty(_buildFolder)) return _buildFolder;
|
|
28
|
+
_buildFolder = new DirectoryInfo(Path.Combine(Application.dataPath, relativeBuildFolder ?? DEFAULT_BUILD_FOLDER)).FullName;
|
|
29
|
+
return _buildFolder;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
21
33
|
public Texture2D icon;
|
|
22
34
|
|
|
23
35
|
public List<BuildInfo> listBuild = new List<BuildInfo>();
|
|
@@ -135,8 +147,6 @@ namespace Amanotes.Editor
|
|
|
135
147
|
|
|
136
148
|
public void DryRun(BuildInfo info)
|
|
137
149
|
{
|
|
138
|
-
if (string.IsNullOrEmpty(buildFolder)) buildFolder = DEFAULT_BUILD_FOLDER;
|
|
139
|
-
|
|
140
150
|
var buildDir = new DirectoryInfo(buildFolder);
|
|
141
151
|
if (!buildDir.Exists) Directory.CreateDirectory(buildDir.FullName);
|
|
142
152
|
|
|
@@ -344,8 +354,13 @@ namespace Amanotes.Editor
|
|
|
344
354
|
|
|
345
355
|
EditorUserBuildSettings.buildAppBundle = isAAB;
|
|
346
356
|
EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
|
|
357
|
+
|
|
358
|
+
#if UNITY_2021_1_OR_NEWER
|
|
347
359
|
EditorUserBuildSettings.androidCreateSymbols = AndroidCreateSymbols.Disabled;
|
|
348
|
-
|
|
360
|
+
#else
|
|
361
|
+
EditorUserBuildSettings.androidCreateSymbolsZip = false;
|
|
362
|
+
#endif
|
|
363
|
+
|
|
349
364
|
string[] listAPKNames = GetAPKNames(buildFolder);
|
|
350
365
|
|
|
351
366
|
for (var i = 0; i < listAPKNames.Length; i++)
|
|
@@ -508,10 +523,10 @@ namespace Amanotes.Editor
|
|
|
508
523
|
|
|
509
524
|
|
|
510
525
|
[InitializeOnLoad]
|
|
511
|
-
internal class
|
|
526
|
+
internal class GDKLocalBuildHelper
|
|
512
527
|
{
|
|
513
|
-
private static
|
|
514
|
-
static
|
|
528
|
+
private static GDKLocalBuild build;
|
|
529
|
+
static GDKLocalBuildHelper()
|
|
515
530
|
{
|
|
516
531
|
EditorApplication.update -= Update;
|
|
517
532
|
EditorApplication.update += Update;
|
|
@@ -530,7 +545,7 @@ namespace Amanotes.Editor
|
|
|
530
545
|
|
|
531
546
|
if (build == null)
|
|
532
547
|
{
|
|
533
|
-
string[] guids = AssetDatabase.FindAssets("t:" + nameof(
|
|
548
|
+
string[] guids = AssetDatabase.FindAssets("t:" + nameof(GDKLocalBuild)); //FindAssets uses tags check documentation for more info
|
|
534
549
|
if (guids.Length == 0)
|
|
535
550
|
{
|
|
536
551
|
EditorApplication.update -= Update;
|
|
@@ -538,7 +553,7 @@ namespace Amanotes.Editor
|
|
|
538
553
|
}
|
|
539
554
|
|
|
540
555
|
string path = AssetDatabase.GUIDToAssetPath(guids[0]);
|
|
541
|
-
build = AssetDatabase.LoadAssetAtPath<
|
|
556
|
+
build = AssetDatabase.LoadAssetAtPath<GDKLocalBuild>(path);
|
|
542
557
|
if (build == null)
|
|
543
558
|
{
|
|
544
559
|
EditorApplication.update -= Update;
|
|
@@ -558,7 +573,7 @@ namespace Amanotes.Editor
|
|
|
558
573
|
// [MenuItem("Window/AmaGDK/Build/Select Build Asset &#b", false, 10)]
|
|
559
574
|
public static void SelectBuild()
|
|
560
575
|
{
|
|
561
|
-
string[] arr = AssetDatabase.FindAssets("t:" + nameof(
|
|
576
|
+
string[] arr = AssetDatabase.FindAssets("t:" + nameof(GDKLocalBuild));
|
|
562
577
|
|
|
563
578
|
if (arr.Length == 0)
|
|
564
579
|
{
|
|
@@ -577,9 +592,9 @@ namespace Amanotes.Editor
|
|
|
577
592
|
EditorGUIUtility.PingObject(obj);
|
|
578
593
|
}
|
|
579
594
|
|
|
580
|
-
private static
|
|
595
|
+
private static GDKLocalBuild FindLocalBuildAssets(string name = null, bool allowFallback = false)
|
|
581
596
|
{
|
|
582
|
-
string[] arr = AssetDatabase.FindAssets("t:" + nameof(
|
|
597
|
+
string[] arr = AssetDatabase.FindAssets("t:" + nameof(GDKLocalBuild));
|
|
583
598
|
if (arr.Length == 0)
|
|
584
599
|
{
|
|
585
600
|
Debug.LogWarning("There are no Build asset in the project!");
|
|
@@ -589,17 +604,17 @@ namespace Amanotes.Editor
|
|
|
589
604
|
for (var i = 0; i < arr.Length; i++)
|
|
590
605
|
{
|
|
591
606
|
string path = AssetDatabase.GUIDToAssetPath(arr[i]).Replace("\\", "/");
|
|
592
|
-
if (string.IsNullOrEmpty(name)) return AssetDatabase.LoadAssetAtPath<
|
|
607
|
+
if (string.IsNullOrEmpty(name)) return AssetDatabase.LoadAssetAtPath<GDKLocalBuild>(path);
|
|
593
608
|
|
|
594
609
|
string fileName = Path.GetFileName(path);
|
|
595
|
-
if (fileName.ToLower().Contains(name.ToLower())) return AssetDatabase.LoadAssetAtPath<
|
|
610
|
+
if (fileName.ToLower().Contains(name.ToLower())) return AssetDatabase.LoadAssetAtPath<GDKLocalBuild>(path);
|
|
596
611
|
}
|
|
597
612
|
|
|
598
613
|
if (!allowFallback) return null;
|
|
599
614
|
|
|
600
615
|
// Fall back to the first one
|
|
601
616
|
string path0 = AssetDatabase.GUIDToAssetPath(arr[0]).Replace("\\", "/");
|
|
602
|
-
return AssetDatabase.LoadAssetAtPath<
|
|
617
|
+
return AssetDatabase.LoadAssetAtPath<GDKLocalBuild>(path0);
|
|
603
618
|
}
|
|
604
619
|
|
|
605
620
|
// [MenuItem("Window/AmaGDK/Build/Android", false, 50)] public static void BuildAndroid() { BuildAndroid(false); }
|
|
@@ -610,7 +625,7 @@ namespace Amanotes.Editor
|
|
|
610
625
|
|
|
611
626
|
private static void BuildAndroid(bool isRelease)
|
|
612
627
|
{
|
|
613
|
-
|
|
628
|
+
GDKLocalBuild buildAsset = FindLocalBuildAssets("android");
|
|
614
629
|
if (buildAsset == null)
|
|
615
630
|
{
|
|
616
631
|
Debug.LogWarning("Build Asset for Android not found!");
|
|
@@ -618,26 +633,26 @@ namespace Amanotes.Editor
|
|
|
618
633
|
}
|
|
619
634
|
|
|
620
635
|
buildAsset.EnableBuildForTarget(BuildTarget.Android);
|
|
621
|
-
buildAsset.buildRQ =
|
|
636
|
+
buildAsset.buildRQ = GDKLocalBuild.BuildRequestTS.Generate();// isRelease
|
|
622
637
|
buildAsset.ProcessBuild();
|
|
623
638
|
}
|
|
624
639
|
|
|
625
640
|
private static void BuildIOS(bool isRelease)
|
|
626
641
|
{
|
|
627
|
-
|
|
642
|
+
GDKLocalBuild buildAsset = FindLocalBuildAssets("ios");
|
|
628
643
|
if (buildAsset == null)
|
|
629
644
|
{
|
|
630
645
|
Debug.LogWarning("Build Asset for iOS not found!");
|
|
631
646
|
return;
|
|
632
647
|
}
|
|
633
648
|
buildAsset.EnableBuildForTarget(BuildTarget.iOS);
|
|
634
|
-
buildAsset.buildRQ =
|
|
649
|
+
buildAsset.buildRQ = GDKLocalBuild.BuildRequestTS.Generate(); //isRelease
|
|
635
650
|
buildAsset.ProcessBuild();
|
|
636
651
|
}
|
|
637
652
|
}
|
|
638
653
|
|
|
639
|
-
[CustomEditor(typeof(
|
|
640
|
-
public class
|
|
654
|
+
[CustomEditor(typeof(GDKLocalBuild))]
|
|
655
|
+
public class GDKLocalBuildEditor : UnityEditor.Editor
|
|
641
656
|
{
|
|
642
657
|
public int bIndex;
|
|
643
658
|
public string path;
|
|
@@ -671,7 +686,7 @@ namespace Amanotes.Editor
|
|
|
671
686
|
}
|
|
672
687
|
public override void OnInspectorGUI()
|
|
673
688
|
{
|
|
674
|
-
var ab = (
|
|
689
|
+
var ab = (GDKLocalBuild)target;
|
|
675
690
|
if (ab == null) return;
|
|
676
691
|
|
|
677
692
|
if (productNameStyle == null) Init();
|
|
@@ -681,7 +696,7 @@ namespace Amanotes.Editor
|
|
|
681
696
|
Rect r0 = GUILayoutUtility.GetRect(0, Screen.width, 16f, 16f);
|
|
682
697
|
r0.xMin = 0;
|
|
683
698
|
r0.xMax += 16f;
|
|
684
|
-
|
|
699
|
+
GDKLocalBuild.DrawRect(r0, new Color32(20, 20, 20, 255));
|
|
685
700
|
|
|
686
701
|
if ((Event.current.type == EventType.MouseUp) && r0.Contains(Event.current.mousePosition))
|
|
687
702
|
{
|
|
@@ -715,19 +730,19 @@ namespace Amanotes.Editor
|
|
|
715
730
|
|
|
716
731
|
if (GUILayout.Button("Create Default"))
|
|
717
732
|
{
|
|
718
|
-
new
|
|
733
|
+
new GDKLocalBuild.BuildInfo().Read();
|
|
719
734
|
|
|
720
|
-
ab.listBuild = new List<
|
|
735
|
+
ab.listBuild = new List<GDKLocalBuild.BuildInfo>
|
|
721
736
|
{
|
|
722
|
-
new
|
|
737
|
+
new GDKLocalBuild.BuildInfo
|
|
723
738
|
{
|
|
724
739
|
target = BuildTarget.Android, isAAB = false, splitAPK = true
|
|
725
740
|
}.Read(),
|
|
726
|
-
new
|
|
741
|
+
new GDKLocalBuild.BuildInfo
|
|
727
742
|
{
|
|
728
743
|
target = BuildTarget.Android, isAAB = true, splitAPK = true
|
|
729
744
|
}.Read(),
|
|
730
|
-
new
|
|
745
|
+
new GDKLocalBuild.BuildInfo
|
|
731
746
|
{
|
|
732
747
|
target = BuildTarget.iOS, isAAB = true, splitAPK = true
|
|
733
748
|
}.Read()
|
|
@@ -740,7 +755,7 @@ namespace Amanotes.Editor
|
|
|
740
755
|
SerializedProperty prop = serializedObject.FindProperty($"listBuild.Array.data[{bIndex}]");
|
|
741
756
|
prop.isExpanded = true;
|
|
742
757
|
|
|
743
|
-
|
|
758
|
+
GDKLocalBuild.BuildInfo info = ab.listBuild[bIndex];
|
|
744
759
|
|
|
745
760
|
EditorGUI.BeginChangeCheck();
|
|
746
761
|
{
|
|
@@ -753,7 +768,7 @@ namespace Amanotes.Editor
|
|
|
753
768
|
r.width = Screen.width;
|
|
754
769
|
r.height = 16f;
|
|
755
770
|
|
|
756
|
-
|
|
771
|
+
GDKLocalBuild.DrawRect(r, new Color32(20, 20, 20, 255));
|
|
757
772
|
|
|
758
773
|
r.xMin += 12f;
|
|
759
774
|
GUI.Label(r, info.buildName);
|
|
@@ -782,7 +797,7 @@ namespace Amanotes.Editor
|
|
|
782
797
|
var nBuilds = 0;
|
|
783
798
|
for (var i = 0; i < ab.listBuild.Count; i++)
|
|
784
799
|
{
|
|
785
|
-
|
|
800
|
+
GDKLocalBuild.BuildInfo item = ab.listBuild[i];
|
|
786
801
|
|
|
787
802
|
if (!item.enable) continue;
|
|
788
803
|
nBuilds++;
|
|
@@ -800,7 +815,7 @@ namespace Amanotes.Editor
|
|
|
800
815
|
{
|
|
801
816
|
if (GUILayout.Button("Build"))
|
|
802
817
|
{
|
|
803
|
-
ab.buildRQ =
|
|
818
|
+
ab.buildRQ = GDKLocalBuild.BuildRequestTS.Generate(); //ab.runGitPostBuild
|
|
804
819
|
ab.ProcessBuild();
|
|
805
820
|
}
|
|
806
821
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -13,7 +13,7 @@ namespace Amanotes.Core.Internal
|
|
|
13
13
|
[HideInInspector] [SerializeField] internal bool enabled = true;
|
|
14
14
|
[NonSerialized] internal string adapterId;
|
|
15
15
|
[NonSerialized] internal string adapterVersion;
|
|
16
|
-
[NonSerialized] internal
|
|
16
|
+
[NonSerialized] protected internal Status status = Status.None;
|
|
17
17
|
|
|
18
18
|
protected abstract void Init(Action<bool> onComplete);
|
|
19
19
|
|