<commit_before>package com.jayway.maven.plugins.android.phase04processclasses;

import com.jayway.maven.plugins.android.AbstractAndroidMojo;
import com.jayway.maven.plugins.android.CommandExecutor;
import com.jayway.maven.plugins.android.ExecutionException;
import com.jayway.maven.plugins.android.common.AndroidExtension;
import com.jayway.maven.plugins.android.config.ConfigHandler;
import com.jayway.maven.plugins.android.config.ConfigPojo;
import com.jayway.maven.plugins.android.config.PullParameter;
import com.jayway.maven.plugins.android.configuration.Proguard;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.codehaus.plexus.util.FileUtils;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.JavaScopes;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * Processes both application and dependency classes using the ProGuard byte code obfuscator,
 * minimzer, and optimizer. For more information, see https://proguard.sourceforge.net.
 *
 * @author Jonson
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 * @goal proguard
 * @phase process-classes
 * @requiresDependencyResolution compile
 */
public class ProguardMojo extends AbstractAndroidMojo
{

    /**
     * <p>
     * ProGuard configuration. ProGuard is disabled by default. Set the skip parameter to false to activate proguard.
     * A complete configuartion can include any of the following:
     * </p>
     * <p/>
     * <pre>
     * &lt;proguard&gt;
     *    &lt;skip&gt;true|false&lt;/skip&gt;
     *    &lt;config&gt;proguard.cfg&lt;/config&gt;
     *    &lt;proguardJarPath&gt;someAbsolutePathToProguardJar&lt;/proguardJarPath&gt;
     *    &lt;filterMavenDescriptor&gt;true|false&lt;/filterMavenDescriptor&gt;
     *    &lt;filterManifest&gt;true|false&lt;/filterManifest&gt;
     *    &lt;jvmArguments&gt;
     *     &lt;jvmArgument&gt;-Xms256m&lt;/jvmArgument&gt;
     *     &lt;jvmArgument&gt;-Xmx512m&lt;/jvmArgument&gt;
     *   &lt;/jvmArguments&gt;
     * &lt;/proguard&gt;
     * </pre>
     * <p>
     * A good practice is to create a release profile in your POM, in which you enable ProGuard.
     * ProGuard should be disabled for development builds, since it obfuscates class and field
     * names, and it may interfere with test projects that rely on your application classes.
     * All parameters can be overridden in profiles or the the proguard* properties. Default values apply and are
     * documented with these properties.
     * </p>
     *
     * @parameter
     */
    @ConfigPojo
    protected Proguard proguard;

    /**
     * Whether ProGuard is enabled or not. Defaults to true.
     *
     * @parameter expression="${android.proguard.skip}"
     * @optional
     */
    private Boolean proguardSkip;

    @PullParameter( defaultValue = "true" )
    private Boolean parsedSkip;

    /**
     * Path to the ProGuard configuration file (relative to project root). Defaults to "proguard.cfg"
     *
     * @parameter expression="${android.proguard.config}"
     * @optional
     */
    private String proguardConfig;

    @PullParameter( defaultValue = "proguard.cfg" )
    private String parsedConfig;

    /**
     * Path to the proguard jar and therefore version of proguard to be used. By default this will load the jar from
     * the Android SDK install. Overriding it with an absolute path allows you to use a newer or custom proguard
     * version..
     * <p/>
     * You can also reference an external Proguard version as a plugin dependency like this:
     * <pre>
     * &lt;plugin&gt;
     *   &lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
     *   &lt;artifactId&gt;android-maven-plugin&lt;/artifactId&gt;
     *     &lt;dependencies&gt;
     *       &lt;dependency&gt;
     *         &lt;groupId&gt;net.sf.proguard&lt;/groupId&gt;
     *         &lt;artifactId&gt;proguard-base&lt;/artifactId&gt;
     *         &lt;version&gt;4.7&lt;/version&gt;
     *       &lt;/dependency&gt;
     *     &lt;/dependencies&gt;
     * </pre>
     * <p/>
     * which will download and use Proguard 4.7 as deployed to the Central Repository.
     *
     * @parameter expression="${android.proguard.proguardJarPath}
     * @optional
     */
    private String proguardProguardJarPath;

    @PullParameter( defaultValueGetterMethod = "getProguardJarPath" )
    private String parsedProguardJarPath;
    
    /**
     * Path to the ProGuard output directory (relative to project root). Defaults to "proguard"
     *
     */
     
