| 127 | } |
| 128 | |
| 129 | void MesonNewBuildDir::updated() |
| 130 | { |
| 131 | auto advanced = m_ui->advanced->getConfig(); |
| 132 | Path buildDir = Path(m_ui->i_buildDir->url()); |
| 133 | QFileInfo mesonExe(advanced.meson.toLocalFile()); |
| 134 | |
| 135 | if (!mesonExe.exists() || !mesonExe.isExecutable() || !mesonExe.isFile() |
| 136 | || !mesonExe.permission(QFileDevice::ReadUser | QFileDevice::ExeUser)) { |
| 137 | setStatus(i18n("Specified meson executable does not exist"), false); |
| 138 | return; |
| 139 | } |
| 140 | |
| 141 | MesonBuilder::DirectoryStatus status = MesonBuilder::evaluateBuildDirectory(buildDir, advanced.backend); |
| 142 | switch (status) { |
| 143 | case MesonBuilder::CLEAN: |
| 144 | case MesonBuilder::DOES_NOT_EXIST: |
| 145 | setStatus(i18n("Creating new build directory"), true); |
| 146 | break; |
| 147 | case MesonBuilder::MESON_CONFIGURED: |
| 148 | setStatus(i18n("Using an already configured build directory"), true); |
| 149 | break; |
| 150 | case MesonBuilder::MESON_FAILED_CONFIGURATION: |
| 151 | setStatus(i18n("Using a broken meson build directory (this should be fine)"), true); |
| 152 | break; |
| 153 | case MesonBuilder::INVALID_BUILD_DIR: |
| 154 | setStatus(i18n("Cannot use specified directory"), false); |
| 155 | break; |
| 156 | case MesonBuilder::DIR_NOT_EMPTY: |
| 157 | setStatus(i18n("There are already files in the build directory"), false); |
| 158 | break; |
| 159 | case MesonBuilder::EMPTY_STRING: |
| 160 | setStatus(i18n("The build directory field must not be empty"), false); |
| 161 | break; |
| 162 | case MesonBuilder::___UNDEFINED___: |
| 163 | setStatus(i18n("You have reached unreachable code. This is a bug"), false); |
| 164 | break; |
| 165 | } |
| 166 | |
| 167 | bool buildDirChanged = false; |
| 168 | if (m_oldBuildDir != buildDir.toLocalFile()) { |
| 169 | m_oldBuildDir = buildDir.toLocalFile(); |
| 170 | buildDirChanged = true; |
| 171 | } |
| 172 | |
| 173 | bool mesonHasChanged = m_ui->advanced->hasMesonChanged(); // Outside if to prevent lazy evaluation |
| 174 | if (!m_ui->options->options() || mesonHasChanged || buildDirChanged) { |
| 175 | if (status == MesonBuilder::MESON_CONFIGURED) { |
| 176 | m_ui->options->repopulateFromBuildDir(m_project, currentConfig())->start(); |
| 177 | } else { |
| 178 | m_ui->options->repopulateFromMesonFile(m_project, advanced.meson)->start(); |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | Meson::BuildDir MesonNewBuildDir::currentConfig() const |
| 184 | { |
nothing calls this directly
no test coverage detected