This repository has been archived by the owner on Jun 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from milosmns/feature/maven-publish
Library publishing config
- Loading branch information
Showing
4 changed files
with
278 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,4 +202,5 @@ $RECYCLE.BIN/ | |
|
||
# Custom rules | ||
.gradle | ||
kssm/build | ||
kssm/build | ||
local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# POM project location config | ||
POM_URL=https://github.com/milosmns/kssm | ||
POM_SCM_URL=https://github.com/milosmns/kssm | ||
POM_SCM_CONNECTION=scm:git:git://github.com/milosmns/kssm.git | ||
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]:milosmns/kssm.git | ||
POM_ISSUE_URL=https://github.com/milosmns/kssm/issues | ||
|
||
# POM licensing config | ||
POM_LICENCE_NAME=MIT License, Version 3.0 | ||
POM_LICENCE_URL=https://opensource.org/licenses/MIT | ||
POM_ALL_LICENCES=['MIT-3.0'] | ||
POM_LICENCE_DIST=repo | ||
|
||
# POM project labeling | ||
POM_NAME=KSSM | ||
POM_DESCRIPTION=Simple State Machines in Kotlin (KSSM) | ||
POM_ARTIFACT_ID=kssm | ||
POM_PACKAGING=jar | ||
GROUP=me.angrybyte.kssm | ||
|
||
# POM developer config | ||
POM_DEVELOPER_ID=milosmns | ||
POM_DEVELOPER_NAME=Milos Marinkovic | ||
POM_DEVELOPER_EMAIL=[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
apply plugin: 'com.jfrog.bintray' | ||
apply plugin: 'com.github.dcendents.android-maven' | ||
|
||
// sets the project version | ||
version = VERSION_NAME | ||
group = GROUP | ||
|
||
// Bintray deployment config | ||
def projectName = project.rootProject.name | ||
def localPropertiesName = 'local.properties' | ||
def isLocalBuild = project.rootProject.file(localPropertiesName).exists() | ||
def uploadConfig = [ | ||
user : '', | ||
apiKey : '', | ||
gpgPassword: '', | ||
ossUser : '', | ||
ossPassword: '' | ||
] | ||
if (!isLocalBuild) { | ||
// load from environment variables | ||
println "# $projectName: '$localPropertiesName' not found, loading deployment config from environment variables" | ||
|
||
uploadConfig.user = System.env.BINTRAY_USER | ||
uploadConfig.apiKey = System.env.BINTRAY_API_KEY | ||
uploadConfig.gpgPassword = System.env.BINTRAY_GPG_PASSWORD | ||
uploadConfig.ossUser = System.env.BINTRAY_OSS_USER | ||
uploadConfig.ossPassword = System.env.BINTRAY_OSS_PASSWORD | ||
} else { | ||
// load from local properties | ||
println "# $projectName: '$localPropertiesName' found, loading deployment config from file" | ||
Properties fileProperties = new Properties() | ||
fileProperties.load(project.rootProject.file(localPropertiesName).newDataInputStream()) | ||
|
||
uploadConfig.user = fileProperties.getProperty('bintray.user') | ||
uploadConfig.apiKey = fileProperties.getProperty('bintray.apikey') | ||
uploadConfig.gpgPassword = fileProperties.getProperty('bintray.gpg.password') | ||
uploadConfig.ossUser = fileProperties.getProperty('bintray.oss.user') | ||
uploadConfig.ossPassword = fileProperties.getProperty('bintray.oss.password') | ||
} | ||
|
||
bintray { | ||
user = uploadConfig.user | ||
key = uploadConfig.apiKey | ||
|
||
configurations = ['archives'] | ||
pkg { | ||
repo = 'maven' | ||
name = POM_ARTIFACT_ID | ||
desc = POM_DESCRIPTION | ||
websiteUrl = POM_URL | ||
issueTrackerUrl = POM_ISSUE_URL | ||
vcsUrl = POM_SCM_URL | ||
licenses = ["Apache-2.0"] | ||
publish = true | ||
publicDownloadNumbers = true | ||
// noinspection GroovyAssignabilityCheck | ||
version { | ||
desc = POM_DESCRIPTION | ||
gpg { | ||
sign = true // Determines whether to GPG sign the files. The default is false | ||
passphrase = uploadConfig.gpgPassword // Optional. The passphrase for GPG signing | ||
} | ||
|
||
mavenCentralSync { | ||
sync = true | ||
user = uploadConfig.ossUser | ||
password = uploadConfig.ossPassword | ||
close = '1' | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().hasPlugin('com.android.library')) { | ||
install { | ||
repositories.mavenInstaller { | ||
configuration = configurations.archives | ||
|
||
pom.groupId = GROUP | ||
pom.artifactId = POM_ARTIFACT_ID | ||
pom.version = VERSION_NAME | ||
|
||
pom.project { | ||
name POM_NAME | ||
packaging POM_PACKAGING | ||
description POM_DESCRIPTION | ||
url POM_URL | ||
|
||
scm { | ||
url POM_SCM_URL | ||
connection POM_SCM_CONNECTION | ||
developerConnection POM_SCM_DEV_CONNECTION | ||
} | ||
|
||
licenses { | ||
license { | ||
name POM_LICENCE_NAME | ||
url POM_LICENCE_URL | ||
distribution POM_LICENCE_DIST | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id POM_DEVELOPER_ID | ||
name POM_DEVELOPER_NAME | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task androidJavadocs(type: Javadoc) { | ||
source = android.sourceSets.main.java.source | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
//failOnError true | ||
println "# $projectName: Configured Android javadocs" | ||
} | ||
|
||
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { | ||
classifier = 'javadoc' | ||
from androidJavadocs.destinationDir | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from android.sourceSets.main.java.source | ||
} | ||
} else { | ||
install { | ||
repositories.mavenInstaller { | ||
pom.groupId = GROUP | ||
pom.artifactId = POM_ARTIFACT_ID | ||
pom.version = VERSION_NAME | ||
|
||
pom.project { | ||
name POM_NAME | ||
packaging POM_PACKAGING | ||
description POM_DESCRIPTION | ||
url POM_URL | ||
|
||
scm { | ||
url POM_SCM_URL | ||
connection POM_SCM_CONNECTION | ||
developerConnection POM_SCM_DEV_CONNECTION | ||
} | ||
|
||
licenses { | ||
license { | ||
name POM_LICENCE_NAME | ||
url POM_LICENCE_URL | ||
distribution POM_LICENCE_DIST | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id POM_DEVELOPER_ID | ||
name POM_DEVELOPER_NAME | ||
email POM_DEVELOPER_EMAIL | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.getDestinationDir() | ||
//failOnError false | ||
println "# $projectName: Configured JAR javadocs" | ||
} | ||
} | ||
|
||
if (JavaVersion.current().isJava8Compatible()) { | ||
allprojects { | ||
tasks.withType(Javadoc) { | ||
options.addStringOption('Xdoclint:none', '-quiet') | ||
} | ||
} | ||
} | ||
|
||
artifacts { | ||
if (project.getPlugins().hasPlugin('com.android.application') || project.getPlugins().hasPlugin('com.android.library')) { | ||
archives androidSourcesJar | ||
archives androidJavadocsJar | ||
} else { | ||
archives sourcesJar | ||
archives javadocJar | ||
} | ||
} |