Embed full version into PList

This commit is contained in:
Dan Balasescu
2025-07-23 17:27:41 +09:00
parent c72a6d929b
commit c91991a328
2 changed files with 13 additions and 9 deletions

View File

@@ -20,15 +20,9 @@ namespace osu.iOS
{
private readonly AppDelegate appDelegate;
public override Version AssemblyVersion
{
get
{
// Example: 2025.613.0-tachyon
string bundleVersion = NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString();
return new Version(bundleVersion.Split('-')[0]);
}
}
public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString());
public override string Version => NSBundle.MainBundle.InfoDictionary["OsuVersion"].ToString();
public override bool HideUnlicensedContent => true;

View File

@@ -22,4 +22,14 @@
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.3" />
</ItemGroup>
<!-- https://github.com/dotnet/macios/blob/eabcdee2ac43a0cc8324396a1bf75f8797d71810/msbuild/Xamarin.Shared/Xamarin.Shared.targets#L1328 -->
<Target Name="AddOsuVersionToBundle" AfterTargets="_CreateAppBundle">
<PropertyGroup>
<PlistFilePath>$(AppBundleDir)/Info.plist</PlistFilePath>
<OsuVersionKey>OsuVersion</OsuVersionKey>
</PropertyGroup>
<Exec Command="bash -c &quot;(/usr/libexec/PlistBuddy -c 'Print :$(OsuVersionKey)' '$(PlistFilePath)' &gt;/dev/null 2&gt;&amp;1 \
&amp;&amp; /usr/libexec/PlistBuddy -c 'Set :$(OsuVersionKey) $(Version)' '$(PlistFilePath)') \
|| /usr/libexec/PlistBuddy -c 'Add :$(OsuVersionKey) string $(Version)' '$(PlistFilePath)'&quot;"/>
</Target>
</Project>