HaxeFoundation / HaxeFoundation/haxe
Conflicting library versions error is missed when using multiple hxmls
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
If I compile with the following command:
```
haxe -lib haxelib:4.1.0 -lib haxelib:git --version
```
I get the expected error ```Error: Error: Cannot process `haxelib:git`: Library haxelib has two versions included : 4.1.0 and git```.
However, if the `-lib` flags are contained between different hxmls, then haxelib is invoked once per hxml, which means it doesn't catch this error anymore:
```
haxe a.hxml b.hxml --version
```
```hxml
# a.hxml
-lib haxelib:4.1.0
```
```hxml
# b.hxml
-lib haxelib:git
```
This leads to a potentially broken compilation and headaches, as vshaxe reports version `4.1.0`, but I might get compiler errors from the git version and really I have a mixture of modules and flags from both versions.
This seems to be a regression since 4.2, possibly due to: #10654.
The correct behaviour is for haxe to call haxelib once per compilation to resolve all libraries at once, which gives haxelib the chance to complain if library versions are conflicting.
Contributor guide
Research direction
Reproduce the behavior with `haxe -lib haxelib:4.1.0 -lib haxelib:git --version` and with the equivalent `a.hxml` and `b.hxml` files. Trace how multiple hxmls are processed and when haxelib is invoked. Done means all libraries from one compilation are resolved together and conflicting versions produce the expected error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100