All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.holoeverywhere.resbuilder.tasks.ResbuilderDefaultTask.groovy Maven / Gradle / Ivy

There is a newer version: 0.3.5
Show newest version
package org.holoeverywhere.resbuilder.tasks

import com.android.build.gradle.BasePlugin
import com.android.sdklib.IAndroidTarget
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.holoeverywhere.resbuilder.dsl.ResbuilderSourceSet

abstract class ResbuilderDefaultTask extends DefaultTask {
    @Input
    def Set source

    private def File resourcesDir

    File obtainResourcesDir() {
        if (resourcesDir == null) {
            try {
                def BasePlugin androidPlugin = project.plugins.find {
                    BasePlugin.class.isAssignableFrom(it.class)
                } as BasePlugin
                if (androidPlugin == null) {
                    throw new RuntimeException("Could not find android plugin/extension")
                }
                resourcesDir = new File(androidPlugin.loadedSdkParser.target.getPath(IAndroidTarget.RESOURCES))
            } catch (Exception e) {
                project.logger.error("Cannot retrieve resource directory", e)
            }
        }
        return resourcesDir
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy