@@ -13,7 +13,6 @@ import (
1313 "github.com/oasisprotocol/oasis-core/go/common/cbor"
1414 "github.com/oasisprotocol/oasis-core/go/common/sgx"
1515 "github.com/oasisprotocol/oasis-core/go/common/version"
16- consensus "github.com/oasisprotocol/oasis-core/go/consensus/api"
1716 "github.com/oasisprotocol/oasis-core/go/runtime/bundle"
1817 "github.com/oasisprotocol/oasis-sdk/client-sdk/go/connection"
1918
@@ -27,7 +26,6 @@ import (
2726const (
2827 buildModeProduction = "production"
2928 buildModeUnsafe = "unsafe"
30- buildModeAuto = "auto"
3129)
3230
3331var (
@@ -50,12 +48,20 @@ var (
5048 fmt .Printf ("Deployment: %s\n " , deploymentName )
5149 fmt .Printf ("Network: %s\n " , deployment .Network )
5250 fmt .Printf ("ParaTime: %s\n " , deployment .ParaTime )
51+ fmt .Printf ("Debug: %v\n " , deployment .Debug )
5352 fmt .Printf ("App ID: %s\n " , deployment .AppID )
5453 fmt .Printf ("Name: %s\n " , manifest .Name )
5554 fmt .Printf ("Version: %s\n " , manifest .Version )
5655 fmt .Printf ("TEE: %s\n " , manifest .TEE )
5756 fmt .Printf ("Kind: %s\n " , manifest .Kind )
5857
58+ switch deployment .Debug {
59+ case true :
60+ buildMode = buildModeUnsafe
61+ case false :
62+ buildMode = buildModeProduction
63+ }
64+
5965 // Prepare temporary build directory.
6066 tmpDir , err := os .MkdirTemp ("" , "oasis-build" )
6167 if err != nil {
@@ -171,29 +177,6 @@ var (
171177 }
172178)
173179
174- func detectBuildMode (npa * common.NPASelection ) {
175- // Configure build mode. In case auto is selected and not offline, query the network. If
176- // autodetection fails, default to production mode.
177- switch {
178- case buildMode == buildModeAuto && ! offline :
179- ctx := context .Background ()
180- conn , err := connection .Connect (ctx , npa .Network )
181- if err != nil {
182- cobra .CheckErr (fmt .Errorf ("unable to autodetect build mode, please provide --mode flag manually (failed to connect to GRPC endpoint: %w)" , err ))
183- }
184-
185- params , err := conn .Consensus ().Registry ().ConsensusParameters (ctx , consensus .HeightLatest )
186- if err != nil {
187- cobra .CheckErr (fmt .Errorf ("unable to autodetect build mode, please provide --mode flag manually (failed to get consensus parameters: %w)" , err ))
188- }
189-
190- if params .DebugAllowTestRuntimes {
191- buildMode = buildModeUnsafe
192- }
193- default :
194- }
195- }
196-
197180func setupBuildEnv (deployment * buildRofl.Deployment , npa * common.NPASelection ) {
198181 // Configure app ID.
199182 os .Setenv ("ROFL_APP_ID" , deployment .AppID )
@@ -267,7 +250,6 @@ func fetchTrustRoot(npa *common.NPASelection, cfg *buildRofl.TrustRootConfig) (s
267250
268251func init () {
269252 buildFlags := flag .NewFlagSet ("" , flag .ContinueOnError )
270- buildFlags .StringVar (& buildMode , "mode" , "auto" , "build mode [production, unsafe, auto]" )
271253 buildFlags .BoolVar (& offline , "offline" , false , "do not perform any operations requiring network access" )
272254 buildFlags .StringVar (& outputFn , "output" , "" , "output bundle filename" )
273255 buildFlags .BoolVar (& doUpdate , "update-manifest" , false , "automatically update the manifest" )
0 commit comments