@@ -47,6 +47,9 @@ import {
47
47
import { IInjector } from "../common/definitions/yok" ;
48
48
import { injector } from "../common/yok" ;
49
49
import { INotConfiguredEnvOptions } from "../common/definitions/commands" ;
50
+ import { IProjectChangesInfo } from "../definitions/project-changes" ;
51
+ import { AndroidPrepareData } from "../data/prepare-data" ;
52
+ import { AndroidBuildData } from "../data/build-data" ;
50
53
51
54
interface NativeDependency {
52
55
name : string ;
@@ -148,6 +151,8 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
148
151
private $androidPluginBuildService : IAndroidPluginBuildService ,
149
152
private $platformEnvironmentRequirements : IPlatformEnvironmentRequirements ,
150
153
private $androidResourcesMigrationService : IAndroidResourcesMigrationService ,
154
+ private $liveSyncProcessDataService : ILiveSyncProcessDataService ,
155
+ private $devicesService : Mobile . IDevicesService ,
151
156
private $filesHashService : IFilesHashService ,
152
157
private $gradleCommandService : IGradleCommandService ,
153
158
private $gradleBuildService : IGradleBuildService ,
@@ -879,8 +884,39 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
879
884
await adb . executeShellCommand ( [ "rm" , "-rf" , deviceRootPath ] ) ;
880
885
}
881
886
882
- public async checkForChanges ( ) : Promise < void > {
883
- // Nothing android specific to check yet.
887
+ public async checkForChanges (
888
+ changesInfo : IProjectChangesInfo ,
889
+ prepareData : AndroidPrepareData ,
890
+ projectData : IProjectData
891
+ ) : Promise < void > {
892
+ //we need to check for abi change in connected device vs last built
893
+ const deviceDescriptors = this . $liveSyncProcessDataService . getDeviceDescriptors (
894
+ projectData . projectDir
895
+ ) ;
896
+ const platformData = this . getPlatformData ( projectData ) ;
897
+ deviceDescriptors . forEach ( deviceDescriptor => {
898
+ const buildData = deviceDescriptor . buildData as AndroidBuildData ;
899
+ if ( buildData . buildFilterDevicesArch ) {
900
+ const outputPath = platformData . getBuildOutputPath ( deviceDescriptor . buildData ) ;
901
+ const apkOutputPath = path . join ( outputPath , prepareData . release ? "release" : "debug" ) ;
902
+ if ( ! this . $fs . exists ( outputPath ) ) {
903
+ return ;
904
+ }
905
+ // check if we already build this arch
906
+ // if not we need to say native has changed
907
+ const device = this . $devicesService . getDevicesForPlatform ( deviceDescriptor . buildData . platform ) . filter ( d => d . deviceInfo . identifier === deviceDescriptor . identifier ) [ 0 ] ;
908
+ const abis = device . deviceInfo . abis . filter ( a => ! ! a && a . length ) [ 0 ] ;
909
+
910
+ const directoryContent = this . $fs . readDirectory ( apkOutputPath ) ;
911
+ const regexp = new RegExp ( `${ abis } .*\.apk` ) ;
912
+ const files = _ . filter ( directoryContent , ( entry : string ) => {
913
+ return regexp . test ( entry ) ;
914
+ } ) ;
915
+ if ( files . length === 0 ) {
916
+ changesInfo . nativeChanged = true ;
917
+ }
918
+ }
919
+ } )
884
920
}
885
921
886
922
public getDeploymentTarget ( projectData : IProjectData ) : semver . SemVer {
0 commit comments