(ctx context.Context, blockMeta waveobj.MetaMapType, rtOpts *waveobj.RuntimeOpts, force bool)
| 112 | } |
| 113 | |
| 114 | func (c *TsunamiController) Start(ctx context.Context, blockMeta waveobj.MetaMapType, rtOpts *waveobj.RuntimeOpts, force bool) error { |
| 115 | log.Printf("TsunamiController.Start called for block %s", c.blockId) |
| 116 | c.runLock.Lock() |
| 117 | defer c.runLock.Unlock() |
| 118 | |
| 119 | scaffoldPath := waveapputil.GetTsunamiScaffoldPath() |
| 120 | settings := wconfig.GetWatcher().GetFullConfig().Settings |
| 121 | sdkReplacePath := settings.TsunamiSdkReplacePath |
| 122 | sdkVersion := settings.TsunamiSdkVersion |
| 123 | if sdkVersion == "" { |
| 124 | sdkVersion = waveapputil.DefaultTsunamiSdkVersion |
| 125 | } |
| 126 | goPath := settings.TsunamiGoPath |
| 127 | |
| 128 | appPath := blockMeta.GetString(waveobj.MetaKey_TsunamiAppPath, "") |
| 129 | appId := blockMeta.GetString(waveobj.MetaKey_TsunamiAppId, "") |
| 130 | |
| 131 | if appPath == "" { |
| 132 | if appId == "" { |
| 133 | return fmt.Errorf("tsunami:apppath or tsunami:appid is required") |
| 134 | } |
| 135 | var err error |
| 136 | appPath, err = waveappstore.GetAppDir(appId) |
| 137 | if err != nil { |
| 138 | return fmt.Errorf("failed to get app directory from tsunami:appid: %w", err) |
| 139 | } |
| 140 | } else { |
| 141 | var err error |
| 142 | appPath, err = wavebase.ExpandHomeDir(appPath) |
| 143 | if err != nil { |
| 144 | return fmt.Errorf("tsunami:apppath invalid: %w", err) |
| 145 | } |
| 146 | if !filepath.IsAbs(appPath) { |
| 147 | return fmt.Errorf("tsunami:apppath must be absolute: %s", appPath) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | if appId != "" { |
| 152 | c.setManifestMetadata(appId) |
| 153 | } |
| 154 | |
| 155 | appName := build.GetAppName(appPath) |
| 156 | osArch := runtime.GOOS + "-" + runtime.GOARCH |
| 157 | |
| 158 | cachePath, err := tsunamiutil.GetTsunamiAppCachePath("local", appName, osArch) |
| 159 | if err != nil { |
| 160 | return fmt.Errorf("failed to get cache path: %w", err) |
| 161 | } |
| 162 | |
| 163 | upToDate, err := isBuildCacheUpToDate(appPath) |
| 164 | if err != nil { |
| 165 | return fmt.Errorf("failed to check build cache: %w", err) |
| 166 | } |
| 167 | |
| 168 | if !upToDate || force { |
| 169 | nodePath := wavebase.GetWaveAppElectronExecPath() |
| 170 | if nodePath == "" { |
| 171 | return fmt.Errorf("electron executable path not set") |
nothing calls this directly
no test coverage detected