blob: 94fb6e74afc461d16270495d0656ac7db0634220 [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
Colin Cross70b40592015-03-23 12:57:34 -070023 "github.com/google/blueprint/bootstrap"
Colin Cross3f40fa42015-01-30 17:27:36 -080024
Colin Cross463a90e2015-06-17 14:20:06 -070025 "android/soong"
26
27 // These imports cause the modules to register their ModuleTypes, etc. with the soong package
28 _ "android/soong/art"
29 _ "android/soong/cc"
Colin Cross3f40fa42015-01-30 17:27:36 -080030 "android/soong/common"
Colin Cross463a90e2015-06-17 14:20:06 -070031 _ "android/soong/genrule"
32 _ "android/soong/java"
Colin Cross3f40fa42015-01-30 17:27:36 -080033)
34
35func main() {
36 flag.Parse()
37
38 // The top-level Blueprints file is passed as the first argument.
39 srcDir := filepath.Dir(flag.Arg(0))
40
Colin Cross463a90e2015-06-17 14:20:06 -070041 ctx := soong.NewContext()
Colin Cross3f40fa42015-01-30 17:27:36 -080042
Colin Cross1332b002015-04-07 17:11:30 -070043 configuration, err := common.NewConfig(srcDir)
Colin Cross3f40fa42015-01-30 17:27:36 -080044 if err != nil {
45 fmt.Fprintf(os.Stderr, "%s", err)
46 os.Exit(1)
47 }
48
49 // Temporary hack
50 //ctx.SetIgnoreUnknownModuleTypes(true)
51
Colin Cross1332b002015-04-07 17:11:30 -070052 bootstrap.Main(ctx, configuration, common.ConfigFileName)
Colin Cross3f40fa42015-01-30 17:27:36 -080053}