onCRLanguageSelectChange()

in src/dotnet/APIView/ClientSPA/src/app/_components/revisions-list/revisions-list.component.ts [494:608]


  onCRLanguageSelectChange() {
    switch(this.createRevisionForm.get('selectedCRLanguage')?.value?.data){
      case "C":
        this.createRevisionInstruction = [
          `Install clang 10 or later.`, 
          `Run <code>clang [inputs like az_*.h] -Xclang -ast-dump=json -I ..\\..\\..\\core\\core\\inc -I "c:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Preview\\VC\\Tools\\MSVC\\14.26.28801\\include\\" > az_core.ast</code>`,
          `Archive the file <code>Compress-Archive az_core.ast -DestinationPath az_core.zip</code>`,
          `Upload the resulting archive.`
        ];
        this.acceptedFilesForReviewUpload = ".zip";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "C#":
        this.createRevisionInstruction = [
          `Run <code>dotnet pack</code>`, 
          `Upload the resulting .nupkg or .dll file.`
        ];
        this.acceptedFilesForReviewUpload = ".nupkg, .dll";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "C++":
        this.createRevisionInstruction = [
          `Generate a token file using the <a href="https://github.com/Azure/azure-sdk-tools/tree/main/tools/apiview/parsers/cpp-api-parser#readme">C++ parser</a>`,
          `Upload the token file generated.`
        ];
        this.acceptedFilesForReviewUpload = ".json";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "Java":
        this.createRevisionInstruction = [
          `Run a <code>mvn package</code> build on your project, which will generate a number of build artifacts in the <code>/target</code> directory. In there, find the file ending <code>sources.jar</code>, and select it.`,
        ];
        this.acceptedFilesForReviewUpload = ".jar";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "Python":
        this.createRevisionInstruction = [
          `Generate wheel for the package. <code>python setup.py bdist_wheel -d [dest_folder]</code>`,
          `Upload generated whl file`
        ];
        this.acceptedFilesForReviewUpload = ".whl";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "JavaScript":
        this.createRevisionInstruction = [
          `Use <code>api-extractor</code> to generate a <a href="https://api-extractor.com/pages/setup/generating_docs/">docModel file</a>`,
          `Upload generated api.json file`
        ];
        this.acceptedFilesForReviewUpload = ".json";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "Go":
        this.createRevisionInstruction = [
          `Archive source module directory in which go.mod is present. <code>Compress-Archive ./sdk/azcore -DestinationPath azcore.zip</code>`,
          `Rename the file <code>Rename-Item azcore.zip -NewName  azcore.gosource</code>`,
          `Upload the resulting archive.`
        ];
        this.acceptedFilesForReviewUpload = ".gosource";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "Swift":
        this.createRevisionInstruction = [
          `Generate JSON file for the source by running Swift APIView parser in XCode. More information is available here on <a href="https://github.com/Azure/azure-sdk-tools/blob/main/src/swift/README.md">Swift API parser</a>`,
          `Upload generated JSON`
        ];
        this.acceptedFilesForReviewUpload = ".json";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "Swagger":
        this.createRevisionInstruction = [
          `Rename swagger json to replace file extension to .swagger  <code>Rename-Item PetSwagger.json -NewName PetSwagger.swagger</code>`,
          `Upload renamed swagger file`
        ];
        this.acceptedFilesForReviewUpload = ".swagger";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      case "TypeSpec":
        this.createRevisionInstruction = [
          `Rename swagger json to replace file extension to .swagger  <code>Rename-Item PetSwagger.json -NewName PetSwagger.swagger</code>`,
          `Upload renamed swagger file`
        ];
        this.acceptedFilesForReviewUpload = ".json";
        this.createRevisionForm.get('selectedFile')?.disable();
        this.createRevisionForm.get('filePath')?.enable();
        break;
      case "Json":
        this.createRevisionInstruction = [
          `Upload .json API review token file.`
        ];
        this.acceptedFilesForReviewUpload = ".json";
        this.createRevisionForm.get('selectedFile')?.enable();
        this.createRevisionForm.get('filePath')?.disable();
        break;
      default:
        this.createRevisionInstruction = [];
        this.acceptedFilesForReviewUpload = undefined;
    }

    if (this.revisionCreationFileUpload) {    
      this.revisionCreationFileUpload.clear();
    }

    this.createRevisionForm.get('label')?.reset();
    this.createRevisionForm.get('selectedFile')?.reset();
    this.createRevisionForm.get('filePath')?.reset()
  }