Skip to content

Commit 2e3034c

Browse files
committed
refactor(pkg): rename packages to com.onesignal.unitysdk.*
1 parent f35eaa7 commit 2e3034c

398 files changed

Lines changed: 936 additions & 498 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: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@
99
ROOT = Path(__file__).resolve().parents[2]
1010
DEMO = ROOT / "examples/demo"
1111
BOOTSTRAP = ROOT / "examples/demo/Assets/OneSignal"
12-
SAMPLE = ROOT / "com.onesignal.unity.core/Samples~"
12+
SAMPLE = ROOT / "com.onesignal.unitysdk.core/Samples~"
1313
INVENTORY = BOOTSTRAP / "Editor/Resources/OneSignalFileInventory.asset"
14+
PACKAGE_NAMES = (
15+
"com.onesignal.unitysdk.core",
16+
"com.onesignal.unitysdk.android",
17+
"com.onesignal.unitysdk.ios",
18+
)
19+
CORE_PACKAGE = PACKAGE_NAMES[0]
20+
MINIMUM_UNITY_VERSION = "2022.3"
1421

1522
EXCLUDED_PREFIXES = (
1623
"Assets/OneSignal/Attribution",
@@ -64,6 +71,41 @@ def validate_inventory() -> None:
6471
)
6572

6673

74+
def validate_packages() -> None:
75+
packages = {
76+
name: json.loads((ROOT / name / "package.json").read_text())
77+
for name in PACKAGE_NAMES
78+
}
79+
core_version = packages[CORE_PACKAGE]["version"]
80+
81+
for name, package in packages.items():
82+
if package.get("name") != name:
83+
fail(f"{name}/package.json name does not match its folder")
84+
if package.get("version") != core_version:
85+
fail(f"{name} version does not match {CORE_PACKAGE}")
86+
if package.get("unity") != MINIMUM_UNITY_VERSION:
87+
fail(f"{name} does not support Unity {MINIMUM_UNITY_VERSION}")
88+
if package.get("license") != "SEE LICENSE IN LICENSE.md":
89+
fail(f"{name} does not reference its package license")
90+
if not package.get("documentationUrl", "").startswith("https://"):
91+
fail(f"{name} does not have an HTTPS documentation URL")
92+
if not package.get("repository", {}).get("url", "").startswith("https://"):
93+
fail(f"{name} does not have an HTTPS repository URL")
94+
if name != CORE_PACKAGE:
95+
if package.get("dependencies", {}).get(CORE_PACKAGE) != core_version:
96+
fail(f"{name} does not depend on {CORE_PACKAGE}@{core_version}")
97+
if package.get("samples"):
98+
fail(f"{name} must not contain samples")
99+
100+
manifest = json.loads((DEMO / "Packages/manifest.json").read_text())
101+
if manifest.get("scopedRegistries"):
102+
fail("demo requires a scoped registry")
103+
for name in PACKAGE_NAMES:
104+
expected_path = f"file:../../../{name}"
105+
if manifest["dependencies"].get(name) != expected_path:
106+
fail(f"demo does not reference {name} at {expected_path}")
107+
108+
67109
def validate_sample() -> None:
68110
for filename, expected_guid in REQUIRED_SAMPLE_GUIDS.items():
69111
path = SAMPLE / filename
@@ -91,11 +133,11 @@ def validate_sample() -> None:
91133
if not required_references.issubset(asmdef["references"]):
92134
fail("sample assembly is missing required references")
93135

