<commit_before>package com.github.jengelman.gradle.plugins.shadow.tasks

import org.gradle.api.DefaultTask
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.TaskAction

import java.util.jar.JarFile


class ConfigureShadowRelocation extends DefaultTask {

    @Input
    ShadowJar target

    @Input
    String prefix = "shadow"

    @InputFiles @Optional
    List<Configuration> getConfigurations() {
        return target.configurations
    }

    @TaskAction
    void configureRelocation() {
        def packages = [] as Set<String>
        configurations.each { configuration ->
            configuration.files.each { jar ->
                JarFile jf = new JarFile(jar)
                jf.entries().each { entry ->
                    if (entry.name.endsWith(".class")) {
                        packages << entry.name[0..entry.name.lastIndexOf('/')-1].replaceAll('/', '.')
                    }
                }
                jf.close()
            }
        }
        packages.each {
            target.relocate(it, "${prefix}.${it}")
        }

    }

    static String taskName(Task task) {
        return "configureRelocation${task.name.capitalize()}"
    }

}
<commit_msg>bug: exclude module-info.class from auto relocation<commit_after>package com.github.jengelman.gradle.plugins.shadow.tasks

import org.gradle.api.DefaultTask
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.TaskAction

import java.util.jar.JarFile


class ConfigureShadowRelocation extends DefaultTask {

    @Input
    ShadowJar target

    @Input
    String prefix = "shadow"

    @InputFiles @Optional
    List<Configuration> getConfigurations() {
        return target.configurations
    }

    @TaskAction
    void configureRelocation() {
        def packages = [] as Set<String>
        configurations.each { configuration ->
            configuration.files.each { jar ->
                JarFile jf = new JarFile(jar)
                jf.entries().each { entry ->
                    if (entry.name.endsWith(".class") && entry.name != "module-info.class") {
                        packages << entry.name[0..entry.name.lastIndexOf('/')-1].replaceAll('/', '.')
                    }
                }
                jf.close()
            }
        }
        packages.each {
            target.relocate(it, "${prefix}.${it}")
        }

    }

    static String taskName(Task task) {
        return "configureRelocation${task.name.capitalize()}"
    }

}

{'fraction_non_alphanumeric': 0.11564871702204553, 'fraction_numerical': 0.0014456089627755693, 'mean_word_length': 2.127683615819209, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2410340', 'n_tokens_mistral': 802, 'n_tokens_neox': 758, 'n_words': 139}