     /**
     * Path relative to the project's build directory(target) where proguard puts folowing files:
     * <p/>
     * <ul>
     *   <li>dump.txt</li><commit_msg>I've removed an invalid text paragraph. I'm pretty sure, that the path is relative to the  build directory (default absolute  path is target/proguard).<commit_after>package com.jayway.maven.plugins.android.phase04processclasses;

import com.jayway.maven.plugins.android.AbstractAndroidMojo;
import com.jayway.maven.plugins.android.CommandExecutor;
import com.jayway.maven.plugins.android.ExecutionException;
import com.jayway.maven.plugins.android.common.AndroidExtension;
import com.jayway.maven.plugins.android.config.ConfigHandler;
import com.jayway.maven.plugins.android.config.ConfigPojo;
import com.jayway.maven.plugins.android.config.PullParameter;
import com.jayway.maven.plugins.android.configuration.Proguard;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.codehaus.plexus.util.FileUtils;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.JavaScopes;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * Processes both application and dependency classes using the ProGuard byte code obfuscator,
 * minimzer, and optimizer. For more information, see https://proguard.sourceforge.net.
 *
 * @author Jonson
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 * @goal proguard
 * @phase process-classes
 * @requiresDependencyResolution compile
 */
public class ProguardMojo extends AbstractAndroidMojo
{

    /**
     * <p>
     * ProGuard configuration. ProGuard is disabled by default. Set the skip parameter to false to activate proguard.
     * A complete configuartion can include any of the following:
     * </p>
     * <p/>
     * <pre>
     * &lt;proguard&gt;
     *    &lt;skip&gt;true|false&lt;/skip&gt;
     *    &lt;config&gt;proguard.cfg&lt;/config&gt;
     *    &lt;proguardJarPath&gt;someAbsolutePathToProguardJar&lt;/proguardJarPath&gt;
     *    &lt;filterMavenDescriptor&gt;true|false&lt;/filterMavenDescriptor&gt;
     *    &lt;filterManifest&gt;true|false&lt;/filterManifest&gt;
     *    &lt;jvmArguments&gt;
     *     &lt;jvmArgument&gt;-Xms256m&lt;/jvmArgument&gt;
     *     &lt;jvmArgument&gt;-Xmx512m&lt;/jvmArgument&gt;
     *   &lt;/jvmArguments&gt;
     * &lt;/proguard&gt;
     * </pre>
     * <p>
     * A good practice is to create a release profile in your POM, in which you enable ProGuard.
     * ProGuard should be disabled for development builds, since it obfuscates class and field
     * names, and it may interfere with test projects that rely on your application classes.
     * All parameters can be overridden in profiles or the the proguard* properties. Default values apply and are
     * documented with these properties.
     * </p>
     *
     * @parameter
     */
    @ConfigPojo
    protected Proguard proguard;

    /**
     * Whether ProGuard is enabled or not. Defaults to true.
     *
     * @parameter expression="${android.proguard.skip}"
     * @optional
     */
    private Boolean proguardSkip;

    @PullParameter( defaultValue = "true" )
    private Boolean parsedSkip;

    /**
     * Path to the ProGuard configuration file (relative to project root). Defaults to "proguard.cfg"
     *
     * @parameter expression="${android.proguard.config}"
     * @optional
     */
    private String proguardConfig;

    @PullParameter( defaultValue = "proguard.cfg" )
    private String parsedConfig;

    /**
     * Path to the proguard jar and therefore version of proguard to be used. By default this will load the jar from
     * the Android SDK install. Overriding it with an absolute path allows you to use a newer or custom proguard
     * version..
     * <p/>
     * You can also reference an external Proguard version as a plugin dependency like this:
     * <pre>
     * &lt;plugin&gt;
     *   &lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
     *   &lt;artifactId&gt;android-maven-plugin&lt;/artifactId&gt;
     *     &lt;dependencies&gt;
     *       &lt;dependency&gt;
     *         &lt;groupId&gt;net.sf.proguard&lt;/groupId&gt;
     *         &lt;artifactId&gt;proguard-base&lt;/artifactId&gt;
     *         &lt;version&gt;4.7&lt;/version&gt;
     *       &lt;/dependency&gt;
     *     &lt;/dependencies&gt;
     * </pre>
     * <p/>
     * which will download and use Proguard 4.7 as deployed to the Central Repository.
     *
     * @parameter expression="${android.proguard.proguardJarPath}
     * @optional
     */
    private String proguardProguardJarPath;

    @PullParameter( defaultValueGetterMethod = "getProguardJarPath" )
    private String parsedProguardJarPath;
    
    /**
     * Path relative to the project's build directory (target) where proguard puts folowing files:
     * <p/>
     * <ul>
     *   <li>dump.txt</li>
{'fraction_non_alphanumeric': 0.10956194996539108, 'fraction_numerical': 0.0025709482843864332, 'mean_word_length': 3.372676178123649, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5400165', 'n_tokens_mistral': 3171, 'n_tokens_neox': 3034, 'n_words': 749}