mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
remove dead code from gradle wrt BUILD_TIMESTAMPS used in signal for expiring builds
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import java.security.MessageDigest
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
@@ -158,7 +156,6 @@ android {
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
project.ext.set("archivesBaseName", "Deltachat");
|
||||
|
||||
buildConfigField "long", "BUILD_TIMESTAMP", getLastCommitTimestamp() + "L"
|
||||
buildConfigField "boolean", "DEV_BUILD", "false"
|
||||
|
||||
ndk {
|
||||
@@ -265,59 +262,3 @@ android {
|
||||
abortOnError false
|
||||
}
|
||||
}
|
||||
|
||||
task assembleWebsiteDescriptor << {
|
||||
android.applicationVariants.all { variant ->
|
||||
if (variant.name.equals("websiteDebug") ||
|
||||
variant.name.equals("websiteRelease"))
|
||||
{
|
||||
File file = new File(variant.outputs[0].outputFile.path)
|
||||
|
||||
if (file.exists()) {
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
file.eachByte 4096, {bytes, size ->
|
||||
md.update(bytes, 0, size);
|
||||
}
|
||||
|
||||
String digest = md.digest().collect {String.format "%02x", it}.join();
|
||||
String url = variant.productFlavors.get(0).ext.websiteUpdateUrl
|
||||
String apkName = variant.outputs[0].outputFile.name
|
||||
|
||||
String descriptor = "{" +
|
||||
"\"versionCode\" : $project.android.defaultConfig.versionCode," +
|
||||
"\"versionName\" : \"$project.android.defaultConfig.versionName\"," +
|
||||
"\"sha256sum\" : \"$digest\"," +
|
||||
"\"url\" : \"$url/$apkName\"" +
|
||||
"}"
|
||||
|
||||
File descriptorFile = new File(variant.outputs[0].outputFile.parent, apkName.replace(".apk", ".json"))
|
||||
|
||||
descriptorFile.write(descriptor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.whenTaskAdded { task ->
|
||||
if (task.name.equals("lint")) {
|
||||
task.enabled = false
|
||||
}
|
||||
|
||||
if (task.name.equals("assembleWebsiteDebug") ||
|
||||
task.name.equals("assembleWebsiteRelease"))
|
||||
{
|
||||
task.finalizedBy assembleWebsiteDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
def getLastCommitTimestamp() {
|
||||
new ByteArrayOutputStream().withStream { os ->
|
||||
def result = exec {
|
||||
executable = 'git'
|
||||
args = ['log', '-1', '--pretty=format:%ct']
|
||||
standardOutput = os
|
||||
}
|
||||
|
||||
return os.toString() + "000"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user