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

@ -158,6 +158,8 @@ if (custom.listFiles()) {
fileName.contains("Test")) {
return
}
map.put(fileName, file.getAbsolutePath())
}
}
jacoco {
@ -323,56 +325,50 @@ android {
// If no file provided use the test file
jsonFile = file(directory + "/info.json")
}
mock_network {
initWith(buildTypes.debug)
matchingFallbacks = ["debug", "release"]
// TODO add DI for the mock network
def parsedJson = new JsonSlurper().parseText(jsonFile.text)
def sourceFile = file(parsedJson.zim_file)
if (!sourceFile.exists()) {
sourceFile = file(directory + "/" + parsedJson.zim_file)
}
local_download_server {
initWith(buildTypes.debug)
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://kiwix-download-server/\""
matchingFallbacks = ["debug", "release"]
}
// 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/\""
if (parsedJson.embed_zim) {
// Place content in each lib directory for embeded zims
for (String archName : archs) {
copy {
from sourceFile
into file(directory + "/jniLibs/" + archName)
rename { String filename -> "libcontent.so" }
}
}
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"
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 55
versionCode parsedJson.version_code.toInteger()
}
if (project.hasProperty("version_name")) {
versionName project.property("version_name")
} else {
versionName "2.4"
}
versionName parsedJson.version_name
}
if (project.hasProperty("content_version_code")) {
def content_version_code = project.property("content_version_code")
@ -385,6 +381,11 @@ android {
} else if (parsedJson.version_code != null) {
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
@ -480,24 +481,17 @@ class TestDroidUpload extends TestServer {
}
}
@Override
void uploadApks(@NonNull String variantName, @NonNull File testApk, File testedApk) {
APIUser.metaClass.shareFile { id, accessGroup ->
System.out.println(id)
try {
delegate.postResource(createUri(selfURI, "/files/" + id + "/share"), [accessGroupId: accessGroup], APIProject.class)
} catch (Exception e) {
System.out.println(e.getLocalizedMessage())
}
}
APIClient client = new APIKeyClient(TESTDROID_SERVER, API_KEY)
APIUser user = client.me()
String testId = user.uploadFile(testApk).getId()
user.shareFile(testId, accessGroup)
String testedId = user.uploadFile(testedApk).getId()
user.shareFile(testedId, accessGroup)
new URL(RUNNER_GATEWAY + "?apk=" + testedId + "&test=" + testId + "&buildno=" + buildNumber).
getText()
}
new URL(RUNNER_GATEWAY + "?apk=" + testedId + "&test=" + testId + "&buildno=" + buildNumber).getText()
}
@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 java.io.File
import javax.inject.Inject
import org.kiwix.kiwixmobile.zim_manager.local_file_transfer.LocalFileTransferActivity;
class ZimManageActivity : BaseActivity() {
@ -158,6 +159,9 @@ class ZimManageActivity : BaseActivity() {
R.id.select_language -> {
zimManageViewModel.requestLanguagesDialog.onNext(Unit)
}
R.id.get_zim_nearby_device -> {
startActivity(Intent(this, LocalFileTransferActivity::class.java));
}
}
return super.onOptionsItemSelected(item)
}