Skip to content

Commit 8aae8b0

Browse files
committed
cleanup build.gradle script
1 parent dde9355 commit 8aae8b0

1 file changed

Lines changed: 1 addition & 58 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -81,67 +81,10 @@ task versionName {
8181
}
8282
}
8383

84-
def downloadBootstrap(String arch, String expectedChecksum, int version) {
85-
def digest = java.security.MessageDigest.getInstance("SHA-256")
86-
87-
def localUrl = "src/main/cpp/bootstrap-" + arch + ".zip"
88-
def file = new File(projectDir, localUrl)
89-
if (file.exists()) {
90-
def buffer = new byte[8192]
91-
def input = new FileInputStream(file)
92-
while (true) {
93-
def readBytes = input.read(buffer)
94-
if (readBytes < 0) break
95-
digest.update(buffer, 0, readBytes)
96-
}
97-
def checksum = new BigInteger(1, digest.digest()).toString(16)
98-
if (checksum == expectedChecksum) {
99-
return
100-
} else {
101-
logger.quiet("Deleting old local file with wrong hash: " + localUrl)
102-
file.delete()
103-
}
104-
}
105-
106-
def remoteUrl = "https://github.com/t-e-l/tel/raw/master/bootstrap/bootstrap-" + arch + ".zip"
107-
logger.quiet("Downloading " + remoteUrl + " ...")
108-
109-
file.parentFile.mkdirs()
110-
def out = new BufferedOutputStream(new FileOutputStream(file))
111-
112-
def connection = new URL(remoteUrl).openConnection()
113-
connection.setInstanceFollowRedirects(true)
114-
def digestStream = new java.security.DigestInputStream(connection.inputStream, digest)
115-
out << digestStream
116-
out.close()
117-
118-
def checksum = new BigInteger(1, digest.digest()).toString(16)
119-
if (checksum != expectedChecksum) {
120-
file.delete()
121-
throw new GradleException("Wrong checksum for " + remoteUrl + ": expected: " + expectedChecksum + ", actual: " + checksum)
122-
}
123-
}
124-
12584
clean {
12685
doLast {
12786
def tree = fileTree(new File(projectDir, 'src/main/cpp'))
12887
tree.include 'bootstrap-*.zip'
12988
tree.each { it.delete() }
13089
}
131-
}
132-
133-
task downloadBootstraps(){
134-
doLast {
135-
def version = 20
136-
/* downloadBootstrap("aarch64", "8fd227e33cf66d2be4029bf5d1002533c6278101aee9f5f80eb45f7a2cfc114", version)
137-
downloadBootstrap("arm", "872dfb346aeb929cab4ed3eeb75ab0608ee0a0f514603e29e2f735e4ceedc8c2", version)
138-
downloadBootstrap("i686", "ea29e28e12597fe81e09d91e257d8517171d0a93b93eb3ea55a976154dfe97b4", version)
139-
downloadBootstrap("x86_64", "59534506b3904d354c0f7b7e1202e52bca0d2d2e5226f88ddb9b979d3322c2d0", version)*/
140-
}
141-
}
142-
143-
afterEvaluate {
144-
android.applicationVariants.all { variant ->
145-
variant.javaCompileProvider.get().dependsOn(downloadBootstraps)
146-
}
147-
}
90+
}

0 commit comments

Comments
 (0)