-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build instrumentation handling logic
- Loading branch information
1 parent
4d97b62
commit c57b09b
Showing
18 changed files
with
1,278 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace App\Enums; | ||
|
||
enum BuildCommandType: string | ||
{ | ||
case COMPILE = 'COMPILE'; | ||
case LINK = 'LINK'; | ||
case CUSTOM = 'CUSTOM'; | ||
case CMAKE_BUILD = 'CMAKE_BUILD'; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Enums; | ||
|
||
/** | ||
* See: https://cmake.org/cmake/help/latest/prop_tgt/TYPE.html | ||
* | ||
* We also include an "UNKNOWN" value in case CMake adds a new type before CDash does. | ||
*/ | ||
enum TargetType: string | ||
{ | ||
case UNKNOWN = 'UNKNOWN'; | ||
case STATIC_LIBRARY = 'STATIC_LIBRARY '; | ||
case MODULE_LIBRARY = 'MODULE_LIBRARY'; | ||
case SHARED_LIBRARY = 'SHARED_LIBRARY'; | ||
case OBJECT_LIBRARY = 'OBJECT_LIBRARY'; | ||
case INTERFACE_LIBRARY = 'INTERFACE_LIBRARY'; | ||
case EXECUTABLE = 'EXECUTABLE'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use App\Enums\BuildCommandType; | ||
use Carbon\Carbon; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
use Illuminate\Database\Eloquent\Relations\BelongsToMany; | ||
use Illuminate\Database\Eloquent\Relations\HasMany; | ||
|
||
/** | ||
* @property int $id | ||
* @property int $buildid | ||
* @property int $targetid | ||
* @property BuildCommandType $type | ||
* @property Carbon $starttime | ||
* @property int $duration Command running time in ms. | ||
* @property string $command | ||
* @property string $result | ||
* @property string $source | ||
* @property string $language | ||
* @property string $config | ||
* | ||
* @mixin Builder<BuildCommand> | ||
*/ | ||
class BuildCommand extends Model | ||
{ | ||
protected $table = 'buildcommands'; | ||
|
||
public $timestamps = false; | ||
|
||
protected $fillable = [ | ||
'type', | ||
'starttime', | ||
'duration', | ||
'command', | ||
'result', | ||
'source', | ||
'language', | ||
'config', | ||
]; | ||
|
||
protected $casts = [ | ||
'id' => 'integer', | ||
'buildid' => 'integer', | ||
'targetid' => 'integer', | ||
'type' => BuildCommandType::class, | ||
'starttime' => 'datetime', | ||
'duration' => 'integer', | ||
]; | ||
|
||
/** | ||
* @return BelongsTo<Build, self> | ||
*/ | ||
public function build(): BelongsTo | ||
{ | ||
return $this->belongsTo(Build::class, 'buildid'); | ||
} | ||
|
||
/** | ||
* @return HasMany<BuildMeasurement> | ||
*/ | ||
public function measurements(): HasMany | ||
{ | ||
return $this->hasMany(BuildMeasurement::class, 'buildcommandid'); | ||
} | ||
|
||
/** | ||
* Some types of commands are associated with a target. | ||
* | ||
* https://cmake.org/cmake/help/git-master/manual/cmake-instrumentation.7.html#v1-snippet-file | ||
* | ||
* @return BelongsTo<Target, self> | ||
*/ | ||
public function target(): BelongsTo | ||
{ | ||
return $this->belongsTo(Target::class, 'targetid'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use App\Enums\TargetType; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
use Illuminate\Database\Eloquent\Relations\BelongsToMany; | ||
use Illuminate\Database\Eloquent\Relations\HasMany; | ||
|
||
/** | ||
* @property int $id | ||
* @property int $buildid | ||
* @property string $name | ||
* @property TargetType $type | ||
* | ||
* @mixin Builder<Target> | ||
*/ | ||
class Target extends Model | ||
{ | ||
protected $table = 'targets'; | ||
|
||
public $timestamps = false; | ||
|
||
protected $fillable = [ | ||
'name', | ||
'type' | ||
]; | ||
|
||
protected $casts = [ | ||
'id' => 'integer', | ||
'buildid' => 'integer', | ||
'type' => TargetType::class, | ||
]; | ||
|
||
/** | ||
* @return BelongsTo<Build, self> | ||
*/ | ||
public function build(): BelongsTo | ||
{ | ||
return $this->belongsTo(Build::class, 'buildid'); | ||
} | ||
|
||
/** | ||
* @return BelongsToMany<Label> | ||
*/ | ||
public function labels(): BelongsToMany | ||
{ | ||
return $this->belongsToMany(Label::class, 'label2target', 'targetid', 'labelid'); | ||
} | ||
|
||
/** | ||
* @return HasMany<BuildCommand> | ||
*/ | ||
public function commands(): HasMany | ||
{ | ||
return $this->hasMany(BuildCommand::class, 'targetid'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.