aboutsummaryrefslogtreecommitdiffstats
path: root/build.gradle
blob: 189d9950b9e8854006d52ce3acc5f1caf54f2852 (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
81
82
83
84
85
86
87
88
89
90
import com.vanniktech.maven.publish.SonatypeHost

buildscript {
    ext {
        pub = [
                publishVersion: 'SNAPSHOT-1.1.0',
                groupId       : 'io.github.landerlyoung',
        ]

        kotlin_version = '1.9.23'

        configRepo = { repo ->
            repo.mavenLocal()
            repo.jcenter()
            repo.google()
        }
    }

    configRepo repositories

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.9.20'
        classpath 'com.vanniktech:gradle-maven-publish-plugin:0.29.0'
        classpath 'com.android.tools.build:gradle:8.5.2'
    }
}

def publishProject = [
        annotation: "jenny-annotation",
        compiler  : "jenny-compiler",
]

allprojects {
    // basic
    configRepo buildscript.repositories
    configRepo repositories

    // config
    group = pub.groupId
    version = pub.publishVersion
    description = 'Java/Android JNI glue/proxy code generator'
    def artifactId = publishProject[name]

    // https://vanniktech.github.io/gradle-maven-publish-plugin/central/#configuring-the-pom
    // https://central.sonatype.com/publishing
    // https://central.sonatype.com/search?namespace=io.github.landerlyoung
    if (artifactId != null) {
        apply plugin: "com.vanniktech.maven.publish"

        mavenPublishing {
            publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
//            signAllPublications()
            coordinates(group, artifactId, version)

            pom {
                name = artifactId
                description = project.description
                inceptionYear = "2015"
                url = 'https://github.com/LanderlYoung/Jenny'
                licenses {
                    license {
                        name = "The Apache License, Version 2.0"
                        url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
                        distribution = "http://www.apache.org/licenses/LICENSE-2.0.txt"
                    }
                }
                developers {
                    developer {
                        id = "LanderlYoung"
                        name = "Landerl Young"
                        url = "https://github.com/LanderlYoung/"
                    }
                }
                scm {
                    url = 'https://github.com/LanderlYoung/Jenny'
                    connection = 'scm:git:git://github.com/LanderlYoung/Jenny.git'
                    developerConnection = "scm:git:ssh://git@github.com//LanderlYoung/Jenny.git"
                }
            }
        }

        // publish to mavenLocal
        //      ./gradlew -PRELEASE_SIGNING_ENABLED=false publishToMavenLocal
        // publish to staging https://central.sonatype.com/publishing
        //      ./gradlew publishAllPublicationsToMavenCentralRepository
        // publish to staging and auto release
        //      ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
    }
}