Manual or instructions for compiling

Hello,

I am wondering if anybody have manual or instructions on how lucee compilers works and is there a rules of how to write a code so there won’t be problems in productions?
Like is it mandatory to compile entire app, or it could be done on part of it? Can it compile a single file? Why some times when there is mix of compiled and uncompiled application is working, and sometimes it is crushing? Can you replace single compiled file with uncompiled? Can files or folders be with capital letters or not? Can files start with numbers? Why it is adding _ before file that starts with number during compellation?

Thanks.

You really do not need to compile ColdFusion code as it runs and compiles, as it is being executed.

The normal method is to run CFM/CFC pages as is, for faster debugging and human editable access to code if needed.

It is policy in the company where I work; so I have no choice. It is for copyright protection.

@Alek101 I don’t know if I can answer all your questions, but check out this tool @pfreitag wrote a while back

is there a rules of how to write a code so there won’t be problems in productions?

Not really. While a few people do this, it’s not really documented and there is no way to automated it very well (outside of the module above) Lucee’s “official” stance on it is to hit the file and then go copy it out of the cfclasses folder. The main issue is Lucee’s bytecode can change between versions, so if you are deploying Lucee x.y.z.q then the class files MUST ALSO have been compiled by Lucee x.y.z.q!

Like is it mandatory to compile entire app, or it could be done on part of it? Can it compile a single file?

You can compile a single file or the entire app, but it creates a class file for each cfm or cfc.

It’s worth noting, you can pre-compile a “lar” file and then specify that file as a CF Mapping, so all the paths to /myMapping/* would map to the code in an existing .lar file. The huge draw back to this is there is no way to create these outside of manual interaction with the Lucee web admin. And furthermore, I don’t think it works to compile the entire web root and then point it to the / mapping. At least, I had issues the last time I tried. The Lucee admin is deployed like this FWIW.

Why some times when there is mix of compiled and uncompiled application is working, and sometimes it is crushing?

I have no idea what this means. You’ll need to be more specific and provide the actual setup and error you’re getting.

Can you replace single compiled file with uncompiled?

I think, yes.

Can files or folders be with capital letters or not?

I’m not sure what you mean, but I assume the capitalization of the files doesn’t matter so long as you keep the class files with whatever name Lucee generated for them.

Can files start with numbers?

I can’t imagine why not. Did you try? Did you have an issue?

Why it is adding _ before file that starts with number during compellation?

Who knows. Is it causing an issue?

Oh also, you can look in JIRA for existing tickets. You’ll notice there’s not a lot of activity on these.

https://luceeserver.atlassian.net/browse/LDEV-2956
https://luceeserver.atlassian.net/browse/LDEV-2379
https://luceeserver.atlassian.net/browse/LDEV-2259
https://luceeserver.atlassian.net/browse/LDEV-2206

Thanks a lot.

We have couple of guys in my workplace and they are uncharged with compiling the code. They are doing it in Lucee admin.

On one of the smaller project we have 404.cfm file, for 404 page. Every time it compiled, it added _ so it was _404.cfm. Eventually I changed the name of file, so my coworker don’t need to manually change it back. It was in lucee 5.6, and we switched to 5.9, so that problem might been solved.

But our main application is huge, and runs on lucee 5.2 and there is always a problem. Today I copied two files into production application and those pages give big yellow screen. On uncompiled development version everything was fine. My coworker than recopied same files and it worked, and than he recompiled part of application, and it works. I haven’t save the error.

I was hoping that somebody had written manual on what should be done, and what is forbidden, in order to prevent problems.

Lucee 5.2 is pretty ancient, there’s been a lot of bugfixes since then, can you repro with 5.3.10.125?

I wish I could.