I have written a program for a company. They want the source code.
The program uses code that I've written over time for several projects for a number of clients.
I want to release only the code that is used by this program. So if a shared file called Utils.pas contains ten functions and this program uses only two of them then I want to release a file called Utils.pas with only those two functions in it.
The code is Borland Pascal, written using Delphi.
Anyone know how I can do this?
Clarification: I am not asking about licensing. I want the customer to have only the source code that is used by their program and nothing else.
Break their code out of utils.pas, into client_xxxx_utils.pas. Charge them your usual rate for the work to do this, rebuild, smoke test, etc.. Problem solved.
Ok, in case it's a chore to figure out what to trim... Compile the program, and look at the utils.pas unit. Normally, you'll have Blue Dots in the margin, indicating that you can set break points. "Dead Code" will not have the blue dots in the margin, as that code has been eliminated by the linker. Anything without a blue dot, is something that they don't need.
For a more automatic approach, perhaps Peganza Pascal Analyzer can identify dead code in one of it's many reports.
Here are some related questions here on SO with similar answers (some by me!)
Finding unused (aka "dead") code in Delphi
How to "automatically" remove unused units from uses clause?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With