Initial kotlin support
Allow java libraries to specify .kt sources, precompile them with
kotlin, and then pass them in the classpath to javac.
Bug: 65219535
Test: java_test.go
Change-Id: Ife22b6ef82ced9ec26a9e5392b2dadacbb16546f
diff --git a/android/paths.go b/android/paths.go
index 69a7b0d..09f760a 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -303,6 +303,39 @@
return list[:k]
}
+// HasExt returns true of any of the paths have extension ext, otherwise false
+func (p Paths) HasExt(ext string) bool {
+ for _, path := range p {
+ if path.Ext() == ext {
+ return true
+ }
+ }
+
+ return false
+}
+
+// FilterByExt returns the subset of the paths that have extension ext
+func (p Paths) FilterByExt(ext string) Paths {
+ ret := make(Paths, 0, len(p))
+ for _, path := range p {
+ if path.Ext() == ext {
+ ret = append(ret, path)
+ }
+ }
+ return ret
+}
+
+// FilterOutByExt returns the subset of the paths that do not have extension ext
+func (p Paths) FilterOutByExt(ext string) Paths {
+ ret := make(Paths, 0, len(p))
+ for _, path := range p {
+ if path.Ext() != ext {
+ ret = append(ret, path)
+ }
+ }
+ return ret
+}
+
// WritablePaths is a slice of WritablePaths, used for multiple outputs.
type WritablePaths []WritablePath