blob: 8e2887c612a12faf34fc9523570c44dc0ed6b856 [file] [log] [blame]
Colin Cross3f40fa42015-01-30 17:27:36 -08001// 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 main
16
17import (
18 "flag"
19 "fmt"
20 "os"
21 "path/filepath"
22
23 "blueprint"
24 "blueprint/bootstrap"
25
26 "android/soong/cc"
27 "android/soong/common"
28 "android/soong/config"
Colin Cross5049f022015-03-18 13:28:46 -070029 "android/soong/genrule"
Colin Cross3f40fa42015-01-30 17:27:36 -080030)
31
32func main() {
33 flag.Parse()
34
35 // The top-level Blueprints file is passed as the first argument.
36 srcDir := filepath.Dir(flag.Arg(0))
37
38 ctx := blueprint.NewContext()
39
40 // Module types
41 ctx.RegisterModuleType("cc_library_static", cc.NewCCLibraryStatic)
42 ctx.RegisterModuleType("cc_library_shared", cc.NewCCLibraryShared)
43 ctx.RegisterModuleType("cc_library", cc.NewCCLibrary)
44 ctx.RegisterModuleType("cc_object", cc.NewCCObject)
45 ctx.RegisterModuleType("cc_binary", cc.NewCCBinary)
Dan Albertc403f7c2015-03-18 14:01:18 -070046 ctx.RegisterModuleType("cc_test", cc.NewCCTest)
Colin Cross3f40fa42015-01-30 17:27:36 -080047
48 ctx.RegisterModuleType("toolchain_library", cc.NewToolchainLibrary)
49
50 ctx.RegisterModuleType("cc_library_host_static", cc.NewCCLibraryHostStatic)
51 ctx.RegisterModuleType("cc_library_host_shared", cc.NewCCLibraryHostShared)
52 ctx.RegisterModuleType("cc_binary_host", cc.NewCCBinaryHost)
53
Colin Cross5049f022015-03-18 13:28:46 -070054 ctx.RegisterModuleType("gensrcs", genrule.NewGenSrcs)
55
Colin Cross3f40fa42015-01-30 17:27:36 -080056 // Mutators
57 ctx.RegisterEarlyMutator("arch", common.ArchMutator)
58 ctx.RegisterEarlyMutator("link", cc.LinkageMutator)
59
60 // Singletons
Colin Cross9454bfa2015-03-17 13:24:18 -070061 ctx.RegisterSingletonType("checkbuild", common.CheckbuildSingleton)
Colin Cross3f40fa42015-01-30 17:27:36 -080062
63 configuration, err := config.New(srcDir)
64 if err != nil {
65 fmt.Fprintf(os.Stderr, "%s", err)
66 os.Exit(1)
67 }
68
69 // Temporary hack
70 //ctx.SetIgnoreUnknownModuleTypes(true)
71
72 bootstrap.Main(ctx, configuration, config.ConfigFileName)
73}