2
0
Эх сурвалжийг харах

refactor(telemetry): use patch instead of script (#2502)

Baptiste Augrain 1 долоо хоног өмнө
parent
commit
bf53c50a5b

+ 50 - 0
patches/telemetry.patch

@@ -0,0 +1,50 @@
+diff --git a/src/vs/platform/telemetry/common/telemetryService.ts b/src/vs/platform/telemetry/common/telemetryService.ts
+index ef676bd..4feb98b 100644
+--- a/src/vs/platform/telemetry/common/telemetryService.ts
++++ b/src/vs/platform/telemetry/common/telemetryService.ts
+@@ -219,3 +219,3 @@ configurationRegistry.registerConfiguration({
+ 			'markdownDescription': getTelemetryLevelSettingDescription(),
+-			'default': TelemetryConfiguration.ON,
++			'default': TelemetryConfiguration.OFF,
+ 			'restricted': true,
+@@ -245,3 +245,3 @@ configurationRegistry.registerConfiguration({
+ 					localize('telemetry.enableTelemetryMd', "Enable diagnostic data to be collected. This helps us to better understand how {0} is performing and where improvements need to be made. [Read more]({1}) about what we collect and our privacy statement.", product.nameLong, product.privacyStatementUrl),
+-			'default': true,
++			'default': false,
+ 			'restricted': true,
+diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts
+index d09ab3f..f37edd6 100644
+--- a/src/vs/workbench/browser/workbench.contribution.ts
++++ b/src/vs/workbench/browser/workbench.contribution.ts
+@@ -496,3 +496,3 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
+ 				'description': localize('enableNaturalLanguageSearch', "Controls whether the command palette should include similar commands. You must have an extension installed that provides Natural Language support."),
+-				'default': true
++				'default': false
+ 			},
+diff --git a/src/vs/workbench/contrib/editTelemetry/browser/editTelemetry.contribution.ts b/src/vs/workbench/contrib/editTelemetry/browser/editTelemetry.contribution.ts
+index 16fd396..587e1e3 100644
+--- a/src/vs/workbench/contrib/editTelemetry/browser/editTelemetry.contribution.ts
++++ b/src/vs/workbench/contrib/editTelemetry/browser/editTelemetry.contribution.ts
+@@ -28,3 +28,3 @@ configurationRegistry.registerConfiguration({
+ 			type: 'boolean',
+-			default: true,
++			default: false,
+ 			tags: ['experimental'],
+diff --git a/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts b/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts
+index e5cec6f..9c9e169 100644
+--- a/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts
++++ b/src/vs/workbench/contrib/preferences/common/preferencesContribution.ts
+@@ -113,3 +113,3 @@ registry.registerConfiguration({
+ 			'description': nls.localize('enableNaturalLanguageSettingsSearch', "Controls whether to enable the natural language search mode for settings. The natural language search is provided by a Microsoft online service."),
+-			'default': true,
++			'default': false,
+ 			'scope': ConfigurationScope.WINDOW,
+diff --git a/src/vs/workbench/electron-browser/desktop.contribution.ts b/src/vs/workbench/electron-browser/desktop.contribution.ts
+index 3517cc1..7b365fa 100644
+--- a/src/vs/workbench/electron-browser/desktop.contribution.ts
++++ b/src/vs/workbench/electron-browser/desktop.contribution.ts
+@@ -342,3 +342,3 @@ import { registerWorkbenchContribution2, WorkbenchPhase } from '../common/contri
+ 				'description': localize('telemetry.enableCrashReporting', "Enable crash reports to be collected. This helps us improve stability. \nThis option requires restart to take effect."),
+-				'default': true,
++				'default': false,
+ 				'tags': ['usesOnlineServices', 'telemetry'],

+ 0 - 2
prepare_vscode.sh

@@ -16,8 +16,6 @@ cp -f LICENSE vscode/LICENSE.txt
 
 cd vscode || { echo "'vscode' dir not found"; exit 1; }
 
-../update_settings.sh
-
 # apply patches
 { set +x; } 2>/dev/null
 

+ 0 - 55
update_settings.sh

@@ -1,55 +0,0 @@
-# shellcheck disable=SC1091,2148
-
-DEFAULT_TRUE="'default': true"
-DEFAULT_FALSE="'default': false"
-DEFAULT_ON="'default': TelemetryConfiguration.ON"
-DEFAULT_OFF="'default': TelemetryConfiguration.OFF"
-TELEMETRY_CRASH_REPORTER="'telemetry.enableCrashReporter':"
-TELEMETRY_CONFIGURATION=" TelemetryConfiguration.ON"
-NLS=workbench.settings.enableNaturalLanguageSearch
-
-# include common functions
-. ../utils.sh
-
-update_setting () {
-  local FILENAME SETTING LINE_NUM IN_SETTING FOUND DEFAULT_TRUE_TO_FALSE
-
-  FILENAME="${2}"
-  # check that the file exists
-  if [[ ! -f "${FILENAME}" ]]; then
-    echo "File to update setting in does not exist ${FILENAME}"
-    return
-  fi
-
-  # go through lines of file, looking for block that contains setting
-  SETTING="${1}"
-  LINE_NUM=0
-  while read -r line; do
-    LINE_NUM=$(( LINE_NUM + 1 ))
-    if [[ "${line}" == *"${SETTING}"* ]]; then
-      IN_SETTING=1
-    fi
-    if [[ ("${line}" == *"${DEFAULT_TRUE}"* || "${line}" == *"${DEFAULT_ON}"*) && "${IN_SETTING}" == "1" ]]; then
-      FOUND=1
-      break
-    fi
-  done < "${FILENAME}"
-
-  if [[ "${FOUND}" != "1" ]]; then
-    echo "${DEFAULT_TRUE} not found for setting ${SETTING} in file ${FILENAME}"
-    return
-  fi
-
-  # construct line-aware replacement string
-  if [[ "${line}" == *"${DEFAULT_TRUE}"* ]]; then
-    DEFAULT_TRUE_TO_FALSE="${LINE_NUM}s/${DEFAULT_TRUE}/${DEFAULT_FALSE}/"
-  else
-    DEFAULT_TRUE_TO_FALSE="${LINE_NUM}s/${DEFAULT_ON}/${DEFAULT_OFF}/"
-  fi
-
-  replace "${DEFAULT_TRUE_TO_FALSE}" "${FILENAME}"
-}
-
-update_setting "${TELEMETRY_CRASH_REPORTER}" src/vs/workbench/electron-sandbox/desktop.contribution.ts
-update_setting "${TELEMETRY_CONFIGURATION}" src/vs/platform/telemetry/common/telemetryService.ts
-update_setting "${NLS}" src/vs/workbench/contrib/preferences/common/preferencesContribution.ts