<commit_before>package net.bytebuddy.build.gradle.android.dependencies;

import com.android.build.api.attributes.BuildTypeAttr;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.attributes.Attribute;
import org.gradle.api.attributes.AttributeCompatibilityRule;
import org.gradle.api.attributes.Category;
import org.gradle.api.attributes.CompatibilityCheckDetails;
import org.gradle.api.attributes.Usage;

import java.util.Objects;

public class BytebuddyDependenciesHandler {
    private final Project project;
    private Configuration bucket;
    private static final String BYTEBUDDY_CONFIGURATION_NAME_FORMAT = "%sBytebuddy";

    public static final Attribute<String> ARTIFACT_TYPE_ATTR = Attribute.of("artifactType", String.class);
    public static final String BYTEBUDDY_JAR_TYPE = "bytebuddy-jar";

    public BytebuddyDependenciesHandler(Project project) {
        this.project = project;
    }

    public void init() {
        initBucketConfig();
        registerAarToJarTransformation();
        registerBytebuddyJarRule();
    }

    public Configuration getConfigurationForBuildType(String buildType) {
        return project.getConfigurations().create(getNameFor(buildType), configuration -> {
            configuration.setCanBeResolved(true);
            configuration.setCanBeConsumed(false);
            configuration.extendsFrom(bucket);
            configuration.attributes(attrs -> {
                attrs.attribute(ARTIFACT_TYPE_ATTR, BYTEBUDDY_JAR_TYPE);
                attrs.attribute(
                        Category.CATEGORY_ATTRIBUTE,
                        project.getObjects().named(Category.class, Category.LIBRARY)
                );
                attrs.attribute(BuildTypeAttr.ATTRIBUTE, project.getObjects().named(BuildTypeAttr.class, buildType));
                attrs.attribute(Usage.USAGE_ATTRIBUTE, project.getObjects().named(Usage.class, Usage.JAVA_RUNTIME));
            });
        });
    }

    private String getNameFor(String buildType) {
        return String.format(BYTEBUDDY_CONFIGURATION_NAME_FORMAT, buildType);
    }

    private void initBucketConfig() {
        bucket = project.getConfigurations().create("bytebuddy", configuration -> {
            configuration.setCanBeConsumed(false);
            configuration.setCanBeResolved(false);
        });
    }

    private void registerAarToJarTransformation() {
        project.getDependencies().registerTransform(AarGradleTransform.class, it -> {
            it.getFrom().attribute(ARTIFACT_TYPE_ATTR, "aar");
            it.getTo().attribute(ARTIFACT_TYPE_ATTR, BYTEBUDDY_JAR_TYPE);
        });
    }

    private void registerBytebuddyJarRule() {
        project.getDependencies().getAttributesSchema().attribute(ARTIFACT_TYPE_ATTR, stringAttributeMatchingStrategy -> {
            stringAttributeMatchingStrategy.getCompatibilityRules().add(BytebuddyJarsRule.class);
        });
    }

    public abstract static class BytebuddyJarsRule implements AttributeCompatibilityRule<String> {
        @Override
        public void execute(CompatibilityCheckDetails<String> details) {
            if (Objects.equals(details.getConsumerValue(), BYTEBUDDY_JAR_TYPE) && Objects.equals(details.getProducerValue(), "jar")) {
                details.compatible();
            }
        }
    }
}<commit_msg>Changing fields visibility in BytebuddyDependenciesHandler<commit_after>package net.bytebuddy.build.gradle.android.dependencies;

import com.android.build.api.attributes.BuildTypeAttr;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.attributes.Attribute;
import org.gradle.api.attributes.AttributeCompatibilityRule;
import org.gradle.api.attributes.Category;
import org.gradle.api.attributes.CompatibilityCheckDetails;
import org.gradle.api.attributes.Usage;

import java.util.Objects;

public class BytebuddyDependenciesHandler {
    private final Project project;
    private Configuration bucket;
    private static final String BYTEBUDDY_CONFIGURATION_NAME_FORMAT = "%sBytebuddy";

    private static final Attribute<String> ARTIFACT_TYPE_ATTR = Attribute.of("artifactType", String.class);
    private static final String BYTEBUDDY_JAR_TYPE = "bytebuddy-jar";

    public BytebuddyDependenciesHandler(Project project) {
        this.project = project;
    }

    public void init() {
        initBucketConfig();
        registerAarToJarTransformation();
        registerBytebuddyJarRule();
    }

    public Configuration getConfigurationForBuildType(String buildType) {
        return project.getConfigurations().create(getNameFor(buildType), configuration -> {
            configuration.setCanBeResolved(true);
            configuration.setCanBeConsumed(false);
            configuration.extendsFrom(bucket);
            configuration.attributes(attrs -> {
                attrs.attribute(ARTIFACT_TYPE_ATTR, BYTEBUDDY_JAR_TYPE);
                attrs.attribute(
                        Category.CATEGORY_ATTRIBUTE,
                        project.getObjects().named(Category.class, Category.LIBRARY)
                );
                attrs.attribute(BuildTypeAttr.ATTRIBUTE, project.getObjects().named(BuildTypeAttr.class, buildType));
                attrs.attribute(Usage.USAGE_ATTRIBUTE, project.getObjects().named(Usage.class, Usage.JAVA_RUNTIME));
            });
        });
    }

    private String getNameFor(String buildType) {
        return String.format(BYTEBUDDY_CONFIGURATION_NAME_FORMAT, buildType);
    }

    private void initBucketConfig() {
        bucket = project.getConfigurations().create("bytebuddy", configuration -> {
            configuration.setCanBeConsumed(false);
            configuration.setCanBeResolved(false);
        });
    }

    private void registerAarToJarTransformation() {
        project.getDependencies().registerTransform(AarGradleTransform.class, it -> {
            it.getFrom().attribute(ARTIFACT_TYPE_ATTR, "aar");
            it.getTo().attribute(ARTIFACT_TYPE_ATTR, BYTEBUDDY_JAR_TYPE);
        });
    }

    private void registerBytebuddyJarRule() {
        project.getDependencies().getAttributesSchema().attribute(ARTIFACT_TYPE_ATTR, stringAttributeMatchingStrategy ->
                stringAttributeMatchingStrategy.getCompatibilityRules().add(BytebuddyJarsRule.class));
    }

    public abstract static class BytebuddyJarsRule implements AttributeCompatibilityRule<String> {
        @Override
        public void execute(CompatibilityCheckDetails<String> details) {
            if (Objects.equals(details.getConsumerValue(), BYTEBUDDY_JAR_TYPE) && Objects.equals(details.getProducerValue(), "jar")) {
                details.compatible();
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.09415776986951364, 'fraction_numerical': 0.0, 'mean_word_length': 3.3209481101857783, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '4160615', 'n_tokens_mistral': 1828, 'n_tokens_neox': 1750, 'n_words': 266}