2015-01-31 02:27:36 +01:00
|
|
|
// Copyright 2015 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
|
2015-03-23 20:57:34 +01:00
|
|
|
"github.com/google/blueprint"
|
|
|
|
"github.com/google/blueprint/bootstrap"
|
2015-01-31 02:27:36 +01:00
|
|
|
|
|
|
|
"android/soong/cc"
|
|
|
|
"android/soong/common"
|
|
|
|
"android/soong/config"
|
2015-03-18 21:28:46 +01:00
|
|
|
"android/soong/genrule"
|
2015-01-31 02:27:36 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
// The top-level Blueprints file is passed as the first argument.
|
|
|
|
srcDir := filepath.Dir(flag.Arg(0))
|
|
|
|
|
|
|
|
ctx := blueprint.NewContext()
|
|
|
|
|
|
|
|
// Module types
|
|
|
|
ctx.RegisterModuleType("cc_library_static", cc.NewCCLibraryStatic)
|
|
|
|
ctx.RegisterModuleType("cc_library_shared", cc.NewCCLibraryShared)
|
|
|
|
ctx.RegisterModuleType("cc_library", cc.NewCCLibrary)
|
|
|
|
ctx.RegisterModuleType("cc_object", cc.NewCCObject)
|
|
|
|
ctx.RegisterModuleType("cc_binary", cc.NewCCBinary)
|
2015-03-18 22:01:18 +01:00
|
|
|
ctx.RegisterModuleType("cc_test", cc.NewCCTest)
|
2015-01-31 02:27:36 +01:00
|
|
|
|
|
|
|
ctx.RegisterModuleType("toolchain_library", cc.NewToolchainLibrary)
|
|
|
|
|
|
|
|
ctx.RegisterModuleType("cc_library_host_static", cc.NewCCLibraryHostStatic)
|
|
|
|
ctx.RegisterModuleType("cc_library_host_shared", cc.NewCCLibraryHostShared)
|
|
|
|
ctx.RegisterModuleType("cc_binary_host", cc.NewCCBinaryHost)
|
|
|
|
|
2015-03-18 21:28:46 +01:00
|
|
|
ctx.RegisterModuleType("gensrcs", genrule.NewGenSrcs)
|
|
|
|
|
2015-01-31 02:27:36 +01:00
|
|
|
// Mutators
|
|
|
|
ctx.RegisterEarlyMutator("arch", common.ArchMutator)
|
|
|
|
ctx.RegisterEarlyMutator("link", cc.LinkageMutator)
|
2015-03-19 22:05:33 +01:00
|
|
|
ctx.RegisterEarlyMutator("test_per_src", cc.TestPerSrcMutator)
|
2015-01-31 02:27:36 +01:00
|
|
|
|
|
|
|
// Singletons
|
2015-03-17 21:24:18 +01:00
|
|
|
ctx.RegisterSingletonType("checkbuild", common.CheckbuildSingleton)
|
2015-01-31 02:27:36 +01:00
|
|
|
|
|
|
|
configuration, err := config.New(srcDir)
|
|
|
|
if err != nil {
|
|
|
|
fmt.Fprintf(os.Stderr, "%s", err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Temporary hack
|
|
|
|
//ctx.SetIgnoreUnknownModuleTypes(true)
|
|
|
|
|
|
|
|
bootstrap.Main(ctx, configuration, config.ConfigFileName)
|
|
|
|
}
|