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")) { 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/\""
} }
} }
parsedJson.zim_file = "libcontent.so"
productFlavors { }
// Vanilla Kiwix app // Set custom config from json
kiwix { applicationId "$parsedJson.package"
println "Configuring Kiwix" buildConfigField "boolean", "IS_CUSTOM_APP", "true"
// Set vanilla config buildConfigField "boolean", "HAS_EMBEDDED_ZIM", "$parsedJson.embed_zim"
buildConfigField "boolean", "IS_CUSTOM_APP", "false" def filename
buildConfigField "boolean", "HAS_EMBEDDED_ZIM", "false" if (parsedJson.zim_file.lastIndexOf("/") >= 0) {
buildConfigField "String", "ZIM_FILE_NAME", "\"\"" filename = parsedJson.zim_file.substring(parsedJson.zim_file.lastIndexOf("/") + 1)
buildConfigField "long", "ZIM_FILE_SIZE", "0" } else {
buildConfigField "int", "CONTENT_VERSION_CODE", "0" filename = parsedJson.zim_file
buildConfigField "String", "ENFORCED_LANG", "\"\"" }
resValue "string", "app_name", "Kiwix" buildConfigField "String", "ZIM_FILE_NAME", "\"$filename\""
resValue "string", "app_search_string", "Search Kiwix" 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")) { if (project.hasProperty("version_code")) {
def version_code = project.property("version_code") def version_code = project.property("version_code")
versionCode version_code.toInteger() versionCode version_code.toInteger()
} else { } else {
versionCode 55 versionCode parsedJson.version_code.toInteger()
} }
if (project.hasProperty("version_name")) { if (project.hasProperty("version_name")) {
versionName project.property("version_name") versionName project.property("version_name")
} else { } else {
versionName "2.4" 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,6 +381,11 @@ 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
@ -480,24 +481,17 @@ 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 @Override
boolean isConfigured() { boolean isConfigured() {
return true 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)
} }