forked from opensrp/fhircore
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mwcore-dev' into 69-questmalawi-core-android-app-hapi-f…
…hir-update-to-v619
- Loading branch information
Showing
336 changed files
with
8,133 additions
and
15,710 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import java.io.File | ||
import java.io.FileInputStream | ||
import java.io.InputStreamReader | ||
import java.util.Properties | ||
|
||
object ProjectProperties { | ||
fun readProperties(file: String): Properties { | ||
val properties = Properties() | ||
val localProperties = File(file) | ||
if (localProperties.isFile) { | ||
InputStreamReader(FileInputStream(localProperties), Charsets.UTF_8).use { reader | ||
-> | ||
properties.load(reader) | ||
} | ||
} else println("\u001B[34mFILE_NOT_FOUND_EXCEPTION: File $file not found\u001B[0m") | ||
|
||
return properties | ||
} | ||
} |
32 changes: 5 additions & 27 deletions
32
android/buildSrc/src/main/kotlin/fhir-properties.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,23 @@ | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.extra | ||
import java.io.File | ||
import java.io.FileInputStream | ||
import java.io.FileNotFoundException | ||
import java.io.InputStreamReader | ||
import java.util.Properties | ||
|
||
val fhirAuthArray = arrayOf( | ||
"FHIR_BASE_URL", "OAUTH_BASE_URL", "OAUTH_CIENT_ID", "OAUTH_CLIENT_SECRET", "OAUTH_SCOPE" | ||
"FHIR_BASE_URL", "OAUTH_BASE_URL", "OAUTH_CIENT_ID", "OAUTH_CLIENT_SECRET", "OAUTH_SCOPE", "APP_ID" | ||
) | ||
//KEYSTORE CREDENTIALS | ||
val keystoreAuthArray = arrayOf( | ||
"KEYSTORE_ALIAS", "KEY_PASSWORD", "KEYSTORE_PASSWORD" | ||
) | ||
|
||
val localProperties = readProperties((properties["localPropertiesFile"] ?: "${rootProject.projectDir}/local.properties").toString()) | ||
val localProperties = ProjectProperties.readProperties((properties["localPropertiesFile"] ?: "${rootProject.projectDir}/local.properties").toString()) | ||
|
||
fhirAuthArray.forEach { property -> | ||
extra.set(property, localProperties.getProperty(property, when { | ||
property.contains("URL") -> "https://sample.url/fhir/" | ||
else -> "sample_" + property | ||
else -> "sample_$property" | ||
} | ||
)) | ||
} | ||
|
||
|
||
val keystoreProperties = readProperties((properties["keystorePropertiesFile"] ?: "${rootProject.projectDir}/keystore.properties").toString()) | ||
val keystoreProperties = ProjectProperties.readProperties((properties["keystorePropertiesFile"] ?: "${rootProject.projectDir}/keystore.properties").toString()) | ||
|
||
keystoreAuthArray.forEach { property -> | ||
extra.set(property, keystoreProperties.getProperty(property, "sample_" + property)) | ||
} | ||
|
||
fun Project.readProperties(file: String): Properties { | ||
val properties = Properties() | ||
val localProperties = File(file) | ||
if (localProperties.isFile) { | ||
InputStreamReader(FileInputStream(localProperties), Charsets.UTF_8).use { reader | ||
-> | ||
properties.load(reader) | ||
} | ||
} else println("\u001B[34mFILE_NOT_FOUND_EXCEPTION: File $file not found\u001B[0m") | ||
|
||
return properties | ||
extra.set(property, keystoreProperties.getProperty(property, "sample_$property")) | ||
} |
Oops, something went wrong.