1 | <?php |
||
2 | |||
3 | /** |
||
4 | * RoboFile.php |
||
5 | * |
||
6 | * PHP version 7 |
||
7 | * |
||
8 | * @author Tim Wagner <[email protected]> |
||
9 | * @copyright 2016 TechDivision GmbH <[email protected]> |
||
10 | * @license https://opensource.org/licenses/MIT |
||
11 | * @link https://github.com/techdivision/import-product-msi |
||
12 | * @link http://www.techdivision.com |
||
13 | */ |
||
14 | |||
15 | use Lurker\Event\FilesystemEvent; |
||
0 ignored issues
–
show
|
|||
16 | |||
17 | use Symfony\Component\Finder\Finder; |
||
18 | |||
19 | /** |
||
20 | * Defines the available build tasks. |
||
21 | * |
||
22 | * @author Tim Wagner <[email protected]> |
||
23 | * @copyright 2016 TechDivision GmbH <[email protected]> |
||
24 | * @license https://opensource.org/licenses/MIT |
||
25 | * @link https://github.com/techdivision/import-product-msi |
||
26 | * @link http://www.techdivision.com |
||
27 | * |
||
28 | * @SuppressWarnings(PHPMD) |
||
29 | */ |
||
30 | class RoboFile extends \Robo\Tasks |
||
31 | { |
||
32 | |||
33 | /** |
||
34 | * The build properties. |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $properties = array( |
||
39 | 'base.dir' => __DIR__, |
||
40 | 'src.dir' => __DIR__ . '/src', |
||
41 | 'dist.dir' => __DIR__ . '/dist', |
||
42 | 'vendor.dir' => __DIR__ . '/vendor', |
||
43 | 'target.dir' => __DIR__ . '/target' |
||
44 | ); |
||
45 | |||
46 | /** |
||
47 | * Run's the composer install command. |
||
48 | * |
||
49 | * @return \Robo\Result The result |
||
50 | */ |
||
51 | public function composerInstall() |
||
52 | { |
||
53 | // optimize autoloader with custom path |
||
54 | return $this->taskComposerInstall() |
||
55 | ->preferDist() |
||
56 | ->optimizeAutoloader() |
||
57 | ->run(); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Run's the composer update command. |
||
62 | * |
||
63 | * @return \Robo\Result The result |
||
64 | */ |
||
65 | public function composerUpdate() |
||
66 | { |
||
67 | // optimize autoloader with custom path |
||
68 | return $this->taskComposerUpdate() |
||
69 | ->preferDist() |
||
70 | ->optimizeAutoloader() |
||
71 | ->run(); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Clean up the environment for a new build. |
||
76 | * |
||
77 | * @return \Robo\Result The result |
||
78 | */ |
||
79 | public function clean() |
||
80 | { |
||
81 | return $this->taskDeleteDir($this->properties['target.dir'])->run(); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Prepare's the environment for a new build. |
||
86 | * |
||
87 | * @return \Robo\Result The result |
||
88 | */ |
||
89 | public function prepare() |
||
90 | { |
||
91 | return $this->taskFileSystemStack() |
||
92 | ->mkdir($this->properties['dist.dir']) |
||
93 | ->mkdir($this->properties['target.dir']) |
||
94 | ->mkdir(sprintf('%s/reports', $this->properties['target.dir'])) |
||
95 | ->run(); |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * Run's the PHPMD. |
||
100 | * |
||
101 | * @return \Robo\Result The result |
||
102 | */ |
||
103 | public function runMd() |
||
104 | { |
||
105 | |||
106 | // run the mess detector |
||
107 | return $this->_exec( |
||
108 | sprintf( |
||
109 | '%s/bin/phpmd %s xml phpmd.xml --reportfile %s/reports/pmd.xml --ignore-violations-on-exit', |
||
110 | $this->properties['vendor.dir'], |
||
111 | $this->properties['src.dir'], |
||
112 | $this->properties['target.dir'] |
||
113 | ) |
||
114 | ); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Run's the PHPCPD. |
||
119 | * |
||
120 | * @return \Robo\Result The result |
||
121 | */ |
||
122 | public function runCpd() |
||
123 | { |
||
124 | |||
125 | // run the copy past detector |
||
126 | return $this->_exec( |
||
127 | sprintf( |
||
128 | '%s/bin/phpcpd %s --log-pmd %s/reports/pmd-cpd.xml', |
||
129 | $this->properties['vendor.dir'], |
||
130 | $this->properties['src.dir'], |
||
131 | $this->properties['target.dir'] |
||
132 | ) |
||
133 | ); |
||
134 | } |
||
135 | |||
136 | /** |
||
137 | * Run's the PHPCodeSniffer. |
||
138 | * |
||
139 | * @return \Robo\Result The result |
||
140 | */ |
||
141 | public function runCs() |
||
142 | { |
||
143 | |||
144 | // run the code sniffer |
||
145 | return $this->_exec( |
||
146 | sprintf( |
||
147 | '%s/bin/phpcs -n --report-full --extensions=php --standard=phpcs.xml --report-checkstyle=%s/reports/phpcs.xml %s', |
||
148 | $this->properties['vendor.dir'], |
||
149 | $this->properties['target.dir'], |
||
150 | $this->properties['src.dir'] |
||
151 | ) |
||
152 | ); |
||
153 | } |
||
154 | |||
155 | /** |
||
156 | * Run's the PHPUnit tests. |
||
157 | * |
||
158 | * @return \Robo\Result The result |
||
159 | */ |
||
160 | public function runTests() |
||
161 | { |
||
162 | |||
163 | // run PHPUnit |
||
164 | return $this->taskPHPUnit(sprintf('%s/bin/phpunit', $this->properties['vendor.dir'])) |
||
165 | ->configFile('phpunit.xml') |
||
166 | ->run(); |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * The complete build process. |
||
171 | * |
||
172 | * @return void |
||
173 | */ |
||
174 | public function build() |
||
175 | { |
||
176 | |||
177 | // stop the build on first failure of a task |
||
178 | $this->stopOnFail(true); |
||
179 | |||
180 | // process the build |
||
181 | $this->clean(); |
||
182 | $this->prepare(); |
||
183 | $this->runCs(); |
||
184 | $this->runCpd(); |
||
185 | $this->runMd(); |
||
186 | $this->runTests(); |
||
187 | } |
||
188 | } |
||
189 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths