9
9
use Magento \Framework \App ;
10
10
use Magento \Framework \App \State ;
11
11
use Magento \Framework \AppInterface ;
12
+ use Magento \Framework \Filesystem ;
12
13
use Magento \Tools \Webdev \CliParams ;
13
14
use Magento \Tools \View \Deployer \Log ;
14
15
use Magento \Framework \View \Asset \Source ;
18
19
use Magento \Framework \App \ObjectManager \ConfigLoader ;
19
20
use Magento \Framework \View \Asset \SourceFileGeneratorPool ;
20
21
use Magento \Framework \View \Asset \PreProcessor \ChainFactoryInterface ;
22
+ use Magento \Framework \App \Filesystem \DirectoryList ;
21
23
22
24
/**
23
25
* Class FileAssembler
@@ -77,6 +79,11 @@ class FileAssembler implements AppInterface
77
79
*/
78
80
private $ chainFactory ;
79
81
82
+ /**
83
+ * @var Filesystem
84
+ */
85
+ private $ filesystem ;
86
+
80
87
/**
81
88
* @param ObjectManagerInterface $objectManager
82
89
* @param Response $response
@@ -88,6 +95,7 @@ class FileAssembler implements AppInterface
88
95
* @param \Magento\Framework\View\Asset\SourceFileGeneratorPool $sourceFileGeneratorPoll
89
96
* @param \Magento\Tools\View\Deployer\Log $logger
90
97
* @param ChainFactoryInterface $chainFactory
98
+ * @param Filesystem $filesystem,
91
99
*
92
100
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
93
101
*/
@@ -101,7 +109,8 @@ public function __construct(
101
109
Source $ assetSource ,
102
110
SourceFileGeneratorPool $ sourceFileGeneratorPoll ,
103
111
Log $ logger ,
104
- ChainFactoryInterface $ chainFactory
112
+ ChainFactoryInterface $ chainFactory ,
113
+ Filesystem $ filesystem
105
114
) {
106
115
$ this ->response = $ response ;
107
116
$ this ->params = $ params ;
@@ -113,6 +122,7 @@ public function __construct(
113
122
$ this ->assetSource = $ assetSource ;
114
123
$ this ->logger = $ logger ;
115
124
$ this ->chainFactory = $ chainFactory ;
125
+ $ this ->filesystem = $ filesystem ;
116
126
}
117
127
118
128
/**
@@ -152,7 +162,13 @@ public function launch()
152
162
]
153
163
);
154
164
155
- $ sourceFileGenerator ->generateFileTree ($ chain );
165
+ $ processedCoreFile = $ sourceFileGenerator ->generateFileTree ($ chain );
166
+
167
+ $ targetDir = $ this ->filesystem ->getDirectoryWrite (DirectoryList::STATIC_VIEW );
168
+ $ rootDir = $ this ->filesystem ->getDirectoryWrite (DirectoryList::ROOT );
169
+ $ source = $ rootDir ->getRelativePath ($ processedCoreFile );
170
+ $ destination = $ asset ->getPath ();
171
+ $ rootDir ->copyFile ($ source , $ destination , $ targetDir );
156
172
157
173
$ this ->logger ->logMessage ("Done " );
158
174
}
0 commit comments