[Preferences] Move GeneratePreferences.rb and yaml configuration files to WTF to...
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Sep 2020 20:26:13 +0000 (20:26 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Sep 2020 20:26:13 +0000 (20:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=217056

Reviewed by Darin Adler.

Move GeneratePreferences.rb and WebPreferences*.yaml files from WebKitLegacy to WTF, and install them into the existing
$SDKROOT/usr/local/install/wtf/Scripts for use by down stack projects.

Source/WebKitLegacy:

* WebKitLegacy.xcodeproj/project.pbxproj:

Source/WebKitLegacy/mac:

Also adds new script, generate-preferences.sh, to make editing / reviewing the invocation a bit easier as you don't
have to use the tiny editor in the Run Scripts phase pane.

Adds new build variable, WTF_BUILD_SCRIPTS_DIR, to easily specify the new location of the moved files.

* Configurations/WebKitLegacy.xcconfig:
* Scripts/GeneratePreferences.rb: Removed.
* Scripts/generate-preferences.sh: Added.
* WebView/WebPreferences.yaml: Removed.
* WebView/WebPreferencesDebug.yaml: Removed.
* WebView/WebPreferencesExperimental.yaml: Removed.
* WebView/WebPreferencesInternal.yaml: Removed.

Source/WTF:

* Scripts/GeneratePreferences.rb: Copied from Source/WebKitLegacy/mac/Scripts/GeneratePreferences.rb.
* Scripts/Preferences: Added.
* Scripts/Preferences/WebPreferences.yaml: Copied from Source/WebKitLegacy/mac/WebView/WebPreferences.yaml.
* Scripts/Preferences/WebPreferencesDebug.yaml: Copied from Source/WebKitLegacy/mac/WebView/WebPreferencesDebug.yaml.
* Scripts/Preferences/WebPreferencesExperimental.yaml: Copied from Source/WebKitLegacy/mac/WebView/WebPreferencesExperimental.yaml.
* Scripts/Preferences/WebPreferencesInternal.yaml: Copied from Source/WebKitLegacy/mac/WebView/WebPreferencesInternal.yaml.
* WTF.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267714 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WTF/ChangeLog
Source/WTF/Scripts/GeneratePreferences.rb [moved from Source/WebKitLegacy/mac/Scripts/GeneratePreferences.rb with 90% similarity, mode: 0644]
Source/WTF/Scripts/Preferences/WebPreferences.yaml [moved from Source/WebKitLegacy/mac/WebView/WebPreferences.yaml with 100% similarity]
Source/WTF/Scripts/Preferences/WebPreferencesDebug.yaml [moved from Source/WebKitLegacy/mac/WebView/WebPreferencesDebug.yaml with 100% similarity]
Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml [moved from Source/WebKitLegacy/mac/WebView/WebPreferencesExperimental.yaml with 100% similarity]
Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml [moved from Source/WebKitLegacy/mac/WebView/WebPreferencesInternal.yaml with 100% similarity]
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig
Source/WebKitLegacy/mac/Scripts/generate-preferences.sh [new file with mode: 0755]

index a468d4aa2b5e51a085744d7fde85d01379bcb900..f26012fafe04c6c39d5c29c9f81ff43be3a07a3b 100644 (file)
@@ -1,3 +1,21 @@
+2020-09-28  Sam Weinig  <weinig@apple.com>
+
+        [Preferences] Move GeneratePreferences.rb and yaml configuration files to WTF to be shared
+        https://bugs.webkit.org/show_bug.cgi?id=217056
+
+        Reviewed by Darin Adler.
+
+        Move GeneratePreferences.rb and WebPreferences*.yaml files from WebKitLegacy to WTF, and install them into the existing
+        $SDKROOT/usr/local/install/wtf/Scripts for use by down stack projects.
+
+        * Scripts/GeneratePreferences.rb: Copied from Source/WebKitLegacy/mac/Scripts/GeneratePreferences.rb.
+        * Scripts/Preferences: Added.
+        * Scripts/Preferences/WebPreferences.yaml: Copied from Source/WebKitLegacy/mac/WebView/WebPreferences.yaml.
+        * Scripts/Preferences/WebPreferencesDebug.yaml: Copied from Source/WebKitLegacy/mac/WebView/WebPreferencesDebug.yaml.
+        * Scripts/Preferences/WebPreferencesExperimental.yaml: Copied from Source/WebKitLegacy/mac/WebView/WebPreferencesExperimental.yaml.
+        * Scripts/Preferences/WebPreferencesInternal.yaml: Copied from Source/WebKitLegacy/mac/WebView/WebPreferencesInternal.yaml.
+        * WTF.xcodeproj/project.pbxproj:
+
 2020-09-25  Yusuke Suzuki  <ysuzuki@apple.com>
 
         [JSC] Introduce JSC_DECLARE_HOST_FUNCTION / JSC_DEFINE_HOST_FUNCTION to make host function definition easy-to-scanned for JIT-caging
old mode 100755 (executable)
new mode 100644 (file)
similarity index 90%
rename from Source/WebKitLegacy/mac/Scripts/GeneratePreferences.rb
rename to Source/WTF/Scripts/GeneratePreferences.rb
index 22c2822..38eacc7
@@ -34,6 +34,7 @@ options = {
   :debugPreferences => nil,
   :experimentalPreferences => nil,
   :internalPreferences => nil,
+  :templateDirectory => nil,
   :outputDirectory => nil,
   :templates => []
 }
@@ -47,13 +48,14 @@ optparse = OptionParser.new do |opts|
   opts.on("--debug input", "file to generate debug preferences from") { |debugPreferences| options[:debugPreferences] = debugPreferences }
   opts.on("--experimental input", "file to generate experimental preferences from") { |experimentalPreferences| options[:experimentalPreferences] = experimentalPreferences }
   opts.on("--internal input", "file to generate internal preferences from") { |internalPreferences| options[:internalPreferences] = internalPreferences }
-  opts.on("--template input", "template to use for generation (may be specified multiple times") { |template| options[:templates] << template }
-  opts.on("--outputDir output", "directory to generate file in") { |output| options[:outputDirectory] = output }
+  opts.on("--template input", "template to use for generation (may be specified multiple times)") { |template| options[:templates] << template }
+  opts.on("--templateDir input", "directory to look for templates in") { |templateDir| options[:templateDirectory] = templateDir }
+  opts.on("--outputDir output", "directory to generate file in") { |outputDir| options[:outputDirectory] = outputDir }
 end
 
 optparse.parse!
 
-if !options[:frontend] || !options[:basePreferences] || !options[:debugPreferences] || !options[:experimentalPreferences] || !options[:internalPreferences]
+if !options[:frontend] || !options[:basePreferences] || !options[:debugPreferences] || !options[:experimentalPreferences] || !options[:internalPreferences] || !options[:templateDirectory]
   puts optparse
   exit -1
 end
@@ -175,8 +177,7 @@ end
 class Preferences
   attr_accessor :preferences
 
-  def initialize(parsedBasePreferences, parsedDebugPreferences, parsedExperimentalPreferences, parsedInternalPreferences, outputDirectory, frontend)
-    @outputDirectory = outputDirectory
+  def initialize(parsedBasePreferences, parsedDebugPreferences, parsedExperimentalPreferences, parsedInternalPreferences, frontend)
     @frontend = frontend
 
     @preferences = []
@@ -212,18 +213,18 @@ class Preferences
     result
   end
 
-  def renderTemplate(template)
-    templateFile = File.join(File.dirname(__FILE__), "PreferencesTemplates", template + ".erb")
+  def renderTemplate(templateDirectory, template, outputDirectory)
+    templateFile = File.join(templateDirectory, template + ".erb")
 
     output = ERB.new(File.read(templateFile), 0, "-").result(binding)
-    File.open(File.join(@outputDirectory, template), "w+") do |f|
+    File.open(File.join(outputDirectory, template), "w+") do |f|
       f.write(output)
     end
   end
 end
 
-preferences = Preferences.new(parsedBasePreferences, parsedDebugPreferences, parsedExperimentalPreferences, parsedInternalPreferences, options[:outputDirectory], options[:frontend])
+preferences = Preferences.new(parsedBasePreferences, parsedDebugPreferences, parsedExperimentalPreferences, parsedInternalPreferences, options[:frontend])
 
 options[:templates].each do |template|
-  preferences.renderTemplate(template)
+  preferences.renderTemplate(options[:templateDirectory], template, options[:outputDirectory])
 end
index 831461813cae6a91b39da0e8daf25c7e2e84e362..67c72fbd676eaf36f0447a0f0ae4b852aaf1b3c6 100644 (file)
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "if [[ \"${DEPLOYMENT_LOCATION}\" == \"NO\" ]]; then\n    PRIVATE_HEADERS_PATH=\"${TARGET_BUILD_DIR%/}/${PRIVATE_HEADERS_FOLDER_PATH}\"\n    ICU_PRIVATE_HEADERS_PATH=\"${TARGET_BUILD_DIR%/}/${ICU_PRIVATE_HEADERS_FOLDER_PATH}\"\nelse\n    PRIVATE_HEADERS_PATH=\"${DSTROOT}/${PRIVATE_HEADERS_FOLDER_PATH}\"\n    ICU_PRIVATE_HEADERS_PATH=\"${DSTROOT}/${ICU_PRIVATE_HEADERS_FOLDER_PATH}\"\nfi;\n\nmkdir -p \"${PRIVATE_HEADERS_PATH}\"\nrsync -av --no-owner --no-group --prune-empty-dirs --exclude \".svn\" --exclude \"usr\" --exclude \"DerivedSources\" --include \"*/\" --include \"*.h\" --exclude \"*\" \"${SRCROOT}/wtf/\" \"${PRIVATE_HEADERS_PATH}\"\n\nrsync -av --no-owner --no-group --prune-empty-dirs --exclude \".svn\" --exclude \"usr\" --exclude \"DerivedSources\" --include \"*/\" --include \"*.rb\" --exclude \"*\" \"${SRCROOT}/Scripts\" \"${PRIVATE_HEADERS_PATH}\"\n\nif [[ \"${USE_INTERNAL_SDK}\" != \"YES\" ]]; then\nmkdir -p \"${ICU_PRIVATE_HEADERS_PATH}\"\nrsync -av --no-owner --no-group --prune-empty-dirs --exclude \".svn\" --exclude \"usr\" --exclude \"DerivedSources\" --include \"*/\" --include \"*.h\" --exclude \"*\" \"${SRCROOT}/icu/\" \"${ICU_PRIVATE_HEADERS_PATH}\"\nfi\n";
+                       shellScript = "if [[ \"${DEPLOYMENT_LOCATION}\" == \"NO\" ]]; then\n    PRIVATE_HEADERS_PATH=\"${TARGET_BUILD_DIR%/}/${PRIVATE_HEADERS_FOLDER_PATH}\"\n    ICU_PRIVATE_HEADERS_PATH=\"${TARGET_BUILD_DIR%/}/${ICU_PRIVATE_HEADERS_FOLDER_PATH}\"\nelse\n    PRIVATE_HEADERS_PATH=\"${DSTROOT}/${PRIVATE_HEADERS_FOLDER_PATH}\"\n    ICU_PRIVATE_HEADERS_PATH=\"${DSTROOT}/${ICU_PRIVATE_HEADERS_FOLDER_PATH}\"\nfi;\n\necho \"${PRIVATE_HEADERS_PATH}\"\nmkdir -p \"${PRIVATE_HEADERS_PATH}\"\nrsync -av --no-owner --no-group --prune-empty-dirs --exclude \".svn\" --exclude \"usr\" --exclude \"DerivedSources\" --include \"*/\" --include \"*.h\" --exclude \"*\" \"${SRCROOT}/wtf/\" \"${PRIVATE_HEADERS_PATH}\"\n\nrsync -av --no-owner --no-group --prune-empty-dirs --exclude \".svn\" --exclude \"usr\" --exclude \"DerivedSources\" --include \"*/\" --include \"*.rb\" --include=\"*/*.yaml\" --exclude \"*\" \"${SRCROOT}/Scripts\" \"${PRIVATE_HEADERS_PATH}\"\n\nif [[ \"${USE_INTERNAL_SDK}\" != \"YES\" ]]; then\nmkdir -p \"${ICU_PRIVATE_HEADERS_PATH}\"\nrsync -av --no-owner --no-group --prune-empty-dirs --exclude \".svn\" --exclude \"usr\" --exclude \"DerivedSources\" --include \"*/\" --include \"*.h\" --exclude \"*\" \"${SRCROOT}/icu/\" \"${ICU_PRIVATE_HEADERS_PATH}\"\nfi\n";
                };
 /* End PBXShellScriptBuildPhase section */
 
index e0b6bdea9558a637d0b8fab5709544ce5797709d..82271ec6b95be1deb407f8ce24d152b7d6642232 100644 (file)
@@ -1,3 +1,15 @@
+2020-09-28  Sam Weinig  <weinig@apple.com>
+
+        [Preferences] Move GeneratePreferences.rb and yaml configuration files to WTF to be shared
+        https://bugs.webkit.org/show_bug.cgi?id=217056
+
+        Reviewed by Darin Adler.
+
+        Move GeneratePreferences.rb and WebPreferences*.yaml files from WebKitLegacy to WTF, and install them into the existing
+        $SDKROOT/usr/local/install/wtf/Scripts for use by down stack projects.
+
+        * WebKitLegacy.xcodeproj/project.pbxproj:
+
 2020-09-26  Sam Weinig  <weinig@apple.com>
 
         [Preferences] Generate Debug and Internal preferences for WebKitLegacy
index 87463a255b3b6cd6651a44d00df336de03c216d4..478d5db816a8f6b016726c345dc18435f1ceddf2 100644 (file)
                7C023A2F251C05FC00BA7BB6 /* WebPreferencesDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C023A2E251C05D500BA7BB6 /* WebPreferencesDefinitions.h */; };
                7C1FB3C21846E8E1001A03D8 /* WebAllowDenyPolicyListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1FB3C11846E8E1001A03D8 /* WebAllowDenyPolicyListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7C671126251FE40F004F4536 /* WebPreferencesInternalFeatures.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C671125251FE406004F4536 /* WebPreferencesInternalFeatures.mm */; };
