-
Notifications
You must be signed in to change notification settings - Fork 13
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
Allow customiztion before command executes. #27
Conversation
@@ -19,4 +21,6 @@ object Libraries { | |||
val SLF4J = "org.slf4j:slf4j-simple:${Versions.SLF4J}" | |||
val SPOCK_CORE = "org.spockframework:spock-core:${Versions.SPOCK_CORE}" | |||
val TYPESAFE_CONFIG = "com.typesafe:config:${Versions.TYPESAFE_CONFIG}" | |||
val CGLIB = "cglib:cglib-nodep:${Versions.CGLIB}" | |||
val OBJENESIS = "org.objenesis:objenesis:${Versions.OBJENESIS}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two libraries are necessary for spock Mock()
.
Previously we can't do any customiztion before the command executes. This PR adds another @CommandCustomizers annotation support for test classes, which allows users to customize their commands before it executes.
a54836f
to
2a64083
Compare
Hey Bo, could you please describe the end user needs here? |
@eriwen Sure, I explained a little above. Please let me know if I didn't make myself clear, thanks! |
Also, it seems that we don't have any CI configuration for this repository, do we? |
@eriwen Could you please take a look? We've been bitten by network issues in sample tests for a long time.... |
Adjust the Command Builder to live with the Command model object and have a bit more fluent API. Change command "Customizer" to "Modifier" to more clearly convey the purpose of this construct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple changes needed, but I will make them since I was late giving feedback.
@@ -17,13 +17,17 @@ | |||
|
|||
import org.apache.commons.io.FileUtils; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.gradle.api.Transformer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels weird to use the Gradle API for transforming here. Is there another way to do this without Gradle?
|
||
import java.util.List; | ||
|
||
public class CommandBuilder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We ought to make this a part of Command
itself and not a side part of sample-check
* Customize the command before the execution runs. | ||
*/ | ||
|
||
public interface CommandCustomizer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the term "Modifier" here
@blindpirate I adjusted this PR slightly and merged with a1e9ad6: Allow Samples to be modified instead of just Commands. This allows folks to prepend/append commands to all samples in addition to modifying them all. I've been trying to figure out why we get "too long path" errors on Windows in the Gradle build using Exemplar v0.5+. I'm working on fixing this problem but happy to get your eyes on it if you need the fix sooner. Please reopen this PR or an issue if what I've provided doesn't actually do what you need for Gradle. |
Context
As an end user, sometimes I want to provide some extra arguments to the commands to be executed by
exemplar
, for example, ingradle/gradle
we want to add-Dorg.gradle.internal.plugins.portal.url.override=<OurOwnRepositoryMirror>
. Currently it's not supported byexemplar
-exemplar
will only run the commands declared in conf files, there's no way to customize them.This PR adds an annotation
@CommandCustomizers
to allow users to customize theirCommand
s before execution. A typical usage is:@eriwen Can you please take a look?