summaryrefslogtreecommitdiffhomepage
path: root/build.gradle
blob: 9333da3584b4276a18a044c9c4c89ffbf14afd90 (plain)
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
buildscript {
    ext {
        activityVersion = '1.4.0'
        annotationsVersion = '1.3.0'
        appcompatVersion = '1.4.1'
        biometricVersion = '1.1.0'
        collectionVersion = '1.2.0'
        constraintLayoutVersion = '2.1.4'
        coordinatorLayoutVersion = '1.2.0'
        coreKtxVersion = '1.7.0'
        coroutinesVersion = '1.6.1'
        datastoreVersion = '1.0.0'
        desugarVersion = '1.1.5'
        fragmentVersion = '1.4.1'
        grpcVersion = '1.46.0'
        jsr305Version = '3.0.2'
        junitVersion = '4.13.2'
        lifecycleRuntimeKtxVersion = '2.4.1'
        materialComponentsVersion = '1.6.0'
        preferenceVersion = '1.2.0'
        protobufGradleVersion = '0.8.18'
        protocVersion = '3.20.1'
        zxingEmbeddedVersion = '4.3.0'

        groupName = 'com.wireguard.android'
    }

    dependencies {
        classpath "com.google.protobuf:protobuf-gradle-plugin:$protobufGradleVersion"
        // gradle plugin 4.0.1 required for fixing bug:
        // https://stackoverflow.com/questions/62168227/getting-source-and-destination-must-be-different-error-while-building-project/62223434#62223434
        //classpath "com.android.tools.build:gradle:$gradleVersion"
    }
}

plugins {
    id "de.undercouch.download" version "5.0.4"
}

task downloadCrowdin(type: Download) {
	src 'https://crowdin.com/backend/download/project/wireguard.zip'
	dest file('build/translations.zip')
	overwrite true
}

task cleanCrowdin(type: Delete) {
	delete 'ui/src/main/res/values-*/strings.xml'
}

task extractCrowdin(type: Copy, dependsOn: ['downloadCrowdin', 'cleanCrowdin']) {
	mustRunAfter 'downloadCrowdin'
	from zipTree(file('build/translations.zip'))
	into file('build/translations')
	doFirst {
		delete 'build/translations'
	}
}

task crowdin(type: Copy, dependsOn: ['extractCrowdin']) {
    mustRunAfter 'extractCrowdin'
    from 'build/translations/wireguard-android/ui/src/main/res'
    into 'ui/src/main/res/'
    doLast {
        delete 'build/translations'
        delete 'build/translations.zip'
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

tasks {
    wrapper {
        gradleVersion = "7.4.2"
        distributionSha256Sum = "29e49b10984e585d8118b7d0bc452f944e386458df27371b49b4ac1dec4b7fda"
    }
}

apply from: "version.gradle"