Created
August 1, 2021 02:08
-
-
Save morristech/5f10f6cba123bea62ea5234136fddb64 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import java.util.regex.Matcher | |
| import java.util.regex.Pattern | |
| apply plugin: 'com.google.gms.google-services' | |
| apply plugin: 'com.android.application' | |
| apply plugin: 'io.fabric' | |
| buildscript { | |
| repositories { | |
| maven { url 'https://maven.fabric.io/public' } | |
| jcenter() | |
| } | |
| dependencies { | |
| classpath 'io.fabric.tools:gradle:1.25.3' | |
| } | |
| } | |
| repositories { | |
| jcenter() | |
| mavenCentral() | |
| google() | |
| maven { url 'https://maven.fabric.io/public' } | |
| maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } | |
| maven { url "https://maven.google.com" } | |
| } | |
| android { | |
| compileSdkVersion 26 | |
| buildToolsVersion "27.0.3" | |
| defaultConfig { | |
| minSdkVersion 15 | |
| targetSdkVersion 25 | |
| multiDexEnabled true | |
| resConfigs "en", "ru" | |
| } | |
| dexOptions { | |
| javaMaxHeapSize "4g" | |
| preDexLibraries = false | |
| } | |
| def manifestProductionPath = 'src/prodServer/AndroidManifest.xml' | |
| def manifestStagingPath = 'src/devServer/AndroidManifest.xml' | |
| def manifestCommonPath = 'src/common/AndroidManifest.xml' | |
| def jniLibsPath = 'src/common/libs' | |
| sourceSets { | |
| main { | |
| java.srcDirs = ['src/common/java'] | |
| res.srcDirs = ['src/common/res'] | |
| assets.srcDirs = ['src/common/assets'] | |
| manifest.srcFile manifestCommonPath | |
| } | |
| devServer { | |
| java.srcDirs = ['src/devServer/java'] | |
| res.srcDirs = ['src/devServer/res'] | |
| manifest.srcFile manifestStagingPath | |
| jniLibs.srcDir jniLibsPath | |
| } | |
| prodServer { | |
| java.srcDirs = ['src/prodServer/java'] | |
| res.srcDirs = ['src/prodServer/res'] | |
| manifest.srcFile manifestProductionPath | |
| jniLibs.srcDir jniLibsPath | |
| } | |
| } | |
| flavorDimensions "environment" | |
| productFlavors { | |
| devServer { | |
| applicationId 'com.example' | |
| versionCode Integer.valueOf(StagingVersionCode) | |
| versionName StagingVersionName | |
| dimension 'environment' | |
| } | |
| prodServer { | |
| applicationId 'com.example' | |
| versionCode Integer.valueOf(ProductionVersionCode) | |
| versionName ProductionVersionName | |
| dimension 'environment' | |
| } | |
| } | |
| signingConfigs { | |
| StagingSigning { | |
| storeFile file("keystore.jks") | |
| storePassword "***some_password*****" | |
| keyAlias "someapp" | |
| keyPassword "***some_password_2*****" | |
| } | |
| ProductionSigning { | |
| storeFile file("keystore.jks") | |
| storePassword "***some_password*****" | |
| keyAlias "someapp" | |
| keyPassword "***some_password_2*****" | |
| } | |
| } | |
| // detect product and set configurations | |
| def defSigningConfig = signingConfigs.StagingSigning | |
| def defProguardFiles = 'proguard-rules.pro' | |
| def defEnvironment = getCurrentFlavor() | |
| if (StagingEnvironment.toLowerCase() == defEnvironment) { | |
| println "===================STAGING ENVIRONMENT===========================" | |
| defSigningConfig = signingConfigs.StagingSigning | |
| defaultConfig { | |
| versionCode Integer.valueOf(StagingVersionCode) | |
| versionName StagingVersionName | |
| } | |
| } else if (ProductionEnvironment.toLowerCase() == defEnvironment) { | |
| println "===================PRODUCTION ENVIRONMENT===========================" | |
| defSigningConfig = signingConfigs.ProductionSigning | |
| defaultConfig { | |
| versionCode Integer.valueOf(ProductionVersionCode) | |
| versionName ProductionVersionName | |
| } | |
| } else { | |
| println "===================NO ENVIRONMENT===========================" | |
| defSigningConfig = signingConfigs.StagingSigning | |
| defaultConfig { | |
| versionCode Integer.valueOf(StagingVersionCode) | |
| versionName StagingVersionName | |
| } | |
| } | |
| buildTypes { | |
| debug { | |
| signingConfig defSigningConfig | |
| buildConfigField "boolean", "LOG", "true" | |
| dependencies { | |
| implementation "com.facebook.android:facebook-android-sdk:4.6.0" | |
| } | |
| minifyEnabled false | |
| proguardFiles getDefaultProguardFile('proguard-android.txt'), defProguardFiles | |
| } | |
| release { | |
| signingConfig defSigningConfig | |
| buildConfigField "boolean", "LOG", "false" | |
| dependencies { | |
| implementation "com.facebook.android:facebook-android-sdk:4.20.0" | |
| } | |
| minifyEnabled false | |
| proguardFiles getDefaultProguardFile('proguard-android.txt'), defProguardFiles | |
| } | |
| } | |
| android.applicationVariants.all { variant -> | |
| variant.outputs.all { | |
| def version = variant.versionName | |
| def versionCode = variant.versionCode | |
| outputFileName ="${variant.name}-${version}(${versionCode}).apk" | |
| } | |
| } | |
| packagingOptions { | |
| exclude 'META-INF/DEPENDENCIES' | |
| exclude 'META-INF/LICENSE' | |
| exclude 'META-INF/LICENSE.txt' | |
| exclude 'META-INF/license.txt' | |
| exclude 'META-INF/NOTICE' | |
| exclude 'META-INF/NOTICE.txt' | |
| exclude 'META-INF/notice.txt' | |
| exclude 'META-INF/ASL2.0' | |
| } | |
| compileOptions { | |
| targetCompatibility 1.8 | |
| sourceCompatibility 1.8 | |
| } | |
| } | |
| ext { | |
| supportLibraryVersion = '26.1.0' | |
| playServicesVersion = '15.0.0' | |
| retrofit2Version = '2.1.0' | |
| okhttp3Version = '3.6.0' | |
| rx = '1.2.1' | |
| } | |
| configurations { | |
| all*.exclude module: 'commons-io' | |
| } | |
| dependencies { | |
| implementation fileTree(dir: 'libs', include: ['*.jar']) | |
| implementation "com.android.support:appcompat-v7:$supportLibraryVersion" | |
| implementation "com.android.support:design:$supportLibraryVersion" | |
| implementation "com.android.support:recyclerview-v7:$supportLibraryVersion" | |
| implementation "com.android.support:support-v4:$supportLibraryVersion" | |
| implementation "com.android.support:customtabs:$supportLibraryVersion" | |
| implementation "com.android.support:animated-vector-drawable:$supportLibraryVersion" | |
| implementation "com.android.support:cardview-v7:$supportLibraryVersion" | |
| implementation "com.squareup.retrofit2:retrofit:$retrofit2Version" | |
| implementation "com.squareup.retrofit2:converter-gson:$retrofit2Version" | |
| implementation "com.squareup.retrofit2:adapter-rxjava:$retrofit2Version" | |
| implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3Version" | |
| implementation "com.squareup.okhttp3:okhttp:$okhttp3Version" | |
| implementation "com.google.android.gms:play-services-gcm:$playServicesVersion" | |
| implementation "com.google.android.gms:play-services-auth:$playServicesVersion" | |
| implementation "com.google.android.gms:play-services-location:$playServicesVersion" | |
| implementation "io.reactivex:rxjava:$rx" | |
| implementation "io.reactivex:rxandroid:$rx" | |
| //alone entities | |
| implementation('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') { | |
| transitive = true | |
| } | |
| implementation('io.fabric.sdk.android:fabric:1.3.10@aar') { | |
| transitive = true | |
| } | |
| } | |
| def getCurrentFlavor() { | |
| Gradle gradle = getGradle() | |
| String tskReqStr = gradle.getStartParameter().getTaskRequests().toString() | |
| Pattern pattern; | |
| if( tskReqStr.contains( "assemble" ) ) | |
| pattern = Pattern.compile("assemble(\\w+)(Release|Debug)") | |
| else | |
| pattern = Pattern.compile("generate(\\w+)(Release|Debug)") | |
| Matcher matcher = pattern.matcher( tskReqStr ) | |
| if( matcher.find() ) | |
| return matcher.group(1).toLowerCase() | |
| else | |
| { | |
| println "NO MATCH FOUND" | |
| return "" | |
| } | |
| } |
This file contains hidden or 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
| # Project-wide Gradle settings. | |
| # IDE (e.g. Android Studio) users: | |
| # Gradle settings configured through the IDE *will override* | |
| # any settings specified in this file. | |
| # For more details on how to configure your build environment visit | |
| # http://www.gradle.org/docs/current/userguide/build_environment.html | |
| # Specifies the JVM arguments used for the daemon process. | |
| # The setting is particularly useful for tweaking memory settings. | |
| # Default value: -Xmx10248m -XX:MaxPermSize=256m | |
| org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | |
| # When configured, Gradle will run in incubating parallel mode. | |
| # This option should only be used with decoupled projects. More details, visit | |
| # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | |
| org.gradle.parallel=true | |
| StagingEnvironment = devServer | |
| ProductionEnvironment = prodServer | |
| StagingVersionName = 1.0.7_staging | |
| StagingVersionCode = 14 | |
| ProductionVersionName = 1.0.7 | |
| ProductionVersionCode = 14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment