Page MenuHomePhorge

T15011: Update support for XHPast on Windows
AcceptedPublic

Authored by speck on Feb 6 2024, 03:06.

Details

Summary

This adds some functional support for building XHPast on Windows.

Refs T15011

Test Plan

I deleted src/parser/xhpast/bin/xhpast.exe and ran arc lint src/filesystem/FileFinder.php and verified that a new xhpast.exe was produced and linted.

Diff Detail

Repository
rARC Arcanist
Branch
xhpastwin
Lint
Lint Errors
SeverityLocationCodeMessage
Errorsrc\parser\xhpast\bin\PhutilXHPASTBinary.php:65XHP86Unsafe Usage of Dynamic String
Warningsupport\xhpast\make.bat:20TXT3Line Too Long
Warningsupport\xhpast\make.bat:21TXT3Line Too Long
Warningsupport\xhpast\make.bat:27TXT3Line Too Long
Warningsupport\xhpast\unistd.h:43TXT3Line Too Long
Unit
Test Failures
Build Status
Buildable 1054
Build 1054: arc lint + arc unit

Unit TestsFailed

TimeTest
13 msArcanistBundleTestCase::testDisjointHunks
EXCEPTION (Exception): Can't parse an empty diff! #0 C:\Users\cspeckrun\Source\phorge\arcanist\src\parser\ArcanistBundle.php(191): ArcanistDiffParser->parseDiff('') #1 C:\Users\cspeckrun\Source\phorge\arcanist\src\parser\__tests__\ArcanistBundleTestCase.php(33): ArcanistBundle::newFromDiff('')
14 msArcanistBundleTestCase::testMergeHunks
EXCEPTION (Exception): Can't parse an empty diff! #0 C:\Users\cspeckrun\Source\phorge\arcanist\src\parser\ArcanistBundle.php(191): ArcanistDiffParser->parseDiff('') #1 C:\Users\cspeckrun\Source\phorge\arcanist\src\parser\__tests__\ArcanistBundleTestCase.php(33): ArcanistBundle::newFromDiff('')
13 msArcanistBundleTestCase::testNonlocalTrailingNewline
EXCEPTION (Exception): Can't parse an empty diff! #0 C:\Users\cspeckrun\Source\phorge\arcanist\src\parser\ArcanistBundle.php(191): ArcanistDiffParser->parseDiff('') #1 C:\Users\cspeckrun\Source\phorge\arcanist\src\parser\__tests__\ArcanistBundleTestCase.php(33): ArcanistBundle::newFromDiff('')
13 msArcanistBundleTestCase::testTrailingContext
EXCEPTION (Exception): Can't parse an empty diff! #0 C:\Users\cspeckrun\Source\phorge\arcanist\src\parser\ArcanistBundle.php(191): ArcanistDiffParser->parseDiff('') #1 C:\Users\cspeckrun\Source\phorge\arcanist\src\parser\__tests__\ArcanistBundleTestCase.php(33): ArcanistBundle::newFromDiff('')
3 msArcanistBaseCommitParserTestCase::testBasics
2 assertion(s) passed.
View Full Test Results (4 Failed · 71 Passed · 1 Skipped)

Event Timeline

speck requested review of this revision.Feb 6 2024, 03:06

Fix use of ExecFuture to pass a scalar string as first argument instead of variable.

Fix some lints about line length

The ArcanistBundleTestCase failures are due to diff binary not being present on Windows systems. The tests could be rewritten to utilize git diff instead but would take some effort.

Passed a week. Nobody commented. I blindly trust you in this field :3 Approve.

This revision is now accepted and ready to land.Feb 15 2024, 23:46
src/parser/xhpast/bin/PhutilXHPASTBinary.php
29–32

I wonder if the caller should avoid to call this, if not windows.

And here, maybe exception instead.

But that is just my curiosity on a sugar thing.

src/parser/xhpast/bin/PhutilXHPASTBinary.php
29–32

(Sorry I get it now. Fine.)

Maybe this is wild, but: should we consider removing the compiled xhpast.exe file from the repository, and host is externally?
I think it's only used for working on PHP on Windows; The equivalent xhpast isn't included, presumably because compiling stuff on Windows is harder.
My argument for this is that the normal way to install arcanist is git clone, which downloads all the history (and 95% of users won't need this particular file).

History is here: https://secure.phabricator.com/source/libphutil/history/master/src/parser/xhpast/bin/xhpast.exe

Also - is the new file statically linked? https://secure.phabricator.com/T5372 did that.

Maybe this is wild, but: should we consider removing the compiled xhpast.exe file from the repository, and host is externally?

I think with this change it's reasonable to remove it. I do believe it was included because compiling it for windows is involved/difficult. This makes it slightly easier.

Also - is the new file statically linked? https://secure.phabricator.com/T5372 did that.

I believe so, the last compilation includes -static, though the two libraries are not but I think that's expected/okay.