Skip to content

Commit b6400b1

Browse files
author
Alex Ames
committed
Added user agent string for build source to unity builds.
Like the C++ libraries, Unity libraries now have the option to declare whether they were built from a Github Actions (in other words, whether they're an official release) or whether they're custom built.
1 parent 80c6e58 commit b6400b1

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ option(FIREBASE_INCLUDE_STORAGE
5252
option(FIREBASE_UNITY_BUILD_TESTS
5353
"Enable the Firebase Unity Build Tests." OFF)
5454

55+
# This should only be enabled by the GitHub Action build script.
56+
option(FIREBASE_GITHUB_ACTION_BUILD
57+
"Indicates that this build was created from a GitHub Action" OFF)
58+
5559
# These options allow selecting what built outputs go into the CPack zip file
5660
# as we merge the different platform zip's together for unity package
5761
# For example: only packing dotnet libraries on linux builds

app/src/VersionInfoTemplate.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ internal class VersionInfo {
2222
/// @brief Retrieves the Firebase Unity SDK version number as a string.
2323
// "@FIREBASE_UNITY_SDK_VERSION@" is replaced at build time.
2424
internal static string SdkVersion { get { return "@FIREBASE_UNITY_SDK_VERSION@"; } }
25+
26+
/// @brief Retrieves a string indicating whether the SDK was built on github.
27+
internal static string BuildSource {
28+
get {
29+
#if FIREBASE_GITHUB_ACTION_BUILD
30+
return "github_action_built";
31+
#else
32+
return "custom_built";
33+
#endif
34+
}
35+
}
2536
}
2637

2738
} // namespace Firebase

app/src/swig/app.i

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,9 @@ static firebase::AppOptions* AppOptionsLoadFromJsonConfig(const char* config) {
903903
RegisterLibraryInternal(
904904
libraryPrefix + "-ver",
905905
Firebase.Platform.PlatformInformation.RuntimeVersion);
906+
// fire-(unity|mono)/<github-action-built|custom_built>
907+
RegisterLibraryInternal(
908+
libraryPrefix + "-buildsrc", Firebase.VersionInfo.BuildSource);
906909
}
907910
// Cache the name so that it can be accessed after the app is disposed.
908911
newProxy.name = newProxy.NameInternal;

0 commit comments

Comments
 (0)