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
buildscript {
repositories {
google()
mavenCentral()
jcenter()
}
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$androidGradlePluginVersion"
@ -35,12 +35,12 @@ apply plugin: 'io.objectbox'
apply plugin: 'jacoco-android'
repositories {
google()
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
google()
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
String[] archs = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']
@ -144,12 +144,12 @@ dependencies {
def map = [:]
def custom = new File("app/src")
if (project.hasProperty("customDir")) {
custom = file(project.property("customDir"))
custom = file(project.property("customDir"))
}
// Set up flavours for each custom app in the directory
if (custom.listFiles()) {
custom.eachFile() { file ->
custom.eachFile() { file ->
def fileName = file.getName()
if (fileName.startsWith(".") ||
@ -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/\""
}
}
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"
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" }
}
}
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")) {
def content_version_code = project.property("content_version_code")
@ -385,30 +381,35 @@ 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
sourceSets {
map.each { name, directory ->
"$name" {
setRoot directory
jni.srcDirs = []
jniLibs.srcDir directory + "/jniLibs"
}
}
// Set each custom apps respective source directory
sourceSets {
map.each { name, directory ->
"$name" {
setRoot directory
jni.srcDirs = []
jniLibs.srcDir directory + "/jniLibs"
}
}
}
compileOptions {
encoding = "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileOptions {
encoding = "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
javaMaxHeapSize "4g"
}
dexOptions {
javaMaxHeapSize "4g"
}
/*
/*
Add back once proguard is configured
buildTypes {
release {
@ -480,26 +481,19 @@ 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
}
@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)
}