94-
package = json.loads((ROOT / "com.onesignal.unity.core/package.json").read_text())
136+
package = json.loads((ROOT / CORE_PACKAGE / "package.json").read_text())
95137
if not any(sample.get("path") == "Samples~" for sample in package.get("samples", [])):
96138
fail("core package does not register Samples~")
97139
if not any(
98-
version.get("name") == "com.onesignal.unity.core"
140+
version.get("name") == "com.onesignal.unitysdk.core"
99141
and version.get("expression") == package["version"]
100142
and version.get("define") == "ONE_SIGNAL_INSTALLED"
101143
for version in asmdef.get("versionDefines", [])
@@ -111,6 +153,7 @@ def main() -> None:
111153
if not (BOOTSTRAP / "Documentation").is_dir():
112154
fail("exportable bootstrap documentation is missing")
113155
validate_inventory()
156+
validate_packages()
114157
validate_sample()
115158
print("Unity distribution layout is valid.")
116159

.github/workflows/cd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Determine npm tag
3838
id: npm-tag
3939
run: |
40-
VERSION=$(node -p "require('./com.onesignal.unity.core/package.json').version")
40+
VERSION=$(node -p "require('./com.onesignal.unitysdk.core/package.json').version")
4141
echo "Detected version: $VERSION"
4242
echo "version=$VERSION" >> $GITHUB_OUTPUT
4343
TAG=""
@@ -72,9 +72,9 @@ jobs:
7272
fi
7373
cd ..
7474
}
75-
publish_pkg com.onesignal.unity.core
76-
publish_pkg com.onesignal.unity.android
77-
publish_pkg com.onesignal.unity.ios
75+
publish_pkg com.onesignal.unitysdk.core
76+
publish_pkg com.onesignal.unitysdk.android
77+
publish_pkg com.onesignal.unitysdk.ios
7878
7979
create_github_release:
8080
needs: publish

