<commit_before>package com.jvoegele.gradle.tasks.android

import com.jvoegele.gradle.tasks.android.exceptions.InstrumentationTestsFailedException;
import com.jvoegele.gradle.tasks.android.exceptions.AdbErrorException;

class InstrumentationTestsTask extends AdbExec {
  def testPackage
  def testRunnersConfig
  def testReportsSourcePath
  def testReportsTargetPath
  def defaultAdbArgs
  
  def InstrumentationTestsTask() {
    logger.info("Running instrumentation tests...")
    
    this.testPackage = ant['manifest.package']
    this.defaultAdbArgs = super.getArgs()
    this.testRunnersConfig = new TestRunnersConfig(project, testPackage)
    
    def testedPackage = ant['tested.manifest.package']
    if (testedPackage) { // this is only set for instrumentation projects
      this.testReportsSourcePath = "/data/data/$testedPackage/files"
      this.testReportsTargetPath = project.file('build/test-results').toString()
    }
    
    onlyIf {
      boolean isTestingOtherPackage = testedPackage != null
      if (!isTestingOtherPackage) { 
        logger.warn "!! Skipping androidInstrumentationTests task since no target package was specified in the manifest"
      }
      isTestingOtherPackage
    }
  } <commit_msg>Fix onlyIf predicate to actually skip the instrumentation task if no target package was specified.<commit_after>package com.jvoegele.gradle.tasks.android

import com.jvoegele.gradle.plugins.android.AndroidPlugin;
import com.jvoegele.gradle.tasks.android.exceptions.InstrumentationTestsFailedException;
import com.jvoegele.gradle.tasks.android.exceptions.AdbErrorException;

class InstrumentationTestsTask extends AdbExec {
  def testPackage
  def testRunnersConfig
  def testReportsSourcePath
  def testReportsTargetPath
  def defaultAdbArgs
  
  def InstrumentationTestsTask() {
    logger.info("Running instrumentation tests...")
    
    this.testPackage = ant['manifest.package']
    this.defaultAdbArgs = super.getArgs()
    this.testRunnersConfig = new TestRunnersConfig(project, testPackage)
    
    def testedPackage = ant['tested.manifest.package']
    if (testedPackage) { // this is only set for instrumentation projects
      this.testReportsSourcePath = "/data/data/$testedPackage/files"
      this.testReportsTargetPath = project.file('build/test-results').toString()
    }
    
    onlyIf {
      boolean isTestingOtherPackage = testedPackage || false
      if (!isTestingOtherPackage) { 
        logger.warn("!! Skipping $AndroidPlugin.ANDROID_INSTRUMENTATION_TESTS_TASK_NAME task "
          + "for project $project.name since no target package was specified in the manifest")
      }
      isTestingOtherPackage
    }
  } 
{'fraction_non_alphanumeric': 0.08092918696140877, 'fraction_numerical': 0.0, 'mean_word_length': 4.066413662239089, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5015634', 'n_tokens_mistral': 765, 'n_tokens_neox': 735, 'n_words': 159}