Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add execute-command-before BuildMutator #310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexBeggs
Copy link
Contributor

@AlexBeggs AlexBeggs commented Feb 7, 2021

  • BuildMutator allows commands to be executed prior to the SCENARIO or BUILD phase. Enabled for all types of builds, Gradle, Bazel, Buck, and Maven.

Dependent on #315

@AlexBeggs AlexBeggs force-pushed the execute-command-before-build-mutator branch from 34a5304 to 8bd8259 Compare February 7, 2021 18:57
}

public enum ExecuteCommandSchedule {
SCENARIO, BUILD
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't handle CLEANUP, Bazel, Buck and Maven don't implement that

.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.redirectError(ProcessBuilder.Redirect.INHERIT);
Process process = processBuilder.start();
return process.waitFor();
Copy link
Contributor Author

@AlexBeggs AlexBeggs Feb 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could potentially add a timeout option but for now I left it

@AlexBeggs AlexBeggs force-pushed the execute-command-before-build-mutator branch 8 times, most recently from b1d27b8 to f34a35c Compare February 7, 2021 22:36
@runningcode runningcode requested a review from lptr February 8, 2021 08:47
@lptr lptr added this to the 0.16.0 milestone Feb 8, 2021
@AlexBeggs AlexBeggs force-pushed the execute-command-before-build-mutator branch 2 times, most recently from d4c772c to 3d31a95 Compare February 8, 2021 18:04
@@ -212,80 +218,26 @@ public ScenarioLoader(GradleBuildConfigurationReader gradleBuildConfigurationRea
String title = scenario.hasPath(TITLE) ? scenario.getString(TITLE) : null;

List<BuildMutator> mutators = BUILD_MUTATOR_CONFIGURATORS.entrySet().stream()
.filter(entry -> scenario.hasPath(entry.getKey()))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filtering isn't done here. The BuildMutator's should be responsible for determining if they support the configuration or not.

- BuildMutator allows commands to be executed prior to the SCENARIO or BUILD phase. Enabled for all types of builds, Gradle, Bazel, Buck, and Maven.

Signed-off-by: Alex Beggs <[email protected]>
@AlexBeggs AlexBeggs force-pushed the execute-command-before-build-mutator branch from 3d31a95 to c1b2376 Compare February 8, 2021 19:48
@wolfs wolfs modified the milestones: 0.16.0, 0.17.0 Mar 18, 2021
@ZacSweers
Copy link

Does this run commands in the root directory of the project? It would be helpful I think to have an example that runs a script that is local to the project being profiled since I think that would be a common case.

@AlexBeggs
Copy link
Contributor Author

If I recall correctly, this runs the command in the working directory or user.dir

@asodja asodja modified the milestones: 0.17.0, 0.18.0 Dec 23, 2021
@asodja asodja removed this from the 0.18.0 milestone Mar 18, 2022
@lptr lptr removed their request for review April 13, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants