123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- apply plugin: 'maven-publish'
- apply plugin: 'signing'
- ext {
- PUBLISH_GROUP_ID = 'io.github.yyxxgame.sdk'
- PUBLISH_ARTIFACT_ID = 'eyuancomm-sdk-ktx-impl'
- PUBLISH_VERSION = '1.0.0-rc4'
- }
- Properties properties = new Properties()
- properties.load(project.rootProject.file('local.properties').newDataInputStream())
- def ossrhUsername = properties.getProperty("SonaType.user")
- def ossrhPassword = properties.getProperty("SonaType.pwd")
- task androidSourcesJar(type: Jar) {
- archiveClassifier.set('source')
- if (project.plugins.findPlugin('com.android.library')) {
- from android.sourceSets.main.java.srcDirs
- } else {
- form sourceSets.main.java.srcDirs
- }
- exclude "**/R.class"
- exclude "**/BuildConfig.class"
- }
- publishing {
- publications {
- release(MavenPublication) {
- // The coordinates of the library, being set from variables that
- // we'll set up in a moment
- groupId PUBLISH_GROUP_ID
- artifactId PUBLISH_ARTIFACT_ID
- version PUBLISH_VERSION
- // Two artifacts, the `aar` and the sources
- artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
- artifact androidSourcesJar
- // Self-explanatory metadata for the most part
- pom {
- name = "${PUBLISH_GROUP_ID}:${PUBLISH_ARTIFACT_ID}"
- description = 'game comm sdk of eyuan'
- // If your project has a dedicated site, use its URL here
- url = 'https://github.com/yyxxgame'
- licenses {
- license {
- // 协议类型,一般默认Apache License2.0的话不用改:
- name = 'The Apache License, Version 2.0'
- url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- }
- }
- developers {
- developer {
- id = 'yyxxgame'
- name = 'yyxxgame'
- email = 'developcentre@yyxxgame.com'
- }
- }
- // Version control info, if you're using GitHub, follow the format as seen here
- scm {
- //修改成你的Git地址:
- connection = 'scm:git:gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
- developerConnection = 'scm:git:ssh://gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git'
- //分支地址:
- url = 'http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX'
- }
- // A slightly hacky fix so that your POM will include any transitive dependencies
- // that your library builds upon
- withXml {
- def dependenciesNode = asNode().appendNode('dependencies')
- for (def node : project.configurations.implementation.allDependencies) {
- if (node.group == "null" || node.name == "unspecified" || node.version == "null") {
- break
- }
- def dependencyNode = dependenciesNode.appendNode('dependency')
- dependencyNode.appendNode('groupId', node.group)
- dependencyNode.appendNode('artifactId', node.name)
- dependencyNode.appendNode('version', node.version)
- }
- }
- }
- }
- }
- repositories {
- // The repository to publish to, Sonatype/MavenCentral
- maven {
- // This is an arbitrary name, you may also use "mavencentral" or
- // any other name that's descriptive for you
- name = "mavencentral"
- def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
- def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
- // You only need this if you want to publish snapshots, otherwise just set the URL
- // to the release repo directly
- url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
- // The username and password we've fetched earlier
- credentials {
- username ossrhUsername
- password ossrhPassword
- }
- }
- }
- }
- signing {
- sign publishing.publications
- }
- publishReleasePublicationToMavencentralRepository.dependsOn(assemble)
|