blob: b052feff2121c99894ee1c0d6e670049a755b52a [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 common
16
17import (
18 "path/filepath"
19
Colin Cross70b40592015-03-23 12:57:34 -070020 "github.com/google/blueprint"
Colin Cross3f40fa42015-01-30 17:27:36 -080021)
22
Colin Cross3f40fa42015-01-30 17:27:36 -080023// ModuleOutDir returns the path to the module-specific output directory.
24func ModuleOutDir(ctx AndroidModuleContext) string {
Colin Cross581c1892015-04-07 16:50:10 -070025 config := ctx.Config().(Config)
26 return filepath.Join(config.IntermediatesDir(), ctx.ModuleDir(), ctx.ModuleName(), ctx.ModuleSubDir())
Colin Cross3f40fa42015-01-30 17:27:36 -080027}
28
29// ModuleSrcDir returns the path of the directory that all source file paths are
30// specified relative to.
31func ModuleSrcDir(ctx blueprint.ModuleContext) string {
32 config := ctx.Config().(Config)
33 return filepath.Join(config.SrcDir(), ctx.ModuleDir())
34}
35
36// ModuleBinDir returns the path to the module- and architecture-specific binary
37// output directory.
38func ModuleBinDir(ctx AndroidModuleContext) string {
39 return filepath.Join(ModuleOutDir(ctx), "bin")
40}
41
42// ModuleLibDir returns the path to the module- and architecture-specific
43// library output directory.
44func ModuleLibDir(ctx AndroidModuleContext) string {
45 return filepath.Join(ModuleOutDir(ctx), "lib")
46}
47
48// ModuleGenDir returns the module directory for generated files
49// path.
50func ModuleGenDir(ctx AndroidModuleContext) string {
51 return filepath.Join(ModuleOutDir(ctx), "gen")
52}
53
54// ModuleObjDir returns the module- and architecture-specific object directory
55// path.
56func ModuleObjDir(ctx AndroidModuleContext) string {
57 return filepath.Join(ModuleOutDir(ctx), "obj")
58}
59
60// ModuleGoPackageDir returns the module-specific package root directory path.
61// This directory is where the final package .a files are output and where
62// dependent modules search for this package via -I arguments.
63func ModuleGoPackageDir(ctx AndroidModuleContext) string {
64 return filepath.Join(ModuleOutDir(ctx), "pkg")
65}
66
67// ModuleIncludeDir returns the module-specific public include directory path.
68func ModuleIncludeDir(ctx AndroidModuleContext) string {
69 return filepath.Join(ModuleOutDir(ctx), "include")
70}
71
72// ModuleProtoDir returns the module-specific public proto include directory path.
73func ModuleProtoDir(ctx AndroidModuleContext) string {
74 return filepath.Join(ModuleOutDir(ctx), "proto")
75}
76
77func ModuleJSCompiledDir(ctx AndroidModuleContext) string {
78 return filepath.Join(ModuleOutDir(ctx), "js")
79}