pas2js "can't find unit \"System.Generics.Collections\""

We have a TMS WEB Core app that builds perfectly fine in the IDE, but when I'm trying to build it within Jenkins, it fails with "can't find unit \"System.Generics.Collections\"".

I've cloned all the required files and EnvOptions.dproj over for Delphi, but this looks like some kind of pathing issue.

Any suggestions as to what I'm missing here?

Our build server does not have Delphi installed, the files have just been pulled from an installation to support the build server.

It's almost like there's a pre-processor not running before the call to pas2js.exe

I assume you have 'system.generics.collections' in your uses list.
Can you try changing that to 'generics.collections' ?

Hi,

I've tried that, which then leaves me with "can't find unit \"System.RTTI\". If I apply the same logic and remove 'System', I then end up with "identifier not found \"TField\"".

My issue is that this works perfectly fine in the IDE, but not when it's built on the Jenkins machine, so I must be missing a pre-processor step.

Any suggestions?

image

Further to this I've tried compiling on the actual Delphi VM from the command line with tmswebcompiler.exe and get the above error.

I also get the same issue with the pas2js on the Delphi VM that I'm seeing on the Jenkins VM.

What's the difference between building in the IDE vs command line?

From the IDE, we also invoke TMSWebCompiler.exe
So, are you launching this from the command line with the same command line parameters as you see reported in the IDE in the output window ?

I've pulled the command line straight from the compiler messages for pas2js, but there's nothing showing for tmswebcompiler.


image

Please try something like:

"e:\tms\tms web core\bin\win32\tmswebcompiler.exe" -ParseDProjFile -ProjectFile project1.dproj

I retested this here and this worked as expected.

I've tried that, and get the error converting (Null) to (OleStr).

I have created a new project, TMS WEB App + XData Server Group, built it in the IDE without issue, and built it from the command line without issue.

As soon as I added System.Generics.Collections to Unit1.pas, it builds in the IDE but fails from the command line.



Under these circumstances, the tmswebcompiler program does work correctly.

Trying to make sense of this, I think I might be barking up the wrong tree...

tmswebcompiler prepares the files for pas2js to run against, doesn't it? Which implies that my issue isn't actually with the pas2js compiler but rather the issue lies with tmswebcompiler not being able to pre-process the files.

Is that correct?

I cannot reproduce this.
Was tested with attached project and you can see the output log of tmswebcompiler.exe

Project1.zip (6.1 KB)

I think I've asked the wrong question, based on not knowing how the IDE was building the application.

Running pas2js on its own will generate the fault:

This leads me to believe that the issue I'm actually trying to fix is not the can't find unit \"System.Generics.Collections\" issue, but the Could not convert variant of type (Null) into type (OleStr) instead.

I'm still trying to reproduce that on a clean project...

If you have precise information, clear steps, sample source project with which a problem in tmswebcompiler can be reproduced, please inform.

Is there a way to find out which unit tmswebcompiler is failing on? I've passed ShowAll and Verbose, but get nothing useful out.

When there is an error in the code it shows the line & position, i.e.

E:\TMS\Support\Web\cmdline\unit1.pas (35, 7) Error: Incompatible types: got "Double" expected "Longint"
Compilation aborted

I call the tmswebcompiler with these parameters, appending my project file:

"C:\DC\TMS\TMS WEB Core RSXE14\Bin\Win32\tmswebcompiler.exe" -ShowAll -Verbose -ParseDProjFile -ProjectFile

What I get as an output is a list of all the switches, followed by Could not convert variant of type (Null) into type (OleStr)

I do not see this error.

As long as I do not have clear steps, a sample source project with which this can be reproduced, it is guesswork and as you can see from this meanwhile very long thread, inefficient to try to help you.

I'm trying to get a small project with the fault to enable you to validate it your end, but it could take some time...