Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Auto clean project during build process
QtWS25 Last Chance

Auto clean project during build process

Scheduled Pinned Locked Moved General and Desktop
11 Posts 3 Posters 8.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qttester5
    wrote on last edited by
    #1

    My build settings for both Release and Debug have an entry for Clean Steps. However, when I run my app, there is no clean happening. If I actually do a Clean from the Build menu, then run my app, it is clear that the clean actually happened, but if I do not, there is no cleaning.

    How can I ensure that cleaning always happens when I run the app?

    The workaround I am searching for is a problem I'm having where QML file edits do not appear when I run the app, even if they are saved, unless I first clean the project. I can run the app two consecutive times with the only change being a manual Clean, and the output on the screen only reflects edits to my QML in the second run.

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      [quote author="qttester5" date="1390716465"]My build settings for both Release and Debug have an entry for Clean Steps. However, when I run my app, there is no clean happening. If I actually do a Clean from the Build menu, then run my app, it is clear that the clean actually happened, but if I do not, there is no cleaning.[/quote]That's expected. Clean Steps are only run when you ask Qt Creator to clean (e.g. Build -> Clean Project).

      [quote]The workaround I am searching for is a problem I'm having where QML file edits do not appear when I run the app, even if they are saved, unless I first clean the project. I can run the app two consecutive times with the only change being a manual Clean, and the output on the screen only reflects edits to my QML in the second run.[/quote]When you build your project, it copies your .qml files into your build directory (which also contains your .exe file).

      When you save your .qml file, it only updates your source directory -- it doesn't copy it into your build directory.

      Now, there are 2 different run buttons:

      • "Re-run this run-configuration" is the small green arrow in the "Application Output" tab. This button runs what is already in your build directory -- it does not update anything before running.
      • "Run (Ctrl-R)" is the large green arrow on the left of Qt Creator, above the "Build Project" and "Start Debugging" buttons. This button checks if your source files -- if they have changed, it will re-build (and update your .qml files) before running.

      Make sure you click on "Run (Ctrl-R)", not "Re-run this run-configuration". This will make your QML edits appear.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qttester5
        wrote on last edited by
        #3

        I always use the big Run button on the left sidebar of Qt Creator, or I use Control-R. I've never used the button in the Application Output tab. By my issue persists and I must clean after editing QML files if I want to see their edits when running the app.

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          Hmm... odd. What happens if you save your files, then click "Build" before "Run"?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0
          • T3STYT Offline
            T3STYT Offline
            T3STY
            wrote on last edited by
            #5

            In QtCreator go to the Projects tab, then in the active configuration get to the Build Steps part. Press Add Build Step > Make and in the "Make arguments" box write clean. After that, move this step (using the buttons on the -top-left- top-right corner of the box) to be the first in the list.
            At this point, every time you build with that configuration Qt will clean the project before building. If in the Build&Run settings (Tools > Options > Build & Run) you've set to always deploy before running it, then you will have a complete rebuild of the project with clean, build and run steps every time you run the project using QtCreator's main Run button. This does not affect the compile/build tab Run button which only executes the compiled project.

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qttester5
              wrote on last edited by
              #6

              JKSH - Save All has no effect. Only Clean resolves the issue so I can see my edits.

              T3STY - I will try adding the clean step as you mention. My Build & Run settings are already set to "Always build before deploying." and "Always deploy before running."

              1 Reply Last reply
              0
              • JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                I meant Build, not Save All.

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  qttester5
                  wrote on last edited by
                  #8

                  Build automatically runs when I press the Run button.

                  1 Reply Last reply
                  0
                  • T3STYT Offline
                    T3STYT Offline
                    T3STY
                    wrote on last edited by
                    #9

                    If so, then you should be correctly set up... when you press "build" you have a clean step before anything, then it starts actually building. When you press "run" it will first build the project which in its turn will first perform the clean step, then build then run. Let me know if it does the trick.

                    Anyway, I'd like to warn you about always cleaning... maybe you're now having a quite small project and completely rebuilding it takes just a few seconds. But when you'll get to a quite large project it will take you ages to rebuild the whole project every time. You should try to solve that issue you're having in a different manner...

                    1 Reply Last reply
                    0
                    • Q Offline
                      Q Offline
                      qttester5
                      wrote on last edited by
                      #10

                      It appears as though this maybe a Qt bug that has already been logged. It requires that qmake be run after adding files to a resource file, otherwise those files will not get updated properly during build process. I have an open ticket and there is another open ticket on this issue as well.

                      1 Reply Last reply
                      0
                      • JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #11

                        Right, I completely forgot about resource files. I had assumed you deployed standalone .qml files.

                        Could you please post the links to your ticket and the other one you found? I'm sure others would be interested in following this issue too.

                        Having to manually run qmake is somewhat inconvenient. You'll need to do it if you, say, delete a file from your project, because the Makefile won't get regenerated. The build process fails because it's trying to build a file that no longer exists.

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved