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

cn.hx.plugin.junkcode.task.ManifestMergeTask.groovy Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package cn.hx.plugin.junkcode.task

import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction

abstract class ManifestMergeTask extends DefaultTask {

    @InputFile
    abstract RegularFileProperty getGenManifestFile()

    @InputFile
    abstract RegularFileProperty getMergedManifest()

    @OutputFile
    abstract RegularFileProperty getUpdatedManifest()

    @TaskAction
    void taskAction() {
        String genManifest = new String(getGenManifestFile().get().asFile.readBytes())
        genManifest = genManifest.substring(genManifest.indexOf("") + "".length(), genManifest.indexOf(""))
        String manifest = new String(getMergedManifest().get().asFile.readBytes())
        manifest = manifest.replace("", "$genManifest\n")
        getUpdatedManifest().get().asFile.write(manifest)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy