github.com/jonsyu1/godel@v0.0.0-20171017211503-64567a0cf169/apps/distgo/params/params.go (about) 1 // Copyright 2016 Palantir Technologies, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package params 16 17 import ( 18 "github.com/palantir/pkg/matcher" 19 ) 20 21 type Project struct { 22 // Products maps product names to configurations. 23 Products map[string]Product 24 // BuildOutputDir specifies the default build output directory for products executables built by the "build" 25 // command. The executables generated by "build" will be written to this directory unless the location is 26 // overridden by the product-specific configuration. 27 BuildOutputDir string 28 // DistOutputDir specifies the default distribution output directory for product distributions created by the 29 // "dist" command. The distribution directory and artifact generated by "dist" will be written to this directory 30 // unless the location is overridden by the product-specific configuration. 31 DistOutputDir string 32 // DistScriptInclude is script content that is prepended to any non-empty ProductDistCfg.Script. It can be used 33 // to define common functionality used in the distribution script for multiple different products. 34 DistScriptInclude string 35 // GroupID is the identifier used as the group ID for the POM. 36 GroupID string 37 // Exclude matches the paths to exclude when determining the projects to build. 38 Exclude matcher.Matcher 39 } 40 41 func (d Project) FilteredProducts() map[string]Product { 42 output := make(map[string]Product) 43 for currProduct, currCfg := range d.Products { 44 currMainPkg := currCfg.Build.MainPkg 45 if !(d.Exclude != nil && d.Exclude.Match(currMainPkg)) { 46 output[currProduct] = currCfg 47 } 48 } 49 return output 50 } 51 52 type Product struct { 53 // Build specifies the build configuration for the product. 54 Build Build 55 // Run specifies the run configuration for the product. 56 Run Run 57 // Dist specifies the dist configurations for the product. 58 Dist []Dist 59 // DockerImages specifies the docker build configurations for the product. 60 DockerImages []DockerImage 61 // Publish specifies the publish configuration that is applied to distributions that do not specify their own 62 // publish configurations. 63 Publish Publish 64 }