Răsfoiți Sursa

feat: make build more generic (#2268)

Baptiste Augrain 2 luni în urmă
părinte
comite
9c310cba11

+ 2 - 0
.github/workflows/insider-linux.yml

@@ -30,7 +30,9 @@ env:
   ASSETS_REPOSITORY: ${{ github.repository }}-insiders
   BINARY_NAME: codium-insiders
   DISABLE_UPDATE: 'yes'
+  GH_REPO_PATH: ${{ github.repository_owner }}/${{ github.repository }}
   GITHUB_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'insider' }}
+  ORG_NAME: ${{ github.repository_owner }}
   OS_NAME: linux
   VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
   VSCODE_QUALITY: insider

+ 3 - 0
.github/workflows/insider-macos.yml

@@ -27,7 +27,10 @@ on:
 env:
   APP_NAME: VSCodium
   ASSETS_REPOSITORY: ${{ github.repository }}-insiders
+  BINARY_NAME: codium-insiders
   GITHUB_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'insider' }}
+  GH_REPO_PATH: ${{ github.repository_owner }}/${{ github.repository }}
+  ORG_NAME: ${{ github.repository_owner }}
   OS_NAME: osx
   VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
   VSCODE_QUALITY: insider

+ 4 - 1
.github/workflows/insider-spearhead.yml

@@ -24,8 +24,11 @@ jobs:
     env:
       APP_NAME: VSCodium
       ASSETS_REPOSITORY: ${{ github.repository }}-insiders
-      VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
+      BINARY_NAME: codium-insiders
+      GH_REPO_PATH: ${{ github.repository_owner }}/${{ github.repository }}
+      ORG_NAME: ${{ github.repository_owner }}
       OS_NAME: osx
+      VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
       VSCODE_ARCH: arm64
       VSCODE_LATEST: ${{ github.event.inputs.dont_update == 'true' && 'no' || 'yes' }}
       VSCODE_QUALITY: insider

+ 3 - 0
.github/workflows/insider-windows.yml

@@ -27,7 +27,10 @@ on:
 env:
   APP_NAME: VSCodium
   ASSETS_REPOSITORY: ${{ github.repository }}-insiders
+  BINARY_NAME: codium-insiders
   GITHUB_BRANCH: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'insider' }}
+  GH_REPO_PATH: ${{ github.repository_owner }}/${{ github.repository }}
+  ORG_NAME: ${{ github.repository_owner }}
   OS_NAME: windows
   VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
   VSCODE_QUALITY: insider

+ 2 - 0
.github/workflows/stable-linux.yml

@@ -30,6 +30,8 @@ env:
   ASSETS_REPOSITORY: ${{ github.repository }}
   BINARY_NAME: codium
   DISABLE_UPDATE: 'yes'
+  GH_REPO_PATH: ${{ github.repository_owner }}/${{ github.repository }}
+  ORG_NAME: ${{ github.repository_owner }}
   OS_NAME: linux
   VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
   VSCODE_QUALITY: stable

+ 3 - 0
.github/workflows/stable-macos.yml

@@ -27,6 +27,9 @@ on:
 env:
   APP_NAME: VSCodium
   ASSETS_REPOSITORY: ${{ github.repository }}
+  BINARY_NAME: codium
+  GH_REPO_PATH: ${{ github.repository_owner }}/${{ github.repository }}
+  ORG_NAME: ${{ github.repository_owner }}
   OS_NAME: osx
   VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
   VSCODE_QUALITY: stable

+ 4 - 1
.github/workflows/stable-spearhead.yml

@@ -21,8 +21,11 @@ jobs:
     env:
       APP_NAME: VSCodium
       ASSETS_REPOSITORY: ${{ github.repository }}
-      VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
+      BINARY_NAME: codium
+      GH_REPO_PATH: ${{ github.repository_owner }}/${{ github.repository }}
+      ORG_NAME: ${{ github.repository_owner }}
       OS_NAME: osx
+      VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
       VSCODE_ARCH: arm64
       VSCODE_LATEST: ${{ github.event.inputs.dont_update == 'true' && 'no' || 'yes' }}
       VSCODE_QUALITY: stable

+ 3 - 0
.github/workflows/stable-windows.yml

