Skip to content

Commit 2f06287

Browse files
authored
Update upmsync.yml
0 parents  commit 2f06287

File tree

179 files changed

+11786
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+11786
-0
lines changed

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Changelog for com.google.android.appbundle
2+
3+
## [1.4.0] - 2021-03-08
4+
### New Features
5+
- Updated bundletool-all.jar from 1.2.0 to 1.5.0
6+
### Bug Fixes
7+
- Fixed issue #69: add a random name to temporary build path
8+
- Fixed issue #74: update bundletool-all.jar with fix
9+
- Fixed issue #82: pass "-Duser.language=en" to jarsigner
10+
11+
## [1.3.0] - 2020-09-30
12+
### New Features
13+
- Updated bundletool-all.jar from 1.0.0 to 1.2.0
14+
### Bug Fixes
15+
- Skip signing app bundles if no signing key is configured, instead of using a debug key (This reduces build time and provides a workaround if jarsigner is freezing)
16+
- Switch build-bundle to use new "--overwrite" flag (Fixes an issue on some systems where the build would fail unless an existing .aab was present)
17+
18+
## [1.2.0] - 2020-07-27
19+
### New Features
20+
- Fixed issue #26: Add support for packaging raw assets targeted by texture format
21+
- Updated bundletool-all.jar from 0.14.0 to 1.0.0
22+
### Bug Fixes
23+
- Support signing app bundles larger than 4GB by switching to jarsigner
24+
25+
## [1.1.1] - 2020-06-08
26+
### Bug Fixes
27+
- Clear the EditorUserBuildSettings.exportAsGoogleAndroidProject flag for AAB builds and Build & Run
28+
29+
## [1.1.0] - 2020-05-04
30+
### New Features
31+
- Updated bundletool-all.jar from 0.13.0 to 0.14.0
32+
- Updated documentation and menu item links
33+
### Bug Fixes
34+
- Fixed issue #11: the package now compiles even if the Android platform isn't installed
35+
36+
## [1.0.0] - 2020-03-17
37+
### New Features
38+
- Initial release
39+
- Includes bundletool-all.jar version 0.13.0
40+

CHANGELOG.md.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Documentation~/index.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Google Android App Bundle Plugin for Unity
2+
3+
*com.google.android.appbundle*
4+
5+
## Overview
6+
7+
The Google Android App Bundle package provides access to the latest Android
8+
App Bundles features, such as Play Asset Delivery.
9+
10+
Refer to the
11+
[documentation](//developer.android.com/guide/app-bundle/asset-delivery/build-unity)
12+
and
13+
[Editor API reference](//developer.android.com/reference/unity/namespace/Google/Android/AppBundle/Editor)
14+
for more information.

Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "Google.Android.AppBundle.Editor",
3+
"includePlatforms": [
4+
"Editor"
5+
]
6+
}

Editor/Google.Android.AppBundle.Editor.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Scripts.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/Scripts/AndroidAppBundle.cs

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// In the Unity 2017 series the EditorUserBuildSettings.buildAppBundle field was introduced in 2017.4.17.
16+
// It might seem preferable to modify buildAppBundle using reflection, but the field is extern.
17+
// Instead check for quite a few versions in the 2017.4.17+ series.
18+
// NOTE: this supports up to UNITY_2017_4_50 and will have to be extended if additional versions are released.
19+
20+
#if UNITY_2018_3_OR_NEWER || UNITY_2017_4_17 || UNITY_2017_4_18 || UNITY_2017_4_19 || UNITY_2017_4_20 || UNITY_2017_4_21 || UNITY_2017_4_22 || UNITY_2017_4_23 || UNITY_2017_4_24 || UNITY_2017_4_25 || UNITY_2017_4_26 || UNITY_2017_4_27 || UNITY_2017_4_28 || UNITY_2017_4_29 || UNITY_2017_4_30 || UNITY_2017_4_31 || UNITY_2017_4_32 || UNITY_2017_4_33 || UNITY_2017_4_34 || UNITY_2017_4_35 || UNITY_2017_4_36 || UNITY_2017_4_37 || UNITY_2017_4_38 || UNITY_2017_4_39 || UNITY_2017_4_40 || UNITY_2017_4_41 || UNITY_2017_4_42 || UNITY_2017_4_43 || UNITY_2017_4_44 || UNITY_2017_4_45 || UNITY_2017_4_46 || UNITY_2017_4_47 || UNITY_2017_4_48 || UNITY_2017_4_49 || UNITY_2017_4_50
21+
#define GOOGLE_ANDROID_APP_BUNDLE_HAS_NATIVE_SUPPORT
22+
using UnityEditor;
23+
#endif
24+
using System;
25+
using System.Text.RegularExpressions;
26+
using Google.Android.AppBundle.Editor.Internal.Utils;
27+
28+
namespace Google.Android.AppBundle.Editor
29+
{
30+
/// <summary>
31+
/// Provides utilities related to
32+
/// <a href="https://developer.android.com/platform/technology/app-bundle/">Android App Bundle</a>.
33+
/// </summary>
34+
public static class AndroidAppBundle
35+
{
36+
/// <summary>
37+
/// The base module contains the Unity game engine.
38+
/// </summary>
39+
public const string BaseModuleName = "base";
40+
41+
/// <summary>
42+
/// Regex used to determine whether a module name is valid.
43+
/// See https://github.com/google/bundletool/blob/master/src/main/java/com/android/tools/build/bundletool/model/BundleModuleName.java#L38
44+
/// </summary>
45+
private static readonly Regex NameRegex = RegexHelper.CreateCompiled(@"^[a-zA-Z][a-zA-Z0-9_]*$");
46+
47+
/// <summary>
48+
/// Returns true if the specified name is a valid Android App Bundle module name, false otherwise.
49+
/// The name "base" is reserved for the base module, so also return false in that case.
50+
/// </summary>
51+
public static bool IsValidModuleName(string name)
52+
{
53+
// TODO(b/131241163): enforce a name length limit if we make it much smaller than 65535.
54+
return name != null
55+
&& NameRegex.IsMatch(name)
56+
&& !name.Equals(BaseModuleName, StringComparison.OrdinalIgnoreCase);
57+
}
58+
59+
/// <summary>
60+
/// Returns true if this version of the Unity Editor has native support for building an Android App Bundle,
61+
/// and false otherwise.
62+
/// </summary>
63+
public static bool HasNativeBuildSupport()
64+
{
65+
#if GOOGLE_ANDROID_APP_BUNDLE_HAS_NATIVE_SUPPORT
66+
return true;
67+
#else
68+
return false;
69+
#endif
70+
}
71+
72+
/// <summary>
73+
/// Returns EditorUserBuildSettings.buildAppBundle if it is defined and false otherwise.
74+
/// </summary>
75+
public static bool IsNativeBuildEnabled()
76+
{
77+
#if GOOGLE_ANDROID_APP_BUNDLE_HAS_NATIVE_SUPPORT
78+
return EditorUserBuildSettings.buildAppBundle;
79+
#else
80+
return false;
81+
#endif
82+
}
83+
84+
/// <summary>
85+
/// Enable the EditorUserBuildSettings.buildAppBundle field if it is defined.
86+
/// </summary>
87+
public static void EnableNativeBuild()
88+
{
89+
#if GOOGLE_ANDROID_APP_BUNDLE_HAS_NATIVE_SUPPORT
90+
EditorUserBuildSettings.buildAppBundle = true;
91+
#endif
92+
}
93+
94+
/// <summary>
95+
/// Disable the EditorUserBuildSettings.buildAppBundle field if it is defined.
96+
/// </summary>
97+
public static void DisableNativeBuild()
98+
{
99+
#if GOOGLE_ANDROID_APP_BUNDLE_HAS_NATIVE_SUPPORT
100+
EditorUserBuildSettings.buildAppBundle = false;
101+
#endif
102+
}
103+
}
104+
}

Editor/Scripts/AndroidAppBundle.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using Google.Android.AppBundle.Editor.Internal.Config;
19+
using UnityEditor;
20+
21+
namespace Google.Android.AppBundle.Editor
22+
{
23+
/// <summary>
24+
/// Provides helper methods for accessing or persisting build-related settings.
25+
/// </summary>
26+
public static class AndroidBuildHelper
27+
{
28+
// Allowed characters for splitting PlayerSettings.GetScriptingDefineSymbolsForGroup().
29+
private static readonly char[] ScriptingDefineSymbolsSplitChars = {';', ',', ' '};
30+
31+
/// <summary>
32+
/// Returns an array of enabled scenes from the "Scenes In Build" section of Unity's Build Settings window.
33+
/// </summary>
34+
public static string[] GetEditorBuildEnabledScenes()
35+
{
36+
return EditorBuildSettings.scenes
37+
.Where(scene => scene.enabled && !string.IsNullOrEmpty(scene.path))
38+
.Select(scene => scene.path)
39+
.ToArray();
40+
}
41+
42+
/// <summary>
43+
/// Creates a <see cref="BuildPlayerOptions"/> for the specified output file path with all other fields set to
44+
/// reasonable default values.
45+
/// </summary>
46+
/// <param name="locationPathName">
47+
/// The output file that will be created when building a player with <see cref="BuildPipeline"/>.
48+
/// </param>
49+
/// <returns>A new <see cref="BuildPlayerOptions"/> object.</returns>
50+
public static BuildPlayerOptions CreateBuildPlayerOptions(string locationPathName)
51+
{
52+
return new BuildPlayerOptions
53+
{
54+
assetBundleManifestPath = AndroidBuildConfiguration.AssetBundleManifestPath,
55+
locationPathName = locationPathName,
56+
options = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None,
57+
scenes = GetEditorBuildEnabledScenes(),
58+
target = BuildTarget.Android,
59+
targetGroup = BuildTargetGroup.Android
60+
};
61+
}
62+
63+
/// <summary>
64+
/// Adds the specified scripting define symbol for Android, but only if it isn't already defined.
65+
/// </summary>
66+
public static void AddScriptingDefineSymbol(string symbol)
67+
{
68+
var scriptingDefineSymbols = GetScriptingDefineSymbols();
69+
if (!IsScriptingSymbolDefined(scriptingDefineSymbols, symbol))
70+
{
71+
SetScriptingDefineSymbols(scriptingDefineSymbols.Concat(new[] {symbol}));
72+
}
73+
}
74+
75+
/// <summary>
76+
/// Removes the specified scripting define symbol if it exists.
77+
/// </summary>
78+
public static void RemoveScriptingDefineSymbol(string symbol)
79+
{
80+
var scriptingDefineSymbols = GetScriptingDefineSymbols();
81+
if (IsScriptingSymbolDefined(scriptingDefineSymbols, symbol))
82+
{
83+
SetScriptingDefineSymbols(scriptingDefineSymbols.Where(sym => sym != symbol));
84+
}
85+
}
86+
87+
/// <summary>
88+
/// Returns true if the specified scripting symbol is defined for Android.
89+
/// </summary>
90+
public static bool IsScriptingSymbolDefined(string symbol)
91+
{
92+
return IsScriptingSymbolDefined(GetScriptingDefineSymbols(), symbol);
93+
}
94+
95+
private static bool IsScriptingSymbolDefined(string[] scriptingDefineSymbols, string symbol)
96+
{
97+
return Array.IndexOf(scriptingDefineSymbols, symbol) >= 0;
98+
}
99+
100+
private static string[] GetScriptingDefineSymbols()
101+
{
102+
var symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android);
103+
if (string.IsNullOrEmpty(symbols))
104+
{
105+
return new string[0];
106+
}
107+
108+
return symbols.Split(ScriptingDefineSymbolsSplitChars, StringSplitOptions.RemoveEmptyEntries);
109+
}
110+
111+
private static void SetScriptingDefineSymbols(IEnumerable<string> scriptingDefineSymbols)
112+
{
113+
var symbols = string.Join(";", scriptingDefineSymbols.ToArray());
114+
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, symbols);
115+
}
116+
}
117+
}

0 commit comments

Comments
 (0)