@@ -187,9 +187,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
187187 } ) ;
188188
189189 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 ) ;
193191
194192 const pluginTempMainSrcDir = path . join ( pluginTempDir , "src" , "main" ) ;
195193 await this . updateManifest ( manifestFilePath , pluginTempMainSrcDir , shortPluginName ) ;
@@ -203,16 +201,19 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
203201 return shouldBuildAar ;
204202 }
205203
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+
206210 private getSourceFilesHashes ( pluginTempPlatformsAndroidDir : string , shortPluginName : string ) : Promise < IStringDictionary > {
207211 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 ) ;
212213 return this . $filesHashService . generateHashes ( pluginNativeDataFiles ) ;
213214 }
214215
215- private async writePluginHashInfo ( fileHashesInfo : IStringDictionary , pluginTempDir : string ) : Promise < void > {
216+ private writePluginHashInfo ( fileHashesInfo : IStringDictionary , pluginTempDir : string ) : void {
216217 const buildDataFile = this . getPathToPluginBuildDataFile ( pluginTempDir ) ;
217218 this . $fs . writeJson ( buildDataFile , fileHashesInfo ) ;
218219 }
@@ -226,7 +227,7 @@ export class AndroidPluginBuildService implements IAndroidPluginBuildService {
226227 fileHashesInfo : IStringDictionary
227228 } ) : Promise < boolean > {
228229
229- let shouldBuildAar = ! ! opts . manifestFilePath || opts . androidSourceDirectories . length > 0 ;
230+ let shouldBuildAar = ! ! opts . manifestFilePath || ! ! opts . androidSourceDirectories . length ;
230231
231232 if ( shouldBuildAar &&
232233 this . $fs . exists ( opts . pluginTempDir ) &&
0 commit comments