@@ -27,6 +27,9 @@ on:
 env:
   APP_NAME: VSCodium
   ASSETS_REPOSITORY: ${{ github.repository }}
+  BINARY_NAME: codium
+  GH_REPO_PATH: ${{ github.repository_owner }}/${{ github.repository }}
+  ORG_NAME: ${{ github.repository_owner }}
   OS_NAME: windows
   VERSIONS_REPOSITORY: ${{ github.repository_owner }}/versions
   VSCODE_QUALITY: stable

+ 3 - 6
build/alpine/package_reh.sh

@@ -7,7 +7,8 @@ if [[ "${CI_BUILD}" == "no" ]]; then
   exit 1
 fi
 
-APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )"
+# include common functions
+. ./utils.sh
 
 mkdir -p assets
 
@@ -26,11 +27,7 @@ export VSCODE_HOST_MOUNT VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME
 if [[ -d "../patches/alpine/reh/" ]]; then
   for file in "../patches/alpine/reh/"*.patch; do
     if [[ -f "${file}" ]]; then
-      echo applying patch: "${file}";
-      if ! git apply --ignore-whitespace "${file}"; then
-        echo failed to apply patch "${file}" >&2
-        exit 1
-      fi
+      apply_patch "${file}"
     fi
   done
 fi

+ 4 - 5
build/linux/package_bin.sh

@@ -7,6 +7,9 @@ if [[ "${CI_BUILD}" == "no" ]]; then
   exit 1
 fi
 
+# include common functions
+. ./utils.sh
+
 tar -xzf ./vscode.tar.gz
 
 chown -R root:root vscode
@@ -63,11 +66,7 @@ fi
 if [[ -d "../patches/linux/client/" ]]; then
   for file in "../patches/linux/client/"*.patch; do
     if [[ -f "${file}" ]]; then
-      echo applying patch: "${file}";
-      if ! git apply --ignore-whitespace "${file}"; then
-        echo failed to apply patch "${file}" >&2
-        exit 1
-      fi
+      apply_patch "${file}"
     fi
   done
 fi

+ 4 - 11
build/linux/package_reh.sh

@@ -7,7 +7,8 @@ if [[ "${CI_BUILD}" == "no" ]]; then
   exit 1
 fi
 
-APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )"
+# include common functions
+. ./utils.sh
 
 mkdir -p assets
 
@@ -88,11 +89,7 @@ sed -i "/target/s/\"20.*\"/\"${NODE_VERSION}\"/" remote/.npmrc
 if [[ -d "../patches/linux/reh/" ]]; then
   for file in "../patches/linux/reh/"*.patch; do
     if [[ -f "${file}" ]]; then
-      echo applying patch: "${file}";
-      if ! git apply --ignore-whitespace "${file}"; then
-        echo failed to apply patch "${file}" >&2
-        exit 1
-      fi
+      apply_patch "${file}"
     fi
   done
 fi
@@ -100,11 +97,7 @@ fi
 if [[ -d "../patches/linux/reh/${VSCODE_ARCH}/" ]]; then
   for file in "../patches/linux/reh/${VSCODE_ARCH}/"*.patch; do
     if [[ -f "${file}" ]]; then
-      echo applying patch: "${file}";
-      if ! git apply --ignore-whitespace "${file}"; then
-        echo failed to apply patch "${file}" >&2
-        exit 1
-      fi
+      apply_patch "${file}"
     fi
   done
 fi

+ 2 - 0
dev/build.sh

@@ -8,6 +8,8 @@
 export APP_NAME="VSCodium"
 export BINARY_NAME="codium"
 export CI_BUILD="no"
+export GH_REPO_PATH="VSCodium/vscodium"
+export ORG_NAME="VSCodium"
 export SHOULD_BUILD="yes"
 export SKIP_ASSETS="yes"
 export SKIP_BUILD="no"

Fișier diff suprimat deoarece este prea mare
+ 150 - 150
patches/brand.patch


+ 3 - 3
patches/feat-announcements.patch

@@ -8,7 +8,7 @@ index c581ac0..f11c0f0 100644
 +			scope: ConfigurationScope.MACHINE,
 +			type: 'boolean',
 +			default: true,
-+			description: localize('workbench.welcomePage.extraAnnouncements', "When enabled, the get started page loads additional announcements from VSCodium's repository.")
++			description: localize('workbench.welcomePage.extraAnnouncements', "When enabled, the get started page loads additional announcements from !!APP_NAME!!'s repository.")
 +		},
  		'workbench.startupEditor': {
 diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
@@ -62,7 +62,7 @@ index 664c55b..43f9e2e 100644
 +		if (this.announcementList) { this.announcementList.dispose(); }
 +
 +		const announcementList = this.announcementList = new GettingStartedIndexList({
-+			title: localize('announcements', "VSCodium Announcements"),
++			title: localize('announcements', "!!APP_NAME!! Announcements"),
 +			klass: 'announcements',
 +			limit: 5,
 +			empty: $('.empty-recent', {}, localize('noAnnouncements', "There are no current announcements.")),
@@ -75,7 +75,7 @@ index 664c55b..43f9e2e 100644
 +
 +			if (showExtras) {
 +				const branch = this.productService.quality === 'insider' ? 'insider' : 'master';
-+				await fetch(`https://raw.githubusercontent.com/VSCodium/vscodium/${branch}/announcements-extra.json`)
++				await fetch(`https://raw.githubusercontent.com/!!GH_REPO_PATH!!/${branch}/announcements-extra.json`)
 +					.then(async res => {
 +						if (res.ok) {
 +							var extraAnnouncements = await res.json() as AnnouncementEntry[];

+ 2 - 2
patches/insider/add-remote-url.patch

@@ -5,7 +5,7 @@ index 7d58861..cefb8ad 100644
 @@ -306,3 +306,3 @@ function packageTask(type, platform, arch, sourceFolderName, destinationFolderNa
  		const productJsonStream = gulp.src(['product.json'], { base: '.' })
 -			.pipe(json({ commit, date: readISODate('out-build'), version, release }))
-+			.pipe(json({ commit, date: readISODate('out-build'), version, release, serverDownloadUrlTemplate: 'https://github.com/VSCodium/vscodium-insiders/releases/download/${version}.${release}-insider/vscodium-reh-${os}-${arch}-${version}.${release}-insider.tar.gz' }))
++			.pipe(json({ commit, date: readISODate('out-build'), version, release, serverDownloadUrlTemplate: 'https://github.com/!!GH_REPO_PATH!!-insiders/releases/download/${version}.${release}-insider/!!APP_NAME_LC!!-reh-${os}-${arch}-${version}.${release}-insider.tar.gz' }))
  			.pipe(es.through(function (file) {
 diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
 index 4af4067..1bac2cc 100644
@@ -14,5 +14,5 @@ index 4af4067..1bac2cc 100644
 @@ -261,3 +261,3 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
  		const productJsonStream = gulp.src(['product.json'], { base: '.' })
 -			.pipe(json({ commit, date: readISODate('out-build'), checksums, version, release }))
-+			.pipe(json({ commit, date: readISODate('out-build'), checksums, version, release, serverDownloadUrlTemplate: 'https://github.com/VSCodium/vscodium-insiders/releases/download/${version}.${release}-insider/vscodium-reh-${os}-${arch}-${version}.${release}-insider.tar.gz' }))
++			.pipe(json({ commit, date: readISODate('out-build'), checksums, version, release, serverDownloadUrlTemplate: 'https://github.com/!!GH_REPO_PATH!!-insiders/releases/download/${version}.${release}-insider/!!APP_NAME_LC!!-reh-${os}-${arch}-${version}.${release}-insider.tar.gz' }))
  			.pipe(es.through(function (file) {

+ 2 - 2
patches/osx/fix-emulated-urls.patch

@@ -6,6 +6,6 @@ index 90c9654..3ef5d32 100644
  						const quality = this.productService.quality;
 -						const stableURL = 'https://code.visualstudio.com/docs/?dv=osx';
 -						const insidersURL = 'https://code.visualstudio.com/docs/?dv=osx&build=insiders';
-+						const stableURL = 'https://github.com/VSCodium/vscodium/releases/latest';
-+						const insidersURL = 'https://github.com/VSCodium/vscodium-insiders/releases/latest';
++						const stableURL = 'https://github.com/!!GH_REPO_PATH!!/releases/latest';
++						const insidersURL = 'https://github.com/!!GH_REPO_PATH!!-insiders/releases/latest';
  						this.openerService.open(quality === 'stable' ? stableURL : insidersURL);

+ 8 - 8
patches/report-issue.patch

@@ -5,7 +5,7 @@ index 447f4c9..4ad0e18 100644
 @@ -153,3 +153,3 @@ class ReportExtensionSlowAction extends Action {
  - OS Version: \`${osVersion}\`
 -- VS Code version: \`${this._productService.version}\`\n\n${message}`);
-+- VSCodium version: \`${this._productService.version}\`\n\n${message}`);
++- !!APP_NAME!! version: \`${this._productService.version}\`\n\n${message}`);
  
 diff --git a/src/vs/workbench/contrib/issue/browser/baseIssueReporterService.ts b/src/vs/workbench/contrib/issue/browser/baseIssueReporterService.ts
 index 26d796b..1d1ff79 100644
@@ -14,7 +14,7 @@ index 26d796b..1d1ff79 100644
 @@ -630,3 +630,3 @@ export class BaseIssueReporterService extends Disposable {
  		if (title) {
 -			this.searchDuplicates(title, issueDescription);
-+			this.searchGitHub('VSCodium/vscodium', title);
++			this.searchGitHub('!!GH_REPO_PATH!!', title);
  		} else {
 @@ -722,33 +722,2 @@ export class BaseIssueReporterService extends Disposable {
  
@@ -54,13 +54,13 @@ index 26d796b..1d1ff79 100644
  		sourceSelect.append(this.makeOption('', localize('selectSource', "Select source"), true));
 -		sourceSelect.append(this.makeOption(IssueSource.VSCode, localize('vscode', "Visual Studio Code"), false));
 -		sourceSelect.append(this.makeOption(IssueSource.Extension, localize('extension', "A VS Code extension"), false));
-+		sourceSelect.append(this.makeOption(IssueSource.VSCode, localize('vscode', "VSCodium"), false));
-+		sourceSelect.append(this.makeOption(IssueSource.Extension, localize('extension', "A VSCodium extension"), false));
++		sourceSelect.append(this.makeOption(IssueSource.VSCode, localize('vscode', "!!APP_NAME!!"), false));
++		sourceSelect.append(this.makeOption(IssueSource.Extension, localize('extension', "A !!APP_NAME!! extension"), false));
  		if (this.product.reportMarketplaceIssueUrl) {
 @@ -905,3 +874,3 @@ export class BaseIssueReporterService extends Disposable {
  			hide(descriptionTextArea);
 -			reset(descriptionTitle, localize('handlesIssuesElsewhere', "This extension handles issues outside of VS Code"));
-+			reset(descriptionTitle, localize('handlesIssuesElsewhere', "This extension handles issues outside of VSCodium"));
++			reset(descriptionTitle, localize('handlesIssuesElsewhere', "This extension handles issues outside of !!APP_NAME!!"));
  			reset(descriptionSubtitle, localize('elsewhereDescription', "The '{0}' extension prefers to use an external issue reporter. To be taken to that issue reporting experience, click the button below.", selectedExtension.displayName));
 diff --git a/src/vs/workbench/contrib/issue/browser/issueReporterModel.ts b/src/vs/workbench/contrib/issue/browser/issueReporterModel.ts
 index 0bbd8ac..4cffa1a 100644
@@ -69,7 +69,7 @@ index 0bbd8ac..4cffa1a 100644
 @@ -92,3 +92,3 @@ ${this._data.issueDescription}
  ${this.getExtensionVersion()}
 -VS Code version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion}
-+VSCodium version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion}
++!!APP_NAME!! version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion}
  OS version: ${this._data.versionInfo && this._data.versionInfo.os}
 diff --git a/src/vs/workbench/contrib/issue/browser/issueReporterPage.ts b/src/vs/workbench/contrib/issue/browser/issueReporterPage.ts
 index 5cbc709..5d6b1e2 100644
@@ -78,10 +78,10 @@ index 5cbc709..5d6b1e2 100644
 @@ -18,3 +18,3 @@ const reviewGuidanceLabel = localize( // intentionally not escaped because of it
  		comment: [
 -			'{Locked="<a href=\"https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions\" target=\"_blank\">"}',
-+			'{Locked="<a href=\"https://github.com/VSCodium/vscodium/wiki/Submitting-Bugs-and-Suggestions\" target=\"_blank\">"}',
++			'{Locked="<a href=\"https://github.com/!!GH_REPO_PATH!!/wiki/Submitting-Bugs-and-Suggestions\" target=\"_blank\">"}',
  			'{Locked="</a>"}'
 @@ -22,3 +22,3 @@ const reviewGuidanceLabel = localize( // intentionally not escaped because of it
  	},
 -	'Before you report an issue here please <a href="https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions" target="_blank">review the guidance we provide</a>.'
-+	'Before you report an issue here please <a href="https://github.com/VSCodium/vscodium/wiki/Submitting-Bugs-and-Suggestions" target="_blank">review the guidance we provide</a>.'
++	'Before you report an issue here please <a href="https://github.com/!!GH_REPO_PATH!!/wiki/Submitting-Bugs-and-Suggestions" target="_blank">review the guidance we provide</a>.'
  );

+ 4 - 4
patches/terminal-suggest.patch

@@ -8,8 +8,8 @@ index 0000000..a5769b1
 +
 +const codiumInsidersCompletionSpec: Fig.Spec = {
 +	...code,
-+	name: 'codium-insiders',
-+	description: 'VSCodium Insiders',
++	name: '!!BINARY_NAME!!-insiders',
++	description: '!!APP_NAME!! Insiders',
 +};
 +
 +export default codiumInsidersCompletionSpec;
@@ -23,8 +23,8 @@ index 0000000..b1fa812
 +
 +const codiumCompletionSpec: Fig.Spec = {
 +	...code,
-+	name: 'codium',
-+	description: 'VSCodium',
++	name: '!!BINARY_NAME!!',
++	description: '!!APP_NAME!!',
 +};
 +
 +export default codiumCompletionSpec;

+ 5 - 5
patches/windows/policies.patch

@@ -28,12 +28,12 @@ index b76d9ff..a84f490 100644
 @@ -64,3 +64,3 @@ class BasePolicy {
          return [
 -            `<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey.replace(/\./g, '_')})" key="Software\\Policies\\Microsoft\\${regKey}" presentation="$(presentation.${this.name})">`,
-+            `<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey.replace(/\./g, '_')})" key="Software\\Policies\\VSCodium\\${regKey}" presentation="$(presentation.${this.name})">`,
++            `<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey.replace(/\./g, '_')})" key="Software\\Policies\\!!ORG_NAME!!\\${regKey}" presentation="$(presentation.${this.name})">`,
              `	<parentCategory ref="${this.category.name.nlsKey}" />`,
 @@ -376,3 +376,3 @@ function renderADMX(regKey, versions, categories, policies) {
  	<policyNamespaces>
 -		<target prefix="${regKey}" namespace="Microsoft.Policies.${regKey}" />
-+		<target prefix="${regKey}" namespace="VSCodium.Policies.${regKey}" />
++		<target prefix="${regKey}" namespace="!!ORG_NAME!!.Policies.${regKey}" />
  	</policyNamespaces>
 diff --git a/build/lib/policies.ts b/build/lib/policies.ts
 index 2488920..8b268ce 100644
@@ -42,12 +42,12 @@ index 2488920..8b268ce 100644
 @@ -80,3 +80,3 @@ abstract class BasePolicy implements Policy {
  		return [
 -			`<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey.replace(/\./g, '_')})" key="Software\\Policies\\Microsoft\\${regKey}" presentation="$(presentation.${this.name})">`,
-+			`<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey.replace(/\./g, '_')})" key="Software\\Policies\\VSCodium\\${regKey}" presentation="$(presentation.${this.name})">`,
++			`<policy name="${this.name}" class="Both" displayName="$(string.${this.name})" explainText="$(string.${this.name}_${this.description.nlsKey.replace(/\./g, '_')})" key="Software\\Policies\\!!ORG_NAME!!\\${regKey}" presentation="$(presentation.${this.name})">`,
  			`	<parentCategory ref="${this.category.name.nlsKey}" />`,
 @@ -553,3 +553,3 @@ function renderADMX(regKey: string, versions: string[], categories: Category[],
  	<policyNamespaces>
 -		<target prefix="${regKey}" namespace="Microsoft.Policies.${regKey}" />
-+		<target prefix="${regKey}" namespace="VSCodium.Policies.${regKey}" />
++		<target prefix="${regKey}" namespace="!!ORG_NAME!!.Policies.${regKey}" />
  	</policyNamespaces>
 diff --git a/eslint.config.js b/eslint.config.js
 index 8e3d288..1fa7cc3 100644
@@ -254,5 +254,5 @@ index 67f7892..5b8859c 100644
 @@ -31,3 +31,3 @@ export class NativePolicyService extends AbstractPolicyService implements IPolic
  			try {
 -				this.watcher.value = createWatcher(this.productName, policyDefinitions, update => {
-+				this.watcher.value = createWatcher('VSCodium', this.productName, policyDefinitions, update => {
++				this.watcher.value = createWatcher('!!ORG_NAME!!', this.productName, policyDefinitions, update => {
  					this._onDidPolicyChange(update);

+ 4 - 21
prepare_vscode.sh

@@ -23,45 +23,28 @@ cd vscode || { echo "'vscode' dir not found"; exit 1; }
 
 for file in ../patches/*.patch; do
   if [[ -f "${file}" ]]; then
-    echo applying patch: "${file}";
-    # grep '^+++' "${file}"  | sed -e 's#+++ [ab]/#./vscode/#' | while read line; do shasum -a 256 "${line}"; done
-    if ! git apply --ignore-whitespace "${file}"; then
-      echo failed to apply patch "${file}" >&2
-      exit 1
-    fi
+    apply_patch "${file}"
   fi
 done
 
 if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
   for file in ../patches/insider/*.patch; do
     if [[ -f "${file}" ]]; then
-      echo applying patch: "${file}";
-      if ! git apply --ignore-whitespace "${file}"; then
-        echo failed to apply patch "${file}" >&2
-        exit 1
-      fi
+      apply_patch "${file}"
     fi
   done
 fi
 
 for file in ../patches/user/*.patch; do
   if [[ -f "${file}" ]]; then
-    echo applying user patch: "${file}";
-    if ! git apply --ignore-whitespace "${file}"; then
-      echo failed to apply patch "${file}" >&2
-      exit 1
-    fi
+    apply_patch "${file}"
   fi
 done
 
 if [[ -d "../patches/${OS_NAME}/" ]]; then
   for file in "../patches/${OS_NAME}/"*.patch; do
     if [[ -f "${file}" ]]; then
-      echo applying patch: "${file}";
-      if ! git apply --ignore-whitespace "${file}"; then
-        echo failed to apply patch "${file}" >&2
-        exit 1
-      fi
+      apply_patch "${file}"
     fi
   done
 fi

+ 23 - 1
utils.sh

@@ -1,7 +1,29 @@
 #!/usr/bin/env bash
 
+APP_NAME="${APP_NAME:VSCodium}"
+APP_NAME_LC="$( echo "${APP_NAME}" | awk '{print tolower($0)}' )"
+BINARY_NAME="${BINARY_NAME:codium}"
+GH_REPO_PATH="${GH_REPO_PATH:VSCodium/vscodium}"
+ORG_NAME="${ORG_NAME:VSCodium}"
+
 # All common functions can be added to this file
 
+apply_patch() {
+  echo applying patch: "$1";
+  # grep '^+++' "$1"  | sed -e 's#+++ [ab]/#./vscode/#' | while read line; do shasum -a 256 "${line}"; done
+  
+  replace "s|!!APP_NAME!!|${APP_NAME}|" "$1"
+  replace "s|!!APP_NAME_LC!!|${APP_NAME_LC}|" "$1"
+  replace "s|!!BINARY_NAME!!|${BINARY_NAME}|" "$1"
+  replace "s|!!GH_REPO_PATH!!|${GH_REPO_PATH}|" "$1"
+  replace "s|!!ORG_NAME!!|${ORG_NAME}|" "$1"
+  
+  if ! git apply --ignore-whitespace "$1"; then
+    echo failed to apply patch "$1" >&2
+    exit 1
+  fi
+}
+
 exists() { type -t "$1" &> /dev/null; }
 
 is_gnu_sed () {
@@ -9,7 +31,7 @@ is_gnu_sed () {
 }
 
 replace () {
-  echo "${1}"
+  # echo "${1}"
   if is_gnu_sed; then
     sed -i -E "${1}" "${2}"
   else

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff