blob: c1999fe27d6ffddd0ba56cec4bbc29d1d66c6a39 [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"
29)
30
31func main() {
32 flag.Parse()
33
34 // The top-level Blueprints file is passed as the first argument.
35 srcDir := filepath.Dir(flag.Arg(0))
36
37 ctx := blueprint.NewContext()
38
39 // Module types
40 ctx.RegisterModuleType("cc_library_static", cc.NewCCLibraryStatic)
41 ctx.RegisterModuleType("cc_library_shared", cc.NewCCLibraryShared)
42 ctx.RegisterModuleType("cc_library", cc.NewCCLibrary)
43 ctx.RegisterModuleType("cc_object", cc.NewCCObject)
44 ctx.RegisterModuleType("cc_binary", cc.NewCCBinary)
45
46 ctx.RegisterModuleType("toolchain_library", cc.NewToolchainLibrary)
47
48 ctx.RegisterModuleType("cc_library_host_static", cc.NewCCLibraryHostStatic)
49 ctx.RegisterModuleType("cc_library_host_shared", cc.NewCCLibraryHostShared)
50 ctx.RegisterModuleType("cc_binary_host", cc.NewCCBinaryHost)
51
52 // Mutators
53 ctx.RegisterEarlyMutator("arch", common.ArchMutator)
54 ctx.RegisterEarlyMutator("link", cc.LinkageMutator)
55
56 // Singletons
57
58 configuration, err := config.New(srcDir)
59 if err != nil {
60 fmt.Fprintf(os.Stderr, "%s", err)
61 os.Exit(1)
62 }
63
64 // Temporary hack
65 //ctx.SetIgnoreUnknownModuleTypes(true)
66
67 bootstrap.Main(ctx, configuration, config.ConfigFileName)
68}