-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- remove the key filtering from the ScenarioLoader outside of the BuildMutators - update existing BuildMutators to return NOOP when key doesn't exist in config, allowing the BuildMutators to be responsible for enabling/disabling functionality. This will allow BuildMutators to work with specific Build types (ie Bazel) or all of them depending on the configuration. Signed-off-by: Alex Beggs <[email protected]>
- Loading branch information
Showing
7 changed files
with
63 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/org/gradle/profiler/mutations/HasPathBuildMutatorConfigurator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.gradle.profiler.mutations; | ||
|
||
import com.typesafe.config.Config; | ||
import java.util.function.Supplier; | ||
import org.gradle.profiler.BuildMutator; | ||
import org.gradle.profiler.InvocationSettings; | ||
|
||
class HasPathBuildMutatorConfigurator implements BuildMutatorConfigurator { | ||
|
||
private Supplier<BuildMutator> configurator; | ||
|
||
HasPathBuildMutatorConfigurator(Supplier<BuildMutator> configurator) { | ||
this.configurator = configurator; | ||
} | ||
|
||
@Override | ||
public BuildMutator configure(Config scenario, String scenarioName, InvocationSettings settings, String key) { | ||
BuildMutator buildMutator; | ||
if (scenario.hasPath(key)) { | ||
buildMutator = configurator.get(); | ||
} else { | ||
buildMutator = BuildMutator.NOOP; | ||
} | ||
return buildMutator; | ||
} | ||
} |