Fix merge errors

But no CAB present
This commit is contained in:
Aditya-Sood 2019-07-02 11:03:11 +05:30
parent 7c71f2b9c9
commit 853c0c4d9d
2 changed files with 94 additions and 96 deletions

View File

@ -8,11 +8,11 @@ import com.testdroid.api.model.APIUser
import groovy.json.JsonSlurper import groovy.json.JsonSlurper
buildscript { buildscript {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
jcenter() jcenter()
} }
dependencies { dependencies {
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion" classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
@ -35,12 +35,12 @@ apply plugin: 'io.objectbox'
apply plugin: 'jacoco-android' apply plugin: 'jacoco-android'
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
maven { maven {
url "https://maven.google.com" url "https://maven.google.com"
} }
jcenter() jcenter()
} }
String[] archs = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'] String[] archs = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']
@ -144,12 +144,12 @@ dependencies {
def map = [:] def map = [:]
def custom = new File("app/src") def custom = new File("app/src")
if (project.hasProperty("customDir")) { if (project.hasProperty("customDir")) {
custom = file(project.property("customDir")) custom = file(project.property("customDir"))
} }
// Set up flavours for each custom app in the directory // Set up flavours for each custom app in the directory
if (custom.listFiles()) { if (custom.listFiles()) {
custom.eachFile() { file -> custom.eachFile() { file ->
def fileName = file.getName() def fileName = file.getName()
if (fileName.startsWith(".") || if (fileName.startsWith(".") ||
@ -158,6 +158,8 @@ if (custom.listFiles()) {
fileName.contains("Test")) { fileName.contains("Test")) {
return return
} }
map.put(fileName, file.getAbsolutePath())
}
} }
jacoco { jacoco {
@ -323,56 +325,50 @@ android {
// If no file provided use the test file // If no file provided use the test file
jsonFile = file(directory + "/info.json") jsonFile = file(directory + "/info.json")
} }
def parsedJson = new JsonSlurper().parseText(jsonFile.text)
mock_network { def sourceFile = file(parsedJson.zim_file)
initWith(buildTypes.debug) if (!sourceFile.exists()) {
matchingFallbacks = ["debug", "release"] sourceFile = file(directory + "/" + parsedJson.zim_file)
// TODO add DI for the mock network
} }
if (parsedJson.embed_zim) {
local_download_server { // Place content in each lib directory for embeded zims
initWith(buildTypes.debug) for (String archName : archs) {
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://kiwix-download-server/\"" copy {
matchingFallbacks = ["debug", "release"] from sourceFile
} into file(directory + "/jniLibs/" + archName)
rename { String filename -> "libcontent.so" }
// Used to assess code coverage
coverage {
initWith debug
testCoverageEnabled true
matchingFallbacks = ["debug", "release"]
}
// Release Type
release {
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://download.kiwix.org/\""
}
}
productFlavors {
// Vanilla Kiwix app
kiwix {
println "Configuring Kiwix"
// Set vanilla config
buildConfigField "boolean", "IS_CUSTOM_APP", "false"
buildConfigField "boolean", "HAS_EMBEDDED_ZIM", "false"
buildConfigField "String", "ZIM_FILE_NAME", "\"\""
buildConfigField "long", "ZIM_FILE_SIZE", "0"
buildConfigField "int", "CONTENT_VERSION_CODE", "0"
buildConfigField "String", "ENFORCED_LANG", "\"\""
resValue "string", "app_name", "Kiwix"
resValue "string", "app_search_string", "Search Kiwix"
if (project.hasProperty("version_code")) {
def version_code = project.property("version_code")
versionCode version_code.toInteger()
} else {
versionCode 55
}
if (project.hasProperty("version_name")) {
versionName project.property("version_name")
} else {
versionName "2.4"
} }
}
parsedJson.zim_file = "libcontent.so"
}
// Set custom config from json
applicationId "$parsedJson.package"
buildConfigField "boolean", "IS_CUSTOM_APP", "true"
buildConfigField "boolean", "HAS_EMBEDDED_ZIM", "$parsedJson.embed_zim"
def filename
if (parsedJson.zim_file.lastIndexOf("/") >= 0) {
filename = parsedJson.zim_file.substring(parsedJson.zim_file.lastIndexOf("/") + 1)
} else {
filename = parsedJson.zim_file
}
buildConfigField "String", "ZIM_FILE_NAME", "\"$filename\""
if (project.hasProperty("zim_file_size")) {
def length = Long.parseLong(project.property("zim_file_size"))
buildConfigField "long", "ZIM_FILE_SIZE", "${length}L"
} else {
long length = sourceFile.length()
buildConfigField "long", "ZIM_FILE_SIZE", "${length}L"
}
if (project.hasProperty("version_code")) {
def version_code = project.property("version_code")
versionCode version_code.toInteger()
} else {
versionCode parsedJson.version_code.toInteger()
}
if (project.hasProperty("version_name")) {
versionName project.property("version_name")
} else {
versionName parsedJson.version_name
} }
if (project.hasProperty("content_version_code")) { if (project.hasProperty("content_version_code")) {
def content_version_code = project.property("content_version_code") def content_version_code = project.property("content_version_code")
@ -385,30 +381,35 @@ android {
} else if (parsedJson.version_code != null) { } else if (parsedJson.version_code != null) {
buildConfigField "int", "CONTENT_VERSION_CODE", "$parsedJson.version_code" buildConfigField "int", "CONTENT_VERSION_CODE", "$parsedJson.version_code"
} }
buildConfigField "String", "ENFORCED_LANG", "\"$parsedJson.enforced_lang\""
resValue "string", "app_name", "$parsedJson.app_name"
resValue "string", "app_search_string", "Search " + "$parsedJson.app_name"
}
} }
}
// Set each custom apps respective source directory // Set each custom apps respective source directory
sourceSets { sourceSets {
map.each { name, directory -> map.each { name, directory ->
"$name" { "$name" {
setRoot directory setRoot directory
jni.srcDirs = [] jni.srcDirs = []
jniLibs.srcDir directory + "/jniLibs" jniLibs.srcDir directory + "/jniLibs"
} }
}
} }
}
compileOptions { compileOptions {
encoding = "UTF-8" encoding = "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
dexOptions { dexOptions {
javaMaxHeapSize "4g" javaMaxHeapSize "4g"
} }
/* /*
Add back once proguard is configured Add back once proguard is configured
buildTypes { buildTypes {
release { release {
@ -480,26 +481,19 @@ class TestDroidUpload extends TestServer {
} }
} }
@Override APIClient client = new APIKeyClient(TESTDROID_SERVER, API_KEY)
void uploadApks(@NonNull String variantName, @NonNull File testApk, File testedApk) { APIUser user = client.me()
APIUser.metaClass.shareFile { id, accessGroup -> String testId = user.uploadFile(testApk).getId()
System.out.println(id) user.shareFile(testId, accessGroup)
try { String testedId = user.uploadFile(testedApk).getId()
delegate.postResource(createUri(selfURI, "/files/" + id + "/share"), [accessGroupId: accessGroup], APIProject.class) user.shareFile(testedId, accessGroup)
} catch (Exception e) {
System.out.println(e.getLocalizedMessage())
}
}
new URL(RUNNER_GATEWAY + "?apk=" + testedId + "&test=" + testId + "&buildno=" + buildNumber). new URL(RUNNER_GATEWAY + "?apk=" + testedId + "&test=" + testId + "&buildno=" + buildNumber).
getText() getText()
} }
new URL(RUNNER_GATEWAY + "?apk=" + testedId + "&test=" + testId + "&buildno=" + buildNumber).getText() @Override
} boolean isConfigured() {
return true
@Override }
boolean isConfigured() {
return true
}
} }

View File

@ -45,6 +45,7 @@ import org.kiwix.kiwixmobile.utils.StyleUtils.dialogStyle
import org.kiwix.kiwixmobile.views.LanguageSelectDialog import org.kiwix.kiwixmobile.views.LanguageSelectDialog
import java.io.File import java.io.File
import javax.inject.Inject import javax.inject.Inject
import org.kiwix.kiwixmobile.zim_manager.local_file_transfer.LocalFileTransferActivity;
class ZimManageActivity : BaseActivity() { class ZimManageActivity : BaseActivity() {
@ -158,6 +159,9 @@ class ZimManageActivity : BaseActivity() {
R.id.select_language -> { R.id.select_language -> {
zimManageViewModel.requestLanguagesDialog.onNext(Unit) zimManageViewModel.requestLanguagesDialog.onNext(Unit)
} }
R.id.get_zim_nearby_device -> {
startActivity(Intent(this, LocalFileTransferActivity::class.java));
}
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
} }