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