Skip to content
This repository was archived by the owner on Feb 17, 2026. It is now read-only.
This repository was archived by the owner on Feb 17, 2026. It is now read-only.

Validate Spoon Task Inputs #82

@ZakTaccardi

Description

@ZakTaccardi

I have the following code:

spoon {
  // The number of separate shards to create.
  if (project.hasProperty('spoonNumShards')) {
    numShards = project.spoonNumShards
  }
  // The shardIndex option to specify which shard to run.
  if (project.hasProperty('spoonShardIndex')) {
    shardIndex = project.spoonShardIndex
  }
}

I ran the following command

./gradlew :app:spoonDebugAndroidTest -PspoonNumShards=4 -PspoonShardIndex=0

Expected output:

I/RemoteAndroidTest: Running am instrument -w -r   -e shardIndex 0 -e numShards 4 -e log true

Actual output:

I/RemoteAndroidTest: Running am instrument -w -r   -e  shardIndex 48 -e numShards 52 -e log true

To fix this, Integer.valueOf(..) is needed.

spoon {
  // The number of separate shards to create.
  if (project.hasProperty('spoonNumShards')) {
    numShards = Integer.valueOf(project.spoonNumShards)
  }
  // The shardIndex option to specify which shard to run.
  if (project.hasProperty('spoonShardIndex')) {
    shardIndex = Integer.valueOf(project.spoonShardIndex)
  }
}

Ask:
Avoid this issue by having the spoon gradle plugin validate its input and throw an exception when numShards/shardIndex, are not integers.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions