Skip to content

Commit

Permalink
Shared check for using adaptive runtime (microsoft#6554)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffCoxMSFT authored Mar 25, 2021
1 parent 90a49bc commit 078e66f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Composer/packages/lib/shared/src/skillsUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,6 @@ export const isLocalhostUrl = (matchUrl: string) => {
export const isSkillHostUpdateRequired = (skillHostEndpoint?: string) => {
return !skillHostEndpoint || isLocalhostUrl(skillHostEndpoint);
};

export const isUsingAdaptiveRuntime = (runtime?: DialogSetting['runtime']): boolean =>
runtime?.key === 'csharp-azurewebapp-v2' || !!runtime?.key?.startsWith('adaptive-runtime-');
4 changes: 1 addition & 3 deletions Composer/packages/server/src/models/bot/botProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import fs from 'fs';
import has from 'lodash/has';
import axios from 'axios';
import { autofixReferInDialog } from '@bfc/indexers';
import { isUsingAdaptiveRuntime } from '@bfc/shared';
import {
getNewDesigner,
FileInfo,
Expand Down Expand Up @@ -47,9 +48,6 @@ const oauthInput = () => ({
});

const defaultLanguage = 'en-us'; // default value for settings.defaultLanguage

const isUsingAdaptiveRuntime = (runtime?: DialogSetting['runtime']): boolean =>
runtime?.key === 'csharp-azurewebapp-v2' || runtime?.key === 'adaptive-runtime-dotnet-webapp';
export class BotProject implements IBotProject {
public ref: LocationRef;
// TODO: address need to instantiate id - perhaps do so in constructor based on Store.get(projectLocationMap)
Expand Down
3 changes: 2 additions & 1 deletion extensions/azurePublish/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
PublishResponse,
PublishResult,
} from '@botframework-composer/types';
import { isUsingAdaptiveRuntime } from '@bfc/shared';

import { authConfig, ResourcesItem } from '../types';

Expand Down Expand Up @@ -190,7 +191,7 @@ export default async (composer: IExtensionRegistration): Promise<void> => {
// include both pre-release and release identifiers here
// TODO: eventually we can clean this up when the "old" runtime is deprecated
// (old runtime support is the else block below)
if (runtime.key === 'csharp-azurewebapp-v2' || runtime.key === 'adaptive-runtime-dotnet-webapp') {
if (isUsingAdaptiveRuntime(runtime)) {
const buildFolder = this.getProjectFolder(resourcekey, this.mode);

// clean up from any previous deploys
Expand Down
4 changes: 1 addition & 3 deletions extensions/azurePublish/src/node/luisAndQnA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import * as path from 'path';

import * as fs from 'fs-extra';
import * as rp from 'request-promise';
import { isUsingAdaptiveRuntime } from '@bfc/shared';
import { ILuisConfig, FileInfo, IBotProject, RuntimeTemplate, DialogSetting } from '@botframework-composer/types';

import { AzurePublishErrors } from './utils/errorHandler';
import { BotProjectDeployLoggerType } from './types';

const isUsingAdaptiveRuntime = (runtime?: DialogSetting['runtime']): boolean =>
runtime?.key === 'csharp-azurewebapp-v2' || runtime?.key === 'adaptive-runtime-dotnet-webapp';

const botPath = (projPath: string, runtime?: DialogSetting['runtime']) =>
isUsingAdaptiveRuntime(runtime) ? projPath : path.join(projPath, 'ComposerDialogs');

Expand Down

0 comments on commit 078e66f

Please sign in to comment.