com.amanotes.gdk 0.2.66-6 → 0.2.66-8
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 +3 -0
- package/Editor/Extra/GDKCIBuildCommand.cs +123 -54
- package/Extra/AmaGDKInstaller.unitypackage +0 -0
- package/Extra/CheckDiskSpace.unitypackage +0 -0
- package/Extra/ForceUpdate.unitypackage +0 -0
- package/Extra/GoogleCMP.unitypackage +0 -0
- package/Extra/LegacyGDKUpdateHelper.unitypackage +0 -0
- package/Extra/PostProcessor.unitypackage +0 -0
- package/Packages/AmaGDKConfig.unitypackage +0 -0
- package/Packages/AmaGDKExample.unitypackage +0 -0
- package/Packages/AmaGDKTest.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.PurchaseConnector.unitypackage +0 -0
- package/Packages/AppsFlyerAdapter.unitypackage +0 -0
- package/Packages/FirebaseRemoteConfigAdapter.unitypackage +0 -0
- package/Packages/IronSourceAdapter.unitypackage +0 -0
- package/Packages/RevenueCatAdapter.unitypackage +0 -0
- package/Packages/SqliteAnalyticsAdapter.unitypackage +0 -0
- package/Runtime/Ad/AmaGDK.Ads.cs +1 -0
- package/Runtime/AmaGDK.cs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
using UnityEditor;
|
|
2
2
|
using System.Linq;
|
|
3
3
|
using System;
|
|
4
|
+
using System.Diagnostics;
|
|
4
5
|
using System.IO;
|
|
5
6
|
using UnityEditor.Build;
|
|
6
7
|
using UnityEditor.Build.Reporting;
|
|
7
8
|
using UnityEngine;
|
|
9
|
+
using Debug = UnityEngine.Debug;
|
|
8
10
|
|
|
9
11
|
namespace Amanotes.Core
|
|
10
12
|
{
|
|
@@ -15,11 +17,65 @@ namespace Amanotes.Core
|
|
|
15
17
|
private const string KEY_ALIAS_NAME = "KEY_ALIAS_NAME";
|
|
16
18
|
private const string KEYSTORE = "keystore.keystore";
|
|
17
19
|
private const string BUILD_OPTIONS_ENV_VAR = "BuildOptions";
|
|
18
|
-
private const string ANDROID_BUNDLE_VERSION_CODE = "VERSION_BUILD_VAR";
|
|
19
20
|
private const string ANDROID_APP_BUNDLE = "BUILD_APP_BUNDLE";
|
|
20
21
|
private const string SCRIPTING_BACKEND_ENV_VAR = "SCRIPTING_BACKEND";
|
|
22
|
+
private const string EXPORT_ANDROID_PROJECT = "EXPORT_ANDROID_PROJECT";
|
|
21
23
|
private const string VERSION_NUMBER_VAR = "VERSION_NUMBER_VAR";
|
|
22
|
-
private const string
|
|
24
|
+
private const string VERSION_BUILD_VAR = "VERSION_BUILD_VAR";
|
|
25
|
+
|
|
26
|
+
public static void InstallPod(EventHandler processExit, string buildPath = null)
|
|
27
|
+
{
|
|
28
|
+
try
|
|
29
|
+
{
|
|
30
|
+
string arguments = "";
|
|
31
|
+
if (Application.isBatchMode && TryGetEnv("CI_SCRIPT_DIR", out string scriptDir))
|
|
32
|
+
{
|
|
33
|
+
arguments = $"{scriptDir}/utils.sh pod-install";
|
|
34
|
+
}
|
|
35
|
+
else if (!Application.isBatchMode)
|
|
36
|
+
{
|
|
37
|
+
string podPath = "/usr/local/bin/pod";
|
|
38
|
+
if (!File.Exists(podPath)) podPath = "/opt/homebrew/bin/pod";
|
|
39
|
+
arguments = $"-c \"{podPath} install --project-directory={buildPath}\"";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Configure process start info
|
|
43
|
+
var startInfo = new ProcessStartInfo
|
|
44
|
+
{
|
|
45
|
+
FileName = "/bin/zsh",
|
|
46
|
+
Arguments = arguments,
|
|
47
|
+
CreateNoWindow = false,
|
|
48
|
+
RedirectStandardOutput = true,
|
|
49
|
+
RedirectStandardError = true,
|
|
50
|
+
UseShellExecute = false
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var proc = new Process
|
|
54
|
+
{
|
|
55
|
+
StartInfo = startInfo,
|
|
56
|
+
EnableRaisingEvents = true
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// Attach event handlers
|
|
60
|
+
proc.OutputDataReceived += (sender, args) =>
|
|
61
|
+
{
|
|
62
|
+
if (args.Data == null) return; // End of the stream
|
|
63
|
+
Debug.Log(args.Data);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
proc.Exited += processExit;
|
|
67
|
+
|
|
68
|
+
// Start the process
|
|
69
|
+
proc.Start();
|
|
70
|
+
proc.BeginOutputReadLine();
|
|
71
|
+
proc.BeginErrorReadLine();
|
|
72
|
+
proc.WaitForExit();
|
|
73
|
+
}
|
|
74
|
+
catch (Exception e)
|
|
75
|
+
{
|
|
76
|
+
Debug.LogError(e);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
23
79
|
|
|
24
80
|
static string GetArgument(string name)
|
|
25
81
|
{
|
|
@@ -185,21 +241,19 @@ namespace Amanotes.Core
|
|
|
185
241
|
var buildTarget = GetBuildTarget();
|
|
186
242
|
|
|
187
243
|
Console.WriteLine(":: Performing build");
|
|
188
|
-
if (TryGetEnv(VERSION_NUMBER_VAR, out
|
|
244
|
+
if (TryGetEnv(VERSION_NUMBER_VAR, out string bundleVersionNumber))
|
|
189
245
|
{
|
|
190
|
-
if (buildTarget == BuildTarget.iOS)
|
|
191
|
-
{
|
|
192
|
-
bundleVersionNumber = GetIosVersion();
|
|
193
|
-
}
|
|
194
246
|
Console.WriteLine($":: Setting bundleVersionNumber to '{bundleVersionNumber}' (Length: {bundleVersionNumber.Length})");
|
|
195
247
|
PlayerSettings.bundleVersion = bundleVersionNumber;
|
|
196
248
|
}
|
|
249
|
+
HandleBuildNumber(buildTarget);
|
|
197
250
|
|
|
198
251
|
if (buildTarget == BuildTarget.Android)
|
|
199
252
|
{
|
|
200
253
|
HandleAndroidAppBundle();
|
|
201
|
-
HandleAndroidBundleVersionCode();
|
|
202
254
|
HandleAndroidKeystore();
|
|
255
|
+
HandleDebugSymbols();
|
|
256
|
+
HandleExportAndroidProject();
|
|
203
257
|
}
|
|
204
258
|
|
|
205
259
|
var buildPath = GetBuildPath();
|
|
@@ -214,6 +268,7 @@ namespace Amanotes.Core
|
|
|
214
268
|
if (buildReport.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
|
215
269
|
throw new Exception($"Build ended with {buildReport.summary.result} status");
|
|
216
270
|
|
|
271
|
+
BuildMetadata.Save(buildPath, buildTarget);
|
|
217
272
|
Console.WriteLine(":: Done with build");
|
|
218
273
|
}
|
|
219
274
|
|
|
@@ -237,34 +292,34 @@ namespace Amanotes.Core
|
|
|
237
292
|
}
|
|
238
293
|
}
|
|
239
294
|
|
|
240
|
-
private static void
|
|
295
|
+
private static void HandleBuildNumber(BuildTarget buildTarget)
|
|
241
296
|
{
|
|
242
|
-
if (TryGetEnv(
|
|
297
|
+
if (!TryGetEnv(VERSION_BUILD_VAR, out string value)) return;
|
|
298
|
+
if (int.TryParse(value, out int version))
|
|
243
299
|
{
|
|
244
|
-
if (
|
|
300
|
+
if (buildTarget == BuildTarget.Android)
|
|
245
301
|
{
|
|
246
|
-
PlayerSettings.Android.bundleVersionCode = version;
|
|
247
|
-
Console.WriteLine($":: {ANDROID_BUNDLE_VERSION_CODE} env var detected, set the bundle version code to {value}.");
|
|
302
|
+
PlayerSettings.Android.bundleVersionCode = version;
|
|
248
303
|
}
|
|
249
|
-
else
|
|
250
|
-
|
|
304
|
+
else if (buildTarget == BuildTarget.iOS)
|
|
305
|
+
{
|
|
306
|
+
PlayerSettings.iOS.buildNumber = version.ToString();
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
Console.WriteLine($":: {VERSION_BUILD_VAR} env var detected, set the bundle version code to {value}.");
|
|
251
310
|
}
|
|
311
|
+
else
|
|
312
|
+
Console.WriteLine($":: {VERSION_BUILD_VAR} env var detected but the version value \"{value}\" is not an integer.");
|
|
252
313
|
}
|
|
253
314
|
|
|
254
|
-
private static
|
|
315
|
+
private static void HandleExportAndroidProject()
|
|
255
316
|
{
|
|
256
|
-
|
|
317
|
+
EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
|
|
318
|
+
if (!TryGetEnv(EXPORT_ANDROID_PROJECT, out string stringValue)) return;
|
|
319
|
+
if (bool.TryParse(stringValue, out bool exportAndroidProject))
|
|
257
320
|
{
|
|
258
|
-
|
|
259
|
-
{
|
|
260
|
-
Console.WriteLine($":: {VERSION_iOS} env var detected, set the version to {value}.");
|
|
261
|
-
return version.ToString();
|
|
262
|
-
}
|
|
263
|
-
else
|
|
264
|
-
Console.WriteLine($":: {VERSION_iOS} env var detected but the version value \"{value}\" is not an integer.");
|
|
321
|
+
EditorUserBuildSettings.exportAsGoogleAndroidProject = exportAndroidProject;
|
|
265
322
|
}
|
|
266
|
-
|
|
267
|
-
throw new ArgumentNullException(nameof(value), $":: Error finding {VERSION_iOS} env var");
|
|
268
323
|
}
|
|
269
324
|
|
|
270
325
|
private static void HandleAndroidKeystore()
|
|
@@ -311,44 +366,58 @@ namespace Amanotes.Core
|
|
|
311
366
|
PlayerSettings.Android.keystorePass = keystorePass;
|
|
312
367
|
PlayerSettings.Android.keyaliasPass = keystoreAliasPass;
|
|
313
368
|
}
|
|
369
|
+
|
|
370
|
+
private static void HandleDebugSymbols()
|
|
371
|
+
{
|
|
372
|
+
#if UNITY_2021_1_OR_NEWER
|
|
373
|
+
EditorUserBuildSettings.androidCreateSymbols = AndroidCreateSymbols.Debugging;
|
|
374
|
+
#elif UNITY_2019_2_OR_NEWER
|
|
375
|
+
EditorUserBuildSettings.androidCreateSymbolsZip = true;
|
|
376
|
+
#endif
|
|
377
|
+
}
|
|
314
378
|
}
|
|
315
379
|
|
|
316
|
-
|
|
380
|
+
[Serializable]
|
|
381
|
+
public class BuildMetadata
|
|
317
382
|
{
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
private static readonly string GRADLE_VERSION = "6.7.1";
|
|
322
|
-
#endif
|
|
323
|
-
private static readonly string GRADLE_ROOT = "/usr/local/gradle";
|
|
383
|
+
public string appVersion;
|
|
384
|
+
public string buildNumber;
|
|
385
|
+
public string buildTarget;
|
|
324
386
|
|
|
387
|
+
public static void Save(string buildPath, BuildTarget buildTarget)
|
|
388
|
+
{
|
|
389
|
+
string outputFile = Path.Combine(buildPath, "build_info.json");
|
|
390
|
+
|
|
391
|
+
var metadata = new BuildMetadata
|
|
392
|
+
{
|
|
393
|
+
appVersion = PlayerSettings.bundleVersion,
|
|
394
|
+
buildNumber = buildTarget == BuildTarget.Android ? PlayerSettings.Android.bundleVersionCode.ToString() : PlayerSettings.iOS.buildNumber,
|
|
395
|
+
buildTarget = buildTarget.ToString()
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
string json = JsonUtility.ToJson(metadata, prettyPrint: true);
|
|
399
|
+
File.WriteAllText(outputFile, json);
|
|
400
|
+
|
|
401
|
+
Console.WriteLine($":: Build information saved to {outputFile}");
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
public class GDKPreProcessBuild: IPreprocessBuildWithReport
|
|
406
|
+
{
|
|
325
407
|
public int callbackOrder
|
|
326
408
|
{
|
|
327
409
|
get { return 0; }
|
|
328
410
|
}
|
|
329
411
|
public void OnPreprocessBuild(BuildReport report)
|
|
330
412
|
{
|
|
331
|
-
if (report.summary.platform
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
{
|
|
340
|
-
EditorPrefs.SetString("GradlePath", envGradlePath);
|
|
341
|
-
Debug.Log("Update gradle path to: " + envGradlePath);
|
|
342
|
-
}
|
|
343
|
-
else
|
|
344
|
-
{
|
|
345
|
-
string gradlePath = GRADLE_ROOT + "/gradle-" + GRADLE_VERSION;
|
|
346
|
-
EditorPrefs.SetString("GradlePath", gradlePath);
|
|
347
|
-
Debug.Log("Update gradle path to: " + gradlePath);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
413
|
+
if (report.summary.platform != BuildTarget.Android) return;
|
|
414
|
+
// Change Gradle path when running in headless mode (CI Machine)
|
|
415
|
+
if (!Application.isBatchMode) return;
|
|
416
|
+
if (!GDKCIBuildCommand.TryGetEnv("GRADLE_PATH", out string envGradlePath)) return;
|
|
417
|
+
EditorPrefs.SetBool("GradleUseEmbedded", false);
|
|
418
|
+
EditorPrefs.SetString("GradlePath", envGradlePath);
|
|
419
|
+
Debug.Log("Update gradle path to: " + envGradlePath);
|
|
420
|
+
|
|
352
421
|
}
|
|
353
422
|
}
|
|
354
423
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/Runtime/Ad/AmaGDK.Ads.cs
CHANGED
|
@@ -318,6 +318,7 @@ namespace Amanotes.Core.Internal
|
|
|
318
318
|
{
|
|
319
319
|
protected AdShowContext context => Ads.context;
|
|
320
320
|
protected AdModuleConfig moduleConfig => Config.ad;
|
|
321
|
+
public Dictionary<string, object> userData => context?.userData;
|
|
321
322
|
|
|
322
323
|
// APIs
|
|
323
324
|
internal protected abstract AdLogic interstitial { get; }
|
package/Runtime/AmaGDK.cs
CHANGED
|
@@ -17,7 +17,7 @@ namespace Amanotes.Core
|
|
|
17
17
|
{
|
|
18
18
|
public partial class AmaGDK : MonoBehaviour
|
|
19
19
|
{
|
|
20
|
-
public const string VERSION = "0.2.66-
|
|
20
|
+
public const string VERSION = "0.2.66-8";
|
|
21
21
|
|
|
22
22
|
internal static Status _status = Status.None;
|
|
23
23
|
private static ConfigAsset _config = null;
|