Skip to content

Commit

Permalink
update publish scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yrom committed Jul 13, 2017
1 parent c6b9a3c commit 1546c85
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea/
.DS_Store
/build
/captures
Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
71 changes: 71 additions & 0 deletions publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apply plugin: 'maven-publish'

version = VERSION_NAME
group = GROUP

def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}

def getReleaseRepositoryUrl() {
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

def getRepositoryUsername() {
return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}

def getRepositoryPassword() {
return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}

publishing {
publications {
mavenJava(MavenPublication) {

from components.java
pom.withXml {
def node = asNode()

node.children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
packaging POM_PACKAGING
description POM_DESCRIPTION
name project.getName()
licenses {
license {
name 'Apache License Version 2.0'
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
artifact sourceJar {
classifier "sources"
}
}
}
repositories {
maven {
url isReleaseBuild() ? getReleaseRepositoryUrl() : getSnapshotRepositoryUrl()
credentials {
username = getRepositoryUsername()
password = getRepositoryPassword()
}
}
}
}
17 changes: 1 addition & 16 deletions shrinker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,4 @@ dependencies {
compile 'commons-io:commons-io:2.4'
testCompile 'junit:junit:4.12'
}
apply plugin: 'maven-publish'

group = 'net.yrom'
version = '0.1.0'
publishing {
repositories {
maven {
url "$rootProject.buildDir/repo"
}
}
publications {
maven(MavenPublication) {
from components.java
}
}
}
apply from: rootProject.file('publish.gradle')
6 changes: 6 additions & 0 deletions shrinker/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
VERSION_NAME=0.1.1
GROUP=net.yrom
POM_PACKAGING=jar
POM_DESCRIPTION=Inline constant fields of android R class by asm and transform-api
POM_DEVELOPER_ID=net.yrom
POM_DEVELOPER_NAME=yrom

0 comments on commit 1546c85

Please sign in to comment.