in apps/vs-code-designer/src/app/utils/vsCodeConfig/tasks.ts [134:294]
async function overwriteTasksJson(context: IActionContext, projectPath: string): Promise<void> {
if (projectPath) {
const message =
'The Azure Logic Apps extension must update the tasks.json file to use the required and installed binary dependencies for Node JS, .NET Framework, and Azure Functions Core Tools. This update overwrites any custom-defined tasks you might have.' +
'\n\nSelecting "Cancel" leaves the file unchanged, but shows this message when you open this project again.' +
'\n\nContinue with the update?';
const tasksJsonPath: string = path.join(projectPath, vscodeFolderName, 'tasks.json');
let tasksJsonContent: any;
const projectFiles = [
...(await getProjFiles(context, ProjectLanguage.CSharp, projectPath)),
...(await getProjFiles(context, ProjectLanguage.FSharp, projectPath)),
];
if (projectFiles.length > 0) {
context.telemetry.properties.isNugetProj = 'true';
const commonArgs: string[] = ['/property:GenerateFullPaths=true', '/consoleloggerparameters:NoSummary'];
const releaseArgs: string[] = ['--configuration', 'Release'];
let projFile: ProjectFile;
const projFiles = [
...(await getProjFiles(context, ProjectLanguage.FSharp, projectPath)),
...(await getProjFiles(context, ProjectLanguage.CSharp, projectPath)),
];
if (projFiles.length === 1) {
projFile = projFiles[0];
} else if (projFiles.length === 0) {
context.errorHandling.suppressReportIssue = true;
throw new Error(
localize('projNotFound', 'Failed to find {0} file in folder "{1}".', 'csproj or fsproj', path.basename(projectPath))
);
} else {
context.errorHandling.suppressReportIssue = true;
throw new Error(
localize(
'projNotFound',
'Expected to find a single {0} file in folder "{1}", but found multiple instead: {2}.',
'csproj or fsproj',
path.basename(projectPath),
projFiles.join(', ')
)
);
}
const targetFramework: string = await getTargetFramework(projFile);
const debugSubpath = getDotnetDebugSubpath(targetFramework);
tasksJsonContent = {
version: '2.0.0',
tasks: [
{
label: 'generateDebugSymbols',
command: '${config:azureLogicAppsStandard.dotnetBinaryPath}',
args: ['${input:getDebugSymbolDll}'],
type: 'process',
problemMatcher: '$msCompile',
},
{
label: 'clean',
command: '${config:azureLogicAppsStandard.dotnetBinaryPath}',
args: ['clean', ...commonArgs],
type: 'process',
problemMatcher: '$msCompile',
},
{
label: 'build',
command: '${config:azureLogicAppsStandard.dotnetBinaryPath}',
args: ['build', ...commonArgs],
type: 'process',
dependsOn: 'clean',
group: {
kind: 'build',
isDefault: true,
},
problemMatcher: '$msCompile',
},
{
label: 'clean release',
command: '${config:azureLogicAppsStandard.dotnetBinaryPath}',
args: [...releaseArgs, ...commonArgs],
type: 'process',
problemMatcher: '$msCompile',
},
{
label: 'publish',
command: '${config:azureLogicAppsStandard.dotnetBinaryPath}',
args: ['publish', ...releaseArgs, ...commonArgs],
type: 'process',
dependsOn: 'clean release',
problemMatcher: '$msCompile',
},
{
label: 'func: host start',
dependsOn: 'build',
type: 'shell',
command: '${config:azureLogicAppsStandard.funcCoreToolsBinaryPath}',
args: ['host', 'start'],
options: {
cwd: debugSubpath,
env: {
PATH: '${config:azureLogicAppsStandard.autoRuntimeDependenciesPath}\\\\NodeJs;${config:azureLogicAppsStandard.autoRuntimeDependenciesPath}\\\\DotNetSDK;$env:PATH',
},
},
problemMatcher: '$func-watch',
isBackground: true,
},
],
inputs: [
{
id: 'getDebugSymbolDll',
type: 'command',
command: 'azureLogicAppsStandard.getDebugSymbolDll',
},
],
};
} else {
context.telemetry.properties.isNugetProj = 'false';
tasksJsonContent = {
version: '2.0.0',
tasks: [
{
label: 'generateDebugSymbols',
command: '${config:azureLogicAppsStandard.dotnetBinaryPath}',
args: ['${input:getDebugSymbolDll}'],
type: 'process',
problemMatcher: '$msCompile',
},
{
type: 'shell',
command: '${config:azureLogicAppsStandard.funcCoreToolsBinaryPath}',
args: ['host', 'start'],
options: {
env: {
PATH: '${config:azureLogicAppsStandard.autoRuntimeDependenciesPath}\\\\NodeJs;${config:azureLogicAppsStandard.autoRuntimeDependenciesPath}\\\\DotNetSDK;$env:PATH',
},
},
problemMatcher: '$func-watch',
isBackground: true,
label: 'func: host start',
group: {
kind: 'build',
isDefault: true,
},
},
],
inputs: [
{
id: 'getDebugSymbolDll',
type: 'command',
command: 'azureLogicAppsStandard.getDebugSymbolDll',
},
],
};
}
// Add a "Don't warn again" option?
if (await confirmOverwriteFile(context, tasksJsonPath, message)) {
await fse.writeFile(tasksJsonPath, JSON.stringify(tasksJsonContent, null, 2));
}
}
}