Skip to content

Add Windows and macOS to CI build matrix and fix cross-platform issues - #445

Open
addwes7 wants to merge 2 commits into
alibaba:mainfrom
addwes7:pr-branch
Open

Add Windows and macOS to CI build matrix and fix cross-platform issues#445
addwes7 wants to merge 2 commits into
alibaba:mainfrom
addwes7:pr-branch

Conversation

@addwes7

@addwes7 addwes7 commented Jun 20, 2026

Copy link
Copy Markdown

What is the purpose of this PR

The CI workflow currently runs only on ubuntu-latest. This PR extends the build matrix to include windows-latest and macos-latest, and fixes a platform-specific issue that was uncovered when running the test suite on Windows.

Expected Result

The project builds and tests successfully on Ubuntu, Windows, and macOS with consistent behavior across platforms.

Windows-specific issue

Multi-line string literals fail on Windows

Expected:
assert("hello\nworld" == "hello\nworld") passes on all platforms.

Actual:
The assertion fails on Windows.

Why:
Windows uses \r\n (CRLF) line endings, while Unix-based systems use \n (LF). Scripts read from disk therefore contain different newline sequences depending on the platform, causing multi-line string literals to produce different values.

Fix:
Normalize all line endings to \n before lexing and parsing.

Changes

File Change
.github/workflows/unittest.yml Add windows-latest and macos-latest to the CI matrix
SyntaxTreeFactory.java Normalize line endings (CRLF/CRLF) before lexing

Description of Fix

Scripts are now normalized to use Unix-style line endings (\n) before tokenization and parsing. This removes platform-dependent differences in multi-line string literals and ensures scripts behave consistently on Windows, macOS, and Linux.

@CLAassistant

CLAassistant commented Jun 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

public static QLParser.ProgramContext buildTree(String script, ParserOperatorManager operatorManager,
boolean printTree, Consumer<String> printer, InterpolationMode interpolationMode, String selectorStart,
String selectorEnd, boolean strictNewLines) {
script = script.replace("\r\n", "\n").replace("\r", "\n");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这个处理略粗暴,建议在Lexer或者Parser中做修改

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Moved the CRLF normalization into QLexer so string literal token text is normalized during lexing

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.

3 participants