<commit_before>package me.zhangls.mulchannel

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction

class MulchannelTask extends DefaultTask {
    @TaskAction
    def mulchannel() {
        //1.get config extension
        ConfigExtension config = project.mulchannel
        //2.decompression zip file to tempDir
        def ant = new AntBuilder();
        ant.unzip(src: config.inputFile, dest: config.tempDir)
        //3.iterater channels
        config.channels.each { item ->
            //3.1.new a channel file
            File file = new File(new File(config.tempDir, "META-INF"), "mulchannel_" + item)
            file.createNewFile()
            //3.2.zip the temp dir
            ant.zip(destfile: new File(config.outputDir, item + ".apk"), basedir: "temp");
            //3.3.delete channel file
            file.delete()
        }
    }
}<commit_msg>support default temp dir<commit_after>package me.zhangls.mulchannel

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction

class MulchannelTask extends DefaultTask {

    File DEFAULT_TEMP = new File(project.getProjectDir(), "temp")

    @TaskAction
    def mulchannel() {
        //1.get config extension
        ConfigExtension config = project.mulchannel
        //2.decompression zip file to tempDir
        def ant = new AntBuilder();

        def temp = config.tempDir == null ? DEFAULT_TEMP : config.tempDir;
        ant.unzip(src: config.inputFile, dest: temp)
        //3.iterater channels
        config.channels.each { item ->
            //3.1.new a channel file
            File file = new File(new File(temp, "META-INF"), "mulchannel_" + item)
            file.createNewFile()
            //3.2.zip the temp dir
            ant.zip(destfile: new File(config.outputDir, item + ".apk"), basedir: temp.getName());
            //3.3.delete channel file
            file.delete()
        }
        if (config.tempDir == null) {
            DEFAULT_TEMP.deleteDir();
        }
    }
}
{'fraction_non_alphanumeric': 0.11077694235588972, 'fraction_numerical': 0.009022556390977444, 'mean_word_length': 2.138364779874214, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1215937', 'n_tokens_mistral': 580, 'n_tokens_neox': 568, 'n_words': 146}