1414namespace Ymir \Cli \Project \Build ;
1515
1616use Symfony \Component \Filesystem \Filesystem ;
17- use Symfony \Component \Finder \Finder ;
1817use Symfony \Component \Finder \SplFileInfo ;
1918use Ymir \Cli \Project \EnvironmentConfiguration ;
2019use Ymir \Cli \Project \ProjectConfiguration ;
@@ -78,7 +77,7 @@ public function perform(EnvironmentConfiguration $environmentConfiguration, Proj
7877 }
7978
8079 if (!empty ($ includePaths )) {
81- $ files ->append ($ this -> getIncludedFiles ($ includePaths ));
80+ $ files ->append ($ projectConfiguration -> getProjectType ()-> getIncludedFiles ($ this -> projectDirectory , $ includePaths ));
8281 }
8382
8483 foreach ($ files as $ file ) {
@@ -103,43 +102,6 @@ private function copyFile(SplFileInfo $file): void
103102 }
104103 }
105104
106- /**
107- * Get base Finder object.
108- */
109- private function getBaseFinder (): Finder
110- {
111- return Finder::create ()
112- ->in ($ this ->projectDirectory )
113- ->files ();
114- }
115-
116- /**
117- * Get the Finder object for finding the all the files from "build.include" configuration node.
118- */
119- private function getIncludedFiles (array $ patterns ): Finder
120- {
121- $ patterns = collect ($ patterns )->map (function (string $ pattern ) {
122- return '/ ' .ltrim ($ pattern , '/ ' );
123- });
124-
125- $ files = $ patterns ->map (function (string $ pattern ): string {
126- return '/ ' .ltrim ($ pattern , '/ ' );
127- })->filter (function (string $ pattern ): bool {
128- return is_file ($ this ->projectDirectory .$ pattern );
129- })->map (function (string $ pattern ): \SplFileInfo {
130- return $ this ->getSplFileInfo ($ pattern );
131- });
132-
133- $ paths = $ patterns ->filter (function (string $ pattern ): bool {
134- return !is_file ($ this ->projectDirectory .$ pattern );
135- });
136-
137- return $ this ->getBaseFinder ()
138- ->path ($ paths ->all ())
139- ->append ($ files ->all ())
140- ->followLinks ();
141- }
142-
143105 /**
144106 * Get a SplFileInfo object for a project file.
145107 */
0 commit comments