| 23 | using namespace KDevelop; |
| 24 | |
| 25 | CustomBuildJob::CustomBuildJob( CustomBuildSystem* plugin, KDevelop::ProjectBaseItem* item, CustomBuildSystemTool::ActionType t ) |
| 26 | : OutputJob( plugin ) |
| 27 | , type( t ) |
| 28 | , exec(nullptr) |
| 29 | , killed( false ) |
| 30 | , enabled( false ) |
| 31 | { |
| 32 | setCapabilities( Killable ); |
| 33 | QString subgrpname; |
| 34 | switch( type ) { |
| 35 | case CustomBuildSystemTool::Build: |
| 36 | subgrpname = ConfigConstants::toolGroupPrefix() + QLatin1String("Build"); |
| 37 | break; |
| 38 | case CustomBuildSystemTool::Clean: |
| 39 | subgrpname = ConfigConstants::toolGroupPrefix() + QLatin1String("Clean"); |
| 40 | break; |
| 41 | case CustomBuildSystemTool::Install: |
| 42 | subgrpname = ConfigConstants::toolGroupPrefix() + QLatin1String("Install"); |
| 43 | break; |
| 44 | case CustomBuildSystemTool::Configure: |
| 45 | subgrpname = ConfigConstants::toolGroupPrefix() + QLatin1String("Configure"); |
| 46 | break; |
| 47 | case CustomBuildSystemTool::Prune: |
| 48 | subgrpname = ConfigConstants::toolGroupPrefix() + QLatin1String("Prune"); |
| 49 | break; |
| 50 | case CustomBuildSystemTool::Undefined: |
| 51 | return; |
| 52 | } |
| 53 | projectName = item->project()->name(); |
| 54 | builddir = plugin->buildDirectory( item ).toLocalFile(); |
| 55 | KConfigGroup g = plugin->configuration( item->project() ); |
| 56 | if(g.isValid()) { |
| 57 | KConfigGroup grp = g.group( subgrpname ); |
| 58 | enabled = grp.readEntry(ConfigConstants::toolEnabled(), false); |
| 59 | cmd = grp.readEntry(ConfigConstants::toolExecutable(), QUrl()).toLocalFile(); |
| 60 | environment = grp.readEntry(ConfigConstants::toolEnvironment(), QString()); |
| 61 | arguments = grp.readEntry(ConfigConstants::toolArguments(), QString()); |
| 62 | } |
| 63 | |
| 64 | QString title; |
| 65 | switch (type) { |
| 66 | case CustomBuildSystemTool::Build: |
| 67 | title = i18nc("Building: <command> <project item name>", "Building: %1 %2", cmd, item->text()); |
| 68 | break; |
| 69 | case CustomBuildSystemTool::Clean: |
| 70 | title = i18nc("Cleaning: <command> <project item name>", "Cleaning: %1 %2", cmd, item->text()); |
| 71 | break; |
| 72 | case CustomBuildSystemTool::Install: |
| 73 | title = installPrefix.isEmpty() ? i18nc("Installing: <command> <project item name>", "Installing: %1 %2", cmd, item->text()) |
| 74 | : i18nc("Installing: <command> <project item name> <installPrefix>", "Installing: %1 %2 %3", cmd, item->text(), installPrefix.toDisplayString(QUrl::PreferLocalFile)); |
| 75 | break; |
| 76 | case CustomBuildSystemTool::Configure: |
| 77 | title = i18nc("Configuring: <command> <project item name>", "Configuring: %1 %2", cmd, item->text()); |
| 78 | break; |
| 79 | case CustomBuildSystemTool::Prune: |
| 80 | title = i18nc("Pruning: <command> <project item name>", "Pruning: %1 %2", cmd, item->text()); |
| 81 | break; |
| 82 | default: |
nothing calls this directly
no test coverage detected