|
1 |
| -// Top-level build file where you can add configuration options common to all sub-projects/modules. |
| 1 | +apply plugin: 'com.android.application' |
2 | 2 |
|
3 |
| -buildscript { |
4 |
| - repositories { |
5 |
| - maven { url "https://mvnrepository.com/artifact" } |
6 |
| - mavenCentral() |
7 |
| - google() |
8 |
| - } |
9 |
| - dependencies { |
10 |
| - //noinspection GradleDependency |
11 |
| - classpath 'com.android.tools.build:gradle:2.3.0' |
12 |
| - |
13 |
| - // NOTE: Do not place your application dependencies here; they belong |
14 |
| - // in the individual module build.gradle files |
| 3 | +def getGitHubCommit = { |
| 4 | + try { |
| 5 | + def hashOutput = new ByteArrayOutputStream() |
| 6 | + def changeOutput = new ByteArrayOutputStream() |
| 7 | + def gitVersionName |
| 8 | + exec { |
| 9 | + commandLine 'git', 'rev-list', '--max-count=1', 'HEAD' |
| 10 | + standardOutput = hashOutput |
| 11 | + } |
| 12 | + exec { |
| 13 | + commandLine 'git', 'diff-index', '--shortstat', 'HEAD' |
| 14 | + standardOutput = changeOutput |
| 15 | + } |
| 16 | + gitVersionName = hashOutput.toString().trim().substring(0, 7); |
| 17 | + if (!changeOutput.toString().trim().empty) { |
| 18 | + def pattern = Pattern.compile("\\d+"); |
| 19 | + def matcher = pattern.matcher(changeOutput.toString().trim()) |
| 20 | + if (matcher.find()) { |
| 21 | + gitVersionName += "-" + matcher.group() |
| 22 | + } |
| 23 | + } |
| 24 | + return gitVersionName |
| 25 | + } catch (ignored) { |
| 26 | + return "UNKNOWN" |
15 | 27 | }
|
16 | 28 | }
|
17 | 29 |
|
18 |
| -allprojects { |
19 |
| - repositories { |
20 |
| - jcenter() |
21 |
| - mavenCentral() |
22 |
| - maven { url "https://jitpack.io" } |
23 |
| - maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } |
24 |
| - maven { url "https://maven.aliyun.com/repository/jcenter" } |
25 |
| - google() |
26 |
| - maven { |
27 |
| - url "https://maven.vriska.ru/" |
28 |
| - credentials { |
29 |
| - username "gradle" |
30 |
| - password "gradle" |
| 30 | +android { |
| 31 | + signingConfigs { |
| 32 | + if (file('.signing/app-release.prop').exists()) { |
| 33 | + release { |
| 34 | + Properties props = new Properties(); |
| 35 | + props.load(new FileInputStream(file(".signing/app-release.prop"))) |
| 36 | + storeFile file(props['RELEASE_STORE_FILE']) |
| 37 | + storePassword props['RELEASE_STORE_PASSWORD'] |
| 38 | + keyAlias props['RELEASE_KEY_ALIAS'] |
| 39 | + keyPassword props['RELEASE_KEY_PASSWORD'] |
| 40 | + } |
| 41 | + } |
| 42 | + debug { |
| 43 | + if (file('.signing/app-debug.prop').exists()) { |
| 44 | + Properties props = new Properties(); |
| 45 | + props.load(new FileInputStream(file(".signing/app-debug.prop"))) |
| 46 | + storeFile file(props['RELEASE_STORE_FILE']) |
| 47 | + storePassword props['RELEASE_STORE_PASSWORD'] |
| 48 | + keyAlias props['RELEASE_KEY_ALIAS'] |
| 49 | + keyPassword props['RELEASE_KEY_PASSWORD'] |
31 | 50 | }
|
32 | 51 | }
|
| 52 | + fdroid { |
| 53 | + if (file('.signing/app-fdroid.prop').exists()) { |
| 54 | + Properties props = new Properties(); |
| 55 | + props.load(new FileInputStream(file(".signing/app-fdroid.prop"))) |
| 56 | + storeFile file(props['RELEASE_STORE_FILE']) |
| 57 | + storePassword props['RELEASE_STORE_PASSWORD'] |
| 58 | + keyAlias props['RELEASE_KEY_ALIAS'] |
| 59 | + keyPassword props['RELEASE_KEY_PASSWORD'] |
| 60 | + } |
| 61 | + } |
| 62 | + } |
| 63 | + splits { |
| 64 | + abi { |
| 65 | + enable true |
| 66 | + reset() |
| 67 | + universalApk true |
| 68 | + } |
| 69 | + } |
| 70 | + lintOptions { |
| 71 | + checkReleaseBuilds false |
| 72 | + } |
| 73 | + compileSdkVersion 29 |
| 74 | + //noinspection GradleDependency |
| 75 | + buildToolsVersion "29.0.0" |
| 76 | + defaultConfig { |
| 77 | + applicationId "uk.openvk.android.legacy" |
| 78 | + //noinspection MinSdkTooLow |
| 79 | + minSdkVersion 7 |
| 80 | + //noinspection GradleDependency,OldTargetApi |
| 81 | + targetSdkVersion 29 |
| 82 | + versionCode 242 |
| 83 | + versionName "1.2.242-u" |
33 | 84 | }
|
| 85 | + buildTypes { |
| 86 | + release { |
| 87 | + buildConfigField "String", "GITHUB_COMMIT", "\"${getGitHubCommit()}\"" |
| 88 | + buildConfigField "String", "SOURCE_CODE", "\"https://github.com/openvk/mobile-android-legacy\"" |
| 89 | + } |
| 90 | + debug { |
| 91 | + buildConfigField "String", "GITHUB_COMMIT", "\"${getGitHubCommit()}\"" |
| 92 | + buildConfigField "String", "SOURCE_CODE", "\"https://github.com/openvk/mobile-android-legacy\"" |
| 93 | + } |
| 94 | + } |
| 95 | + productFlavors { |
| 96 | + prereleaseConfig { |
| 97 | + applicationId "uk.openvk.android.legacy" |
| 98 | + //noinspection MinSdkTooLow |
| 99 | + minSdkVersion 7 |
| 100 | + //noinspection OldTargetApi |
| 101 | + targetSdkVersion 29 |
| 102 | + versionCode 242 |
| 103 | + versionName "1.2.242-d" |
| 104 | + signingConfig signingConfigs.debug |
| 105 | + } |
| 106 | + releaseConfig { |
| 107 | + minSdkVersion 7 |
| 108 | + applicationId 'uk.openvk.android.legacy' |
| 109 | + targetSdkVersion 29 |
| 110 | + versionCode 242 |
| 111 | + versionName '1.2.242' |
| 112 | + if (file('.signing/app-release.prop').exists()) { |
| 113 | + signingConfig signingConfigs.release |
| 114 | + } |
| 115 | + } |
| 116 | + fdroidConfig { |
| 117 | + applicationId "uk.openvk.android.legacy" |
| 118 | + //noinspection MinSdkTooLow |
| 119 | + minSdkVersion 7 |
| 120 | + //noinspection OldTargetApi |
| 121 | + targetSdkVersion 29 |
| 122 | + versionCode 242 |
| 123 | + versionName "1.2.242-f" |
| 124 | + if (file('.signing/app-fdroid.prop').exists()) { |
| 125 | + signingConfig signingConfigs.fdroid |
| 126 | + } |
| 127 | + } |
| 128 | + } |
| 129 | + compileOptions { |
| 130 | + sourceCompatibility JavaVersion.VERSION_1_7 |
| 131 | + targetCompatibility JavaVersion.VERSION_1_7 |
| 132 | + } |
| 133 | +} |
| 134 | + |
| 135 | +dependencies { |
| 136 | + compile fileTree(include: ['*.jar'], dir: 'libs') |
| 137 | + //noinspection GradleDependency,GradleCompatible |
| 138 | + compile 'com.android.support:recyclerview-v7:24.0.0' |
| 139 | + compile 'com.android.support:multidex:1.0.3' |
| 140 | + compile 'com.commit451:PhotoView:1.2.5' |
| 141 | + //noinspection GradleDependency,GradleCompatible |
| 142 | + compile 'com.android.support:support-v4:24.0.0' |
| 143 | + //noinspection GradleDependency,GradleCompatible |
| 144 | + compile 'com.android.support:appcompat-v7:24.0.0' |
| 145 | + //noinspection GradleCompatible,GradleDependency |
| 146 | + compile 'com.android.support:preference-v7:24.0.0' |
| 147 | + compile 'com.readystatesoftware.systembartint:systembartint:1.0.3' |
| 148 | + compile project(':modules:actionbar') |
| 149 | + compile project(':modules:popupmenu') |
| 150 | + compile 'com.reginald.swiperefresh:library:1.1.2' |
| 151 | + compile 'com.seppius.plurals:android-i18n-plurals:1.1' |
| 152 | + // Android 2.x plurals patch |
| 153 | + compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' |
| 154 | + compile 'ch.acra:acra:4.6.0' |
| 155 | + compile 'com.nineoldandroids:library:2.4.0' |
| 156 | + compile 'org.apmem.tools:layouts:1.8' |
| 157 | + compile project(':modules:twemojicon') |
| 158 | + compile project(':modules:ovk-api') |
34 | 159 | }
|
0 commit comments