code: func newApp(ra *schema.RuntimeApp, podManifest *schema.PodManifest, pod *pkgPod.Pod, appState appStateFunc) (*v1.App, error) {
  	app := &v1.App{
  		Name:            ra.Name.String(),
  		ImageID:         ra.Image.ID.String(),
  		UserAnnotations: ra.App.UserAnnotations,
  		UserLabels:      ra.App.UserLabels,
  	}
  
  	podVols := podManifest.Volumes
  	podVolsByName := make(map[types.ACName]types.Volume, len(podVols))
  	for i := range podManifest.Volumes {
  		podVolsByName[podVols[i].Name] = podVols[i]
  	}
  
  	for _, mnt := range ra.Mounts {
  		readOnly := false
  		var hostPath string
  		// AppVolume is optional
  		if av := mnt.AppVolume; av != nil {
  			hostPath = av.Source
  			if ro := av.ReadOnly; ro != nil {
  				readOnly = *ro
  			}
  		} else {
  			hostPath = podVolsByName[mnt.Volume].Source
  			if ro := podVolsByName[mnt.Volume].ReadOnly; ro != nil {
  				readOnly = *ro
  			}
  		}
  		app.Mounts = append(app.Mounts, &v1.Mount{
  			Name:          mnt.Volume.String(),
  			ContainerPath: mnt.Path,
  			HostPath:      hostPath,
  			ReadOnly:      readOnly,
  		})
  	}
  
  	// Generate state.
  	if err := appState(app, pod); err != nil {
  		return nil, fmt.Errorf("error getting app's state: %v", err)
  	}
  
  	return app, nil
  }
docs: // newApp constructs the App object with the runtime app and pod manifest.