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

proguard.gradle.plugin.android.transforms.AndroidConsumerRulesTransform.kt Maven / Gradle / Ivy

Go to download

Gradle plugin for ProGuard, the free shrinker, optimizer, obfuscator, and preverifier for Java bytecode

There is a newer version: 7.6.0
Show newest version
/*
 * ProGuard -- shrinking, optimization, obfuscation, and preverification
 *             of Java bytecode.
 *
 * Copyright (c) 2002-2020 Guardsquare NV
 */

package proguard.gradle.plugin.android.transforms

import java.io.File
import org.gradle.api.artifacts.transform.InputArtifact
import org.gradle.api.artifacts.transform.TransformAction
import org.gradle.api.artifacts.transform.TransformOutputs
import org.gradle.api.artifacts.transform.TransformParameters
import org.gradle.api.file.FileSystemLocation
import org.gradle.api.provider.Provider

/**
 * Class that defines the transformation from 'android-consumer-proguard-rules'
 * artifacts to 'proguard-consumer-rule' artifacts. This is done by simply
 * copying the files over.
 */
abstract class AndroidConsumerRulesTransform : TransformAction {
    @get:InputArtifact
    abstract val inputArtifact: Provider

    override fun transform(outputs: TransformOutputs) {
        val inputFile = inputArtifact.get().asFile
        val outputDir = outputs.dir(inputFile.name)

        for (file in inputFile.listFiles() ?: emptyArray()) {
            val outputFile = File(outputDir, file.name)
            file.copyRecursively(outputFile)
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy