File tree Expand file tree Collapse file tree 2 files changed +32
-21
lines changed
Expand file tree Collapse file tree 2 files changed +32
-21
lines changed Original file line number Diff line number Diff line change 1111use SPC \store \Downloader ;
1212use SPC \store \FileSystem ;
1313use SPC \store \SourceManager ;
14+ use SPC \util \GlobalValueTrait ;
1415
1516abstract class LibraryBase
1617{
18+ use GlobalValueTrait;
19+
1720 /** @var string */
1821 public const NAME = 'unknown ' ;
1922
@@ -31,7 +34,7 @@ public function __construct(?string $source_dir = null)
3134 if (static ::NAME === 'unknown ' ) {
3235 throw new RuntimeException ('no unknown!!!!! ' );
3336 }
34- $ this ->source_dir = $ source_dir ?? (SOURCE_PATH . '/ ' . static ::NAME );
37+ $ this ->source_dir = $ source_dir ?? (SOURCE_PATH . '/ ' . Config:: getLib ( static ::NAME , ' source ' ) );
3538 }
3639
3740 /**
@@ -328,26 +331,6 @@ public function patchBeforeMake(): bool
328331 return false ;
329332 }
330333
331- public function getBinDir (): string
332- {
333- return BUILD_BIN_PATH ;
334- }
335-
336- public function getIncludeDir (): string
337- {
338- return BUILD_INCLUDE_PATH ;
339- }
340-
341- public function getBuildRootPath (): string
342- {
343- return BUILD_ROOT_PATH ;
344- }
345-
346- public function getLibDir (): string
347- {
348- return BUILD_LIB_PATH ;
349- }
350-
351334 /**
352335 * Build this library.
353336 *
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace SPC \util ;
6+
7+ trait GlobalValueTrait
8+ {
9+ public function getBinDir (): string
10+ {
11+ return BUILD_BIN_PATH ;
12+ }
13+
14+ public function getIncludeDir (): string
15+ {
16+ return BUILD_INCLUDE_PATH ;
17+ }
18+
19+ public function getBuildRootPath (): string
20+ {
21+ return BUILD_ROOT_PATH ;
22+ }
23+
24+ public function getLibDir (): string
25+ {
26+ return BUILD_LIB_PATH ;
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments