Skip to content
Browse files

Merge pull request #143 from appamatto/master

Support for creating and publishing apklib (library projects)
  • Loading branch information...
2 parents e3e177e + 88efe6e commit a075328d743d6e015a66ab140f989ac40af02dc7 @jberkel committed Oct 4, 2012
Showing with 21 additions and 0 deletions.
  1. +18 −0 src/main/scala/AndroidBase.scala
  2. +3 −0 src/main/scala/AndroidKeys.scala
View
18 src/main/scala/AndroidBase.scala
@@ -58,6 +58,20 @@ object AndroidBase {
}
}
+ private def apklibPackageTask =
+ (manifestPath, mainResPath, mainAssetsPath, javaSource, scalaSource, packageApkLibPath, streams) map {
+ (manPath, rPath, aPath, jPath, sPath, apklib, s) =>
+ s.log.info("packaging apklib")
+ val mapping =
+ (PathFinder(manPath) x flat) ++
+ (PathFinder(jPath) ** "*.java" x rebase(jPath, "src")) ++
+ (PathFinder(sPath) ** "*.scala" x rebase(sPath, "src")) ++
+ ((PathFinder(rPath) ***) x rebase(rPath, "res")) ++
+ ((PathFinder(aPath) ***) x rebase(rPath, "assets"))
+ IO.jar(mapping, apklib, new java.util.jar.Manifest)
+ apklib
+ }
+
private def apklibDependenciesTask =
(update in Compile, sourceManaged, managedJavaPath, resourceManaged, streams) map {
(updateReport, srcManaged, javaManaged, resManaged, s) => {
@@ -163,6 +177,8 @@ object AndroidBase {
packageApkName <<= (artifact, versionName) map ((a, v) => String.format("%s-%s.apk", a.name, v)),
packageApkPath <<= (target, packageApkName) map (_ / _),
+ packageApkLibName <<= (artifact, versionName) map ((a, v) => String.format("%s-%s.apklib", a.name, v)),
+ packageApkLibPath <<= (target, packageApkLibName) map (_ / _),
manifestPath <<= (sourceDirectory, manifestName) map((s,m) => Seq(s / m)),
manifestPackage <<= findPath,
@@ -181,6 +197,7 @@ object AndroidBase {
managedNativePath <<= (sourceManaged in Compile) (_ / "native_libs"),
extractApkLibDependencies <<= apklibDependenciesTask,
+ apklibPackage <<= apklibPackageTask,
managedSourceDirectories in Compile <<= (managedJavaPath, managedScalaPath) (Seq(_, _)),
@@ -237,6 +254,7 @@ object AndroidBase {
resourceDirectory <<= (resourceDirectory in Compile),
resourceDirectories <<= (resourceDirectories in Compile),
javaSource <<= (javaSource in Compile),
+ scalaSource <<= (scalaSource in Compile),
managedClasspath <<= (managedClasspath in Runtime),
fullClasspath <<= (fullClasspath in Runtime)
))
View
3 src/main/scala/AndroidKeys.scala
@@ -39,6 +39,7 @@ object AndroidKeys {
/** Determined Settings */
val packageApkName = TaskKey[String]("package-apk-name")
+ val packageApkLibName = TaskKey[String]("package-apklib-name")
val osDxName = SettingKey[String]("os-dx-name")
/** Path Settings */
@@ -68,6 +69,7 @@ object AndroidKeys {
val classesDexPath = SettingKey[File]("classes-dex-path")
val resourcesApkPath = SettingKey[File]("resources-apk-path")
val packageApkPath = TaskKey[File]("package-apk-path")
+ val packageApkLibPath = TaskKey[File]("package-apklib-path")
val useProguard = SettingKey[Boolean]("use-proguard")
/** Install Settings */
@@ -96,6 +98,7 @@ object AndroidKeys {
/** Base Tasks */
case class LibraryProject(pkgName: String, manifest: File, sources: Set[File], resDir: Option[File], assetsDir: Option[File])
+ val apklibPackage = TaskKey[File]("apklib-package")
val extractApkLibDependencies = TaskKey[Seq[LibraryProject]]("apklib-dependencies", "Unpack apklib dependencies")
val copyNativeLibraries = TaskKey[Unit]("copy-native-libraries", "Copy native libraries added to libraryDependencies")

0 comments on commit a075328

Please sign in to comment.
Something went wrong with that request. Please try again.