import * as path from 'path' ; import * as vscode from 'vscode' ; import { IDeployContext , ParsedSite } from 'vscode-azureappservice' ; import { deploySubpathSetting , packTaskName , preDeployTaskSetting , ProjectLanguage , remoteBuildSetting } from '../../constants' ; import { localize } from '../../localize' ; import { updateWorkspaceSetting } from '../../vsCodeConfig/settings' ; import { tryGetFunctionProjectRoot } from '../createNewProject/verifyIsProject' ; import { ensureGitIgnoreContents } from '../initProjectForVSCode/InitVSCodeStep/PythonInitVSCodeStep' ; export async function validateRemoteBuild ( context , site , workspaceFolder , language ) { if ( language === ProjectLanguage . Python && ! site . kuduUrl ) { const message = localize ( 'remoteBuildNotSupported' , 'The selected Function App doesn\'t support your project\'s configuration. Deploy to a newer Function App or downgrade your config.' ) ; const learnMoreLink = 'https://aka.ms/AA5vsfd' ; const downgrade = { title : localize ( 'downgrade' , 'Downgrade config' ) } ; await context . ui . showWarningMessage ( message , { learnMoreLink , modal : true , stepName : 'validateRemoteBuild' } , downgrade ) ; const projectPath = await tryGetFunctionProjectRoot ( context , workspaceFolder ) || workspaceFolder . uri . fsPath ; await updateWorkspaceSetting ( remoteBuildSetting , false , workspaceFolder ) ; await updateWorkspaceSetting ( preDeployTaskSetting , packTaskName , workspaceFolder ) ; const zipFileName = path . basename ( projectPath ) + '.zip' ; await updateWorkspaceSetting ( deploySubpathSetting , path . posix . join ( path . relative ( workspaceFolder . uri . fsPath , projectPath ) , zipFileName ) , workspaceFolder ) ; await ensureGitIgnoreContents ( projectPath , [ zipFileName ] ) ; } }