blob: 17ec37ff9067a80556669b7513ffac111de7d585 [file] [log] [blame]
Colin Cross9454bfa2015-03-17 13:24:18 -07001// 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
15package common
16
17import (
Colin Cross70b40592015-03-23 12:57:34 -070018 "github.com/google/blueprint"
Colin Cross9454bfa2015-03-17 13:24:18 -070019)
20
21func CheckbuildSingleton() blueprint.Singleton {
22 return &checkbuildSingleton{}
23}
24
25type checkbuildSingleton struct{}
26
27func (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 Crosse2e6fc22015-03-17 13:26:49 -070041 // HACK: checkbuild should be an optional build, but force it enabled for now
42 //Optional: true,
Colin Cross9454bfa2015-03-17 13:24:18 -070043 })
44}