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

com.avito.plugin.SignBundleTask.kt Maven / Gradle / Ivy

Go to download

Collection of infrastructure libraries and gradle plugins of Avito Android project

There is a newer version: 2022.1
Show newest version
package com.avito.plugin

import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.workers.WorkerExecutor
import java.io.File
import javax.inject.Inject

public abstract class SignBundleTask @Inject constructor(
    workerExecutor: WorkerExecutor
) : SignArtifactTask(workerExecutor) {

    @get:InputFile
    public abstract val unsignedFileProperty: RegularFileProperty

    @get:OutputFile
    public abstract val signedFileProperty: RegularFileProperty

    override fun unsignedFile(): File {
        return unsignedFileProperty.get().asFile
    }

    override fun signedFile(): File {
        return signedFileProperty.get().asFile
    }

    override fun hackForArtifactsApi() {
        signedFile().copyTo(resultLocation(), overwrite = true)
    }

    /**
     * transform API is broken for ArtifactType.Bundle, hacking here to provide expected result
     * https://issuetracker.google.com/issues/174678813
     */
    private fun resultLocation(): File {
        return signedFile().path
            .replaceAfterLast("/", unsignedFile().name) // replace bugged `out` file name with original one
            .replace("/$name", "") // remove `signBundleViaServiceVariant` from path, bugged
            .let { File(it) }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy