-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
publishing config
- Loading branch information
Showing
7 changed files
with
242 additions
and
60 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 |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
/build | ||
/captures | ||
.externalNativeBuild | ||
/bintray.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
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,21 @@ | ||
ext.version = "1.0" | ||
ext.group = "xyz.peridy.shimmer" | ||
ext.name = "ShimmerLayout" | ||
ext.scm = 'https://github.com/rnpy/ShimmerLayout.git' | ||
ext.description = 'Simple, memory efficient and high performance Shimmer Layout for Android.' | ||
|
||
ext.minSdk = 15 | ||
ext.compileSdk = 26 | ||
ext.buildTools = "26.0.2" | ||
ext.kotlin_version = '1.2.21' | ||
ext.bintray_version = '1.7.3' | ||
ext.gradle_version = '3.0.1' | ||
ext.android_support_version = '27.0.2' | ||
ext.maven_gradle_plugin_version = '2.0' | ||
ext.dexcount_version = '0.8.2' | ||
|
||
// Demo app | ||
ext.rxlifecycle2_version = '2.2.0' | ||
ext.google_play_services_version = '11.4.0' | ||
ext.rxandroid_version = '2.0.1' | ||
ext.rxjava_version = '2.1.5' |
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,113 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'com.jfrog.bintray' | ||
|
||
project.afterEvaluate { | ||
if (project.plugins.hasPlugin("com.android.library")) { | ||
project.android.libraryVariants.all { variant -> | ||
variant.getOutputs().all { output -> | ||
outputFileName = new File("${project.name}-v${project.version}.aar") | ||
} | ||
} | ||
} | ||
} | ||
|
||
project.group = project.ext.group | ||
project.version = project.ext.version | ||
|
||
bintray { | ||
user = BINTRAY_USERNAME | ||
key = BINTRAY_API_KEY | ||
pkg { | ||
repo = 'shimmer' | ||
name = getArtifactId() | ||
licenses = ['BSD 2-Clause'] | ||
vcsUrl = project.ext.scm | ||
version { | ||
name = project.version | ||
desc = project.ext.description | ||
released = new Date() | ||
vcsTag = project.version | ||
} | ||
publications = ['Bintray'] | ||
} | ||
} | ||
|
||
// Create the pom configuration: | ||
def pomConfig = { | ||
licenses { | ||
license { | ||
name "BSD 2-Clause" | ||
url "http://www.opensource.org/licenses/bsd-license.php" | ||
distribution "repo" | ||
} | ||
} | ||
scm { | ||
url ext.scm | ||
} | ||
} | ||
|
||
//create a jar from source files | ||
task sourceJar(type: Jar) { | ||
if (project.plugins.hasPlugin("com.android.library")) { | ||
from android.sourceSets.main.java.srcDirs | ||
classifier "sources" | ||
} | ||
} | ||
|
||
publishing.publications { | ||
Bintray(MavenPublication) { | ||
groupId project.ext.group | ||
artifactId getArtifactId() | ||
version project.ext.version | ||
|
||
artifact sourceJar | ||
artifact "$buildDir/outputs/aar/${project.name}-v${project.version}.aar" | ||
|
||
//generate pom nodes for dependencies | ||
//when a project references another project, it's artifact node is generated | ||
pom.withXml { | ||
def root = asNode() | ||
root.appendNode('description', project.ext.description) | ||
root.appendNode('name', project.ext.name) | ||
root.appendNode('url', project.ext.scm) | ||
root.children().last() + pomConfig | ||
|
||
def dependenciesNode = root.appendNode('dependencies') | ||
|
||
configurations.compile.allDependencies.each { dependency -> | ||
if (dependency.group != null && dependency.name != null) { | ||
|
||
if (dependency instanceof ProjectDependency) { | ||
dependency.getDependencyProject().getArtifacts().each { artifact -> | ||
addDependencyNodeToPom(dependenciesNode, dependency.group, getArtifactId(dependency.dependencyProject), dependency.version) | ||
} | ||
} else { | ||
addDependencyNodeToPom(dependenciesNode, dependency.group, dependency.name, dependency.version) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def getArtifactId() { | ||
return getArtifactId(project) | ||
|
||
} | ||
|
||
def getArtifactId(someProject) { | ||
if (!someProject.ext.has('artifactId')) { | ||
//default artifactId is the project/module name | ||
return someProject.getName() | ||
|
||
} | ||
return someProject.ext.artifactId | ||
} | ||
|
||
|
||
def addDependencyNodeToPom(dependenciesNode, group, artifact, version) { | ||
def dependencyNode = dependenciesNode.appendNode('dependency') | ||
dependencyNode.appendNode("groupId", group) | ||
dependencyNode.appendNode("artifactId", artifact) | ||
dependencyNode.appendNode("version", version) | ||
} |
Oops, something went wrong.