[EFL][CMAKE] Compress resource files of inspector
[WebKit.git] / Source / PlatformEfl.cmake
index 6bf44f0..bab370b 100644 (file)
@@ -1,11 +1,12 @@
-add_subdirectory(${WEBKIT_DIR}/efl/DefaultTheme)
+add_subdirectory(${WEBCORE_DIR}/platform/efl/DefaultTheme)
 
 if (ENABLE_INSPECTOR)
     add_custom_target(
         web-inspector-resources ALL
         COMMAND ${CMAKE_COMMAND} -E copy_directory ${WEBCORE_DIR}/inspector/front-end ${WEB_INSPECTOR_DIR}
         COMMAND ${CMAKE_COMMAND} -E copy ${WEBCORE_DIR}/English.lproj/localizedStrings.js ${WEB_INSPECTOR_DIR}
-        COMMAND ${CMAKE_COMMAND} -E copy ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js ${WEB_INSPECTOR_DIR}/InspectorBackendCommands.js
+        COMMAND ${CMAKE_COMMAND} -E copy ${WEBKIT2_DIR}/UIProcess/InspectorServer/front-end/inspectorPageIndex.html ${WEB_INSPECTOR_DIR}
+        COMMAND ${CMAKE_COMMAND} -E copy ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js ${WEB_INSPECTOR_DIR}
         DEPENDS ${WebCore_LIBRARY_NAME}
         WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
     )
@@ -16,4 +17,22 @@ if (ENABLE_INSPECTOR)
                        PATTERN "*.css"
                        PATTERN "*.gif"
                        PATTERN "*.png")
+
+    find_program(UGLIFYJS_EXECUTABLE uglifyjs)
+    if (UGLIFYJS_EXECUTABLE AND (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug"))
+        file(GLOB frontend_js_files "${WEBCORE_DIR}/inspector/front-end/*.js")
+        set(all_js_files
+            ${frontend_js_files}
+            "${WEBCORE_DIR}/English.lproj/localizedStrings.js"
+            "${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js"
+        )
+
+        foreach (js_file ${all_js_files})
+            get_filename_component(filename ${js_file} NAME)
+            install(CODE
+                "execute_process(
+                    COMMAND ${UGLIFYJS_EXECUTABLE} --overwrite ${filename}
+                    WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${WEB_INSPECTOR_DIR})")
+        endforeach ()
+    endif ()
 endif ()