@@ -43,13 +43,6 @@ android {
4343 storeFile file(" ${ rootDir} /demo.keystore.jks" )
4444 storePassword ' 123456'
4545 }
46- // Signing config which utilize external file properties
47- easyscan {
48- // keyAlias keystoreProperties['keyAlias']
49- // keyPassword keystoreProperties['keyPassword']
50- // storeFile file(keystoreProperties['storeFile'])
51- // storePassword keystoreProperties['storePassword']
52- }
5346 }
5447
5548 compileSdkVersion 30
@@ -64,7 +57,7 @@ android {
6457 targetSdkVersion 30
6558
6659 versionCode 46
67- versionName " 2.3.8 ." + versionCode. toString()
60+ versionName " 2.3.9 ." + versionCode. toString()
6861
6962 // Add build version and git hash to bundle (.aab) file name.
7063 setProperty(" archivesBaseName" , " $project . name -v$versionCode -${ gitHash} " )
@@ -99,11 +92,62 @@ android {
9992 initWith release
10093 matchingFallbacks = [' release' ]
10194 // To run release under IDE
102- signingConfig signingConfigs. easyscan
95+ signingConfig null // Will be override later
96+ }
97+ }
98+
99+ // Define flavors
100+ flavorDimensions ' stage'
101+ productFlavors {
102+ develop {
103+ dimension ' stage'
104+ }
105+ product {
106+ dimension ' stage'
107+
108+ repositories {
109+ maven {
110+ url ' http://repo.pixelnetica.com:8081/artifactory/libs-release'
111+ }
112+ }
113+
114+ // Using external file for app signing
115+ // Create a variable called keystorePropertiesFile, and initialize it to your
116+ // keystore.properties file, in the rootProject folder.
117+ def keystorePropertiesFile = rootProject. file(" ${ projectDir} /keystore.properties" )
118+
119+ try {
120+ keystorePropertiesFile. withInputStream { stream ->
121+ println " Configure signing flavor"
122+
123+ // Initialize a new Properties() object called keystoreProperties.
124+ def keystoreProperties = new Properties ()
125+
126+ // Load your keystore.properties file into the keystoreProperties object.
127+ keystoreProperties. load(stream)
128+
129+ signingConfig = android. signingConfigs. create(" ${ name} " )
130+ signingConfig. keyAlias = keystoreProperties[' keyAlias' ]
131+ signingConfig. keyPassword = keystoreProperties[' keyPassword' ]
132+ signingConfig. storeFile = file(keystoreProperties[' storeFile' ])
133+ signingConfig. storePassword = keystoreProperties[' storePassword' ]
134+ }
135+ } catch (IOException e) {
136+ println " Cannot read playstore properties"
137+ signingConfig null
138+ }
103139 }
140+ }
104141
142+ variantFilter { variant ->
143+ // To check for a certain build type, use variant.buildType.name == "<buildType>"
144+ if (variant. flavors[0 ]. name == ' develop' && variant. buildType. name == ' playstore' ) {
145+ // Gradle ignores any variants that satisfy the conditions above.
146+ setIgnore(true )
147+ }
105148 }
106149
150+
107151 // Add build version to apk file name
108152 applicationVariants. all { variant ->
109153 variant. outputs. all {
@@ -112,31 +156,60 @@ android {
112156 }
113157}
114158
159+ // Raise error of no signing config found
160+ task checkSigningConfig {
161+ doLast {
162+ android. applicationVariants. all { variant ->
163+ assert variant. signingConfig != null
164+ }
165+ }
166+ }
167+
168+ // Check signing configuration only for assembleProductPlaystore variant
169+ project. afterEvaluate {
170+ assembleProductPlaystore. dependsOn checkSigningConfig
171+ }
172+
115173repositories {
116174 flatDir{
117175 dirs ' libs'
118176 }
119- maven {
120- url ' http://repo.pixelnetica.com:8081/artifactory/libs-release'
121- }
122177}
123178
124179// Lookup dynamic libraries changes every 10 minutes
125180configurations. all {
126181 resolutionStrategy. cacheChangingModulesFor 10 , ' minutes'
182+
183+ // we work with the unreleased development version
184+ if (name. contains(' develop' )) {
185+ resolutionStrategy. dependencySubstitution. all { DependencySubstitution dependency ->
186+ if (dependency. requested instanceof ModuleComponentSelector ) {
187+ ModuleComponentSelector selector = (ModuleComponentSelector ) dependency. requested
188+ if (selector. group == ' com.pixelnetica.sdk' && selector. module == ' scanning-release' ) {
189+ def targetProject = findProject(' :scanning' )
190+ if (targetProject != null ) {
191+ println " Substitute mobule for configuration $name "
192+ dependency. useTarget targetProject
193+ }
194+ }
195+ }
196+ }
197+ }
127198}
128199
129200// Command to refresh dependencies
130201// gradlew.bat clean build --refresh-dependencies
131202
132203dependencies {
133204 // Take release library "-SNAPSHOT" behavior: update every changes, not only version number
134- implementation(' com.pixelnetica.sdk:scanning-release:2.3.8' ) { changing = true }
205+ implementation(' com.pixelnetica.sdk:scanning-release:2.3.9' ) { changing = true }
206+
207+ // Dependencies for develop stage
208+ developImplementation(' androidx.exifinterface:exifinterface:1.3.2' )
135209
136210 implementation " androidx.annotation:annotation:1.1.0"
137211 implementation " androidx.appcompat:appcompat:1.2.0"
138- implementation ' androidx.constraintlayout:constraintlayout:2.0.1'
139- implementation ' androidx.exifinterface:exifinterface:1.2.0'
140- implementation ' com.google.android.material:material:1.2.1'
212+ implementation ' androidx.constraintlayout:constraintlayout:2.0.4'
213+ implementation ' com.google.android.material:material:1.3.0'
141214 implementation ' androidx.lifecycle:lifecycle-extensions:2.2.0'
142215}
0 commit comments