Skip to content

Commit

Permalink
Merge pull request #57 from ChristianBecker/no_useless_tasks
Browse files Browse the repository at this point in the history
Removed useless *TestClasses task per variant.
  • Loading branch information
erd committed Jul 31, 2014
2 parents b9502b0 + 34f0f85 commit 2ac3d4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 49 deletions.
12 changes: 3 additions & 9 deletions src/main/groovy/org/robolectric/gradle/RobolectricPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import org.gradle.api.tasks.testing.TestReport
class RobolectricPlugin implements Plugin<Project> {
private static final String[] TEST_DIRS = ['test', 'androidTest']
private static final String TEST_TASK_NAME = 'test'
private static final String TEST_CLASSES_DIR = "test-classes"
private static final String TEST_REPORT_DIR = "test-report"
private static final String RELEASE_VARIANT = "release"
private static final String TEST_CLASSES_DIR = 'test-classes'
private static final String TEST_REPORT_DIR = 'test-report'
private static final String RELEASE_VARIANT = 'release'

void apply(Project project) {
def extension = project.extensions.create('robolectric', RobolectricTestExtension)
Expand Down Expand Up @@ -126,12 +126,6 @@ class RobolectricPlugin implements Plugin<Project> {
testClassesTaskPerVariation.group = null
testClassesTaskPerVariation.description = null

def testClassesTaskPerFlavor = project.tasks.create("$projectFlavorName$buildTypeName" + 'TestClasses')
testClassesTaskPerFlavor.dependsOn testClassesTaskPerVariation

def testClassesTask = project.tasks.maybeCreate('testClasses')
testClassesTask.dependsOn testClassesTaskPerVariation

// don't leave test resources behind
def processResourcesTask = project.tasks.getByName variationSources.processResourcesTaskName
processResourcesTask.destinationDir = testDestinationDir.getSingleFile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,6 @@ class RobolectricPluginTest {
assertThat(project.tasks.testDebug.ignoreFailures).isTrue()
}

@Test
public void createsGenericTestClassesTask() {
Project project = evaluatableProject()
project.evaluate()

assertThat(project.tasks.testClasses).isNotNull()
}

@Test
public void dumpsAllTestClassFilesAndResourcesIntoTheSameDirectory() {
Project project = evaluatableProject()
Expand All @@ -110,38 +102,6 @@ class RobolectricPluginTest {
assertThat(project.tasks.processTestBetaDebugResources.destinationDir).isEqualTo(expectedDestination)
}

@Test
public void uniqueTaskCreatedForEachFlavor() {
Project project = evaluatableProject()
project.android { productFlavors { prod {}; beta {} } }
project.evaluate()

assertThat(project.tasks.BetaDebugTestClasses).isNotNull()
assertThat(project.tasks.ProdDebugTestClasses).isNotNull()
}

@Test
public void uniqueTaskCreatedForEachBuildType() {
Project project = evaluatableProject()
project.android { buildTypes { debug {}; trial {} } }
project.evaluate()

assertThat(project.tasks.DebugTestClasses).isNotNull()
assertThat(project.tasks.TrialTestClasses).isNotNull()
}

@Test
public void uniqueTaskCreatedForEachFlavorAndBuildType() {
Project project = evaluatableProject()
project.android { productFlavors { prod {}; beta {} }; buildTypes { debug {}; trial {} } }
project.evaluate()

assertThat(project.tasks.BetaDebugTestClasses).isNotNull()
assertThat(project.tasks.BetaTrialTestClasses).isNotNull()
assertThat(project.tasks.ProdDebugTestClasses).isNotNull()
assertThat(project.tasks.ProdTrialTestClasses).isNotNull()
}

@Test
public void parseInstrumentTestCompile_androidGradle_0_12_0() {
String androidGradleTool = "com.android.tools.build:gradle:0.12.0"
Expand Down

0 comments on commit 2ac3d4c

Please sign in to comment.