def debugee()

in debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala [563:638]


  def debugee(request: Request): EitherNel[String, Resource[IO, DAPodil.Debugee]] =
    Debugee.LaunchArgs.parse(request.arguments).map {
      case args: Debugee.LaunchArgs.Manual => debugee(args)
      case Debugee.LaunchArgs.TDMLConfig
            .Generate(
              schemaPath,
              dataPath,
              stopOnEntry,
              infosetFormat,
              infosetOutput,
              name,
              description,
              tdmlPath,
              variables,
              tunables
            ) =>
        // Create a LaunchArgs.Manual, run the debugee with it, and then generate the TDML file
        debugee(
          Debugee.LaunchArgs
            .Manual(schemaPath, dataPath, stopOnEntry, infosetFormat, infosetOutput, variables, tunables)
        ).onFinalize(
          infosetOutput match {
            case Debugee.LaunchArgs.InfosetOutput.File(path) =>
              IO(TDML.generate(path, schemaPath, dataPath, name, description, tdmlPath))
            case _ =>
              // This case should never be hit. Validation is being done on launch config prior to
              //   this section of code attempting to run a DFDL operation. If the user is trying to
              //   generate a TDML file and an infosetOutput type of 'none' | 'console' is selected,
              //   an error will be displayed, and the execution will be aborted, before the DFDL operation begins.
              IO.unit
          }
        )
      case Debugee.LaunchArgs.TDMLConfig
            .Append(
              schemaPath,
              dataPath,
              stopOnEntry,
              infosetFormat,
              infosetOutput,
              name,
              description,
              tdmlPath,
              variables,
              tunables
            ) =>
        // Create a LaunchArgs.Manual, run the debugee with it, and then append to the existing TDML file
        debugee(
          Debugee.LaunchArgs
            .Manual(schemaPath, dataPath, stopOnEntry, infosetFormat, infosetOutput, variables, tunables)
        ).onFinalize(
          infosetOutput match {
            case Debugee.LaunchArgs.InfosetOutput.File(path) =>
              IO(TDML.append(path, schemaPath, dataPath, name, description, tdmlPath))
            case _ =>
              // This case should never be hit. Validation is being done on launch config prior to
              //   this section of code attempting to run a DFDL operation. If the user is trying to
              //   append to a TDML file and an infosetOutput type of 'none' | 'console' is selected,
              //   an error will be displayed, and the execution will be aborted, before the DFDL operation begins.
              IO.unit
          }
        )
      case Debugee.LaunchArgs.TDMLConfig
            .Execute(stopOnEntry, infosetFormat, infosetOutput, name, description, tdmlPath, variables, tunables) =>
        // From a TDML file, create a LaunchArgs.Manual from the named test, run the debugee with it
        Resource.eval(IO(TDML.execute(name, description, tdmlPath))).flatMap {
          case None =>
            Resource.raiseError[IO, Debugee, Throwable](
              new RuntimeException(s"couldn't execute TDML with name $name, description $description, path $tdmlPath")
            )
          case Some((schemaPath, dataPath)) =>
            debugee(
              Debugee.LaunchArgs
                .Manual(schemaPath, dataPath, stopOnEntry, infosetFormat, infosetOutput, variables, tunables)
            )
        }
    }