+               7CCE766B25223BC8003C7BD2 /* generate-preferences.sh in Resources */ = {isa = PBXBuildFile; fileRef = 7CCE766A25223BC7003C7BD2 /* generate-preferences.sh */; };
                7E6FEF0808985A7200C44C3F /* WebScriptDebugDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                931633EB0AEDFF930062B92D /* WebFrameLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 931633EA0AEDFF930062B92D /* WebFrameLoaderClient.h */; };
                9321D5921A391DC3008052BE /* WebImmediateActionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9321D5911A391DB8008052BE /* WebImmediateActionController.h */; };
                7C01CB82173435C900C5D807 /* PopupMenuMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PopupMenuMac.mm; sourceTree = "<group>"; };
                7C01CB83173435C900C5D807 /* SearchPopupMenuMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenuMac.h; sourceTree = "<group>"; };
                7C01CB84173435C900C5D807 /* SearchPopupMenuMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SearchPopupMenuMac.mm; sourceTree = "<group>"; };
-               7C023211251B8E3A00BA7BB6 /* GeneratePreferences.rb */ = {isa = PBXFileReference; lastKnownFileType = text.script.ruby; path = GeneratePreferences.rb; sourceTree = "<group>"; };
                7C023212251B925C00BA7BB6 /* WebFeature.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebFeature.h; sourceTree = "<group>"; };
                7C023213251B925C00BA7BB6 /* WebFeature.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WebFeature.m; sourceTree = "<group>"; };
                7C023216251B96E400BA7BB6 /* WebPreferencesExperimentalFeatures.mm.erb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebPreferencesExperimentalFeatures.mm.erb; sourceTree = "<group>"; };
                7C023219251B988200BA7BB6 /* WebFeatureInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebFeatureInternal.h; sourceTree = "<group>"; };
-               7C02321C251B9BD600BA7BB6 /* WebPreferences.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = WebPreferences.yaml; sourceTree = "<group>"; };
-               7C02321D251B9BD600BA7BB6 /* WebPreferencesDebug.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = WebPreferencesDebug.yaml; sourceTree = "<group>"; };
-               7C02321E251B9BD600BA7BB6 /* WebPreferencesExperimental.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = WebPreferencesExperimental.yaml; sourceTree = "<group>"; };
-               7C02321F251B9BD600BA7BB6 /* WebPreferencesInternal.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = WebPreferencesInternal.yaml; sourceTree = "<group>"; };
                7C0239EB251BA01A00BA7BB6 /* UnifiedSource2-mm.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource2-mm.mm"; sourceTree = "<group>"; };
                7C0239EC251BA01A00BA7BB6 /* UnifiedSource21-mm.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource21-mm.mm"; sourceTree = "<group>"; };
                7C0239ED251BA01A00BA7BB6 /* UnifiedSource18-mm.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "UnifiedSource18-mm.mm"; sourceTree = "<group>"; };
                7C671118251C2459004F4536 /* postprocess-header-rule */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = "postprocess-header-rule"; path = "scripts/postprocess-header-rule"; sourceTree = "<group>"; };
                7C671119251C2483004F4536 /* check-xcfilelists.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = "check-xcfilelists.sh"; path = "scripts/check-xcfilelists.sh"; sourceTree = "<group>"; };
                7C671123251FB237004F4536 /* WebPreferencesInternalFeatures.mm.erb */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebPreferencesInternalFeatures.mm.erb; sourceTree = "<group>"; };
