lin
2025-08-14 dae8bad597b6607a449b32bf76c523423f7720ed
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
description = 'Conscrypt: OpenJdk UberJAR'
 
ext {
    buildUberJar = Boolean.parseBoolean(System.getProperty('org.conscrypt.openjdk.buildUberJar', 'false'))
    uberJarClassifiers = (System.getProperty('org.conscrypt.openjdk.uberJarClassifiers',
            'osx-x86_64,linux-x86_64,windows-x86,windows-x86_64')).split(',')
    classesDir = "${buildDir}/classes"
    resourcesDir = "${buildDir}/resources"
    sourcesDir = "${buildDir}/sources"
}
 
if (buildUberJar) {
    configurations {
        uberJar
    }
 
    // Point the jar task to the copied classes and resources directories.
    jar {
        from classesDir
        from resourcesDir
    }
 
    sourcesJar {
        from sourcesDir
    }
 
    // Add the dependencies for the uber jar.
    uberJarClassifiers.each { uberJarClassifier ->
        dependencies.uberJar "${group}:conscrypt-openjdk:${version}:${uberJarClassifier}"
    }
 
    /**
     * Copy the native libraries to the resources directory.
     */
    task copySharedLibs(type: Copy, dependsOn: configurations.uberJar) {
        from {
            configurations.uberJar.collect {
                zipTree(it)
            }
        }
        include '/META-INF/native/**'
        into file(resourcesDir)
    }
    jar.dependsOn copySharedLibs
 
    /**
     * Copy the object files to the classes directory.
     */
    task copyClasses(type: Copy, dependsOn: configurations.uberJar) {
        from {
            configurations.uberJar.collect {
                zipTree(it)
            }
        }
        exclude '/META-INF/**'
        into file(classesDir)
    }
    jar.dependsOn copyClasses
 
    task copySources(type: Copy, dependsOn: ":conscrypt-openjdk:sourcesJar") {
        from {
            project(":conscrypt-openjdk").sourceSets.main.java
        }
        into file(sourcesDir)
    }
    sourcesJar.dependsOn copySources
 
    // Note that this assumes that the version of BoringSSL for each
    // artifact exactly matches the one on the current system.
    jar.manifest {
        attributes ('BoringSSL-Version': boringSslVersion,
                    'Automatic-Module-Name': 'org.conscrypt')
    }
} else {
    // Not building an uber jar - disable all tasks.
    tasks.collect {
        it.enabled = false
    }
}