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