Skip to content

Commit d547e50

Browse files
committed
fix: sca-scan workflow
1 parent 3356d58 commit d547e50

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

contentstack/build.gradle

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,26 @@ android {
112112

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

123-
buildConfigField "String", "host", localProperties['host']
124-
buildConfigField "String", "APIKey", localProperties['APIKey']
125-
buildConfigField "String", "deliveryToken", localProperties['deliveryToken']
126-
buildConfigField "String", "environment", localProperties['environment']
127-
buildConfigField "String", "contentTypeUID", localProperties['contentType']
128-
buildConfigField "String", "assetUID", localProperties['assetUid']
129-
buildConfigField "String", "variantUID", localProperties['variantUID']
130-
buildConfigField "String", "variantEntryUID", localProperties['variantEntryUID']
127+
buildConfigField "String", "host", getPropertyOrEmpty('host')
128+
buildConfigField "String", "APIKey", getPropertyOrEmpty('APIKey')
129+
buildConfigField "String", "deliveryToken", getPropertyOrEmpty('deliveryToken')
130+
buildConfigField "String", "environment", getPropertyOrEmpty('environment')
131+
buildConfigField "String", "contentTypeUID", getPropertyOrEmpty('contentType')
132+
buildConfigField "String", "assetUID", getPropertyOrEmpty('assetUid')
133+
buildConfigField "String", "variantUID", getPropertyOrEmpty('variantUID')
134+
buildConfigField "String", "variantEntryUID", getPropertyOrEmpty('variantEntryUID')
131135
buildConfigField "String[]", "variantsUID", variantsAsArrayString
132136
}
133137
release {

contentstack/src/androidTest/java/com/contentstack/sdk/EntryTestCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public void onCompletion(ResponseType responseType, Error error) {
324324

325325
@Test
326326
public void VariantsTestSingleUid(){
327-
final Entry entry = stack.contentType("author").entry(variantEntryUID).variants(variantUID);
327+
final Entry entry = stack.contentType("product").entry(variantEntryUID).variants(variantUID);
328328
entry.fetch(new EntryResultCallBack() {
329329
@Override
330330
public void onCompletion(ResponseType responseType, Error error) {
@@ -335,7 +335,7 @@ public void onCompletion(ResponseType responseType, Error error) {
335335
}
336336
@Test
337337
public void VariantsTestArray(){
338-
final Entry entry = stack.contentType("author").entry(variantEntryUID).variants(variantsUID);
338+
final Entry entry = stack.contentType("product").entry(variantEntryUID).variants(variantsUID);
339339
entry.fetch(new EntryResultCallBack() {
340340
@Override
341341
public void onCompletion(ResponseType responseType, Error error) {

0 commit comments

Comments
 (0)