102102import static io .ballerina .projects .util .ProjectConstants .BAL_TOOL_JSON ;
103103import static io .ballerina .projects .util .ProjectConstants .BAL_TOOL_TOML ;
104104import static io .ballerina .projects .util .ProjectConstants .BLANG_SOURCE_EXT ;
105+ import static io .ballerina .projects .util .ProjectConstants .CLOUD_TOML ;
105106import static io .ballerina .projects .util .ProjectConstants .DEPENDENCIES_TOML ;
106107import static io .ballerina .projects .util .ProjectConstants .DEPENDENCY_GRAPH_JSON ;
107108import static io .ballerina .projects .util .ProjectConstants .EXEC_BACKUP_DIR_NAME ;
@@ -1340,7 +1341,10 @@ public static boolean isFilesModifiedSinceLastBuild(BuildJson buildJson, Project
13401341 if (isSettingsFileModified (buildJson )) {
13411342 return true ;
13421343 }
1343- if (isBallerinaTomlFileModified (buildJson , project )) {
1344+ if (isTomlFileModified (buildJson .getBallerinaTomlMetaInfo (), project .sourceRoot ().resolve (BALLERINA_TOML ).toFile ())) {
1345+ return true ;
1346+ }
1347+ if (isTomlFileModified (buildJson .getCloudTomlMetaInfo (), project .sourceRoot ().resolve (CLOUD_TOML ).toFile ())) {
13441348 return true ;
13451349 }
13461350 if (isTestExecution ) {
@@ -1366,21 +1370,20 @@ public static DependencyGraph<BuildProject> resolveWorkspaceDependencies(
13661370 return projectDependencyGraph ;
13671371 }
13681372
1369- private static boolean isBallerinaTomlFileModified (BuildJson buildJson , Project project ) {
1373+ private static boolean isTomlFileModified (BuildJson .FileMetaInfo tomlFileMetaInfo , File tomlFile ) {
1374+ if (tomlFileMetaInfo == null ) {
1375+ // No Cloud.toml in the project
1376+ return tomlFile .exists ();
1377+ }
13701378 try {
1371- File ballerinaTomlFile = project .sourceRoot ().resolve (BALLERINA_TOML ).toFile ();
1372- if (ballerinaTomlFile .exists () && ballerinaTomlFile .isFile ()) {
1373- long lastModified = ballerinaTomlFile .lastModified ();
1374- long size = Files .size (ballerinaTomlFile .toPath ());
1375- BuildJson .FileMetaInfo ballerinaTomlFileMetaInfo = buildJson .getBallerinaTomlMetaInfo ();
1376- if (ballerinaTomlFileMetaInfo == null ) {
1377- return true ;
1378- }
1379- if (ballerinaTomlFileMetaInfo .getSize () == size &&
1380- ballerinaTomlFileMetaInfo .getLastModifiedTime () == lastModified ) {
1379+ if (tomlFile .exists () && tomlFile .isFile ()) {
1380+ long lastModified = tomlFile .lastModified ();
1381+ long size = Files .size (tomlFile .toPath ());
1382+ if (tomlFileMetaInfo .getSize () == size &&
1383+ tomlFileMetaInfo .getLastModifiedTime () == lastModified ) {
13811384 return false ;
13821385 }
1383- return !getSHA256Digest (ballerinaTomlFile ).equals (ballerinaTomlFileMetaInfo .getHash ());
1386+ return !getSHA256Digest (tomlFile ).equals (tomlFileMetaInfo .getHash ());
13841387 }
13851388 return true ;
13861389 } catch (IOException | NoSuchAlgorithmException e ) {
0 commit comments