diff --git a/android/build.gradle b/android/build.gradle index 843e5e1..b6dccc4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -68,20 +68,20 @@ android { abiFilters = project(":app").android.defaultConfig.ndk.abiFilters } } - + externalNativeBuild { cmake { path "CMakeLists.txt" } } - + sourceSets { main { jniLibs.srcDirs 'libnode/bin/' } main.assets.srcDirs += '../install/resources/nodejs-modules' } - + lintOptions { abortOnError false } @@ -114,6 +114,8 @@ task GenerateNodeProjectAssetsLists { delete "${rootProject.buildDir}/nodejs-assets/file.list" delete "${rootProject.buildDir}/nodejs-assets/dir.list" + ArrayList file_list_arr = new ArrayList(); + ArrayList dir_list_arr = new ArrayList(); String file_list = ""; String dir_list = ""; @@ -123,14 +125,26 @@ task GenerateNodeProjectAssetsLists { assets_tree.exclude('**/*~') // Exclude temporary files. assets_tree.visit { assetFile -> if (assetFile.isDirectory()) { - dir_list += "${assetFile.relativePath}\n" + dir_list_arr.add("${assetFile.relativePath}\n"); } else { - file_list += "${assetFile.relativePath}\n" + file_list_arr.add("${assetFile.relativePath}\n"); } } + + //Ensure both files are ordered similarly across builds. + Collections.sort(file_list_arr); + Collections.sort(dir_list_arr); + def file_list_path = new File( "${rootProject.buildDir}/nodejs-assets/file.list") + for (String file : file_list_arr){ + file_list += file; + } file_list_path.write file_list + def dir_list_path = new File( "${rootProject.buildDir}/nodejs-assets/dir.list") + for (String dir : dir_list_arr){ + dir_list += dir; + } dir_list_path.write dir_list } } @@ -433,4 +447,4 @@ if ("1".equals(shouldRebuildNativeModules)) { tasks.getByPath(":${project.name}:preBuild").dependsOn "GenerateNodeNativeAssetsLists${abi_name}" } project.android.sourceSets.main.assets.srcDirs+="${rootProject.buildDir}/nodejs-native-assets/" -} \ No newline at end of file +}