Skip to content

Commit 39b22ac

Browse files
Merge pull request #51 from contentstack/feat/DX-67-gcp-support
gcp support implementation
2 parents 39762c3 + 8f9b157 commit 39b22ac

File tree

8 files changed

+80
-99
lines changed

8 files changed

+80
-99
lines changed

.github/workflows/publish-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ jobs:
3434
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.mavenCentralPassword }}
3535
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signingInMemoryKey }}
3636
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signingInMemoryKeyId }}
37-
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingInMemoryKeyPassword }}
37+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingInMemoryKeyPassword }}

.github/workflows/publish-snapshot.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Publish - Snapshot
22

33
on:
44
push:
5+
branches:
6+
- master
57

68
jobs:
79
publish:
@@ -41,4 +43,4 @@ jobs:
4143
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.mavenCentralPassword }}
4244
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.signingInMemoryKey }}
4345
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.signingInMemoryKeyId }}
44-
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingInMemoryKeyPassword }}
46+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.signingInMemoryKeyPassword }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,6 @@ lib/
4545
src/androidTest/java/com/builtio/contentstack/ApplicationTest.java
4646
src/main/res/
4747
contentstack/src/androidTest/java/com/contentstack/sdk/SyncTestCase.java
48+
49+
# key file
50+
key.keystore

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
## Version 3.14.0
44

5-
### Date: 10-Feb-2024
5+
### Date: 13-May-2024
66

77
- support of new sync api
88
- initSeqSync in stack class
99
- seqSync in stack class
10+
- GCP support implementation
1011

1112
---
1213

contentstack/build.gradle

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
}
55

66
import com.vanniktech.maven.publish.SonatypeHost
7+
78
android.buildFeatures.buildConfig true
89

910
mavenPublishing {
@@ -39,7 +40,23 @@ mavenPublishing {
3940
}
4041
}
4142

43+
44+
tasks.register('jacocoTestReport', JacocoReport) {
45+
dependsOn['testDebugUnitTest', 'createDebugCoverageReport']
46+
reports {
47+
html.enabled = true
48+
}
49+
afterEvaluate {
50+
classDirectories.setFrom(files(classDirectories.files.collect {
51+
fileTree(dir: it, exclude: '**com/contentstack/okhttp**')
52+
fileTree(dir: it, exclude: '**com/contentstack/okio**')
53+
fileTree(dir: it, exclude: '**com/contentstack/txtmark**')
54+
}))
55+
}
56+
}
57+
4258
android {
59+
//namespace "com.contentstack.sdk"
4360
packagingOptions {
4461
exclude("META-INF/DEPENDENCIES")
4562
exclude("META-INF/LICENSE")
@@ -52,37 +69,36 @@ android {
5269
exclude("META-INF/*.kotlin_module")
5370
}
5471

55-
5672
testOptions {
5773
unitTests.all {
58-
jacoco {
59-
includeNoLocationClasses = true
60-
excludes = ['jdk.internal.*']
61-
}
74+
// jacoco {
75+
// includeNoLocationClasses = true
76+
// }
6277
}
6378
}
6479
signingConfigs {
6580
debug {
66-
storeFile file("/Users/shaileshmishra/keystore/key.keystore")
81+
storeFile file("../key.keystore")
6782
storePassword 'android'
6883
keyAlias 'key0'
6984
keyPassword 'android'
7085
}
7186
release {
72-
storeFile file("/Users/shaileshmishra/keystore/key.keystore")
87+
storeFile file("../key.keystore")
7388
storePassword 'android'
7489
keyAlias 'key0'
7590
keyPassword 'android'
7691
}
7792
}
7893
compileSdk 30
7994
defaultConfig {
95+
// Required when setting minSdkVersion to 20 or lower
8096
multiDexEnabled true
8197
minSdkVersion 23
8298
versionCode 1
8399
versionName "1.0"
84100
useLibrary 'org.apache.http.legacy'
85-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
101+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
86102
signingConfig signingConfigs.release
87103
}
88104

@@ -94,6 +110,7 @@ android {
94110
debuggable true
95111
testCoverageEnabled true
96112
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
113+
97114
buildConfigField "String", "host", localProperties['host']
98115
buildConfigField "String", "APIKey", localProperties['APIKey']
99116
buildConfigField "String", "deliveryToken", localProperties['deliveryToken']
@@ -115,16 +132,18 @@ android {
115132
}
116133
configurations { archives }
117134
dependencies {
135+
def multidex = "2.0.1"
118136
def volley = "1.2.1"
119137
def junit = "4.13.2"
120138
configurations.configureEach { resolutionStrategy.force 'com.android.support:support-annotations:23.1.0' }
121139
implementation fileTree(include: ['*.jar'], dir: 'libs')
122140
implementation "com.android.volley:volley:$volley"
123141
implementation "junit:junit:$junit"
142+
// For AGP 7.4+
124143
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
125144
testImplementation 'junit:junit:4.13.2'
126145
androidTestImplementation 'androidx.test:core:1.5.0'
127-
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
146+
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
128147
exclude group: 'com.android.support', module: 'support-annotations'
129148
})
130149
}
@@ -139,5 +158,6 @@ tasks.register('createJar', Jar) {
139158
archivesBaseName = "contentstack.jar"
140159
from('build/contentstack-jar/')
141160
include 'com/contentstack/'
161+
//include 'META-INF/'
142162
}
143163
createJar.dependsOn(clearJar, unzip, build)

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,17 @@ public void test_AZURE_NA() throws Exception {
178178
stack = Contentstack.stack(appContext, DEFAULT_API_KEY, DEFAULT_DELIVERY_TOKEN, DEFAULT_ENV, config);
179179
}
180180

181+
@Test
182+
public void test_GCP_NA() throws Exception {
183+
Config config = new Config();
184+
String DEFAULT_API_KEY = BuildConfig.APIKey;
185+
String DEFAULT_DELIVERY_TOKEN = BuildConfig.deliveryToken;
186+
String DEFAULT_ENV = BuildConfig.environment;
187+
String DEFAULT_HOST = BuildConfig.host;
188+
config.setHost(DEFAULT_HOST);
189+
config.setRegion(Config.ContentstackRegion.GCP_NA);
190+
Context appContext = InstrumentationRegistry.getTargetContext();
191+
stack = Contentstack.stack(appContext, DEFAULT_API_KEY, DEFAULT_DELIVERY_TOKEN, DEFAULT_ENV, config);
192+
}
193+
181194
}

contentstack/src/main/java/com/contentstack/sdk/Config.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void setBranch(String branch) {
5252
* config.setRegion(ContentstackRegion.EU);
5353
* config.setRegion(ContentstackRegion.AZURE_EU);
5454
* config.setRegion(ContentstackRegion.AZURE_NA);
55+
* config.setRegion(ContentstackRegion.GCP_NA);
5556
* }
5657
* </pre>
5758
*/
@@ -77,7 +78,7 @@ public Config earlyAccess(String[] earlyAccess) {
7778
return this;
7879
}
7980

80-
public enum ContentstackRegion {US, EU, AZURE_NA, AZURE_EU}
81+
public enum ContentstackRegion {US, EU, AZURE_NA, AZURE_EU, GCP_NA}
8182

8283
/**
8384
* Config constructor

0 commit comments

Comments
 (0)