Realm provides a database viewer called "Realm Studio" that allows users to browse the contents of their database. When the application is used to view a database, it creates several "temporary" files in the directory of the database, namely:
- A
.realm.lockfile. - A
.realm.notefile. - A
.realm.managementdirectory containing:- A
access_control.control.mxfile. - A
access_control.new_commit.cvfile. - A
access_control.pick_writer.cvfile. - A
access_control.write.mxfile.
- A
In the context of Android, a preexisting Realm database is sometimes shipped with an application by placing the database in the /assets directory. Thus, when the Realm Studio is used to view this database, the aforementioned files are generated in /assets. For unknown reasons, this causes Gradle to hang indefinitely at the :app:generateDebugAssets task.
As such, i'd like to find a way to exclude these files from the build. I've tried several methods, such as:
applicationVariants.all { variant ->
if (variant.buildType.name == 'debug') {
variant.mergeAssets.doLast {
delete(fileTree(dir: variant.mergeAssets.outputDir, includes: ['**/*.cv', '**/*.mx', '**/*.lock', '**/*.note']))
}
}
}
and other methods, like:
sourceSets.main.assets.exclude 'appData.realm.management'
sourceSets.main.assets.exclude 'appData.realm.management/access_control.control.mx'
sourceSets.main.assets.exclude 'appData.realm.management/access_control.new_commit.cv'
sourceSets.main.assets.exclude 'appData.realm.management/access_control.pick_writer.cv'
sourceSets.main.assets.exclude 'appData.realm.management/access_control.write.mx'
sourceSets.main.assets.exclude 'appData.realm.lock'
sourceSets.main.assets.exclude 'appData.realm.note'
to no avail.
How can one instruct Gradle to exclude these files when running a build?
from Exclude temporary Realm files from Gradle build
No comments:
Post a Comment