Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append APK file name with version and variant #505

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ target/
tmp/
opensrp-giz-malawi/debug/
opensrp-giz-malawi/preview/
opensrp-giz-malawi/releaseDebug/
*google-services.json
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ These instructions will get you a copy of the project up and running on your loc

## Development setup

Get the

### Steps to set up
[OpenSRP android client app build](https://smartregister.atlassian.net/wiki/spaces/Documentation/pages/6619236/OpenSRP+App+Build)

Expand Down
83 changes: 53 additions & 30 deletions opensrp-giz-malawi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,30 @@ jacoco {
toolVersion = jacocoVersion
}

Properties properties = new Properties()
if (project.rootProject.file("local.properties").exists()) {
properties.load(project.rootProject.file("local.properties").newDataInputStream())
} else{
project.logger.error("local.properties file does not exist")
}

ext.getLocalProperty = { key ->
if (properties != null && properties.containsKey(key)) {
return properties[key]
} else {
project.logger.error(key + " could not be found. Setting it to an empty string")
return "\"\""
}
}


ext.checkKeys = { keys ->
keys.each { key ->
if (properties == null || !properties.containsKey(key)) {
project.logger.error(key + " is missing from the local.properties")
}
}
}

android {
useLibrary 'org.apache.http.legacy'
Expand All @@ -50,34 +74,7 @@ android {

testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'

if (project.rootProject.file("local.properties").exists()) {

Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())

if (properties != null && properties.containsKey("oauth.client.id")) {

buildConfigField "String", "OAUTH_CLIENT_ID", properties["oauth.client.id"]

} else {
project.logger.error("oauth.client.id variable is not set in your local.properties")
buildConfigField "String", "OAUTH_CLIENT_ID", "\"sample_client_id\""
}


if (properties != null && properties.containsKey("oauth.client.secret")) {

buildConfigField "String", "OAUTH_CLIENT_SECRET", properties["oauth.client.secret"]

} else {
project.logger.error("oauth.client.secret variable is not set in your local.properties")
buildConfigField "String", "OAUTH_CLIENT_SECRET", "\"sample_client_secret\""
}
} else {
buildConfigField "String", "OAUTH_CLIENT_ID", '""'
buildConfigField "String", "OAUTH_CLIENT_SECRET", '""'
}

checkKeys(["oauth.client.id.production", "oauth.client.secret.production", "oauth.client.id.stage", "oauth.client.secret.stage", "oauth.client.id.preview", "oauth.client.secret.preview"])

javaCompileOptions {
annotationProcessorOptions {
Expand Down Expand Up @@ -128,6 +125,10 @@ android {
buildConfigField "int", "GROWTH_MONITORING_SYNC_TIME", '15'
buildConfigField "String[]", "LOCATION_LEVELS", '{"Country", "Province", "District", "Facility", "Village"}'
buildConfigField "String[]", "HEALTH_FACILITY_LEVELS", '{"Country", "Province", "District", "Health Facility", "Village"}'

buildConfigField "String", "OAUTH_CLIENT_ID", getLocalProperty("oauth.client.id.production")
buildConfigField "String", "OAUTH_CLIENT_SECRET", getLocalProperty("oauth.client.secret.production")

}

releaseDebug {
Expand All @@ -141,7 +142,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rule.pro'
resValue "string", 'opensrp_url', '"https://opensrp.health.gov.mw/opensrp/"'
buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '10'
buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '10'
buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '2'
buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2'
buildConfigField "int", "VACCINE_SYNC_TIME", '0'
buildConfigField "int", "DATABASE_VERSION", '20'
Expand All @@ -157,6 +158,9 @@ android {
buildConfigField "int", "GROWTH_MONITORING_SYNC_TIME", '15'
buildConfigField "String[]", "LOCATION_LEVELS", '{"Country", "Province", "District", "Facility", "Village"}'
buildConfigField "String[]", "HEALTH_FACILITY_LEVELS", '{"Country", "Province", "District", "Health Facility", "Village"}'

buildConfigField "String", "OAUTH_CLIENT_ID", getLocalProperty("oauth.client.id.production")
buildConfigField "String", "OAUTH_CLIENT_SECRET", getLocalProperty("oauth.client.secret.production")
}

preview {
Expand Down Expand Up @@ -185,6 +189,9 @@ android {
buildConfigField "int", "GROWTH_MONITORING_SYNC_TIME", '15'
buildConfigField "String[]", "LOCATION_LEVELS", '{"Country", "Province", "District", "Facility", "Village"}'
buildConfigField "String[]", "HEALTH_FACILITY_LEVELS", '{"Country", "Province", "District", "Health Facility", "Village"}'

buildConfigField "String", "OAUTH_CLIENT_ID", getLocalProperty("oauth.client.id.preview")
buildConfigField "String", "OAUTH_CLIENT_SECRET", getLocalProperty("oauth.client.secret.preview")
}

debug {
Expand All @@ -210,6 +217,22 @@ android {
buildConfigField "String[]", "LOCATION_LEVELS", '{"Country", "Province", "District", "Facility", "Village"}'
buildConfigField "String[]", "HEALTH_FACILITY_LEVELS", '{"Country", "Province", "District", "Health Facility", "Village"}'
testCoverageEnabled true

buildConfigField "String", "OAUTH_CLIENT_ID", getLocalProperty("oauth.client.id.stage")
buildConfigField "String", "OAUTH_CLIENT_SECRET", getLocalProperty("oauth.client.secret.stage")
}
}

// https://stackoverflow.com/a/27119543/152938
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = new File(outputFileName.replace(".apk", "-${defaultConfig.versionName}.apk"))
}
}

testVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = new File(outputFileName.replace(".apk", "-${defaultConfig.versionName}.apk"))
}
}

Expand Down Expand Up @@ -291,7 +314,7 @@ dependencies {
exclude group: 'io.ona.rdt-capture', module: 'lib'
}

api('org.smartregister:opensrp-client-core:5.0.9-SNAPSHOT@aar') {
api('org.smartregister:opensrp-client-core:5.0.12-LOCAL-SNAPSHOT@aar') {
transitive = true
exclude group: 'id.zelory', module: 'compressor'
exclude group: 'com.github.bmelnychuk', module: 'atv'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public LoginPresenter(BaseLoginContract.View loginView) {
mLoginView = new WeakReference<>(loginView);
mLoginInteractor = new LoginInteractor(this);
mLoginModel = new BaseLoginModel();

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public synchronized void processClient(List<EventClient> eventClientList, boolea

@Override
public void processClient(List<EventClient> eventClients) throws Exception {
ClientClassification clientClassification = assetJsonToJava("ec_client_classification.json",
/*ClientClassification clientClassification = assetJsonToJava("ec_client_classification.json",
ClientClassification.class);
Table vaccineTable = assetJsonToJava("ec_client_vaccine.json", Table.class);
Table weightTable = assetJsonToJava("ec_client_weight.json", Table.class);
Expand Down Expand Up @@ -232,7 +232,7 @@ else if (eventType.equals(VaccineIntentService.EVENT_TYPE) || eventType
Runnable runnable = () -> updateClientAlerts(clientsForAlertUpdates);

appExecutors.diskIO().execute(runnable);
}
}*/

}

Expand Down