@@ -54,6 +54,7 @@ export class ProjectChangesService implements IProjectChangesService {
54
54
private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
55
55
private $fs : IFileSystem ,
56
56
private $filesHashService : IFilesHashService ,
57
+ private $logger : ILogger ,
57
58
private $injector : IInjector ) {
58
59
}
59
60
@@ -83,9 +84,13 @@ export class ProjectChangesService implements IProjectChangesService {
83
84
projectData ,
84
85
this . fileChangeRequiresBuild ) ;
85
86
87
+ this . $logger . trace ( `Set nativeChanged to ${ this . _changesInfo . nativeChanged } . skipModulesNativeCheck is: ${ projectChangesOptions . skipModulesNativeCheck } ` ) ;
88
+
86
89
if ( this . _newFiles > 0 || this . _changesInfo . nativeChanged ) {
90
+ this . $logger . trace ( `Setting modulesChanged to true, newFiles: ${ this . _newFiles } , nativeChanged: ${ this . _changesInfo . nativeChanged } ` ) ;
87
91
this . _changesInfo . modulesChanged = true ;
88
92
}
93
+
89
94
if ( platform === this . $devicePlatformsConstants . iOS . toLowerCase ( ) ) {
90
95
this . _changesInfo . configChanged = this . filesChanged ( [ path . join ( platformResourcesDir , platformData . configurationFileName ) ,
91
96
path . join ( platformResourcesDir , "LaunchScreen.storyboard" ) ,
@@ -97,12 +102,15 @@ export class ProjectChangesService implements IProjectChangesService {
97
102
path . join ( platformResourcesDir , APP_GRADLE_FILE_NAME )
98
103
] ) ;
99
104
}
105
+
106
+ this . $logger . trace ( `Set value of configChanged to ${ this . _changesInfo . configChanged } ` ) ;
100
107
}
101
108
102
109
const projectService = platformData . platformProjectService ;
103
110
await projectService . checkForChanges ( this . _changesInfo , projectChangesOptions , projectData ) ;
104
111
105
112
if ( projectChangesOptions . bundle !== this . _prepareInfo . bundle || projectChangesOptions . release !== this . _prepareInfo . release ) {
113
+ this . $logger . trace ( `Setting all setting to true. Current options are: ` , projectChangesOptions , " old prepare info is: " , this . _prepareInfo ) ;
106
114
this . _changesInfo . appFilesChanged = true ;
107
115
this . _changesInfo . appResourcesChanged = true ;
108
116
this . _changesInfo . modulesChanged = true ;
@@ -112,9 +120,11 @@ export class ProjectChangesService implements IProjectChangesService {
112
120
this . _prepareInfo . bundle = projectChangesOptions . bundle ;
113
121
}
114
122
if ( this . _changesInfo . packageChanged ) {
123
+ this . $logger . trace ( "Set modulesChanged to true as packageChanged is true" ) ;
115
124
this . _changesInfo . modulesChanged = true ;
116
125
}
117
126
if ( this . _changesInfo . modulesChanged || this . _changesInfo . appResourcesChanged ) {
127
+ this . $logger . trace ( `Set configChanged to true, current value of moduleChanged is: ${ this . _changesInfo . modulesChanged } , appResourcesChanged is: ${ this . _changesInfo . appResourcesChanged } ` ) ;
118
128
this . _changesInfo . configChanged = true ;
119
129
}
120
130
if ( this . _changesInfo . hasChanges ) {
@@ -129,6 +139,7 @@ export class ProjectChangesService implements IProjectChangesService {
129
139
130
140
this . _changesInfo . nativePlatformStatus = this . _prepareInfo . nativePlatformStatus ;
131
141
142
+ this . $logger . trace ( "checkForChanges returns" , this . _changesInfo ) ;
132
143
return this . _changesInfo ;
133
144
}
134
145
@@ -234,14 +245,16 @@ export class ProjectChangesService implements IProjectChangesService {
234
245
}
235
246
236
247
private containsNewerFiles ( dir : string , skipDir : string , projectData : IProjectData , processFunc ?: ( filePath : string , projectData : IProjectData ) => boolean ) : boolean {
237
-
238
248
const dirName = path . basename ( dir ) ;
249
+ this . $logger . trace ( `containsNewerFiles will check ${ dir } ` ) ;
239
250
if ( _ . startsWith ( dirName , '.' ) ) {
251
+ this . $logger . trace ( `containsNewerFiles returns false for ${ dir } as its name starts with dot (.) .` ) ;
240
252
return false ;
241
253
}
242
254
243
255
const dirFileStat = this . $fs . getFsStats ( dir ) ;
244
256
if ( this . isFileModified ( dirFileStat , dir ) ) {
257
+ this . $logger . trace ( `containsNewerFiles returns true for ${ dir } as the dir itself has been modified.` ) ;
245
258
return true ;
246
259
}
247
260
@@ -256,24 +269,30 @@ export class ProjectChangesService implements IProjectChangesService {
256
269
const changed = this . isFileModified ( fileStats , filePath ) ;
257
270
258
271
if ( changed ) {
272
+ this . $logger . trace ( `File ${ filePath } has been changed.` ) ;
259
273
if ( processFunc ) {
260
274
this . _newFiles ++ ;
275
+ this . $logger . trace ( `Incremented the newFiles counter. Current value is ${ this . _newFiles } ` ) ;
261
276
const filePathRelative = path . relative ( projectData . projectDir , filePath ) ;
262
277
if ( processFunc . call ( this , filePathRelative , projectData ) ) {
278
+ this . $logger . trace ( `containsNewerFiles returns true for ${ dir } . The modified file is ${ filePath } ` ) ;
263
279
return true ;
264
280
}
265
281
} else {
282
+ this . $logger . trace ( `containsNewerFiles returns true for ${ dir } . The modified file is ${ filePath } ` ) ;
266
283
return true ;
267
284
}
268
285
}
269
286
270
287
if ( fileStats . isDirectory ( ) ) {
271
288
if ( this . containsNewerFiles ( filePath , skipDir , projectData , processFunc ) ) {
289
+ this . $logger . trace ( `containsNewerFiles returns true for ${ dir } .` ) ;
272
290
return true ;
273
291
}
274
292
}
275
-
276
293
}
294
+
295
+ this . $logger . trace ( `containsNewerFiles returns false for ${ dir } .` ) ;
277
296
return false ;
278
297
}
279
298
@@ -291,7 +310,7 @@ export class ProjectChangesService implements IProjectChangesService {
291
310
}
292
311
293
312
private fileChangeRequiresBuild ( file : string , projectData : IProjectData ) {
294
- if ( path . basename ( file ) === "package.json" ) {
313
+ if ( path . basename ( file ) === PACKAGE_JSON_FILE_NAME ) {
295
314
return true ;
296
315
}
297
316
const projectDir = projectData . projectDir ;
@@ -302,7 +321,7 @@ export class ProjectChangesService implements IProjectChangesService {
302
321
let filePath = file ;
303
322
while ( filePath !== NODE_MODULES_FOLDER_NAME ) {
304
323
filePath = path . dirname ( filePath ) ;
305
- const fullFilePath = path . join ( projectDir , path . join ( filePath , "package.json" ) ) ;
324
+ const fullFilePath = path . join ( projectDir , path . join ( filePath , PACKAGE_JSON_FILE_NAME ) ) ;
306
325
if ( this . $fs . exists ( fullFilePath ) ) {
307
326
const json = this . $fs . readJson ( fullFilePath ) ;
308
327
if ( json [ "nativescript" ] && _ . startsWith ( file , path . join ( filePath , "platforms" ) ) ) {
0 commit comments