Browse Source

Improved handling of Android framework archive (in particualr for Eclipse).

master
Achim D. Brucker 2 years ago
parent
commit
333ed62072
3 changed files with 21 additions and 7 deletions
  1. +1
    -0
      .gitignore
  2. +3
    -3
      com.logicalhacking.dasca.crosslanguage/build.gradle
  3. +17
    -4
      com.logicalhacking.dasca.crosslanguage/src/main/scala/com/logicalhacking/dasca/crosslanguage/builder/CordovaCGBuilder.scala

+ 1
- 0
.gitignore View File

@@ -12,3 +12,4 @@ build
com.logicalhacking.dasca.dataflow/config/main.config
com.logicalhacking.dasca.dataflow/main.log*
com.logicalhacking.dasca.crosslanguage/BuildCordovaCallgraph.launch
com.logicalhacking.dasca.crosslanguage/src/main/resources/android-26.jar

+ 3
- 3
com.logicalhacking.dasca.crosslanguage/build.gradle View File

@@ -63,15 +63,15 @@ task installAndroidSdk(type: Sync, dependsOn: downloadAndroidSdk) {
outputs.cacheIf { true }
}

task copyAndroidJar(type: Sync, dependsOn: installAndroidSdk) {
task copyAndroidJar(type: Copy, dependsOn: installAndroidSdk) {
from "${installAndroidSdk.destinationDir}/platforms/${installAndroidSdk.components['platforms']}/android.jar"
into temporaryDir
rename { "android-26.jar" }
into 'src/main/resources'
}

processResources {
with copySpec {
from copyAndroidJar
rename { "android-dasca.jar" }
}
}



+ 17
- 4
com.logicalhacking.dasca.crosslanguage/src/main/scala/com/logicalhacking/dasca/crosslanguage/builder/CordovaCGBuilder.scala View File

@@ -161,12 +161,25 @@ class CordovaCGBuilder(val apk: File, val apkUnzipDir: File) {
}

private def createJavaCallGraph = {
val tmpAndroidJar = File.createTempFile("android-dasca", ".jar")
val tmpAndroidJar = File.createTempFile("android-26", ".jar")
tmpAndroidJar.deleteOnExit()
if (null != getClass.getClassLoader.getResource("android-dasca.jar")){
TemporaryFile.urlToFile(tmpAndroidJar, getClass.getClassLoader.getResource("android-dasca.jar"))
val rscDirs = List("android-26.jar")
var androidResource = null:java.net.URL
for (rsc <- rscDirs) {
if (null == androidResource) {
logger.info("Searching android framework: " + rsc)
androidResource = getClass.getClassLoader.getResource(rsc)
if (null != androidResource) {
logger.info(" Found android framework: " + rsc)
}
}
}
if (null != androidResource){
TemporaryFile.urlToFile(tmpAndroidJar, androidResource)
}else{
val msg = "Please install android-dasca.jar in resources directory."
val msg = "Please install a suiteable android framework in the resources directory."
logger.error(msg);
throw new FileNotFoundException(msg);
}


Loading…
Cancel
Save