Colin Cross | 9454bfa | 2015-03-17 13:24:18 -0700 | [diff] [blame] | 1 | // Copyright 2015 Google Inc. All rights reserved. |
| 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 common |
| 16 | |
| 17 | import ( |
Colin Cross | 70b4059 | 2015-03-23 12:57:34 -0700 | [diff] [blame] | 18 | "github.com/google/blueprint" |
Colin Cross | 9454bfa | 2015-03-17 13:24:18 -0700 | [diff] [blame] | 19 | ) |
| 20 | |
| 21 | func CheckbuildSingleton() blueprint.Singleton { |
| 22 | return &checkbuildSingleton{} |
| 23 | } |
| 24 | |
| 25 | type checkbuildSingleton struct{} |
| 26 | |
| 27 | func (c *checkbuildSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) { |
| 28 | deps := []string{} |
| 29 | ctx.VisitAllModules(func(module blueprint.Module) { |
| 30 | if a, ok := module.(AndroidModule); ok { |
| 31 | if len(a.base().checkbuildFiles) > 0 { |
| 32 | deps = append(deps, ctx.ModuleName(module)+"-checkbuild") |
| 33 | } |
| 34 | } |
| 35 | }) |
| 36 | |
| 37 | ctx.Build(pctx, blueprint.BuildParams{ |
| 38 | Rule: blueprint.Phony, |
| 39 | Outputs: []string{"checkbuild"}, |
| 40 | Implicits: deps, |
Colin Cross | e2e6fc2 | 2015-03-17 13:26:49 -0700 | [diff] [blame] | 41 | // HACK: checkbuild should be an optional build, but force it enabled for now |
| 42 | //Optional: true, |
Colin Cross | 9454bfa | 2015-03-17 13:24:18 -0700 | [diff] [blame] | 43 | }) |
| 44 | } |