Prevent overwrite unchanged files during build?

Is there by any chance a setting that switches off that during build nearly EVERY file is updated in the output directory? Even resources that never change are updated and get a new file-last-change date. This causes my FTP file uploader script (WinSCP) to always upload the whole project rather than only the few changed files. During testing this always takes ages...

1 Like

At this moment, there are no switches for this. A possible strategy is to put fixed resources in a separate folder (for example assets folder) and not FTP'ing this assets folder every time to deploy?

Yes I did that, but it's the many images I have in DFMs that get overwritten all the time. But if there is no way to switch that off, then be it. But it may be a feature request.

We will reflect on this and consider this for future developments.

In the meantime, people interested in this feature may use the attached post build event patch program. This is what it does:


Program CheckOutputChanges;

(*

 This is a helper program for post processing a TMS Web Core project build.
 During a TMS Web Core build process, all resources defined in the project
 are deployed to the output directory with a current file date, even if the
 file hasn't been changed since the last build. When using an FTP tool to
 upload changed files to the web server, this always causes ALL files to
 be uploaded to the server, since the file dates of the local files are newer
 than the file dates of the already uploaded files. Uploading ALL files may
 at times take "ages"...

 This helper program creates a shadow cache of the deployed files. Then every time
 the project is built, the created files are checked against the files stored
 in the shadow cache unsing an MD5 digest. If the digests are the same, the
 files are considered unchanged and the cached file will be copied back to the
 output directory such that the FTP uploader sees no difference and hence does
 not upload the file, saving a lot of upload time.

 The program creates a directory "Shadow" in parallel to the default Web Core
 output directory ...\TMSWeb. So, given a project lives in directory "C:\MyProj",
 then the shadow directory would be "C:\MyProj\TMSWeb\Shadow". Based on the
 current project build configuration, typically "Debug" or "Release", a resp.
 subdirectory is created, e.g. "C:\MyProj\TMSWeb\Shadow\Release". If the project
 exports any further subdirectories, then shadows for these directories will be
 created as well.

 The created shadow directories may be deleted at any time with no harm.

 Usage:
  The console program needs up to 3 command line parameters:

  - /PROJ:<path to the project>
    This is the path where the project lives in. In the example above, this
    is "C:\MyProj"

  - /CONF:<configuration>
    This is the name of the build configuration set up in the project, e.g.
    "Release".

  - /Deb (optional)
    If present, the program writes log messages into the output console.


 Embedding the program into the project settings as "Build event" for
 automatic post build usage:

 Open the project settings and open "Deploy \ Build events" (translated from
 German "Erzeugen - Build Ereignisse"). Make sure you edit the correct
 configuration. Then add the following to the "Post-Buld-Event" commands:

   "<the path to>\CheckOutputChanges.exe" /Deb /Proj:"$(PROJECTDIR)" /Conf:$(Config)

 Use this line exactly as shown, except for "<the path to>" which is the path
 where the executable of this helper program lives.

 When compiling the TMS Web Core project, watch the output in the Delphi IDE
 messages area.

*)

(Code may be used by anyone without restrictions)

CheckOutputChanges.dpr (7.4 KB)

1 Like

Thanks for sharing