<commit_before>package android

import java.util.Properties

import sbt._
import sbt.Keys._

import com.android.builder.core.AndroidBuilder
import com.android.builder.sdk.DefaultSdkLoader
import com.android.sdklib.{AndroidTargetHash, IAndroidTarget, SdkManager}
import com.android.sdklib.repository.FullRevision
import com.android.SdkConstants
import com.android.utils.ILogger

import java.io.File

import scala.collection.JavaConversions._
import scala.xml.XML

import Keys._
import Tasks._
import Commands._

object Plugin extends sbt.Plugin {

  // android build steps
  // * handle library dependencies (android.library.reference.N)
  // * ndk TODO
  // * aidl
  // * renderscript
  // * BuildConfig.java
  // * aapt
  // * compile
  // * obfuscate
  // * dex
  // * png crunch
  // * package resources
  // * package apk
  // * sign
  // * zipalign

  lazy val androidBuild: Seq[Setting[_]]= {
    // only set the property below if this plugin is actually used
    // this property is a workaround for bootclasspath messing things
    // up and causing full-recompiles
    System.setProperty("xsbt.skip.cp.lookup", "true")
    allPluginSettings
  }

  def androidBuild(projects: Project*): Seq[Setting[_]]= {
    androidBuild ++
      (projects map { p =>
        Seq(
          collectResources in Android <<=
            collectResources in Android dependsOn (compile in Compile in p),
          compile in Compile <<= compile in Compile dependsOn(
            packageT in Compile in p)
        )
      }).flatten
  }

  lazy val androidBuildAar: Seq[Setting[_]] = androidBuildAar()
  lazy val androidBuildApklib: Seq[Setting[_]] = androidBuildApklib()
  def androidBuildAar(projects: Project*): Seq[Setting[_]] = {
    androidBuild(projects:_*) ++ buildAar
  }
  def androidBuildApklib(projects: Project*): Seq[Setting[_]] = {
    androidBuild(projects:_*) ++ buildApklib
  }

  def buildAar = Seq(libraryProject in Android := true) ++
      addArtifact(aarArtifact in Android, packageAar in Android)

  def buildApklib = Seq(libraryProject in Android := true) ++
    addArtifact(apklibArtifact in Android, packageApklib in Android)

  private lazy val allPluginSettings: Seq[Setting[_]] = inConfig(Compile) (Seq(
    unmanagedSourceDirectories <<= (projectLayout in Android) (l =>
      Set(l.sources, l.javaSource, l.scalaSource).toSeq),<commit_msg>Auto-set localProjects when using androidBuild(...)<commit_after>package android

import java.util.Properties

import android.Dependencies.LibraryProject
import sbt._
import sbt.Keys._

import com.android.builder.core.AndroidBuilder
import com.android.builder.sdk.DefaultSdkLoader
import com.android.sdklib.{AndroidTargetHash, IAndroidTarget, SdkManager}
import com.android.sdklib.repository.FullRevision
import com.android.SdkConstants
import com.android.utils.ILogger

import java.io.File

import scala.collection.JavaConversions._
import scala.xml.XML

import Keys._
import Tasks._
import Commands._

object Plugin extends sbt.Plugin {

  // android build steps
  // * handle library dependencies (android.library.reference.N)
  // * ndk TODO
  // * aidl
  // * renderscript
  // * BuildConfig.java
  // * aapt
  // * compile
  // * obfuscate
  // * dex
  // * png crunch
  // * package resources
  // * package apk
  // * sign
  // * zipalign

  lazy val androidBuild: Seq[Setting[_]]= {
    // only set the property below if this plugin is actually used
    // this property is a workaround for bootclasspath messing things
    // up and causing full-recompiles
    System.setProperty("xsbt.skip.cp.lookup", "true")
    allPluginSettings
  }

  def androidBuild(projects: Project*): Seq[Setting[_]]= {
    androidBuild ++
      (projects flatMap { p =>
        Seq(
          collectResources in Android <<=
            collectResources in Android dependsOn (compile in Compile in p),
          compile in Compile <<= compile in Compile dependsOn(
            packageT in Compile in p)
        )
      }) :+ (localProjects in Android := projects map { p =>
        LibraryProject(p.base)
      })
  }

  lazy val androidBuildAar: Seq[Setting[_]] = androidBuildAar()
  lazy val androidBuildApklib: Seq[Setting[_]] = androidBuildApklib()
  def androidBuildAar(projects: Project*): Seq[Setting[_]] = {
    androidBuild(projects:_*) ++ buildAar
  }
  def androidBuildApklib(projects: Project*): Seq[Setting[_]] = {
    androidBuild(projects:_*) ++ buildApklib
  }

  def buildAar = Seq(libraryProject in Android := true) ++
      addArtifact(aarArtifact in Android, packageAar in Android)

  def buildApklib = Seq(libraryProject in Android := true) ++
    addArtifact(apklibArtifact in Android, packageApklib in Android)

  private lazy val allPluginSettings: Seq[Setting[_]] = inConfig(Compile) (Seq(
    unmanagedSourceDirectories <<= (projectLayout in Android) (l =>
      Set(l.sources, l.javaSource, l.scalaSource).toSeq),
{'fraction_non_alphanumeric': 0.10804174340085942, 'fraction_numerical': 0.0, 'mean_word_length': 3.455788514129444, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '6151619', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1458, 'n_words': 387}