blob: 2fbf54bf226467ce27a4a255106e0e50362974c2 [file] [log] [blame]
Colin Cross2fe66872015-03-30 17:20:39 -07001// 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 java
16
17import (
18 "path/filepath"
19
20 "android/soong/common"
21)
22
23var resourceExcludes = []string{
24 "*.java",
25 "package.html",
26 "overview.html",
27 ".*.swp",
28 ".DS_Store",
29 "*~",
30}
31
32func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, dirs []string) []jarSpec {
33 jarSpecs := make([]jarSpec, len(dirs))
34
35 for i, dir := range dirs {
36 fileListFile := filepath.Join(common.ModuleOutDir(ctx), "res", dir, "resources.list")
37 depFile := fileListFile + ".d"
38 dir := filepath.Join(common.ModuleSrcDir(ctx), dir)
39 glob := filepath.Join(dir, "**/*")
40 common.GlobRule(ctx, glob, resourceExcludes, fileListFile, depFile)
41 jarSpecs[i] = jarSpec{fileListFile, dir}
42 }
43
44 return jarSpecs
45}