@@ -187,9 +187,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
187
187
} ) ;
188
188
189
189
if ( shouldBuildAar ) {
190
- // In case plugin was already built in the current process, we need to clean the old sources as they may break the new build.
191
- this . $fs . deleteDirectory ( pluginTempDir ) ;
192
- this . $fs . ensureDirectoryExists ( pluginTempDir ) ;
190
+ this . cleanPluginDir ( pluginTempDir ) ;
193
191
194
192
const pluginTempMainSrcDir = path . join ( pluginTempDir , "src" , "main" ) ;
195
193
await this . updateManifest ( manifestFilePath , pluginTempMainSrcDir , shortPluginName ) ;
@@ -203,16 +201,19 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
203
201
return shouldBuildAar ;
204
202
}
205
203
204
+ private cleanPluginDir ( pluginTempDir : string ) : void {
205
+ // In case plugin was already built in the current process, we need to clean the old sources as they may break the new build.
206
+ this . $fs . deleteDirectory ( pluginTempDir ) ;
207
+ this . $fs . ensureDirectoryExists ( pluginTempDir ) ;
208
+ }
209
+
206
210
private getSourceFilesHashes ( pluginTempPlatformsAndroidDir : string , shortPluginName : string ) : Promise < IStringDictionary > {
207
211
const pathToAar = path . join ( pluginTempPlatformsAndroidDir , `${ shortPluginName } .aar` ) ;
208
- const pluginNativeDataFiles = this . $fs . enumerateFilesInDirectorySync ( pluginTempPlatformsAndroidDir , ( file : string , stat : IFsStats ) => {
209
- return file !== pathToAar ;
210
- } ) ;
211
-
212
+ const pluginNativeDataFiles = this . $fs . enumerateFilesInDirectorySync ( pluginTempPlatformsAndroidDir , ( file : string , stat : IFsStats ) => file !== pathToAar ) ;
212
213
return this . $filesHashService . generateHashes ( pluginNativeDataFiles ) ;
213
214
}
214
215
215
- private async writePluginHashInfo ( fileHashesInfo : IStringDictionary , pluginTempDir : string ) : Promise < void > {
216
+ private writePluginHashInfo ( fileHashesInfo : IStringDictionary , pluginTempDir : string ) : void {
216
217
const buildDataFile = this . getPathToPluginBuildDataFile ( pluginTempDir ) ;
217
218
this . $fs . writeJson ( buildDataFile , fileHashesInfo ) ;
218
219
}
@@ -226,7 +227,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
226
227
fileHashesInfo : IStringDictionary
227
228
} ) : Promise < boolean > {
228
229
229
- let shouldBuildAar = ! ! opts . manifestFilePath || opts . androidSourceDirectories . length > 0 ;
230
+ let shouldBuildAar = ! ! opts . manifestFilePath || ! ! opts . androidSourceDirectories . length ;
230
231
231
232
if ( shouldBuildAar &&
232
233
this . $fs . exists ( opts . pluginTempDir ) &&
0 commit comments