Home | History | Annotate | Download | only in gradle
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.build.gradle
     17 
     18 import com.android.build.gradle.internal.AaptOptionsImpl
     19 import org.gradle.api.tasks.InputDirectory
     20 import org.gradle.api.tasks.InputFile
     21 import org.gradle.api.tasks.InputFiles
     22 import org.gradle.api.tasks.Nested
     23 import org.gradle.api.tasks.Optional
     24 import org.gradle.api.tasks.OutputDirectory
     25 import org.gradle.api.tasks.OutputFile
     26 import org.gradle.api.tasks.TaskAction
     27 
     28 class ProcessResourcesTask extends BaseAndroidTask {
     29 
     30     @InputFile
     31     File manifestFile
     32 
     33     @InputDirectory @Optional
     34     File crunchDir
     35 
     36     @InputFiles
     37     Iterable<File> resDirectories
     38 
     39     @OutputDirectory @Optional
     40     File sourceOutputDir
     41 
     42     @OutputFile @Optional
     43     File packageFile
     44 
     45     @OutputFile @Optional
     46     File proguardFile
     47 
     48     @Nested
     49     AaptOptionsImpl aaptOptions
     50 
     51     @TaskAction
     52     void generate() {
     53 
     54         getBuilder().processResources(
     55                 getManifestFile().absolutePath,
     56                 getCrunchDir()?.absolutePath,
     57                 getResDirectories(),
     58                 getSourceOutputDir()?.absolutePath,
     59                 getPackageFile()?.absolutePath,
     60                 getProguardFile()?.absolutePath,
     61                 getAaptOptions())
     62     }
     63 }
     64