Skip to content

Commit 210b51e

Browse files
authored
fix: [SDK-4927] migrate to Unity External Dependency Manager (#892)
1 parent 1518fe2 commit 210b51e

62 files changed

Lines changed: 112 additions & 5588 deletions

File tree

Some content is hidden

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

.github/scripts/validate-unity-distribution.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
ROOT = Path(__file__).resolve().parents[2]
1010
DEMO = ROOT / "examples/demo"
11+
DEMO_PROJECTS = (DEMO, ROOT / "examples/demo-no-location")
1112
BOOTSTRAP = ROOT / "examples/demo/Assets/OneSignal"
1213
SAMPLE = ROOT / "com.onesignal.unitysdk.core/Samples~"
1314
INVENTORY = BOOTSTRAP / "Editor/Resources/OneSignalFileInventory.asset"
@@ -17,6 +18,9 @@
1718
"com.onesignal.unitysdk.ios",
1819
)
1920
CORE_PACKAGE = PACKAGE_NAMES[0]
21+
PLATFORM_PACKAGES = PACKAGE_NAMES[1:]
22+
EDM_PACKAGE = "com.unity.external-dependency-manager"
23+
EDM_VERSION = "2.0.0"
2024
MINIMUM_UNITY_VERSION = "2022.3"
2125
MINIMUM_UNITY_RELEASE = "0f1"
2226

@@ -103,13 +107,23 @@ def validate_packages() -> None:
103107
if package.get("samples"):
104108
fail(f"{name} must not contain samples")
105109

106-
manifest = json.loads((DEMO / "Packages/manifest.json").read_text())
107-
if manifest.get("scopedRegistries"):
108-
fail("demo requires a scoped registry")
109-
for name in PACKAGE_NAMES:
110-
expected_path = f"file:../../../{name}"
111-
if manifest["dependencies"].get(name) != expected_path:
112-
fail(f"demo does not reference {name} at {expected_path}")
110+
for name in PLATFORM_PACKAGES:
111+
if packages[name].get("dependencies", {}).get(EDM_PACKAGE) != EDM_VERSION:
112+
fail(f"{name} does not depend on {EDM_PACKAGE}@{EDM_VERSION}")
113+
114+
legacy_installer = ROOT / CORE_PACKAGE / "Editor/SetupSteps/InstallEdm4uStep.cs"
115+
if legacy_installer.exists():
116+
fail(f"{legacy_installer.relative_to(ROOT)} installs unsupported Google EDM4U")
117+
118+
for project in DEMO_PROJECTS:
119+
project_name = project.relative_to(ROOT)
120+
manifest = json.loads((project / "Packages/manifest.json").read_text())
121+
if manifest.get("scopedRegistries"):
122+
fail(f"{project_name} must not declare a scoped registry")
123+
for name in PACKAGE_NAMES:
124+
expected_path = f"file:../../../{name}"
125+
if manifest["dependencies"].get(name) != expected_path:
126+
fail(f"{project_name} does not reference {name} at {expected_path}")
113127

114128

115129
def validate_sample() -> None:
@@ -152,6 +166,16 @@ def validate_sample() -> None:
152166

153167

