package com.xml.guard.tasks

import com.xml.guard.entensions.GuardExtension
import com.xml.guard.utils.readProjectMapFile
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import javax.inject.Inject

/**
 * User: ljx
 * Date: 2022/2/25
 * Time: 19:06
 */
open class HxDemoTask @Inject constructor(
    private val guardExtension: GuardExtension,
    private val variantName: String,
) : DefaultTask() {

    init {
        group = "guard"
    }

    private val mappingFile = guardExtension.mappingFile ?: project.file("xml-class-mapping.txt")

    private var classnameList = mutableListOf<String>()
    private var packagerList = mutableListOf<String>()

    @TaskAction
    fun execute() {
        val classMapName = guardExtension.classMapName
        val packageNameMapName = guardExtension.packageNameMapName

        classnameList = readProjectMapFile(classMapName)
        packagerList = readProjectMapFile(packageNameMapName)
        println(classnameList[1]);
        println(packagerList[1]);
    }


}