-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
162 lines (134 loc) · 4.52 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
def version = '1.3.10'
def versionNum = 9000020
def webInstallDir = "${project.buildDir}/web"
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
}
}
repositories {
google()
mavenCentral()
}
apply plugin: 'com.android.application'
android {
dataBinding.enabled true
externalNativeBuild.cmake.path 'CMakeLists.txt'
defaultConfig {
applicationId 'com.ap.transmission.btc'
minSdkVersion 19
targetSdkVersion 30
compileSdkVersion 30
versionCode versionNum
versionName version
externalNativeBuild.cmake {
targets 'transmissionbtc'
arguments "-DTR_SRC_DIR=${project.buildDir}/transmission", "-DTR_WEB_INSTALL_DIR=${webInstallDir}"
}
ndk {
def abi = project.properties['ABI']
def filters = (abi != null) ? abi.split(",") : ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']
debugSymbolLevel 'FULL'
abiFilters = filters
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
def localPropsFile = file('local.properties')
if (localPropsFile.isFile()) {
def localProps = new Properties()
localProps.load(localPropsFile.newDataInputStream())
if (localProps['kestorePath'] != null) {
signingConfigs {
release {
storeFile file(localProps["kestorePath"])
storePassword localProps["kestorePassword"]
keyAlias localProps["kestoreAlias"]
keyPassword localProps["kestoreKeyPassword"]
}
}
}
}
sourceSets {
main {
assets.srcDirs += "${project.buildDir}/assets"
}
}
buildTypes {
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
applicationIdSuffix '.debug'
signingConfig signingConfigs.release
}
}
applicationVariants.all { v ->
tasks["merge${v.name.capitalize()}Assets"].dependsOn("mergeWebAssets${v.name.capitalize()}")
tasks["mergeWebAssets${v.name.capitalize()}"].dependsOn("externalNativeBuild${v.name.capitalize()}")
}
lintOptions {
disable 'MissingTranslation'
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
task cleanAll(type: Delete) {
delete project.buildDir
delete file(".cxx")
}
task mergeWebAssets() {
doLast {
def webDir = "${project.buildDir}/assets/web"
def arch = file("${project.buildDir}/web-control.tar.gz")
if (!arch.isFile()) {
def url = new URL('https://github.com/ronggang/transmission-web-control/archive/master.tar.gz')
url.withInputStream { i -> arch.withOutputStream { it << i } }
}
def md = java.security.MessageDigest.getInstance("SHA1")
arch.eachByte(1024 * 1024) { byte[] buf, int n -> md.update(buf, 0, n) }
def sha1 = new BigInteger(1, md.digest()).toString(16).padLeft( 40, '0' )
new File(webDir).mkdirs()
new File(webDir, 'checksum.sha1').write(sha1)
copy {
from "${webInstallDir}/usr/local/share/transmission/public_html"
into webDir
}
copy {
from "${webDir}/index.html"
into webDir
rename 'index.html', 'index.original.html'
}
copy {
from(tarTree(arch)) {
include 'transmission-web-control-master/src/**'
includeEmptyDirs = false
eachFile { fcd ->
fcd.relativePath = new RelativePath(!fcd.isDirectory(),
(String[]) fcd.relativePath.segments.drop(2))
}
}
into webDir
rename 'index.html', 'index.webcontrol.html'
}
}
}
task mergeWebAssetsRelease(dependsOn: mergeWebAssets) {
}
task mergeWebAssetsDebug(dependsOn: mergeWebAssets) {
}