This task will migrate (remap) the project's source files to a new mapping version.
Running this task with edit your project's source files. It does NOT make a backup. It is highly recommened that you commit any pending changes before doing this. (If you are not using version control, you should be.)
This process uses Srg2Source to remap the project's source files. Therefore, your project must be compilable for this process to work.
By default, the updateMappings
task will only update the source directories in the projects main
source set. If you use additioanl source sets in your project, then you must add them to the remapping tasks. Below is an example adding an api
source set. Note: The property check is important as these tasks do not exists unless it is specified.
if (project.hasProperty('UPDATE_MAPPINGS')) {
extractRangeMap {
sources sourceSets.api.java.srcDirs
}
applyRangeMap {
sources sourceSets.api.java.srcDirs
}
sourceSets.api.java.srcDirs.each { extractMappedNew.addTarget it }
}
This command should be run before you update the mapping version in you build file.
./gradlew -PUPDATE_MAPPINGS="new mapping version" -PUPDATE_MAPPINGS_CHANNEL="snapshot" updateMappings
Note that the UPDATE_MAPPINGS_CHANNEL
property is not required and will default to snapshot
.
- Extra imports: Srg2Source is not the greatest with inner classes and will sometimes add extra imports for them.