bldy.build/build@v0.0.0-20181002085557-d04b29acc6a7/build.go (about) 1 // Copyright 2015-2016 Sevki <s@sevki.org>. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package build defines build target and build context structures 6 package build 7 8 import ( 9 "bldy.build/build/executor" 10 "bldy.build/build/label" 11 "bldy.build/build/workspace" 12 ) 13 14 //go:generate stringer -type=Status 15 // Status represents a nodes status. 16 type Status int 17 18 const ( 19 // Success is success 20 Success Status = iota 21 // Fail is a failed job 22 Fail 23 // Pending is a pending job 24 Pending 25 // Started is a started job 26 Started 27 // Fatal is a fatal crash 28 Fatal 29 // Warning is a job that has warnings 30 Warning 31 // Building is a job that's being built 32 Building 33 ) 34 35 var ( 36 HostPlatform = label.Label("@bldy//platforms:host") 37 DefaultPlatform = HostPlatform 38 ) 39 40 // Rule defines the interface that rules must implement for becoming build targets. 41 type Rule interface { 42 Name() string 43 Dependencies() []label.Label 44 Outputs() []string 45 Hash() []byte 46 Build(*executor.Executor) error 47 Platform() label.Label 48 Workspace() workspace.Workspace 49 } 50 51 // VM seperate the parsing and evauluating targets logic from rest of bldy 52 // so we can implement and use new grammars like jsonnet or go it self. 53 type VM interface { 54 GetTarget(label.Label) (Rule, error) 55 }