| Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 1 | // 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 |  | 
|  | 15 | package common | 
|  | 16 |  | 
|  | 17 | import ( | 
|  | 18 | "path/filepath" | 
|  | 19 |  | 
| Colin Cross | 70b4059 | 2015-03-23 12:57:34 -0700 | [diff] [blame] | 20 | "github.com/google/blueprint" | 
| Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 21 | ) | 
|  | 22 |  | 
| Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 23 | // ModuleOutDir returns the path to the module-specific output directory. | 
|  | 24 | func ModuleOutDir(ctx AndroidModuleContext) string { | 
| Colin Cross | 581c189 | 2015-04-07 16:50:10 -0700 | [diff] [blame] | 25 | config := ctx.Config().(Config) | 
|  | 26 | return filepath.Join(config.IntermediatesDir(), ctx.ModuleDir(), ctx.ModuleName(), ctx.ModuleSubDir()) | 
| Colin Cross | 3f40fa4 | 2015-01-30 17:27:36 -0800 | [diff] [blame] | 27 | } | 
|  | 28 |  | 
|  | 29 | // ModuleSrcDir returns the path of the directory that all source file paths are | 
|  | 30 | // specified relative to. | 
|  | 31 | func 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. | 
|  | 38 | func 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. | 
|  | 44 | func ModuleLibDir(ctx AndroidModuleContext) string { | 
|  | 45 | return filepath.Join(ModuleOutDir(ctx), "lib") | 
|  | 46 | } | 
|  | 47 |  | 
|  | 48 | // ModuleGenDir returns the module directory for generated files | 
|  | 49 | // path. | 
|  | 50 | func 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. | 
|  | 56 | func 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. | 
|  | 63 | func ModuleGoPackageDir(ctx AndroidModuleContext) string { | 
|  | 64 | return filepath.Join(ModuleOutDir(ctx), "pkg") | 
|  | 65 | } | 
|  | 66 |  | 
|  | 67 | // ModuleIncludeDir returns the module-specific public include directory path. | 
|  | 68 | func ModuleIncludeDir(ctx AndroidModuleContext) string { | 
|  | 69 | return filepath.Join(ModuleOutDir(ctx), "include") | 
|  | 70 | } | 
|  | 71 |  | 
|  | 72 | // ModuleProtoDir returns the module-specific public proto include directory path. | 
|  | 73 | func ModuleProtoDir(ctx AndroidModuleContext) string { | 
|  | 74 | return filepath.Join(ModuleOutDir(ctx), "proto") | 
|  | 75 | } | 
|  | 76 |  | 
|  | 77 | func ModuleJSCompiledDir(ctx AndroidModuleContext) string { | 
|  | 78 | return filepath.Join(ModuleOutDir(ctx), "js") | 
|  | 79 | } |