-               7C671125251FE406004F4536 /* WebPreferencesInternalFeatures.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPreferencesInternalFeatures.mm; path = WebPreferencesInternalFeatures.mm; sourceTree = "<group>"; };
+               7C671125251FE406004F4536 /* WebPreferencesInternalFeatures.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPreferencesInternalFeatures.mm; sourceTree = "<group>"; };
+               7CCE766A25223BC7003C7BD2 /* generate-preferences.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "generate-preferences.sh"; sourceTree = "<group>"; };
                7E6FEF0508985A7200C44C3F /* WebScriptDebugDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                7E6FEF0608985A7200C44C3F /* WebScriptDebugDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebScriptDebugDelegate.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                833987810543012D00EE146E /* WebDocumentPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDocumentPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                        isa = PBXGroup;
                        children = (
                                7C02320F251B8E3A00BA7BB6 /* PreferencesTemplates */,
-                               7C023211251B8E3A00BA7BB6 /* GeneratePreferences.rb */,
+                               7CCE766A25223BC7003C7BD2 /* generate-preferences.sh */,
                        );
                        name = Scripts;
                        path = mac/Scripts;
                                EDE850CD06ECC79E005FAB05 /* WebPreferenceKeysPrivate.h */,
                                3944606E020F50ED0ECA1767 /* WebPreferences.h */,
                                F5AEBB3D024A527601C1A526 /* WebPreferences.mm */,
