Skip to content

Commit

Permalink
发布文件调整
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheedon committed May 29, 2022
1 parent 224dd54 commit 9cd6c2a
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 50 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ buildscript {
classpath "com.android.tools.build:gradle:4.2.2"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
173 changes: 123 additions & 50 deletions script/gradle-jcenter-push.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,133 @@
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'

group = POM_GROUP_ID
version = VERSION_NAME

afterEvaluate {
publishing {
publications {
maven(MavenPublication) {

pom{
groupId = POM_GROUP_ID
artifactId = POM_ARTIFACT_ID
version = VERSION_NAME + POM_PACKAGING
}

if (project.hasProperty("android")) { // Android libraries
from components.release
artifact androidSourcesJar
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.kotlin.srcDirs
}

task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.kotlin.srcDirs
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
}
classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
} else { // Java libraries
from components.java
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java.srcDirs
}
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}
afterEvaluate { project ->
install {
repositories.mavenInstaller {
configurePOM(pom);
}
}

if (project.hasProperty("android")) { // Android libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.srcDirs
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference", "${android.sdkDirectory}/docs/reference"
}
classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
} else { // Java libraries
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java.srcDirs
}
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}
}

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
private configurePOM(def pom) {
pom.project {
packaging POM_PACKAGING
groupId POM_GROUP_ID
artifactId POM_ARTIFACT_ID

name POM_NAME
description POM_DESCRIPTION
url POM_URL

version VERSION_NAME
inceptionYear POM_INCEPTION_YEAR

licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
comments POM_LICENCE_COMMENTS
}
}

developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
// email POM_DEVELOPER_EMAIL
// url POM_DEVELOPER_URL
}
}

scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}

issueManagement {
system POM_ISSUE_MANAGEMENT_SYSTEM
url POM_ISSUE_MANAGEMENT_URL
}
}
}

// Default Bintray
def getRepositoryUser() {
return hasProperty('BINTRAY_USER') ? BINTRAY_USER : ""
}

def getRepositoryKey() {
return hasProperty('BINTRAY_KEY') ? BINTRAY_KEY : ""
}

def getRepositoryGPGPassword() {
return hasProperty('BINTRAY_GPG_PASSWORD') ? BINTRAY_GPG_PASSWORD : ""
}

bintray {
user = getRepositoryUser();
key = getRepositoryKey();

group = POM_GROUP_ID
version = VERSION_NAME

configurations = ['archives']

pkg {
repo = POM_BINTRAY_PRPO
name = POM_BINTRAY_NAME
desc = POM_DESCRIPTION
websiteUrl = POM_URL
vcsUrl = POM_GIT_URL
licenses = POM_LICENCE_ALL
publish = true
publicDownloadNumbers = true
version {
desc = POM_DESCRIPTION
gpg {
sign = !(getRepositoryGPGPassword() == null || getRepositoryGPGPassword() == "");
// true //Determines whether to GPG sign the files. The default is false
passphrase = getRepositoryGPGPassword();
//Optional. The passphrase for GPG signing'
}
}
}
}

0 comments on commit 9cd6c2a

Please sign in to comment.