@@ -55,14 +55,14 @@ public class BuildContext : FrostingContext
5555 public FilePath NetcodeRuntimeAsmDefFile => NetcodeRuntimeAsmDefFiles . First ( ( file ) => File . Exists ( file . FullPath ) ) ;
5656 public FilePath NetcodeRuntimeProjectFile => NetcodeRuntimeProjectDirectory . CombineWithFilePath ( "Unity.Netcode.Runtime.csproj" ) ;
5757
58- public Version UnityVersion { get ; }
58+ public UnityVersion UnityVersion { get ; }
5959 public Version UnityNetcodeVersion { get ; }
6060 public Version UnityTransportVersion { get ; }
6161 public bool UnityNetcodeNativeCollectionSupport { get ; }
6262
6363 public DirectoryPath PatcherCommonOutputDirectory => PatcherProjectDirectory
6464 . Combine ( "dist" )
65- . Combine ( $ "unity-v{ UnityVersion } ")
65+ . Combine ( $ "unity-v{ UnityVersion . Version } ")
6666 . Combine ( $ "unity-transport-v{ UnityTransportVersion } ") ;
6767
6868 public DirectoryPath PatcherSpecificOutputDirectory => PatcherCommonOutputDirectory
@@ -76,7 +76,7 @@ public class BuildContext : FrostingContext
7676 public BuildContext ( ICakeContext context )
7777 : base ( context )
7878 {
79- UnityVersion = context . Argument < Version > ( "unity-version" , new Version ( 2022 , 3 , 9 ) ) ;
79+ UnityVersion = context . Argument < UnityVersion > ( "unity-version" , UnityVersion . Parse ( " 2022.3.9f1" ) ) ;
8080 UnityNetcodeVersion = context . Argument < Version > ( "netcode-version" , new Version ( 1 , 5 , 2 ) ) ;
8181 UnityTransportVersion = context . Argument < Version > ( "transport-version" , new Version ( 1 , 0 , 0 ) ) ;
8282 UnityNetcodeNativeCollectionSupport = context . Argument < bool > ( "native-collection-support" , false ) ;
@@ -91,7 +91,7 @@ public sealed class GatherConstantsTask : AsyncFrostingTask<BuildContext>
9191{
9292 public IEnumerable < string > ComputeUnityVersionConstants ( BuildContext ctx )
9393 {
94- if ( ctx . UnityVersion < new Version ( 2021 , 1 , 0 ) )
94+ if ( ctx . UnityVersion < UnityVersion . Parse ( " 2021.1.0" ) )
9595 throw new ArgumentOutOfRangeException ( nameof ( UnityVersion ) , "Unity version must be >=2020.1.0." ) ;
9696
9797 var versionConstants = new LinkedList < string > ( ) ;
@@ -111,22 +111,22 @@ public IEnumerable<string> ComputeUnityVersionConstants(BuildContext ctx)
111111 versionConstants . AddLast ( VersionOrNewerConstant ( ctx . UnityVersion . Major , minor ) ) ;
112112 }
113113
114- versionConstants . AddRange ( VersionConstants ( ctx . UnityVersion . Major , ctx . UnityVersion . Minor , ctx . UnityVersion . Build ) ) ;
114+ versionConstants . AddRange ( VersionConstants ( ctx . UnityVersion . Major , ctx . UnityVersion . Minor , ctx . UnityVersion . Patch ) ) ;
115115 return versionConstants ;
116116
117117 string VersionOrNewerConstant ( int major , int minor ) => $ "UNITY_{ major } _{ minor } _OR_NEWER";
118- IEnumerable < string > VersionConstants ( int major , int minor , int build ) {
119- if ( minor < 0 && build < 0 )
118+ IEnumerable < string > VersionConstants ( int major , int minor , int patch ) {
119+ if ( minor < 0 && patch < 0 )
120120 return [ MajorConstant ( ) ] ;
121121
122- if ( build < 0 )
122+ if ( patch < 0 )
123123 return [ MajorConstant ( ) , MajorMinorConstant ( ) ] ;
124124
125125 return [ MajorConstant ( ) , MajorMinorConstant ( ) , MajorMinorBuildConstant ( ) ] ;
126126
127127 string MajorConstant ( ) => $ "UNITY_{ major } ";
128128 string MajorMinorConstant ( ) => $ "UNITY_{ major } _{ minor } ";
129- string MajorMinorBuildConstant ( ) => $ "UNITY_{ major } _{ minor } _{ build } ";
129+ string MajorMinorBuildConstant ( ) => $ "UNITY_{ major } _{ minor } _{ patch } ";
130130 } ;
131131 }
132132
@@ -152,7 +152,6 @@ public async Task<IEnumerable<AsmDefVersionDefine>> ReadVersionDefines(BuildCont
152152
153153 public async Task < IEnumerable < string > > ResolveAsmDefConstants ( BuildContext context )
154154 {
155- var unityVersion = UnityVersion . Parse ( "6000.4.1f1" ) ; // todo: replace with context member
156155 var packageVersions = await ReadPackageVersions ( context ) ;
157156 LinkedList < string > constants = new ( ) ;
158157 foreach ( var versionDefine in await ReadVersionDefines ( context ) ) {
@@ -163,7 +162,7 @@ public async Task<IEnumerable<string>> ResolveAsmDefConstants(BuildContext conte
163162 continue ;
164163 }
165164 if ( versionDefine . ResourceIsUnity ) {
166- if ( ! versionDefine . UnityVersionRange . Satisfies ( unityVersion ) ) continue ;
165+ if ( ! versionDefine . UnityVersionRange . Satisfies ( context . UnityVersion ) ) continue ;
167166 constants . AddLast ( versionDefine . DefineSymbol ) ;
168167 continue ;
169168 }
0 commit comments