File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed
modules/apps/frontend-js/frontend-js-loader-modules-extender Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change 1- import com.liferay.gradle.util.copy.StripPathSegmentsAction
1+ import com.liferay.gradle.util.hash.HashUtil
2+
3+ import org.gradle.api.file.RelativePath
24
35task buildLiferayAMDLoader (type : Copy )
46
57File jsDestinationDir = file(" tmp/META-INF/resources" )
68
79buildLiferayAMDLoader {
810 dependsOn npmInstall
9- eachFile new StripPathSegmentsAction (4 )
1011 from npmInstall. nodeModulesDir
1112
1213 include " @liferay/amd-loader/build/loader/loader.js.map"
1314 include " @liferay/amd-loader/build/loader/loader.js"
1415
1516 includeEmptyDirs = false
1617 into jsDestinationDir
18+
19+ eachFile {
20+ details ->
21+
22+ def sourcePath = details. sourcePath
23+
24+ if (sourcePath. endsWith(" .map" )) {
25+ sourcePath = sourcePath[0 .. -5 ]
26+ }
27+
28+ def md5 = HashUtil . md5(
29+ new File (" ${ npmInstall.nodeModulesDir} /${ sourcePath} " ))
30+
31+ def hash = md5. asCompactString()[0 .. 11 ]
32+
33+ def segments = details. relativePath. segments
34+
35+ def fileName = segments[-1 ]
36+
37+ def i = fileName. indexOf(" ." )
38+
39+ segments[-1 ] = " ${ fileName[0..i]} (${ hash} )${ fileName[i..-1]} "
40+
41+ details. relativePath = new RelativePath (
42+ true , segments[4 .. -1 ]. toArray(new String []{}))
43+ }
1744}
1845
1946classes {
You can’t perform that action at this time.
0 commit comments