Skip to content
This repository was archived by the owner on Oct 26, 2022. It is now read-only.

add resourceContainingJars key for ApkBuilder / prevent other projects are broken by GlobalScope #142

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/scala/AndroidInstall.scala
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ object AndroidInstall {
case None => (classDirectory +++ proguardInJars --- scalaInstance.libraryJar) get
}
},
resourceContainingJars <<= dxInputs map (_ ** "*.jar" get),

cleanApk <<= (packageApkPath) map (IO.delete(_)),

Expand All @@ -198,7 +199,7 @@ object AndroidInstall {

packageConfig <<=
(toolsPath, packageApkPath, resourcesApkPath, classesDexPath,
nativeLibrariesPath, managedNativePath, dxInputs, resourceDirectory) map
nativeLibrariesPath, managedNativePath, resourceContainingJars, resourceDirectory) map
(ApkConfig(_, _, _, _, _, _, _, _)),

packageDebug <<= packageTask(true),
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/AndroidKeys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ object AndroidKeys {
val proguard = TaskKey[Option[File]]("proguard", "Optimize class files.")
val dxInputs = TaskKey[Seq[File]]("dx-inputs", "Input for dex command")
val dx = TaskKey[File]("dx", "Convert class files to dex files")
val resourceContainingJars = TaskKey[Seq[File]]("resource-containing-jars")

val makeAssetPath = TaskKey[Unit]("make-assest-path")

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/ApkBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ case class ApkConfig(
classesDexPath: File,
nativeLibrariesPath: File,
managedNativePath: File,
dexInputs: Seq[File],
resourceContainingJars: Seq[File],
resourceDirectory: File
)

Expand Down Expand Up @@ -47,7 +47,7 @@ class ApkBuilder(project: ApkConfig, debug: Boolean) {
setDebugMode(builder, debug)
addNativeLibraries(builder, project.nativeLibrariesPath, null)
addNativeLibraries(builder, project.managedNativePath, null)
for (file <- project.dexInputs; if file.isFile)
for (file <- project.resourceContainingJars; if file.isFile)
addResourcesFromJar(builder, file)
addSourceFolder(builder, project.resourceDirectory)
sealApk(builder)
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/PlainJavaProject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import AndroidKeys._
object PlainJavaProject {
lazy val settings: Seq[Setting[_]] = inConfig(Android) (Seq(
useProguard := false,
autoScalaLibrary in GlobalScope := false,
manifestPath <<= (baseDirectory, manifestName) map((s,m) => Seq(s / m)) map (x=>x),
proguardOptimizations := Seq.empty,
mainResPath <<= (baseDirectory, resDirectoryName) (_ / _) map (x=>x),
mainAssetsPath <<= (baseDirectory, assetsDirectoryName) (_ / _),
javaSource in Compile <<= (baseDirectory) (_ / "src")
)
) ++ Seq(
autoScalaLibrary := false
)
}