Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions app/Http/Submission/Handlers/BuildHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use App\Models\BuildCommand;
use App\Models\BuildCommandOutput;
use App\Models\BuildMeasurement;
use App\Models\Label as EloquentLabel;
use App\Models\Label;
use App\Models\Site;
use App\Models\SiteInformation;
use App\Models\Target;
Expand All @@ -40,7 +40,6 @@
use CDash\Model\BuildError;
use CDash\Model\BuildFailure;
use CDash\Model\BuildGroup;
use CDash\Model\Label;
use CDash\Model\Project;
use CDash\Model\Subscriber;
use CDash\Submission\CommitAuthorHandlerInterface;
Expand Down Expand Up @@ -78,7 +77,7 @@ class BuildHandler extends AbstractXmlHandler implements ActionableBuildInterfac
* don't exist until parsing is complete.
*
* @var array<string,array{
* labels: array<EloquentLabel>,
* labels: array<Label>,
* target: Target
* }>
*/
Expand Down Expand Up @@ -463,14 +462,14 @@ public function endElement($parser, $name): void
if (isset($this->Error->Labels)) {
$hasLabel = false;
foreach ($this->Labels as $lbl) {
if ($lbl->Text === $this->SubProjectName) {
if ($lbl->text === $this->SubProjectName) {
$hasLabel = true;
break;
}
}
if (!$hasLabel) {
$label = $factory->create(Label::class);
$label->Text = $this->SubProjectName;
$label->text = $this->SubProjectName;
if (!$this->Error instanceof BuildFailure) {
throw new RuntimeException('Field "Error" is not instance of BuildFailure.');
}
Expand Down Expand Up @@ -645,7 +644,7 @@ public function text($parser, $data): void
throw new Exception('Target data not initialized properly.');
}

$this->Targets[$this->MostRecentCommand['targetname']]['labels'][] = EloquentLabel::firstOrCreate([
$this->Targets[$this->MostRecentCommand['targetname']]['labels'][] = Label::firstOrCreate([
'text' => $data,
]);
} elseif ($this->getParent() === 'LABELS' && $element === 'LABEL') {
Expand All @@ -657,7 +656,7 @@ public function text($parser, $data): void
}
}
if (empty($this->ErrorSubProjectName)) {
$this->Label->Text = $data;
$this->Label->text = $data;
}
} elseif (
$this->currentPathMatches('site.build.commands.*.namedmeasurement.value')
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Submission/Handlers/ConfigureHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/

use App\Models\Label;
use App\Models\Site;
use App\Models\SiteInformation;
use App\Services\SiteService;
Expand All @@ -30,7 +31,6 @@
use CDash\Model\Build;
use CDash\Model\BuildConfigure;
use CDash\Model\BuildGroup;
use CDash\Model\Label;
use CDash\Model\Project;
use CDash\Model\Subscriber;

Expand Down Expand Up @@ -289,7 +289,7 @@ public function text($parser, $data): void
$this->SubProjects[$this->SubProjectName][] = $data;
$build = $this->Builds[$this->SubProjectName];
$label = $this->getModelFactory()->create(Label::class);
$label->Text = $data;
$label->text = $data;
$build->AddLabel($label);
} elseif ($parent === 'LABELS' && $element === 'LABEL') {
// First, check if this label belongs to a SubProject
Expand All @@ -301,7 +301,7 @@ public function text($parser, $data): void
}
}
if (empty($subproject_name)) {
$this->Label->Text = $data;
$this->Label->text = $data;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Submission/Handlers/CoverageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/

use App\Models\Label;
use App\Models\Site;
use App\Models\SiteInformation;
use App\Services\ProjectService;
Expand All @@ -26,7 +27,6 @@
use CDash\Model\Coverage;
use CDash\Model\CoverageFile;
use CDash\Model\CoverageSummary;
use CDash\Model\Label;
use CDash\Model\Project;
use CDash\Model\SubProject;

Expand Down Expand Up @@ -227,7 +227,7 @@ public function text($parser, $data): void
break;
}
} elseif ($element === 'LABEL') {
$this->Label->Text = $data;
$this->Label->text = $data;
}
}
}
4 changes: 2 additions & 2 deletions app/Http/Submission/Handlers/CoverageJUnitHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/

use App\Models\Label;
use App\Models\Site;
use App\Models\SiteInformation;
use App\Services\SiteService;
use App\Utils\SubmissionUtils;
use CDash\Model\Coverage;
use CDash\Model\CoverageFile;
use CDash\Model\CoverageSummary;
use CDash\Model\Label;
use CDash\Model\Project;

class CoverageJUnitHandler extends AbstractXmlHandler
Expand Down Expand Up @@ -181,7 +181,7 @@ public function text($parser, $data): void
{
$element = $this->getElement();
if ($element === 'LABEL') {
$this->Label->Text = $data;
$this->Label->text = $data;
}
}
}
4 changes: 2 additions & 2 deletions app/Http/Submission/Handlers/DynamicAnalysisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
=========================================================================*/

use App\Models\DynamicAnalysisDefect;
use App\Models\Label;
use App\Models\Site;
use App\Models\SiteInformation;
use App\Services\SiteService;
Expand All @@ -32,7 +33,6 @@
use CDash\Model\BuildGroup;
use CDash\Model\DynamicAnalysis;
use CDash\Model\DynamicAnalysisSummary;
use CDash\Model\Label;
use CDash\Model\Project;
use CDash\Model\Subscriber;

Expand Down Expand Up @@ -256,7 +256,7 @@ public function text($parser, $data): void
}
}
if (empty($this->TestSubProjectName)) {
$this->Label->Text = $data;
$this->Label->text = $data;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Submission/Handlers/GcovTarHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/

use App\Models\Label;
use App\Utils\SubmissionUtils;
use CDash\Model\Build;
use CDash\Model\Coverage;
use CDash\Model\CoverageFile;
use CDash\Model\CoverageFileLog;
use CDash\Model\CoverageSummary;
use CDash\Model\Label;
use CDash\Model\SubProject;
use League\Flysystem\UnableToReadFile;
use RecursiveDirectoryIterator;
Expand Down Expand Up @@ -381,7 +381,7 @@ public function ParseGcovFile($fileinfo): void
if (array_key_exists($path, $this->Labels)) {
foreach ($this->Labels[$path] as $labelText) {
$label = new Label();
$label->Text = $labelText;
$label->text = $labelText;
$coverage->AddLabel($label);
}
}
Expand Down Expand Up @@ -483,7 +483,7 @@ public function ParseUncoveredSourceFile($fileinfo, $path)
if (array_key_exists($path, $this->Labels)) {
foreach ($this->Labels[$path] as $labelText) {
$label = new Label();
$label->Text = $labelText;
$label->text = $labelText;
$coverage->AddLabel($label);
}
}
Expand Down
6 changes: 2 additions & 4 deletions app/Http/Submission/Handlers/ProjectHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/

use App\Models\Label;
use App\Services\ProjectService;
use CDash\Model\Label;
use CDash\Model\Project;
use CDash\Model\SubProject;
use Illuminate\Support\Facades\DB;
Expand Down Expand Up @@ -167,9 +167,7 @@ public function endElement($parser, $name): void
$this->SubProjectPosition++;

// Insert the label.
$Label = new Label();
$Label->Text = $this->SubProject->GetName();
$Label->Insert();
Label::firstOrCreate(['text' => $this->SubProject->GetName()]);

$this->SubProjects[$this->SubProject->GetId()] = $this->SubProject;

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Submission/Handlers/TestingHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Submission\Handlers;

use App\Models\Label;
use App\Models\Site;
use App\Models\SiteInformation;
use App\Models\TestMeasurement;
Expand All @@ -20,7 +21,6 @@
use CDash\Model\Build;
use CDash\Model\BuildGroup;
use CDash\Model\Image;
use CDash\Model\Label;
use CDash\Model\Project;
use CDash\Model\Subscriber;
use CDash\Submission\CommitAuthorHandlerInterface;
Expand Down Expand Up @@ -307,7 +307,7 @@ public function text($parser, $data): void
break;
}
}
$this->Label->Text = $data;
$this->Label->text = $data;
$this->Labels[] = $this->Label;
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Submission/Handlers/UploadHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
PURPOSE. See the above copyright notices for more information.
=========================================================================*/

use App\Models\Label;
use App\Models\Site;
use App\Models\SiteInformation;
use App\Models\UploadFile;
use App\Services\SiteService;
use App\Utils\SubmissionUtils;
use CDash\Model\Label;
use CDash\Model\Project;
use Illuminate\Http\File;
use Illuminate\Support\Carbon;
Expand Down Expand Up @@ -276,7 +276,7 @@ public function text($parser, $data): void
} elseif ($parent === 'UPLOAD' && $element === 'TIME') {
$this->Timestamp = (int) $data;
} elseif ($element === 'LABEL') {
$this->Label->Text = $data;
$this->Label->text = $data;
}
}

Expand Down
11 changes: 4 additions & 7 deletions app/Models/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Enums\TestTimeStatusCategory;
use Carbon\Carbon;
use CDash\Model\Label;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
Expand Down Expand Up @@ -109,11 +108,11 @@ public function testMeasurements(): HasMany
}

/**
* @return BelongsToMany<\App\Models\Label, $this>
* @return BelongsToMany<Label, $this>
*/
public function labels(): BelongsToMany
{
return $this->belongsToMany(\App\Models\Label::class, 'label2test', 'testid', 'labelid');
return $this->belongsToMany(Label::class, 'label2test', 'testid', 'labelid');
}

/**
Expand Down Expand Up @@ -172,7 +171,7 @@ public function addLabel(Label $label): void
if (null === $this->labels) {
$this->labels = collect();
}
$this->labels->put($label->Text, $label);
$this->labels->put($label->text, $label);
}

/**
Expand All @@ -185,9 +184,7 @@ public function getLabels(): Collection
if (null === $this->labels) {
$this->labels = collect();
foreach ($this->labels()->get() as $eloquent_label) {
$label = new Label();
$label->Id = $eloquent_label->id;
$this->labels->put($eloquent_label->text, $label);
$this->labels->put($eloquent_label->text, $eloquent_label);
}
}
return $this->labels;
Expand Down
9 changes: 6 additions & 3 deletions app/Utils/TestCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace App\Utils;

use App\Models\Label;
use App\Models\Test;
use App\Models\TestImage;
use App\Models\TestMeasurement;
Expand Down Expand Up @@ -178,9 +179,11 @@ public function create(Build $build): void
$build->AddTest($buildtest);

foreach ($this->labels as $label) {
$label->Test = $buildtest;
$label->Insert();
$buildtest->addLabel($label);
if ($label->text !== null && $label->text !== '') {
$eloquent_label = Label::firstOrCreate(['text' => $label->text]);
$buildtest->labels()->syncWithoutDetaching([$eloquent_label->id]);
$buildtest->addLabel($eloquent_label);
}
}

// test2image
Expand Down
Loading