Skip to content

Commit b47da11

Browse files
authored
feat: bundle nupkg files into artifact.zip (#1510)
1 parent 527a373 commit b47da11

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

server/aws-lsp-codewhisperer/src/language-server/netTransform/artifactManager.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,25 @@ export class ArtifactManager {
144144
}
145145
this.logging.log('Total project references: ' + projects.length)
146146

147+
let packages: string[] = []
148+
if (request.PackageReferences != null) {
149+
for (const pkg of request.PackageReferences) {
150+
if (!pkg.NetCompatiblePackageFilePath) {
151+
continue
152+
}
153+
try {
154+
const packageRelativePath = this.normalizePackageFileRelativePath(pkg.NetCompatiblePackageFilePath)
155+
packages.push(packageRelativePath)
156+
await this.copyFile(
157+
pkg.NetCompatiblePackageFilePath,
158+
this.getWorkspaceReferencePathFromRelativePath(packageRelativePath)
159+
)
160+
} catch (error) {
161+
this.logging.log('Failed to process package file: ' + error + pkg.NetCompatiblePackageFilePath)
162+
}
163+
}
164+
}
165+
147166
return {
148167
EntryPath: this.normalizeSourceFileRelativePath(request.SolutionRootPath, request.SelectedProjectPath),
149168
SolutionPath: this.normalizeSourceFileRelativePath(request.SolutionRootPath, request.SolutionFilePath),
@@ -152,6 +171,7 @@ export class ArtifactManager {
152171
...(request.EnableRazorViewTransform !== undefined && {
153172
EnableRazorViewTransform: request.EnableRazorViewTransform,
154173
}),
174+
Packages: packages,
155175
} as RequirementJson
156176
}
157177

@@ -240,6 +260,10 @@ export class ArtifactManager {
240260
: relativePath.toLowerCase()
241261
}
242262

263+
normalizePackageFileRelativePath(packageFilePath: string): string {
264+
return path.join(packagesFolderName, path.basename(packageFilePath)).toLowerCase()
265+
}
266+
243267
zipDirectory(sourceDir: string, outPath: string) {
244268
const archive = archiver('zip', { zlib: { level: 9 } })
245269
const stream = fs.createWriteStream(outPath)

server/aws-lsp-codewhisperer/src/language-server/netTransform/models.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,5 @@ export interface PackageReferenceMetadata {
148148
NetCompatiblePackageVersion?: string
149149
NetCompatibleAssemblyPath?: string
150150
NetCompatibleAssemblyRelativePath?: string
151+
NetCompatiblePackageFilePath?: string
151152
}

0 commit comments

Comments
 (0)