Skip to content

keep inputstream source when generating from the plugin - #186

Merged
phax merged 3 commits into
phax:masterfrom
glelouet:keeping_is_source
Sep 6, 2026
Merged

keep inputstream source when generating from the plugin#186
phax merged 3 commits into
phax:masterfrom
glelouet:keeping_is_source

Conversation

@glelouet

@glelouet glelouet commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Instead of getting a stream of inputstream, we also get their source information, if any.

That source information is transmitted down to the generators, so they can use it, eg to deduce class name based on the file.

It is also printed on error, to know which file / url generated the issue.

Now the source responsible is returned in the error
@glelouet
glelouet requested a review from phax August 30, 2026 01:49
@glelouet

Copy link
Copy Markdown
Collaborator Author

sorry, should be draft, I realize the pair is not transmitted to the generator which could use that information

@glelouet
glelouet marked this pull request as draft August 30, 2026 01:51
@glelouet
glelouet marked this pull request as ready for review August 30, 2026 02:03
@glelouet

Copy link
Copy Markdown
Collaborator Author

I made a PR rather than a discussion for this one. The reason is that I was thinking how to do that before, and how it could help the generators.

@glelouet glelouet changed the title plugin sources are kept with the inputstream keep inputstream source when genrating from the plugin Aug 30, 2026
@phax

phax commented Aug 30, 2026

Copy link
Copy Markdown
Owner

I have the concept of IReadableResource in my ph-io base library - with ClassPathResource, FileResource and URLResource with the sanity methods for InputStream and Reader - please have a look

@glelouet

Copy link
Copy Markdown
Collaborator Author

Can't find the repo. Can you link @phax ?
Or better, change the PR to incorporate your idea instead.

@phax

phax commented Aug 31, 2026

Copy link
Copy Markdown
Owner

@glelouet glelouet changed the title keep inputstream source when genrating from the plugin keep inputstream source when generating from the plugin Sep 5, 2026
@phax
phax merged commit 390fba5 into phax:master Sep 6, 2026
4 checks passed
phax pushed a commit that referenced this pull request Sep 7, 2026
* maven plugin now concats data and source params streams.

Previously, "data" was superseeding the "source" ; now they are both
used.

If none are present, still returns a Stream.of(null) so that a generator
which does not need data would still work (is called against a null
inputstream), while a generator that requires data would fail (with NPE)
rather than be silently skipped.

* keep inputstream source when generating from the plugin (#186)

* plugin sources are kept with the inputstream

Now the source responsible is returned in the error

* sourcedinputstream transmitted to the generators.

* activate specific projects formatter and reformat them :P

---------

Co-authored-by: glelouet <n@mo>

* removed the default build(JCM)

since the plugin should never had no data to transmit, no point in this
method that was not called to start with.

---------

Co-authored-by: glelouet <n@mo>
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

Successfully merging this pull request may close these issues.

2 participants