Skip to content

Commit 14b4358

Browse files
author
David Hasani
committed
add yaml file to zip
1 parent 8b8d0d5 commit 14b4358

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

packages/core/src/amazonqGumby/chat/controller/controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ export class GumbyController {
382382
break
383383
case ButtonActions.CONTINUE_TRANSFORMATION_FORM:
384384
this.messenger.sendMessage('Ok, I will continue without this information.', message.tabID, 'ai-prompt')
385+
transformByQState.setCustomDependencyVersionFilePath('')
385386
this.promptJavaHome('source', message.tabID)
386387
break
387388
case ButtonActions.VIEW_TRANSFORMATION_HUB:
@@ -449,7 +450,7 @@ export class GumbyController {
449450
})
450451

451452
this.messenger.sendOneOrMultipleDiffsMessage(oneOrMultipleDiffsSelection, message.tabID)
452-
this.messenger.sendCustomDependencyVersionSelectionMessage(message.tabID)
453+
await this.messenger.sendCustomDependencyVersionMessage(message.tabID)
453454
})
454455
}
455456

packages/core/src/amazonqGumby/chat/controller/messenger/messenger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ ${codeSnippet}
747747
)
748748
}
749749

750-
public async sendCustomDependencyVersionSelectionMessage(tabID: string) {
750+
public async sendCustomDependencyVersionMessage(tabID: string) {
751751
const message = 'You can optionally upload a YAML file to specify which dependency versions to upgrade to.'
752752
const buttons: ChatItemButton[] = []
753753

packages/core/src/codewhisperer/models/model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ export enum BuildSystem {
666666
Unknown = 'Unknown',
667667
}
668668

669+
// TO-DO: include the custom YAML file path here somewhere?
669670
export class ZipManifest {
670671
sourcesRoot: string = 'sources/'
671672
dependenciesRoot: string = 'dependencies/'

packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import { convertToTimeString } from '../../../shared/datetime'
5656
import { getAuthType } from '../../../auth/utils'
5757
import { UserWrittenCodeTracker } from '../../tracker/userWrittenCodeTracker'
5858
import { DiffModel } from './transformationResultsViewProvider'
59-
import { spawnSync } from 'child_process'
59+
import { spawnSync } from 'child_process' // eslint-disable-line no-restricted-imports
6060

6161
export function getSha256(buffer: Buffer) {
6262
const hasher = crypto.createHash('sha256')
@@ -394,6 +394,14 @@ export async function zipCode(
394394
dependenciesCopied = true
395395
}
396396

397+
if (transformByQState.getCustomDependencyVersionFilePath() && zipManifest instanceof ZipManifest) {
398+
zip.addLocalFile(
399+
transformByQState.getCustomDependencyVersionFilePath(),
400+
'custom-upgrades',
401+
'dependency-versions.yaml'
402+
)
403+
}
404+
397405
zip.addFile('manifest.json', Buffer.from(JSON.stringify(zipManifest)), 'utf-8')
398406

399407
throwIfCancelled()

packages/core/src/codewhisperer/service/transformByQ/transformFileHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function loadManifestFile(directory: string) {
4848
}
4949

5050
export async function copyDirectory(sourcePath: string, destinationPath: string) {
51-
fs.mkdir(destinationPath)
51+
await fs.mkdir(destinationPath)
5252
const files = await fs.readdir(sourcePath)
5353

5454
for (const file of files) {
@@ -78,7 +78,7 @@ export async function createLocalBuildUploadZip(baseDir: string, exitCode: numbe
7878
exitCode: exitCode,
7979
commandLogFileName: 'clientBuildLogs.log',
8080
}
81-
const formattedManifest = JSON.stringify(buildResultsManifest, null, 2)
81+
const formattedManifest = JSON.stringify(buildResultsManifest)
8282
await fs.writeFile(manifestFilePath, formattedManifest, 'utf8')
8383

8484
const buildLogsFilePath = path.join(baseDir, 'clientBuildLogs.log')

0 commit comments

Comments
 (0)