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