in server/aws-lsp-codewhisperer/src/language-server/netTransform/artifactManager.ts [95:156]
async createRequirementJsonContent(request: StartTransformRequest): Promise<RequirementJson> {
const projects: Project[] = []
for (const project of request.ProjectMetadata) {
const sourceCodeFilePaths = project.SourceCodeFilePaths.filter(filePath => filePath)
const codeFiles: CodeFile[] = []
const references: References[] = []
for (const filePath of sourceCodeFilePaths) {
try {
await this.copySourceFile(request.SolutionRootPath, filePath)
const contentHash = await this.calculateMD5Async(filePath)
const relativePath = this.normalizeSourceFileRelativePath(request.SolutionRootPath, filePath)
codeFiles.push({
contentMd5Hash: contentHash,
relativePath: relativePath,
})
} catch (error) {
this.logging.log('Failed to process file: ' + error + filePath)
}
}
for (const reference of project.ExternalReferences) {
try {
const relativePath = this.normalizeReferenceFileRelativePath(
reference.RelativePath,
reference.IncludedInArtifact
)
await this.copyFile(
reference.AssemblyFullPath,
this.getWorkspaceReferencePathFromRelativePath(relativePath)
)
let artifactReference: References = {
includedInArtifact: reference.IncludedInArtifact,
relativePath: relativePath,
isThirdPartyPackage: false,
}
await this.processPrivatePackages(request, reference, artifactReference)
references.push(artifactReference)
} catch (error) {
this.logging.log('Failed to process file: ' + error + reference.AssemblyFullPath)
}
}
projects.push({
projectFilePath: this.normalizeSourceFileRelativePath(request.SolutionRootPath, project.ProjectPath),
projectTarget: project.ProjectTargetFramework,
codeFiles: codeFiles,
references: references,
})
}
this.logging.log('Total project references: ' + projects.length)
return {
EntryPath: this.normalizeSourceFileRelativePath(request.SolutionRootPath, request.SelectedProjectPath),
SolutionPath: this.normalizeSourceFileRelativePath(request.SolutionRootPath, request.SolutionFilePath),
Projects: projects,
TransformNetStandardProjects: request.TransformNetStandardProjects,
...(request.EnableRazorViewTransform !== undefined && {
EnableRazorViewTransform: request.EnableRazorViewTransform,
}),
} as RequirementJson
}