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

registerInputAndProcess should exist #14

Open
virtuald opened this issue Nov 12, 2015 · 2 comments
Open

registerInputAndProcess should exist #14

virtuald opened this issue Nov 12, 2015 · 2 comments

Comments

@virtuald
Copy link
Contributor

Looking at registerInputsAndProcess, it appears that it adds to the result set if the workspace is not in delta mode or if the resource is unmodified. This seems like an internal detail of sorts, would make sense to have registerInputAndProcess that contains that detail for single-input processing.

@ifedorenko
Copy link
Contributor

I am not sure I understand the problem. Are you saying that BuildContext#registerAndProcessInputs returns unexpected (or at least "un-intuitive") results in some cases, or do you want similar register-and-process API that takes single File input?

If it's the former, please provide a unit test that shows the problem.

If it's the latter, I tried to introduce InputProcessor callback interface and registerAndProcessInput(File, InputProcessor) API, but that was not very convenient to use, at least without java8 lambdas. I also tried "fluent" builder approach, but did not like it either. And I do not see how to introduce registerAndProcessInput(File) without retuning null, which I believe will be inconvenient and error prone. Got other ideas?

@virtuald
Copy link
Contributor Author

The latter.

The problem is that you have two types of workspace modes (here) -- and it seems like it would be nice for the caller to not have to know about this. Or, is the checking for delta mode just an optimization? Then in which case my complaint is less valid.

Alternative to null: You could have registerAndProcessInput(File) return an iterable? Return either empty collection or Arrays.asList(item). It's a bit weird, but less error prone.

Yet another alternative, allow registerInputs to work with a single file too, not just directories.

I agree that an inputProcessor interface would be annoying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants