Incremental resource merger support.
authorXavier Ducrohet <xav@android.com>
Mon, 10 Dec 2012 22:59:50 +0000 (14:59 -0800)
committerXavier Ducrohet <xav@android.com>
Thu, 20 Dec 2012 02:58:16 +0000 (18:58 -0800)
commit86fe65512d1230aafd9cb974b733f6fd09ac15ce
tree93af6083035fda4c76400be8e67eea8477cce6aa
parentcca0ebcf9848a905e1c1ed5139af6d3f64866657
Incremental resource merger support.

First a ChangeManager (and associated classes) that detects changed
files across build runs. This is to be replaced by Gradle once this
information is given to the tasks.

Then, a rewrite of ResourceMerger and ResourceSet to allow saving a
post run state, and reloading it on the next run, to allow for
incremental updates of the merged resource folder by only updating
the resources that changed, were removed or were added.

Finally a change to the BaseTask to support incremental tasks and
provide some default support that actual tasks can use or not.
The BaseTask will do some first checks to figure out if incremental
runs are supported by the class or by the current state, and
call one of two methods to do either full run or incremental run.

The MergerResourceTask is changed to use this, and its incremental
method does a bit more checking and reverts to full run when it
cannot do an incremental run.

Finally a bunch of tests to ensure this works fine.

Change-Id: I3808e2d57aa45882eaf1030e16b092ecd58d9729
79 files changed:
build.gradle
builder/prebuilts/common.jar
builder/prebuilts/sdk_common.jar [new file with mode: 0644]
builder/src/main/java/com/android/builder/AndroidBuilder.java
builder/src/main/java/com/android/builder/VariantConfiguration.java
builder/src/main/java/com/android/builder/internal/CommandLineRunner.java
builder/src/main/java/com/android/builder/internal/compiler/AidlProcessor.java
builder/src/main/java/com/android/builder/internal/incremental/ChangeManager.java [new file with mode: 0644]
builder/src/main/java/com/android/builder/internal/incremental/FileEntity.java [new file with mode: 0644]
builder/src/main/java/com/android/builder/internal/incremental/FileManager.java [new file with mode: 0644]
builder/src/main/java/com/android/builder/resources/FileStatus.java [new file with mode: 0644]
builder/src/main/java/com/android/builder/resources/NodeUtils.java [new file with mode: 0644]
builder/src/main/java/com/android/builder/resources/Resource.java
builder/src/main/java/com/android/builder/resources/ResourceFile.java
builder/src/main/java/com/android/builder/resources/ResourceMap.java [new file with mode: 0644]
builder/src/main/java/com/android/builder/resources/ResourceMerger.java
builder/src/main/java/com/android/builder/resources/ResourceSet.java
builder/src/main/java/com/android/builder/resources/SourceSet.java [new file with mode: 0644]
builder/src/main/java/com/android/builder/resources/ValueResourceParser.java
builder/src/test/java/com/android/builder/VariantConfigurationTest.java
builder/src/test/java/com/android/builder/resources/BaseTestCase.java
builder/src/test/java/com/android/builder/resources/NoteUtilsTest.java [new file with mode: 0644]
builder/src/test/java/com/android/builder/resources/ResourceMergerTest.java
builder/src/test/java/com/android/builder/resources/ResourceSetTest.java
builder/src/test/java/com/android/builder/resources/ValueResourceParserTest.java
builder/src/test/resources/testData/baseMerge/merger.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/main/drawable/new_overlay.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/main/drawable/removed_overlay.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/main/drawable/touched.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/main/drawable/untouched.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/merger.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/new_overlay.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/overlay/drawable-hdpi/new_alternate.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/overlay/drawable/new_overlay.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/resOut/drawable-ldpi/removed.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/resOut/drawable/new_overlay.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/resOut/drawable/removed_overlay.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/resOut/drawable/touched.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicFiles/resOut/drawable/untouched.png [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues/main/values/values.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues/merger.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues/overlay/values-fr/values.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues/overlay/values/values.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues/resOut/values-en/values.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues/resOut/values/values.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues2/main/values/values.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues2/merger.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/basicValues2/resOut/values/values.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/filesVsValues/main/layout/alias_replaced_by_file.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/filesVsValues/main/layout/main.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/filesVsValues/main/values/values.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/filesVsValues/merger.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/filesVsValues/resOut/layout/file_replaced_by_alias.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/filesVsValues/resOut/layout/main.xml [new file with mode: 0644]
builder/src/test/resources/testData/incMergeData/filesVsValues/resOut/values/values.xml [new file with mode: 0644]
gradle/src/integration-test/groovy/com/android/build/gradle/ProjectTest.groovy
gradle/src/main/groovy/com/android/build/gradle/BasePlugin.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/AaptOptionsImpl.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/DefaultAndroidSourceSet.java
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/AidlCompileTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/BaseTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/DexTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/GenerateBuildConfigTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/MergeResourcesTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/PackageApplicationTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/PrepareDependenciesTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/ProcessManifestTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/ProcessResourcesTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/ProcessTestManifestTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/RunTestsTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/UninstallTask.groovy
gradle/src/main/groovy/com/android/build/gradle/internal/tasks/ZipAlignTask.groovy
gradle/src/main/groovy/com/android/build/gradle/tasks/AidlCompile.groovy
gradle/src/main/groovy/com/android/build/gradle/tasks/Dex.groovy
gradle/src/main/groovy/com/android/build/gradle/tasks/GenerateBuildConfig.groovy
gradle/src/main/groovy/com/android/build/gradle/tasks/MergeResources.groovy
gradle/src/main/groovy/com/android/build/gradle/tasks/PackageApplication.groovy
gradle/src/main/groovy/com/android/build/gradle/tasks/ProcessResources.groovy
gradle/src/main/groovy/com/android/build/gradle/tasks/ZipAlign.groovy