Skip to content

Commit

Permalink
fix: sca-scan workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
reeshika-h committed Sep 12, 2024
1 parent 3356d58 commit d547e50
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
24 changes: 14 additions & 10 deletions contentstack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,26 @@ android {

def localProperties = new Properties()
localProperties.load(new FileInputStream(rootProject.file("local.properties")))
def variantsArray = localProperties['variantsUID']?.split(",")?.collect { it.trim() }
def variantsAsArrayString = 'new String[] {' + variantsArray.collect { "\"$it\"" }.join(", ") + '}'
def getPropertyOrEmpty = { key ->
def value = localProperties.getProperty(key)
return value != null ? "$value" : "\"\""
}
def variantsArray = localProperties.getProperty('variantsUID')?.split(",")?.collect { it.trim() }
def variantsAsArrayString = variantsArray ? 'new String[] {' + variantsArray.collect { "\"$it\"" }.join(", ") + '}' : "new String[0]"
buildTypes {
debug {
debuggable true
testCoverageEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

buildConfigField "String", "host", localProperties['host']
buildConfigField "String", "APIKey", localProperties['APIKey']
buildConfigField "String", "deliveryToken", localProperties['deliveryToken']
buildConfigField "String", "environment", localProperties['environment']
buildConfigField "String", "contentTypeUID", localProperties['contentType']
buildConfigField "String", "assetUID", localProperties['assetUid']
buildConfigField "String", "variantUID", localProperties['variantUID']
buildConfigField "String", "variantEntryUID", localProperties['variantEntryUID']
buildConfigField "String", "host", getPropertyOrEmpty('host')
buildConfigField "String", "APIKey", getPropertyOrEmpty('APIKey')
buildConfigField "String", "deliveryToken", getPropertyOrEmpty('deliveryToken')
buildConfigField "String", "environment", getPropertyOrEmpty('environment')
buildConfigField "String", "contentTypeUID", getPropertyOrEmpty('contentType')
buildConfigField "String", "assetUID", getPropertyOrEmpty('assetUid')
buildConfigField "String", "variantUID", getPropertyOrEmpty('variantUID')
buildConfigField "String", "variantEntryUID", getPropertyOrEmpty('variantEntryUID')
buildConfigField "String[]", "variantsUID", variantsAsArrayString
}
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public void onCompletion(ResponseType responseType, Error error) {

@Test
public void VariantsTestSingleUid(){
final Entry entry = stack.contentType("author").entry(variantEntryUID).variants(variantUID);
final Entry entry = stack.contentType("product").entry(variantEntryUID).variants(variantUID);
entry.fetch(new EntryResultCallBack() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
Expand All @@ -335,7 +335,7 @@ public void onCompletion(ResponseType responseType, Error error) {
}
@Test
public void VariantsTestArray(){
final Entry entry = stack.contentType("author").entry(variantEntryUID).variants(variantsUID);
final Entry entry = stack.contentType("product").entry(variantEntryUID).variants(variantsUID);
entry.fetch(new EntryResultCallBack() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
Expand Down

0 comments on commit d547e50

Please sign in to comment.