Skip to content

Commit

Permalink
refactor: switch to SDK usage on macOS by default
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Oct 10, 2024
1 parent 828b6e6 commit 8e9aa1f
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 444 deletions.
11 changes: 0 additions & 11 deletions evm-config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
"type": "string",
"default": "electron"
},
"preserveXcode": {
"description": "Preserve the N most recent Xcode versions",
"type": "integer",
"default": 5,
"minimum": 1
},
"onlySdk": {
"description": "Use macOS SDKs instead of downloading full XCode versions when necessary",
"type": "boolean",
"default": false
},
"execName": {
"description": "Name of the built executable to run",
"type": "string",
Expand Down
2 changes: 0 additions & 2 deletions example-configs/evm.base.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
root: /path/to/your/developer/folder
reclient: remote_exec
preserveXcode: 5
onlySdk: false
remotes:
electron:
# SSH or HTTPS url
Expand Down
16 changes: 4 additions & 12 deletions src/e
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const evmConfig = require('./evm-config');
const { color, fatal } = require('./utils/logging');
const depot = require('./utils/depot-tools');
const { refreshPathVariable } = require('./utils/refresh-path');
const { loadXcode } = require('./utils/load-xcode');
const { ensureSDK } = require('./utils/sdk');

// Refresh the PATH variable at the top of this shell so that retries in the same shell get the latest PATH variable
Expand Down Expand Up @@ -188,17 +187,10 @@ ci.command('rerun', 'Rerun CI workflows and builds');
ci.command('cancel', 'Cancel CI workflows and builds');

program
.command('load-xcode')
.option('--only-sdk', 'Only load the macOS SDK and not the full Xcode', false)
.description(
'Loads required versions of Xcode or macOS SDKs and symlinks them (may require sudo)',
)
.action(({ onlySdk }) => {
if (onlySdk) {
ensureSDK();
} else {
loadXcode();
}
.command('load-macos-sdk')
.description('Loads required versions of macOS SDKs and symlinks them (may require sudo)')
.action(() => {
ensureSDK();
});

program
Expand Down
7 changes: 1 addition & 6 deletions src/e-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const { color, fatal } = require('./utils/logging');
const depot = require('./utils/depot-tools');
const { ensureDir } = require('./utils/paths');
const reclient = require('./utils/reclient');
const { loadXcode } = require('./utils/load-xcode');
const { ensureSDK, ensureSDKAndSymlink } = require('./utils/sdk');

function getGNArgs(config) {
Expand Down Expand Up @@ -101,11 +100,7 @@ program
reclient.downloadAndPrepare(config);

if (process.platform === 'darwin') {
if (config.onlySdk) {
ensureSDK();
} else {
loadXcode({ quiet: true });
}
ensureSDK();
}

if (options.onlyGen) {
Expand Down
13 changes: 5 additions & 8 deletions src/e-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const { color, fatal } = require('./utils/logging');
const { resolvePath, ensureDir } = require('./utils/paths');
const depot = require('./utils/depot-tools');
const { checkGlobalGitConfig } = require('./utils/git');
const { loadXcode } = require('./utils/load-xcode');
const { ensureSDK } = require('./utils/sdk');

// https://gn.googlesource.com/gn/+/main/docs/reference.md?pli=1#var_target_cpu
Expand Down Expand Up @@ -68,8 +67,6 @@ function createConfig(options) {
args: gn_args,
out: options.out,
},
preserveXcode: 5,
onlySdk: options.onlySdk,
env: {
CHROMIUM_BUILDTOOLS_PATH: path.resolve(root, 'src', 'buildtools'),
GIT_CACHE_PATH: process.env.GIT_CACHE_PATH
Expand Down Expand Up @@ -139,11 +136,6 @@ program
.option('--msan', `When building, enable clang's memory sanitizer`, false)
.option('--lsan', `When building, enable clang's leak sanitizer`, false)
.option('--mas', 'Build for the macOS App Store', false)
.option(
'--only-sdk',
'Use macOS SDKs instead of downloading full XCode versions when necessary',
false,
)
.addOption(archOption)
.option('--bootstrap', 'Run `e sync` and `e build` after creating the build config.')
.addOption(
Expand Down Expand Up @@ -184,6 +176,11 @@ program
}
}

// ensure macOS SDKs are loaded
if (process.platform === 'darwin') {
ensureSDK();
}

const config = createConfig(options);

// make sure the config name is new
Expand Down
4 changes: 2 additions & 2 deletions src/evm-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ function sanitizeConfig(name, config, overwrite = false) {
changes.push(`fixed invalid property ${color.config('reclient: none')}`);
}

if (!('preserveXcode' in config)) {
if ('preserveXcode' in config) {
config.preserveXcode = 5;
changes.push(`defined ${color.config('preserveXcode')} to default value of 5`);
changes.push(`removed ${color.config('preserveXcode')} property`);
}

if (config.goma) {
Expand Down
5 changes: 0 additions & 5 deletions src/utils/depot-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ function depotOpts(config, opts = {}) {
...require('./reclient').env(config),
};

if (!config.onlySdk) {
// use build-tools version of Xcode
opts.env.DEVELOPER_DIR = require('./xcode').XcodePath;
}

// put depot tools at the front of the path
const key = pathKey();
const paths = [DEPOT_TOOLS_DIR];
Expand Down
112 changes: 0 additions & 112 deletions src/utils/load-xcode.js

This file was deleted.

Loading

0 comments on commit 8e9aa1f

Please sign in to comment.