Skip to content

Respect local OS line endings when generating files - #406

Merged
tsegismont merged 3 commits into
eclipse-vertx:masterfrom
ahus1:is-5849-respect-local-lineendings
Nov 30, 2026
Merged

tsegismont merged 3 commits into
eclipse-vertx:masterfrom
ahus1:is-5849-respect-local-lineendings

Conversation

@ahus1

@ahus1 ahus1 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

This avoids listing all files changes in a Git diff and IDEs.

Closes eclipse-vertx/vert.x#5849

@ahus1
ahus1 marked this pull request as ready for review February 5, 2026 22:46
@ahus1

ahus1 commented Feb 5, 2026

Copy link
Copy Markdown
Contributor Author

@vietj - this should contain the changes as discussed in the contributor hangout and listed in eclipse-vertx/vert.x#5849.

Please take a look when you have the time. Thanks!

@vietj vietj added this to the 5.1.0 milestone Feb 6, 2026
@vietj vietj modified the milestones: 5.1.0, 5.1.1, 5.1.2 May 31, 2026
@vietj vietj modified the milestones: 5.1.2, 5.1.3 Jun 8, 2026
@vietj vietj modified the milestones: 5.1.3, 5.1.4 Jun 23, 2026
@vietj vietj modified the milestones: 5.1.4, 5.1.5, 5.1.6 Jul 7, 2026
@vietj vietj modified the milestones: 5.1.6, 5.1.7 Aug 5, 2026
@vietj vietj modified the milestones: 5.1.7, 5.1.8 Sep 1, 2026
@vietj vietj modified the milestones: 5.1.8, 5.1.9 Sep 9, 2026
@vietj vietj modified the milestones: 5.1.9, 5.2.1 Sep 18, 2026
@vietj vietj modified the milestones: 5.2.1, 5.2.2 Oct 7, 2026
@vietj vietj modified the milestones: 5.2.2, 5.2.3 Oct 21, 2026
@vietj vietj modified the milestones: 5.2.3, 5.2.4 Nov 3, 2026
@tsegismont tsegismont removed this from the 5.2.4 milestone Nov 30, 2026
@tsegismont tsegismont added this to the 5.3.0 milestone Nov 30, 2026
This avoids listing all files changes in a Git diff and IDEs.

Closes eclipse-vertx/vert.x#5849
@tsegismont
tsegismont force-pushed the is-5849-respect-local-lineendings branch from 48095bc to c4369b7 Compare November 30, 2026 15:28
Instead of reading the system line separator on each pass over the
generated files, it is read once when the Processor class is loaded.

The converter is a constant that is a no-op when the local line
separator is LF, and otherwise replaces LF with the local separator.
Compile a model with the testgen2 generator and check the generated
Java source contains only the system line separator.

The 5.x CI matrix already runs the tests on Windows (JDK 25), where
the LF to CRLF conversion is exercised.

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you @ahus1

@tsegismont

Copy link
Copy Markdown
Member

@ahus1 I updated the branch with 2 changes. Now, the content converter is computed when the class is loaded and there is a test for line separators.

@tsegismont
tsegismont merged commit e1f5ce5 into eclipse-vertx:master Nov 30, 2026
5 checks passed
tsegismont added a commit that referenced this pull request Nov 30, 2026
* Respect local OS line endings when generating files

This avoids listing all files changes in a Git diff and IDEs.

Closes eclipse-vertx/vert.x#5849

* Read the line separator at class load and use a constant converter

Instead of reading the system line separator on each pass over the
generated files, it is read once when the Processor class is loaded.

The converter is a constant that is a no-op when the local line
separator is LF, and otherwise replaces LF with the local separator.

* Verify generated files use the system line separator

Compile a model with the testgen2 generator and check the generated
Java source contains only the system line separator.

The 5.x CI matrix already runs the tests on Windows (JDK 25), where
the LF to CRLF conversion is exercised.

---------


(cherry picked from commit e1f5ce5)

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Co-authored-by: Alexander Schwartz <alexander.schwartz@gmx.net>
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.

Generated Java files are generated on Windows with LF, showing up in IDEs as modified

3 participants