From 13794310d7a5183bb64d561690021513f603f347 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Sun, 1 Dec 2024 22:44:09 -0800 Subject: [PATCH 1/3] Clean-up and bug fixes --- README.md | 70 +++++++--- package.json | 8 +- src/api.ts | 150 ++++++++++++++++----- src/features/views/treeViewItems.ts | 4 +- src/features/views/utils.ts | 2 +- src/internal.api.ts | 4 +- src/managers/conda/condaPackageManager.ts | 10 +- src/managers/sysPython/pipManager.ts | 10 +- src/managers/sysPython/sysPythonManager.ts | 5 + src/managers/sysPython/utils.ts | 25 ++-- src/managers/sysPython/venvManager.ts | 5 + 11 files changed, 205 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index 1f4de4d6..33a602d5 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,11 @@ This extension provides an Environments view, which can be accessed via the VS C By default, the extension uses the `venv` environment manager. This default manager determines how environments are created, managed, and where packages are installed. However, users can change the default by setting the `python-envs.defaultEnvManager` to a different environment manager. The following environment managers are supported out of the box: -|Id| name |Description| -|---|----|--| -|ms-python.python:venv| `venv` |The default environment manager. It is a built-in environment manager provided by the Python standard library.| -|ms-python.python:system| System Installed Python | These are global Python installs on your system. These are typically installed with your OS, from [python.org](https://www.python.org/), or any other OS package manager. | -|ms-python.python:conda| `conda` | The [Anaconda](https://www.anaconda.com/) environment manager. | +| Id | name | Description | +| ----------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ms-python.python:venv | `venv` | The default environment manager. It is a built-in environment manager provided by the Python standard library. | +| ms-python.python:system | System Installed Python | These are global Python installs on your system. These are typically installed with your OS, from [python.org](https://www.python.org/), or any other OS package manager. | +| ms-python.python:conda | `conda` | The [Anaconda](https://www.anaconda.com/) environment manager. | The environment manager is responsible for specifying which package manager will be used by default to install and manage Python packages within the environment. This ensures that packages are managed consistently according to the preferred tools and settings of the chosen environment manager. @@ -28,27 +28,58 @@ This extension provides a package view for you to manage, install and uninstall The extension uses `pip` as the default package manager. You can change this by setting the `python-envs.defaultPackageManager` setting to a different package manager. The following are package managers supported out of the box: -|Id| name |Description| -|---|----|--| -|ms-python.python:pip| `pip` | Pip acts as the default package manager and it's typically built-in to Python.| -|ms-python.python:conda| `conda` | The [Anaconda](https://www.anaconda.com/) environment manager. | +| Id | name | Description | +| ---------------------- | ------- | ------------------------------------------------------------------------------ | +| ms-python.python:pip | `pip` | Pip acts as the default package manager and it's typically built-in to Python. | +| ms-python.python:conda | `conda` | The [Anaconda](https://www.anaconda.com/) environment manager. | ## Settings Reference -| Setting (python-envs.) | Default | Description | -| ----- | ----- | -----| -| defaultEnvManager | `"ms-python.python:venv"` | The default environment manager used for creating and managing environments. | -| defaultPackageManager | `"ms-python.python:pip"` | The default package manager to use for installing and managing packages. This is often dictated by the default environment manager but can be customized. | -| pythonProjects | `[]` | A list of Python workspaces, specified by the path, in which you can set particular environment and package managers. You can set information for a workspace as `[{"path": "/path/to/workspace", "envManager": "ms-python.python:venv", "packageManager": "ms-python.python:pip"]}`. | +| Setting (python-envs.) | Default | Description | +| ---------------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| defaultEnvManager | `"ms-python.python:venv"` | The default environment manager used for creating and managing environments. | +| defaultPackageManager | `"ms-python.python:pip"` | The default package manager to use for installing and managing packages. This is often dictated by the default environment manager but can be customized. | +| pythonProjects | `[]` | A list of Python workspaces, specified by the path, in which you can set particular environment and package managers. You can set information for a workspace as `[{"path": "/path/to/workspace", "envManager": "ms-python.python:venv", "packageManager": "ms-python.python:pip"]}`. | +## API Reference (proposed) -## API Reference +See [api.ts](https://github.com/microsoft/vscode-python-environments/blob/main/src/api.ts) for the full list of Extension APIs. -See `src\api.ts` for the full list of APIs. +Consuming these APIs from your extension: + +```typescript +let _extApi: PythonEnvironmentApi | undefined; +async function getEnvExtApi(): Promise { + if (_extApi) { + return _extApi; + } + const extension = getExtension(ENVS_EXTENSION_ID); + if (!extension) { + throw new Error('Python Environments extension not found.'); + } + if (extension?.isActive) { + _extApi = extension.exports as PythonEnvironmentApi; + return _extApi; + } + + await extension.activate(); + + _extApi = extension.exports as PythonEnvironmentApi; + return _extApi; +} + +export async function activate(context: ExtensionContext) { + const envApi = await getEnvExtApi(); + + // Get the environment for the workspace folder or global python if no workspace is open + const uri = workspace.workspaceFolders ? workspace.workspaceFolders[0].uri : undefined; + const env = await envApi.getEnvironment(uri); +} +``` ## Contributing -This project welcomes contributions and suggestions. Most contributions require you to agree to a +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. @@ -60,7 +91,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - ## Questions, issues, feature requests, and contributions - If you have a question about how to accomplish something with the extension, please [ask on our Discussions page](https://github.com/microsoft/vscode-python/discussions/categories/q-a). @@ -77,7 +107,7 @@ The Microsoft Python Extension for Visual Studio Code collects usage data and se ## Trademarks -This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow +This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. -Any use of third-party trademarks or logos are subject to those third-party's policies. \ No newline at end of file +Any use of third-party trademarks or logos are subject to those third-party's policies. diff --git a/package.json b/package.json index 8ceb2da1..6a7e78cf 100644 --- a/package.json +++ b/package.json @@ -286,7 +286,7 @@ { "command": "python-envs.createTerminal", "group": "inline", - "when": "view == env-managers && viewItem =~ /.*pythonEnvironment.*/" + "when": "view == env-managers && viewItem =~ /.*pythonEnvironment.*activatable.*/" }, { "command": "python-envs.refreshPackages", @@ -315,16 +315,16 @@ { "command": "python-envs.set", "group": "inline", - "when": "view == python-projects && viewItem == python-workspace" + "when": "view == python-projects && viewItem =~ /.*python-workspace.*/" }, { "command": "python-envs.reset", - "when": "view == python-projects && viewItem == python-workspace" + "when": "view == python-projects && viewItem =~ /.*python-workspace.*/" }, { "command": "python-envs.createTerminal", "group": "inline", - "when": "view == python-projects && viewItem == python-workspace" + "when": "view == python-projects && viewItem =~ /.*python-workspace.*/" } ], "view/title": [ diff --git a/src/api.ts b/src/api.ts index 0030838c..e9733008 100644 --- a/src/api.ts +++ b/src/api.ts @@ -238,7 +238,7 @@ export type RefreshEnvironmentsScope = Uri | undefined; /** * The scope for which environments are required. - * - `undefined`/`"all"`: All environments. + * - `"all"`: All environments. * - `"global"`: Python installations that are usually a base for creating virtual environments. * - {@link Uri}: Environments for the workspace/folder/file pointed to by the Uri. */ @@ -294,23 +294,6 @@ export type DidChangeEnvironmentsEventArgs = { environment: PythonEnvironment; }[]; -export type PythonIsKnownContext = Uri | string; - -/** - * Result of checking if a context is a known Python environment. - */ -export interface PythonIsKnownResult { - /** - * The confidence level of the result (low, moderate, or high). - */ - confidence: 'low' | 'moderate' | 'high'; - - /** - * The Python environment match. - */ - result: 'unknown' | 'known' | 'canHandle'; -} - /** * Type representing the context for resolving a Python environment. */ @@ -332,7 +315,9 @@ export interface EnvironmentManager { /** * The preferred package manager ID for the environment manager. - * @example 'ms-python.python:pip' + * + * @example + * 'ms-python.python:pip' */ readonly preferredPackageManagerId: string; @@ -423,15 +408,6 @@ export interface EnvironmentManager { */ resolve(context: ResolveEnvironmentContext): Promise; - /** - * Checks if the specified context is a known Python environment. The string/Uri can point to the environment root folder - * or to python executable. It can also be a named environment. - * - * @param context - The URI/string context to check. - * @returns A promise that resolves to the result of the check. - */ - isKnown?(context: PythonIsKnownContext): Promise; - /** * Clears the environment manager's cache. * @@ -577,7 +553,7 @@ export interface PackageManager { /** * The log output channel for the package manager. */ - logOutput?: LogOutputChannel; + log?: LogOutputChannel; /** * Installs packages in the specified Python environment. @@ -615,9 +591,8 @@ export interface PackageManager { * @param environment The Python environment for which to get installable items. * * Note: An environment can be used by multiple projects, so the installable items returned. - * should be for the environment. IF you want to do it for a particular project, then you may - * shown a QuickPick to the user to select the project, and filter the installable items based - * on the project. + * should be for the environment. If you want to do it for a particular project, then you should + * ask user to select a project, and filter the installable items based on the project. */ getInstallable?(environment: PythonEnvironment): Promise; @@ -766,7 +741,8 @@ export interface Installable { readonly group?: string; /** - * Path to the requirements, version of the package, or any other project file path. + * Description about the installable item. This can also be path to the requirements, + * version of the package, or any other project file path. */ readonly description?: string; @@ -1046,17 +1022,70 @@ export interface PythonTerminalOptions extends TerminalOptions { } export interface PythonTerminalCreateApi { + /** + * Creates a terminal and activates any (activatable) environment for the terminal. + * + * @param environment The Python environment to activate. + * @param options Options for creating the terminal. + * + * Note: Non-activatable environments have no effect on the terminal. + */ createTerminal(environment: PythonEnvironment, options: PythonTerminalOptions): Promise; } +/** + * Options for running a Python script or module in a terminal. + * + * Example: + * * Running Script: `python myscript.py --arg1` + * ```typescript + * { + * args: ["myscript.py", "--arg1"] + * } + * ``` + * * Running a module: `python -m my_module --arg1` + * ```typescript + * { + * args: ["-m", "my_module", "--arg1"] + * } + * ``` + */ export interface PythonTerminalExecutionOptions { + /** + * Current working directory for the terminal. This in only used to create the terminal. + */ cwd: string | Uri; + + /** + * Arguments to pass to the python executable. + */ args?: string[]; + + /** + * Set `true` to show the terminal. + */ show?: boolean; } export interface PythonTerminalRunApi { + /** + * Runs a Python script or module in a terminal. This API will create a terminal if one is not available to use. + * If a terminal is available, it will be used to run the script or module. + * + * Note: + * - If you restart VS Code, this will create a new terminal, this is a limitation of VS Code. + * - If you close the terminal, this will create a new terminal. + * - In cases of multi-root/project scenario, it will create a separate terminal for each project. + */ runInTerminal(environment: PythonEnvironment, options: PythonTerminalExecutionOptions): Promise; + + /** + * Runs a Python script or module in a dedicated terminal. This API will create a terminal if one is not available to use. + * If a terminal is available, it will be used to run the script or module. This terminal will be dedicated to the script, + * and selected based on the `terminalKey`. + * + * @param terminalKey A unique key to identify the terminal. For scripts you can use the Uri of the script file. + */ runInDedicatedTerminal( terminalKey: Uri | string, environment: PythonEnvironment, @@ -1065,6 +1094,7 @@ export interface PythonTerminalRunApi { } /** + * Options for running a Python task. * * Example: * * Running Script: `python myscript.py --arg1` @@ -1081,23 +1111,63 @@ export interface PythonTerminalRunApi { * ``` */ export interface PythonTaskExecutionOptions { - project?: PythonProject; + /** + * Name of the task to run. + */ + name: string; + + /** + * Arguments to pass to the python executable. + */ args: string[]; + + /** + * The Python project to use for the task. + */ + project?: PythonProject; + + /** + * Current working directory for the task. Default is the project directory for the script being run. + */ cwd?: string; + + /** + * Environment variables to set for the task. + */ env?: { [key: string]: string }; - name: string; } export interface PythonTaskRunApi { + /** + * Run a Python script or module as a task. + * + */ runAsTask(environment: PythonEnvironment, options: PythonTaskExecutionOptions): Promise; } +/** + * Options for running a Python script or module in the background. + */ export interface PythonBackgroundRunOptions { + /** + * The Python environment to use for running the script or module. + */ args: string[]; + + /** + * Current working directory for the script or module. Default is the project directory for the script being run. + */ cwd?: string; + + /** + * Environment variables to set for the script or module. + */ env?: { [key: string]: string | undefined }; } export interface PythonBackgroundRunApi { + /** + * Run a Python script or module in the background. This API will create a new process to run the script or module. + */ runInBackground(environment: PythonEnvironment, options: PythonBackgroundRunOptions): Promise; } @@ -1107,8 +1177,18 @@ export interface PythonExecutionApi PythonTaskRunApi, PythonBackgroundRunApi {} +/** + * Event arguments for when the monitored `.env` files or any other sources change. + */ export interface DidChangeEnvironmentVariablesEventArgs { + /** + * The URI of the file that changed. No `Uri` means a non-file source of environment variables changed. + */ uri?: Uri; + + /** + * The type of change that occurred. + */ changeTye: FileChangeType; } diff --git a/src/features/views/treeViewItems.ts b/src/features/views/treeViewItems.ts index fec897b3..6c3901bd 100644 --- a/src/features/views/treeViewItems.ts +++ b/src/features/views/treeViewItems.ts @@ -2,6 +2,7 @@ import { TreeItem, TreeItemCollapsibleState, MarkdownString, Command, ThemeIcon, import { InternalEnvironmentManager, InternalPackageManager } from '../../internal.api'; import { PythonEnvironment, IconPath, Package, PythonProject } from '../../api'; import { removable } from './utils'; +import { isActivatableEnvironment } from '../common/activation'; export enum EnvTreeItemKind { manager = 'python-env-manager', @@ -63,8 +64,9 @@ export class PythonEnvTreeItem implements EnvTreeItem { } private getContextValue() { + const activatable = isActivatableEnvironment(this.environment) ? '-activatable' : ''; const remove = this.parent.manager.supportsRemove ? '-remove' : ''; - return `pythonEnvironment${remove}`; + return `pythonEnvironment${remove}${activatable}`; } private setIcon(item: TreeItem) { diff --git a/src/features/views/utils.ts b/src/features/views/utils.ts index e2b9f7f1..6f033140 100644 --- a/src/features/views/utils.ts +++ b/src/features/views/utils.ts @@ -6,7 +6,7 @@ export function removable(project: PythonProject): boolean { const workspace = getWorkspaceFolder(project.uri); if (workspace) { // If the project path is same as the workspace path, then we cannot remove the project. - path.normalize(workspace?.uri.fsPath).toLowerCase() !== path.normalize(project.uri.fsPath).toLowerCase(); + return path.normalize(workspace?.uri.fsPath).toLowerCase() !== path.normalize(project.uri.fsPath).toLowerCase(); } return true; } diff --git a/src/internal.api.ts b/src/internal.api.ts index 258750e1..62e6e607 100644 --- a/src/internal.api.ts +++ b/src/internal.api.ts @@ -203,8 +203,8 @@ export class InternalPackageManager implements PackageManager { public get iconPath(): IconPath | undefined { return this.manager.iconPath; } - public get logOutput(): LogOutputChannel | undefined { - return this.manager.logOutput; + public get log(): LogOutputChannel | undefined { + return this.manager.log; } install(environment: PythonEnvironment, packages: string[], options: PackageInstallOptions): Promise { diff --git a/src/managers/conda/condaPackageManager.ts b/src/managers/conda/condaPackageManager.ts index ab26a6c6..723a73f5 100644 --- a/src/managers/conda/condaPackageManager.ts +++ b/src/managers/conda/condaPackageManager.ts @@ -28,7 +28,7 @@ export class CondaPackageManager implements PackageManager, Disposable { private packages: Map = new Map(); - constructor(public readonly api: PythonEnvironmentApi, public readonly logOutput: LogOutputChannel) { + constructor(public readonly api: PythonEnvironmentApi, public readonly log: LogOutputChannel) { this.name = 'conda'; this.displayName = 'Conda'; this.description = 'Conda package manager'; @@ -54,11 +54,11 @@ export class CondaPackageManager implements PackageManager, Disposable { this.packages.set(environment.envId.id, after); this._onDidChangePackages.fire({ environment: environment, manager: this, changes }); } catch (e) { - this.logOutput.error('Error installing packages', e); + this.log.error('Error installing packages', e); setImmediate(async () => { const result = await window.showErrorMessage('Error installing packages', 'View Output'); if (result === 'View Output') { - this.logOutput.show(); + this.log.show(); } }); } @@ -80,11 +80,11 @@ export class CondaPackageManager implements PackageManager, Disposable { this.packages.set(environment.envId.id, after); this._onDidChangePackages.fire({ environment: environment, manager: this, changes }); } catch (e) { - this.logOutput.error('Error uninstalling packages', e); + this.log.error('Error uninstalling packages', e); setImmediate(async () => { const result = await window.showErrorMessage('Error installing packages', 'View Output'); if (result === 'View Output') { - this.logOutput.show(); + this.log.show(); } }); } diff --git a/src/managers/sysPython/pipManager.ts b/src/managers/sysPython/pipManager.ts index 1511fda3..5123e4ce 100644 --- a/src/managers/sysPython/pipManager.ts +++ b/src/managers/sysPython/pipManager.ts @@ -36,7 +36,7 @@ export class PipPackageManager implements PackageManager, Disposable { constructor( private readonly api: PythonEnvironmentApi, - public readonly logOutput: LogOutputChannel, + public readonly log: LogOutputChannel, private readonly venv: VenvManager, ) { this.name = 'pip'; @@ -65,11 +65,11 @@ export class PipPackageManager implements PackageManager, Disposable { this.packages.set(environment.envId.id, after); this._onDidChangePackages.fire({ environment, manager: this, changes }); } catch (e) { - this.logOutput.error('Error installing packages', e); + this.log.error('Error installing packages', e); setImmediate(async () => { const result = await window.showErrorMessage('Error installing packages', 'View Output'); if (result === 'View Output') { - this.logOutput.show(); + this.log.show(); } }); } @@ -91,11 +91,11 @@ export class PipPackageManager implements PackageManager, Disposable { this.packages.set(environment.envId.id, after); this._onDidChangePackages.fire({ environment: environment, manager: this, changes }); } catch (e) { - this.logOutput.error('Error uninstalling packages', e); + this.log.error('Error uninstalling packages', e); setImmediate(async () => { const result = await window.showErrorMessage('Error installing packages', 'View Output'); if (result === 'View Output') { - this.logOutput.show(); + this.log.show(); } }); } diff --git a/src/managers/sysPython/sysPythonManager.ts b/src/managers/sysPython/sysPythonManager.ts index 65b64505..33ba1683 100644 --- a/src/managers/sysPython/sysPythonManager.ts +++ b/src/managers/sysPython/sysPythonManager.ts @@ -15,6 +15,7 @@ import { SetEnvironmentScope, } from '../../api'; import { + clearSystemEnvCache, getSystemEnvForGlobal, getSystemEnvForWorkspace, refreshPythons, @@ -193,6 +194,10 @@ export class SysPythonManager implements EnvironmentManager { return resolved; } + async clearCache(): Promise { + await clearSystemEnvCache(); + } + private findEnvironmentByPath(fsPath: string): PythonEnvironment | undefined { const normalized = path.normalize(fsPath); return this.collection.find((e) => { diff --git a/src/managers/sysPython/utils.ts b/src/managers/sysPython/utils.ts index a7793b75..7a79fb84 100644 --- a/src/managers/sysPython/utils.ts +++ b/src/managers/sysPython/utils.ts @@ -256,8 +256,8 @@ export async function refreshPackages( manager: PackageManager, ): Promise { if (!environment.execInfo) { - manager.logOutput?.error(`No executable found for python: ${environment.environmentPath.fsPath}`); - showErrorMessage(`No executable found for python: ${environment.environmentPath.fsPath}`, manager.logOutput); + manager.log?.error(`No executable found for python: ${environment.environmentPath.fsPath}`); + showErrorMessage(`No executable found for python: ${environment.environmentPath.fsPath}`, manager.log); return []; } @@ -268,19 +268,14 @@ export async function refreshPackages( data = await runUV( ['pip', 'list', '--python', environment.execInfo.run.executable], undefined, - manager.logOutput, + manager.log, ); } else { - data = await runPython( - environment.execInfo.run.executable, - ['-m', 'pip', 'list'], - undefined, - manager.logOutput, - ); + data = await runPython(environment.execInfo.run.executable, ['-m', 'pip', 'list'], undefined, manager.log); } } catch (e) { - manager.logOutput?.error('Error refreshing packages', e); - showErrorMessage('Error refreshing packages', manager.logOutput); + manager.log?.error('Error refreshing packages', e); + showErrorMessage('Error refreshing packages', manager.log); return []; } @@ -330,14 +325,14 @@ export async function installPackages( await runUV( [...installArgs, '--python', environment.execInfo.run.executable, ...packages], undefined, - manager.logOutput, + manager.log, ); } else { await runPython( environment.execInfo.run.executable, ['-m', ...installArgs, ...packages], undefined, - manager.logOutput, + manager.log, ); } @@ -376,14 +371,14 @@ export async function uninstallPackages( await runUV( ['pip', 'uninstall', '--python', environment.execInfo.run.executable, ...remove], undefined, - manager.logOutput, + manager.log, ); } else { await runPython( environment.execInfo.run.executable, ['-m', 'pip', 'uninstall', '-y', ...remove], undefined, - manager.logOutput, + manager.log, ); } return refreshPackages(environment, api, manager); diff --git a/src/managers/sysPython/venvManager.ts b/src/managers/sysPython/venvManager.ts index f48fbd77..438bfa1c 100644 --- a/src/managers/sysPython/venvManager.ts +++ b/src/managers/sysPython/venvManager.ts @@ -16,6 +16,7 @@ import { SetEnvironmentScope, } from '../../api'; import { + clearVenvCache, createPythonVenv, findVirtualEnvironments, getGlobalVenvLocation, @@ -285,6 +286,10 @@ export class VenvManager implements EnvironmentManager { return undefined; } + async clearCache(): Promise { + await clearVenvCache(); + } + private addEnvironment(environment: PythonEnvironment, raiseEvent?: boolean): void { if (this.collection.find((e) => e.envId.id === environment.envId.id)) { return; From 01bd60f0c149254d09a9c857e5609c5cf937afa4 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Sun, 1 Dec 2024 23:43:08 -0800 Subject: [PATCH 2/3] . --- src/api.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api.ts b/src/api.ts index e9733008..190c0cce 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + import { Uri, Disposable, From 353d256ef996e677b946d0b9eb54ced351c88b93 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Mon, 2 Dec 2024 09:05:05 -0800 Subject: [PATCH 3/3] Fix release templates --- build/azure-pipeline.pre-release.yml | 24 +++++++------- build/azure-pipeline.stable.yml | 49 ++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/build/azure-pipeline.pre-release.yml b/build/azure-pipeline.pre-release.yml index 525d7917..770c0029 100644 --- a/build/azure-pipeline.pre-release.yml +++ b/build/azure-pipeline.pre-release.yml @@ -2,13 +2,13 @@ trigger: none pr: none -schedules: - - cron: '0 10 * * 1-5' # 10AM UTC (2AM PDT) MON-FRI (VS Code Pre-release builds at 9PM PDT) - displayName: Nightly Pre-Release Schedule - always: false # only run if there are source code changes - branches: - include: - - main +# schedules: +# - cron: '0 10 * * 1-5' # 10AM UTC (2AM PDT) MON-FRI (VS Code Pre-release builds at 9PM PDT) +# displayName: Nightly Pre-Release Schedule +# always: false # only run if there are source code changes +# branches: +# include: +# - main resources: repositories: @@ -27,7 +27,8 @@ parameters: extends: template: azure-pipelines/extension/pre-release.yml@templates parameters: - publishExtension: ${{ parameters.publishExtension }} + # publishExtension: ${{ parameters.publishExtension }} + publishExtension: false ghCreateTag: false standardizedVersioning: true l10nSourcePaths: ./src @@ -71,7 +72,7 @@ extends: - task: UsePythonVersion@0 inputs: - versionSpec: '3.8' + versionSpec: '3.9' addToPath: true architecture: 'x64' displayName: Select Python version @@ -79,15 +80,12 @@ extends: - script: npm ci displayName: Install NPM dependencies - - script: python ./build/update_package_file.py + - script: python ./build/update_package_json.py displayName: Update telemetry in package.json - script: python ./build/update_ext_version.py --for-publishing displayName: Update build number - - script: npx gulp prePublishBundle - displayName: Build - - bash: | mkdir -p $(Build.SourcesDirectory)/python-env-tools/bin chmod +x $(Build.SourcesDirectory)/python-env-tools/bin diff --git a/build/azure-pipeline.stable.yml b/build/azure-pipeline.stable.yml index 170d0e6d..517be175 100644 --- a/build/azure-pipeline.stable.yml +++ b/build/azure-pipeline.stable.yml @@ -1,9 +1,4 @@ trigger: none -# branches: -# include: -# - release* -# tags: -# include: ['*'] pr: none resources: @@ -26,10 +21,42 @@ extends: l10nSourcePaths: ./src publishExtension: ${{ parameters.publishExtension }} ghCreateTag: true + + buildPlatforms: + - name: Linux + vsceTarget: 'web' + - name: Linux + packageArch: arm64 + vsceTarget: linux-arm64 + - name: Linux + packageArch: arm + vsceTarget: linux-armhf + - name: Linux + packageArch: x64 + vsceTarget: linux-x64 + - name: Linux + packageArch: arm64 + vsceTarget: alpine-arm64 + - name: Linux + packageArch: x64 + vsceTarget: alpine-x64 + - name: MacOS + packageArch: arm64 + vsceTarget: darwin-arm64 + - name: MacOS + packageArch: x64 + vsceTarget: darwin-x64 + - name: Windows + packageArch: arm + vsceTarget: win32-arm64 + - name: Windows + packageArch: x64 + vsceTarget: win32-x64 + buildSteps: - task: NodeTool@0 inputs: - versionSpec: '18.17.0' + versionSpec: '20.18.0' displayName: Select Node version - task: UsePythonVersion@0 @@ -42,14 +69,8 @@ extends: - script: npm ci displayName: Install NPM dependencies - - script: python -m pip install -U pip - displayName: Upgrade pip - - - script: python -m pip install wheel - displayName: Install wheel - - - script: python -m pip install nox - displayName: Install wheel + - script: python ./build/update_package_json.py + displayName: Update telemetry in package.json - script: python ./build/update_ext_version.py --release --for-publishing displayName: Update build number