Permit using multiple spawn modules in integration tests.
The comment stating that multiple spawn modules cannot be handled dates back to 2014, so I'm going to assume it's obsolete.
This simplifies test setup when multiple modules need to be registered prior to the strategy module.
@@ -457,10 +457,13 @@ public abstract class BuildIntegrationTestCase {
};
}
- // There should be one getSpawnModule at a time, as we lack infrastructure to decide from
- // which Module to take the SpawnActionContext for specific actions.
- protected BlazeModule getSpawnModule() {
- return new StandaloneModule();
+ /**
+ * Returns modules necessary for configuring spawn strategies.
+ *
+ * <p>These modules are registered <em>before</em> {@link #getStrategyModule}.
+ */
+ protected ImmutableList<BlazeModule> getSpawnModules() {
+ return ImmutableList.of(new StandaloneModule());
}
/** Gets a module containing rules (by default, using the TestRuleClassProvider) */
@@ -514,8 +517,9 @@ public abstract class BuildIntegrationTestCase {
.setBugReporter(bugReporter)
.setStartupOptionsProvider(startupOptionsParser)
.addBlazeModule(connectivityModule)
- .addBlazeModule(getMockBazelRepositoryModule())
- .addBlazeModule(getSpawnModule())
+ .addBlazeModule(getMockBazelRepositoryModule());
+ getSpawnModules().forEach(builder::addBlazeModule);
+ builder
.addBlazeModule(getBuildInfoModule())
.addBlazeModule(getRulesModule())
.addBlazeModule(getStrategyModule());