154168
def main() -> None:
169+
for project in DEMO_PROJECTS:
170+
legacy_edm = project / "Assets/ExternalDependencyManager"
171+
if legacy_edm.exists():
172+
fail(f"{legacy_edm.relative_to(ROOT)} bundles unsupported Google EDM4U")
173+
settings_path = project / "ProjectSettings/ExternalDependencyManagerSettings.json"
174+
if not settings_path.is_file():
175+
fail(f"{settings_path.relative_to(ROOT)} is missing")
176+
settings = json.loads(settings_path.read_text())
177+
if not settings.get("edmEnabled"):
178+
fail(f"{settings_path.relative_to(ROOT)} does not enable Unity EDM")
155179
if (BOOTSTRAP / "Example").exists() or (BOOTSTRAP / "Example.meta").exists():
156180
fail("empty legacy Asset Store Example path still exists")
157181
if (BOOTSTRAP / "Documentation~").exists():

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ You must generate the appropriate credentials for the platform(s) you are releas
6868
> **Upgrading from 3.x.x to 5.x.x?**</br>
6969
> Please check out our [v3 to v5 migration guide](MIGRATION_GUIDE_v3_to_v5.md).
7070
71+
> **Upgrading to 6.x.x?**</br>
72+
> Version 6 uses [Unity's External Dependency Manager](https://docs.unity3d.com/Packages/com.unity.external-dependency-manager@2.0/manual/get-started-with-edm.html). If your project still contains Google's legacy EDM4U under `Assets/ExternalDependencyManager`, select **Use Unity's External Dependency Manager** when prompted. After confirming that your other plugins support Unity EDM, delete the legacy Assets installation so only one dependency manager remains.
73+
7174
1. Add the OneSignal Unity SDK as an available asset to your account by clicking **Add to My Assets** from [our listing on the Unity Asset Store](https://assetstore.unity.com/packages/add-ons/services/billing/onesignal-sdk-193316).
7275
2. Find the package waiting for you to download by clicking **Open in Unity** from that same page. This will open the Unity Editor and its Package Manager window.
7376
3. Install **OneSignal SDK Android** and/or **OneSignal SDK iOS** from the product. Unity installs **OneSignal SDK Core** automatically as a dependency.

com.onesignal.unitysdk.android/LICENSE.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,3 @@ Includes ShortcutBadger:
111111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112112
See the License for the specific language governing permissions and
113113
limitations under the License.
114-
115-
116-
Includes unity-jar-resolver
117-
Copyright (C) 2014 Google Inc.
118-
119-
Licensed under the Apache License, Version 2.0 (the "License");
120-
you may not use this file except in compliance with the License.
121-
You may obtain a copy of the License at
122-
123-
http://www.apache.org/licenses/LICENSE-2.0
124-
125-
Unless required by applicable law or agreed to in writing, software
126-
distributed under the License is distributed on an "AS IS" BASIS,
127-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128-
See the License for the specific language governing permissions and
129-
limitations under the License.

com.onesignal.unitysdk.android/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"unityRelease": "0f1",
77
"description": "Android platform implementation for the OneSignal Unity SDK, including native dependency resolution and notification resources.",
88
"dependencies": {
9-
"com.onesignal.unitysdk.core": "6.0.0"
9+
"com.onesignal.unitysdk.core": "6.0.0",
10+
"com.unity.external-dependency-manager": "2.0.0"
1011
},
1112
"keywords": [
1213
"push-notifications",

com.onesignal.unitysdk.core/Editor/SetupSteps/InstallEdm4uStep.cs

Lines changed: 0 additions & 148 deletions
This file was deleted.

com.onesignal.unitysdk.core/Editor/SetupSteps/InstallEdm4uStep.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

com.onesignal.unitysdk.core/LICENSE.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,3 @@ Includes ShortcutBadger:
111111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112112
See the License for the specific language governing permissions and
113113
limitations under the License.
114-
115-
116-
Includes unity-jar-resolver
117-
Copyright (C) 2014 Google Inc.
118-
119-
Licensed under the Apache License, Version 2.0 (the "License");
120-
you may not use this file except in compliance with the License.
121-
You may obtain a copy of the License at
122-
123-
http://www.apache.org/licenses/LICENSE-2.0
124-
125-
Unless required by applicable law or agreed to in writing, software
126-
distributed under the License is distributed on an "AS IS" BASIS,
127-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128-
See the License for the specific language governing permissions and
129-
limitations under the License.

com.onesignal.unitysdk.ios/Editor/BuildPostProcessor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public class BuildPostProcessor : IPostprocessBuildWithReport
9696
/// <summary>
9797
/// must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's
9898
/// added before "pod install" (50)
99-
/// https://github.com/googlesamples/unity-jar-resolver#appending-text-to-generated-podfile
10099
/// </summary>
101100
public int callbackOrder => 45;
102101

com.onesignal.unitysdk.ios/LICENSE.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,3 @@ Includes ShortcutBadger:
111111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112112
See the License for the specific language governing permissions and
113113
limitations under the License.
114-
115-
116-
Includes unity-jar-resolver
117-
Copyright (C) 2014 Google Inc.
118-
119-
Licensed under the Apache License, Version 2.0 (the "License");
120-
you may not use this file except in compliance with the License.
121-
You may obtain a copy of the License at
122-
123-
http://www.apache.org/licenses/LICENSE-2.0
124-
125-
Unless required by applicable law or agreed to in writing, software
126-
distributed under the License is distributed on an "AS IS" BASIS,
127-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128-
See the License for the specific language governing permissions and
129-
limitations under the License.

com.onesignal.unitysdk.ios/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"unityRelease": "0f1",
77
"description": "iOS platform implementation for the OneSignal Unity SDK, including the native bridge, CocoaPods dependencies, and Xcode post-processing.",
88
"dependencies": {
9-
"com.onesignal.unitysdk.core": "6.0.0"
9+
"com.onesignal.unitysdk.core": "6.0.0",
10+
"com.unity.external-dependency-manager": "2.0.0"
1011
},
1112
"keywords": [
1213
"push-notifications",

0 commit comments

Comments
 (0)