@@ -20,19 +20,17 @@ class BuildDataInputFile
20
20
public string path ;
21
21
public string contentHash ;
22
22
23
- public BuildDataInputFile ( NPath npath )
23
+ public BuildDataInputFile ( NPath npath , bool developmentBuild )
24
24
{
25
25
path = npath . ToString ( ) ;
26
26
if ( npath . HasExtension ( "cs" ) )
27
27
{
28
28
var monoScript = AssetDatabase . LoadAssetAtPath < MonoScript > ( path ) ;
29
29
if ( monoScript != null )
30
- contentHash = monoScript . GetPropertiesHashString ( ) ;
30
+ contentHash = monoScript . GetPropertiesHashString ( developmentBuild ) ;
31
31
}
32
32
else
33
- {
34
33
contentHash = AssetDatabase . GetAssetDependencyHash ( npath . ToString ( ) ) . ToString ( ) ;
35
- }
36
34
}
37
35
}
38
36
@@ -68,19 +66,17 @@ bool CheckAssetDirty(BuildDataInputFile file)
68
66
return true ;
69
67
}
70
68
71
- string hash = "" ;
69
+ string contentHash = "" ;
72
70
if ( path . Extension == "cs" )
73
71
{
74
72
var monoScript = AssetDatabase . LoadAssetAtPath < MonoScript > ( path . ToString ( ) ) ;
75
73
if ( monoScript != null )
76
- hash = monoScript . GetPropertiesHashString ( ) ;
74
+ contentHash = monoScript . GetPropertiesHashString ( buildOptions . HasFlag ( BuildOptions . Development ) ) ;
77
75
}
78
76
else
79
- {
80
- hash = AssetDatabase . GetAssetDependencyHash ( path . ToString ( ) ) . ToString ( ) ;
81
- }
77
+ contentHash = AssetDatabase . GetAssetDependencyHash ( file . path ) . ToString ( ) ;
82
78
83
- if ( hash != file . contentHash )
79
+ if ( contentHash != file . contentHash )
84
80
{
85
81
Console . WriteLine ( $ "Rebuilding Data files because { path } is dirty (hash)") ;
86
82
return true ;
@@ -103,7 +99,7 @@ bool DoCheckDirty()
103
99
return true ;
104
100
}
105
101
106
- if ( buildOptions != buildData . buildOptions )
102
+ if ( ( buildOptions & BuildData . BuildOptionsMask ) != buildData . buildOptions )
107
103
{
108
104
Console . WriteLine ( "Rebuilding Data files because the build options have changed" ) ;
109
105
return true ;
@@ -147,22 +143,23 @@ bool DoCheckDirty()
147
143
[ RequiredByNativeCode ]
148
144
static public void WriteBuildData ( string buildDataPath , BuildReport report , string [ ] scenes , string [ ] prefabs )
149
145
{
146
+ var developmentBuild = report . summary . options . HasFlag ( BuildOptions . Development ) ;
150
147
var inputScenes = new List < BuildDataInputFile > ( ) ;
151
148
foreach ( var scene in scenes )
152
- inputScenes . Add ( new BuildDataInputFile ( scene ) ) ;
149
+ inputScenes . Add ( new BuildDataInputFile ( scene , developmentBuild ) ) ;
153
150
154
151
var inputFiles = new List < BuildDataInputFile > ( ) ;
155
152
foreach ( var scene in scenes )
156
- inputFiles . Add ( new BuildDataInputFile ( scene ) ) ;
153
+ inputFiles . Add ( new BuildDataInputFile ( scene , developmentBuild ) ) ;
157
154
foreach ( var prefab in prefabs )
158
- inputFiles . Add ( new BuildDataInputFile ( prefab ) ) ;
155
+ inputFiles . Add ( new BuildDataInputFile ( prefab , developmentBuild ) ) ;
159
156
foreach ( var assetInfo in report . packedAssets . SelectMany ( a => a . contents ) )
160
157
{
161
158
if ( assetInfo . sourceAssetPath . ToNPath ( ) . FileExists ( ) && ! assetInfo . sourceAssetPath . StartsWith ( "." ) )
162
- inputFiles . Add ( new BuildDataInputFile ( assetInfo . sourceAssetPath ) ) ;
159
+ inputFiles . Add ( new BuildDataInputFile ( assetInfo . sourceAssetPath , developmentBuild ) ) ;
163
160
}
164
161
foreach ( var projectSetting in new NPath ( "ProjectSettings" ) . Files ( "*.asset" ) )
165
- inputFiles . Add ( new BuildDataInputFile ( projectSetting ) ) ;
162
+ inputFiles . Add ( new BuildDataInputFile ( projectSetting , developmentBuild ) ) ;
166
163
167
164
var buildData = new BuildData ( )
168
165
{
@@ -189,7 +186,7 @@ static public bool CheckDirty(string buildDataPath, BuildOptions buildOptions, s
189
186
{
190
187
buildData = JsonUtility . FromJson < BuildData > ( buildReportPath . ReadAllText ( ) ) ,
191
188
scenes = scenes ,
192
- buildOptions = buildOptions & BuildData . BuildOptionsMask
189
+ buildOptions = buildOptions
193
190
} ;
194
191
return tracker . DoCheckDirty ( ) ;
195
192
}
0 commit comments