.github/workflows/create-release-pr.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ jobs:
8989
9090
# Get versions from target branch (not the release branch)
9191
CURRENT_VERSION=$(git show origin/${{ inputs.target_branch }}:examples/demo/Assets/OneSignal/VERSION | tr -d '\n\r' | xargs)
92-
ANDROID_VERSION=$(git show origin/${{ inputs.target_branch }}:com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.cs | grep -oE 'Version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
93-
IOS_VERSION=$(git show origin/${{ inputs.target_branch }}:com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.cs | grep -oE 'Version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
92+
ANDROID_VERSION=$(git show origin/${{ inputs.target_branch }}:com.onesignal.unitysdk.android/Editor/OneSignalAndroidDependencies.cs | grep -oE 'Version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
93+
IOS_VERSION=$(git show origin/${{ inputs.target_branch }}:com.onesignal.unitysdk.ios/Editor/OneSignaliOSDependencies.cs | grep -oE 'Version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
9494
echo "unity_from=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
9595
echo "android_from=${ANDROID_VERSION}" >> $GITHUB_OUTPUT
9696
echo "ios_from=${IOS_VERSION}" >> $GITHUB_OUTPUT
@@ -109,7 +109,7 @@ jobs:
109109
sleep 30
110110
done
111111
if [ "$FOUND" != "true" ]; then echo "✗ Android SDK version ${VERSION} not found after 5 attempts"; exit 1; fi
112-
sed -i -E "s/const string Version = \"[0-9][0-9.]*\"/const string Version = \"$VERSION\"/" com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.cs
112+
sed -i -E "s/const string Version = \"[0-9][0-9.]*\"/const string Version = \"$VERSION\"/" com.onesignal.unitysdk.android/Editor/OneSignalAndroidDependencies.cs
113113
sed -i -E "s/<androidPackage spec=\"com\.onesignal:OneSignal:[0-9][0-9.]*\"/<androidPackage spec=\"com.onesignal:OneSignal:$VERSION\"/" examples/demo/Assets/OneSignal/Editor/OneSignalAndroidDependencies.xml
114114
sed -i -E "s/'com\.onesignal:OneSignal:[0-9][0-9.]*'/'com.onesignal:OneSignal:$VERSION'/" examples/demo/Assets/Plugins/Android/mainTemplate.gradle
115115
sed -i -E "s/<package>com\.onesignal:OneSignal:[0-9][0-9.]*<\/package>/<package>com.onesignal:OneSignal:$VERSION<\/package>/" examples/demo/ProjectSettings/AndroidResolverDependencies.xml
@@ -133,7 +133,7 @@ jobs:
133133
sleep 30
134134
done
135135
if [ "$FOUND" != "true" ]; then echo "✗ iOS SDK version ${VERSION} not found after 5 attempts"; exit 1; fi
136-
sed -i -E "s/const string Version = \"[0-9][0-9.]*\"/const string Version = \"$VERSION\"/" com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.cs
136+
sed -i -E "s/const string Version = \"[0-9][0-9.]*\"/const string Version = \"$VERSION\"/" com.onesignal.unitysdk.ios/Editor/OneSignaliOSDependencies.cs
137137
sed -i -E "s/version=\"[0-9][0-9.]*\"/version=\"$VERSION\"/" examples/demo/Assets/OneSignal/Editor/OneSignaliOSDependencies.xml
138138
139139
# Only commit if there are changes
@@ -145,18 +145,18 @@ jobs:
145145
run: |
146146
PADDED_VERSION=$(echo "${{ inputs.unity_version }}" | awk -F. '{printf "%02d%02d%02d", $1, $2, $3}')
147147
printf "%s" "${{ inputs.unity_version }}" > examples/demo/Assets/OneSignal/VERSION
148-
for file in com.onesignal.unity.core/package.json com.onesignal.unity.android/package.json com.onesignal.unity.ios/package.json; do
148+
for file in com.onesignal.unitysdk.core/package.json com.onesignal.unitysdk.android/package.json com.onesignal.unitysdk.ios/package.json; do
149149
sed -i "s/\"version\": \".*\"/\"version\": \"${{ inputs.unity_version }}\"/" "$file"
150-
sed -i "s/\"com.onesignal.unity.core\": \".*\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/" "$file"
150+
sed -i "s/\"com.onesignal.unitysdk.core\": \".*\"/\"com.onesignal.unitysdk.core\": \"${{ inputs.unity_version }}\"/" "$file"
151151
done
152-
sed -i "s/public const string Version = \".*\"/public const string Version = \"${{ inputs.unity_version }}\"/" com.onesignal.unity.core/Runtime/OneSignal.cs
153-
sed -i "s/public const string VersionHeader = \".*\"/public const string VersionHeader = \"${PADDED_VERSION}\"/" com.onesignal.unity.core/Runtime/OneSignalPlatform.cs
154-
for asm in examples/demo/Assets/OneSignal/Editor/OneSignal.UnityPackage.Editor.asmdef examples/demo/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef com.onesignal.unity.core/Samples~/OneSignal.UnityPackage.Example.asmdef; do
152+
sed -i "s/public const string Version = \".*\"/public const string Version = \"${{ inputs.unity_version }}\"/" com.onesignal.unitysdk.core/Runtime/OneSignal.cs
153+
sed -i "s/public const string VersionHeader = \".*\"/public const string VersionHeader = \"${PADDED_VERSION}\"/" com.onesignal.unitysdk.core/Runtime/OneSignalPlatform.cs
154+
for asm in examples/demo/Assets/OneSignal/Editor/OneSignal.UnityPackage.Editor.asmdef examples/demo/Assets/OneSignal/Attribution/OneSignal.UnityPackage.Attribution.asmdef com.onesignal.unitysdk.core/Samples~/OneSignal.UnityPackage.Example.asmdef; do
155155
sed -i "s/\"expression\": \".*\"/\"expression\": \"${{ inputs.unity_version }}\"/" "$asm"
156156
done
157-
sed -i "s/\"com.onesignal.unity.core\": \"[0-9.]\+\"/\"com.onesignal.unity.core\": \"${{ inputs.unity_version }}\"/g" examples/demo/Packages/packages-lock.json
157+
sed -i "s/\"com.onesignal.unitysdk.core\": \"[0-9.]\+\"/\"com.onesignal.unitysdk.core\": \"${{ inputs.unity_version }}\"/g" examples/demo/Packages/packages-lock.json
158158
sed -i "s/bundleVersion: .*/bundleVersion: ${{ inputs.unity_version }}/" examples/demo/ProjectSettings/ProjectSettings.asset
159-
sed -i "s/setSdkVersion:@\"[0-9]*\"/setSdkVersion:@\"${PADDED_VERSION}\"/" com.onesignal.unity.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm
159+
sed -i "s/setSdkVersion:@\"[0-9]*\"/setSdkVersion:@\"${PADDED_VERSION}\"/" com.onesignal.unitysdk.ios/Runtime/Plugins/iOS/UIApplication+OneSignalUnity.mm
160160
161161
# Only commit if there are changes
162162
git add -A

.github/workflows/e2e.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
- name: Resolve OneSignal Android SDK version
5959
id: android-sdk-version
6060
run: |
61-
VERSION=$(grep -oE 'Version = "[0-9]+\.[0-9]+\.[0-9]+"' com.onesignal.unity.android/Editor/OneSignalAndroidDependencies.cs | head -n1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
61+
VERSION=$(grep -oE 'Version = "[0-9]+\.[0-9]+\.[0-9]+"' com.onesignal.unitysdk.android/Editor/OneSignalAndroidDependencies.cs | head -n1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
6262
if [ -z "$VERSION" ]; then
6363
echo "::error::Could not parse OneSignal Android SDK version from OneSignalAndroidDependencies.cs"
6464
exit 1
@@ -149,7 +149,7 @@ jobs:
149149
uses: actions/cache@v5
150150
with:
151151
path: examples/demo/Build/iOS-DerivedData
152-
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/Packages/manifest.json', 'examples/demo/Assets/csc.rsp', 'examples/demo/ProjectSettings/ProjectVersion.txt', 'examples/demo/ProjectSettings/ProjectSettings.asset', 'com.onesignal.unity.ios/Editor/**', 'com.onesignal.unity.core/Editor/**', 'examples/demo/iOS/ExportOptions.plist') }}
152+
key: deriveddata-${{ runner.os }}-${{ hashFiles('examples/demo/Packages/manifest.json', 'examples/demo/Assets/csc.rsp', 'examples/demo/ProjectSettings/ProjectVersion.txt', 'examples/demo/ProjectSettings/ProjectSettings.asset', 'com.onesignal.unitysdk.ios/Editor/**', 'com.onesignal.unitysdk.core/Editor/**', 'examples/demo/iOS/ExportOptions.plist') }}
153153
restore-keys: deriveddata-${{ runner.os }}-
154154

155155
- name: Export Xcode project from Unity

ASSET_STORE_PACKAGES.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Unity Asset Store packages
2+
3+
The multi-package Unity Asset Store product starts at SDK version `6.0.0`.
4+
This major-version cutover changes the package identifiers:
5+
6+
- `com.onesignal.unitysdk.core`
7+
- `com.onesignal.unitysdk.android`
8+
- `com.onesignal.unitysdk.ios`
9+
10+
Android and iOS depend on the exact same version of Core. The Full Usage
11+
sample is distributed only with Core. All packages require Unity 2022.3 or
12+
newer.
13+
14+
## Release verification
15+
16+
Before uploading a release:
17+
18+
1. Run `python3 .github/scripts/validate-unity-distribution.py`.
19+
2. Pack and sign each package with the OneSignal Unity organization through
20+
Asset Store Publishing Tools.
21+
3. Confirm each signed tarball contains `.attestation.p7m`.
22+
4. Run Unity package validation for every tarball.
23+
5. Upload each tarball to the matching technical name in the existing
24+
multi-package draft.
25+
6. Install the draft product in clean Unity 2022.3 and current Unity 6
26+
projects. Verify dependency resolution, valid signatures, the Core Full
27+
Usage sample, and the absence of duplicate assemblies or missing scripts.
28+
29+
Migration and deprecation of the legacy `com.onesignal.unity.*` npm packages
30+
are handled separately from this package cutover.

MIGRATION_GUIDE_v2_to_v3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ OneSignal.Default.Initialize("your_app_id");
160160

161161
We also now include a prefab for codeless initialization!
162162

163-
Located in the `com.onesignal.unity.core` package we've include a simple prefab which initializes OneSignal. You can easily find it using the Asset search bar to find `OneSignalController.prefab` and making sure to select All** or **In Packages** for your search option. Drag the prefab into your very first scene, fill in the **App Id, and you are immediately ready to go!
163+
Located in the `com.onesignal.unitysdk.core` package we've include a simple prefab which initializes OneSignal. You can easily find it using the Asset search bar to find `OneSignalController.prefab` and making sure to select All** or **In Packages** for your search option. Drag the prefab into your very first scene, fill in the **App Id, and you are immediately ready to go!
164164

165165
#### Debugging
166166
Set the log and alert levels

README.md

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -62,58 +62,18 @@ You must generate the appropriate credentials for the platform(s) you are releas
6262
- Amazon Fire - [Generate an Amazon API Key](https://documentation.onesignal.com/docs/generate-an-amazon-api-key)
6363

6464
## Installation
65-
There are two methods of installation available for the OneSignal Unity SDK:
6665
> **Upgrading from 2.x.x to 3.x.x?**</br>
6766
> Please check out our [v2 to v3 migration guide](MIGRATION_GUIDE_v2_to_v3.md).
6867
6968
> **Upgrading from 3.x.x to 5.x.x?**</br>
7069
> Please check out our [v3 to v5 migration guide](MIGRATION_GUIDE_v3_to_v5.md).
7170
72-
<details>
73-
<summary><b>Unity Asset Store</b> <i>(click to expand)</i></summary>
74-
7571
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).
7672
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.
77-
3. On the SDK's listing in the Editor click the **Download** button. When it finishes click **Import**.
78-
79-
![onesignal unity sdk in my assets](examples/demo/Assets/OneSignal/Documentation/asset_listing.png)
80-
81-
4. A prompt to import all of the files of the OneSignal Unity SDK will appear. Click **Import** to continue and compile the scripts into your project.
82-
5. Navigate to **Window > OneSignal SDK Setup** (or follow the popup if upgrading) in the Unity Editor which will bring up a window with some final steps which need
83-
to be completed in order to finalize the installation. The most important of these steps is **Import OneSignal packages**.
84-
85-
> *Depending on your project configuration and if you are upgrading from a previous version, some of these steps may already be marked as "completed"*
86-
87-
![sdk setup steps window](examples/demo/Assets/OneSignal/Documentation/setup_window.png)
88-
89-
6. After importing the packages Unity will notify you that a new registry has been added and the **OneSignal SDK Setup** window will have refreshed with a few additional
90-
steps. Following these will finalize your installation of the OneSignal Unity SDK.
91-
</details>
92-
93-
<details>
94-
<summary><b>Unity Package Manager</b> <i>(click to expand)</i></summary>
95-
96-
1. From within the Unity Editor navigate to **Edit > Project Settings** and then to the **Package Manager** settings tab.
97-
98-
![unity registry manager](examples/demo/Assets/OneSignal/Documentation/package_manager_tab.png)
99-
100-
2. Create a *New Scoped Registry* by entering
101-
```
102-
Name npmjs
103-
URL https://registry.npmjs.org
104-
Scope(s) com.onesignal
105-
```
106-
and click **Save**.
107-
3. Open the **Window > Package Manager** and switch to **My Registries** via the **Packages:** dropdown menu. You will see all of the OneSignal Unity SDK packages available
108-
on which you can then click **Install** for the platforms you would like to include. Dependencies will be added automatically.
109-
4. Once the packages have finished importing you will find a new menu under **Window > OneSignal SDK Setup**. Open it and you will find some final steps which need to be completed
110-
in order to finalize the installation.
111-
112-
> *Depending on your project configuration and if you are upgrading from a previous version, some of these steps may already be marked as "completed"*
113-
114-
![my registries menu selection](examples/demo/Assets/OneSignal/Documentation/registry_menu.png)
73+
3. Install **OneSignal SDK Android** and/or **OneSignal SDK iOS** from the product. Unity installs **OneSignal SDK Core** automatically as a dependency.
74+
4. Open **Window > OneSignal SDK Setup** and complete the remaining platform setup steps.
11575

116-
</details>
76+
No scoped npm registry is required.
11777

11878
## Platform Configuration
11979
### iOS
@@ -147,7 +107,7 @@ After building in Unity and exporting the XCode project follow these steps:
147107
Most of the Android setup was already handled during installation!
148108

149109
The only thing remaining is to setup your own notification icons. You can do this be replacing the example icons located at `Assets/Plugins/Android/OneSignalConfig.androidlib/src/main/res`
150-
with your own. There is a complete guide for this [in the plugin's README](com.onesignal.unity.android/Editor/OneSignalConfig.androidlib/README.md). See our
110+
with your own. There is a complete guide for this [in the plugin's README](com.onesignal.unitysdk.android/Editor/OneSignalConfig.androidlib/README.md). See our
151111
[Customize Notification Icons](https://documentation.onesignal.com/docs/customize-notification-icons) page for additional details.
152112

153113
### Disable Location Module (Optional)
@@ -172,7 +132,7 @@ For a compact implementation of the major SDK features, open **Window > Package
172132

173133
### Initialization
174134
#### Prefab
175-
Located in the `com.onesignal.unity.core` package we've include a simple prefab which initializes OneSignal. You can easily find it using the Asset search bar
135+
Located in the `com.onesignal.unitysdk.core` package we've include a simple prefab which initializes OneSignal. You can easily find it using the Asset search bar
176136
to find `OneSignalController.prefab` and making sure to select **All** or **In Packages** for your search option. Drag the prefab into your very first scene, fill
177137
in the **App Id**, and you are immediately ready to go!
178138

0 commit comments

Comments
 (0)