-                               7C02321C251B9BD600BA7BB6 /* WebPreferences.yaml */,
-                               7C02321D251B9BD600BA7BB6 /* WebPreferencesDebug.yaml */,
                                7C023A21251BA43E00BA7BB6 /* WebPreferencesDefaultValues.h */,
                                7C023A22251BA43E00BA7BB6 /* WebPreferencesDefaultValues.mm */,
-                               7C02321E251B9BD600BA7BB6 /* WebPreferencesExperimental.yaml */,
                                7C023A28251BB5E500BA7BB6 /* WebPreferencesInternal.h */,
-                               7C02321F251B9BD600BA7BB6 /* WebPreferencesInternal.yaml */,
                                9CAE9D070252A4130ECA16EA /* WebPreferencesPrivate.h */,
                                84311A1205EAAAF00088EDA4 /* WebResource.h */,
                                84311A1305EAAAF00088EDA4 /* WebResource.mm */,
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               7CCE766B25223BC8003C7BD2 /* generate-preferences.sh in Resources */,
                                A1382CDF24B15A51001645B0 /* LaBanquePostaleQuirks.js in Resources */,
                                29AEF960134C76FB00FE5096 /* OutlookQuirksUserScript.js in Resources */,
                                5C9D925A22D7E8AD008E9266 /* Sources.txt in Resources */,
                        inputFileListPaths = (
                        );
                        inputPaths = (
-                               "$(SRCROOT)/mac/WebView/WebPreferences.yaml",
-                               "$(SRCROOT)/mac/WebView/WebPreferencesDebug.yaml",
-                               "$(SRCROOT)/mac/WebView/WebPreferencesExperimental.yaml",
-                               "$(SRCROOT)/mac/WebView/WebPreferencesInternal.yaml",
-                               "$(SRCROOT)/mac/Scripts/GeneratePreferences.rb",
+                               "$(WTF_BUILD_SCRIPTS_DIR)/Preferences/WebPreferences.yaml",
+                               "$(WTF_BUILD_SCRIPTS_DIR)/Preferences/WebPreferencesDebug.yaml",
+                               "$(WTF_BUILD_SCRIPTS_DIR)/Preferences/WebPreferencesExperimental.yaml",
+                               "$(WTF_BUILD_SCRIPTS_DIR)/Preferences/WebPreferencesInternal.yaml",
+                               "$(WTF_BUILD_SCRIPTS_DIR)/GeneratePreferences.rb",
                                "$(SRCROOT)/mac/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb",
                                "$(SRCROOT)/mac/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb",
                                "$(SRCROOT)/mac/Scripts/PreferencesTemplates/WebPreferencesInternalFeatures.mm.erb",
                        outputFileListPaths = (
                        );
                        outputPaths = (
-                               "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy/WebPreferencesDefinitions.h",
-                               "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy/WebPreferencesExperimentalFeatures.mm",
-                               "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy/WebPreferencesInternalFeatures.mm",
-                               "${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy/WebViewPreferencesChangedGenerated.mm",
+                               "$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitLegacy/WebPreferencesDefinitions.h",
+                               "$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitLegacy/WebPreferencesExperimentalFeatures.mm",
+                               "$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitLegacy/WebPreferencesInternalFeatures.mm",
+                               "$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitLegacy/WebViewPreferencesChangedGenerated.mm",
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        shellPath = /bin/sh;
-                       shellScript = "set -e\n\n${SRCROOT}/mac/Scripts/GeneratePreferences.rb --frontend WebKitLegacy --template WebPreferencesDefinitions.h --template WebPreferencesExperimentalFeatures.mm --template WebPreferencesInternalFeatures.mm --template WebViewPreferencesChangedGenerated.mm --outputDir ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy/ --base ${SRCROOT}/mac/WebView/WebPreferences.yaml --debug ${SRCROOT}/mac/WebView/WebPreferencesDebug.yaml --experimental ${SRCROOT}/mac/WebView/WebPreferencesExperimental.yaml --internal ${SRCROOT}/mac/WebView/WebPreferencesInternal.yaml\n";
+                       shellScript = "${SRCROOT}/mac/Scripts/generate-preferences.sh\n";
                };
                A13EE61D185AE82700556064 /* Postprocess Headers */ = {
                        isa = PBXShellScriptBuildPhase;
index 6b3b17e839a5ac84b71c75c49ec126e8f3840579..2023a3b012d12841b808dfb37d89a93311c03330 100644 (file)
@@ -1,3 +1,26 @@
+2020-09-28  Sam Weinig  <weinig@apple.com>
+
+        [Preferences] Move GeneratePreferences.rb and yaml configuration files to WTF to be shared
+        https://bugs.webkit.org/show_bug.cgi?id=217056
+
+        Reviewed by Darin Adler.
+
+        Move GeneratePreferences.rb and WebPreferences*.yaml files from WebKitLegacy to WTF, and install them into the existing
+        $SDKROOT/usr/local/install/wtf/Scripts for use by down stack projects.
+
+        Also adds new script, generate-preferences.sh, to make editing / reviewing the invocation a bit easier as you don't
+        have to use the tiny editor in the Run Scripts phase pane.
+
+        Adds new build variable, WTF_BUILD_SCRIPTS_DIR, to easily specify the new location of the moved files.
+
+        * Configurations/WebKitLegacy.xcconfig:
+        * Scripts/GeneratePreferences.rb: Removed.
+        * Scripts/generate-preferences.sh: Added.
+        * WebView/WebPreferences.yaml: Removed.
+        * WebView/WebPreferencesDebug.yaml: Removed.
+        * WebView/WebPreferencesExperimental.yaml: Removed.
+        * WebView/WebPreferencesInternal.yaml: Removed.
+
 2020-09-28  Devin Rousso  <drousso@apple.com>
 
         [iOS] unable to airplay directly loaded fullscreen video
index c48d450c3037c6f75f640b799185e819f44f4e2f..ea009571f58c7ac2e4cec0f8cacfe3c28b254cab 100644 (file)
@@ -127,6 +127,14 @@ WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $
 WEBCORE_PRIVATE_HEADERS_DIR_Production_macosx_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(PRODUCTION_FRAMEWORKS_DIR)/WebCore.framework/PrivateHeaders;
 WEBCORE_PRIVATE_HEADERS_engineering = $(BUILT_PRODUCTS_DIR)/WebCore.framework/PrivateHeaders;
 
+WTF_BUILD_SCRIPTS_DIR = $(WTF_BUILD_SCRIPTS_DIR_$(CONFIGURATION));
+WTF_BUILD_SCRIPTS_DIR_Release = $(WTF_BUILD_SCRIPTS_DIR_engineering);
+WTF_BUILD_SCRIPTS_DIR_Debug = $(WTF_BUILD_SCRIPTS_DIR_engineering);
+WTF_BUILD_SCRIPTS_DIR_Production = $(WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));
+WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_YES = $(SDKROOT)$(WK_ALTERNATE_WEBKIT_SDK_PATH)/usr/local/include/wtf/Scripts;
+WTF_BUILD_SCRIPTS_DIR_Production_COCOA_TOUCH_NO = $(SDKROOT)/usr/local/include/wtf/Scripts;
+WTF_BUILD_SCRIPTS_DIR_engineering = $(BUILT_PRODUCTS_DIR)/usr/local/include/wtf/Scripts;
+
 WK_USE_OVERRIDE_FRAMEWORKS_DIR = $(WK_NOT_$(WK_EMPTY_$(WK_OVERRIDE_FRAMEWORKS_DIR)));
 
 WK_OVERRIDE_FRAMEWORKS_DIR = $(WK_OVERRIDE_FRAMEWORKS_DIR_USE_STAGING_INSTALL_PATH_$(USE_STAGING_INSTALL_PATH));
diff --git a/Source/WebKitLegacy/mac/Scripts/generate-preferences.sh b/Source/WebKitLegacy/mac/Scripts/generate-preferences.sh
new file mode 100755 (executable)
index 0000000..3b24159
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Copyright (C) 2020 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+set -e
+
+ARGS=("$@")
+
+PREFERENCES_DIR=${WTF_BUILD_SCRIPTS_DIR}/Preferences
+
+/usr/bin/env ruby ${WTF_BUILD_SCRIPTS_DIR}/GeneratePreferences.rb --frontend WebKitLegacy --template WebPreferencesDefinitions.h --template WebPreferencesExperimentalFeatures.mm --template WebPreferencesInternalFeatures.mm --template WebViewPreferencesChangedGenerated.mm --templateDir=${SRCROOT}/mac/Scripts/PreferencesTemplates --outputDir ${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy/ --base ${PREFERENCES_DIR}/WebPreferences.yaml --debug ${PREFERENCES_DIR}/WebPreferencesDebug.yaml --experimental ${PREFERENCES_DIR}/WebPreferencesExperimental.yaml --internal ${PREFERENCES_DIR}/WebPreferencesInternal.yaml