Skip to content

Commit

Permalink
Add gradle logic to publish to Binary
Browse files Browse the repository at this point in the history
closes #19
  • Loading branch information
isuPatches committed Oct 30, 2016
1 parent a41b4b6 commit 948493f
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 58 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ Util library used as a wrapper around WiFi and Connectivity manager for Android
[![Build Status](https://travis-ci.org/isuPatches/WiseFy.svg?branch=master)](https://travis-ci.org/isuPatches/WiseFy)

[ ![Download](https://api.bintray.com/packages/isupatches/Maven/wisefy/images/download.svg) ](https://bintray.com/isupatches/Maven/wisefy/_latestVersion)

## Adding to your project

Gradle:

```
compile 'com.isupatches:wisefy:1.0.5'
```

Maven:

```
<dependency>
<groupId>com.isupatches</groupId>
<artifactId>wisefy</artifactId>
<version>1.0.5</version>
<type>pom</type>
</dependency>
```

## Getting An Instance

WiseFy now supports the builder pattern so cool functionality can be added later!
Expand All @@ -21,8 +42,6 @@ To grab an instance with logging enabled:
WiseFy mWiseFy = new WiseFy.withContext(getActivity()).logging(true).getSmarts();
```

**IMPORTANT!** Please make sure you call withContext for WiseFy to work properly

## Commands

To add an open network:
Expand Down
60 changes: 4 additions & 56 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
apply plugin: 'com.android.library'
apply plugin: 'jacoco'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: "com.github.dcendents.android-maven"

group = 'com.isupatches'
version = '1.0.4'
group = rootProject.ext.GROUP
version = rootProject.ext.VERSION_NAME

def coverageSourceDirs = [
'../app/src/main/java'
Expand Down Expand Up @@ -100,57 +99,6 @@ dependencies {
testCompile 'junit:junit:4.12'
}

install {
repositories.mavenInstaller {
pom {
project {
artifactId 'wisefy'
packaging 'aar'

name 'WiseFy'
url 'https://github.com/isuPatches/WiseFy'

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'isuPatches'
name 'Sarah Klinefelter'
email 'isuPatches@yahoo.com'
}
}
scm {
connection 'https://github.com/isuPatches/WiseFy.git'
developerConnection 'https://github.com/isuPatches/WiseFy.git'
url 'https://github.com/isuPatches/WiseFy'
}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
destinationDir = file("../javadoc/")
failOnError false
}

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

artifacts {
archives javadocJar
archives sourcesJar
}
apply from: rootProject.file('gradle/gradle-bintray-install.gradle')
apply from: rootProject.file('gradle/gradle-bintray-upload.gradle')
29 changes: 29 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.5.6'
classpath "com.github.dcendents:android-maven-gradle-plugin:1.5"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.2'
classpath "org.jacoco:org.jacoco.core:0.7.7.201606060606"
classpath "org.jacoco:org.jacoco.agent:0.7.7.201606060606"
classpath "org.jacoco:org.jacoco.report:0.7.7.201606060606"
Expand Down Expand Up @@ -41,4 +42,32 @@ subprojects {
}
}
}
}

ext {
GROUP = "com.isupatches"
VERSION_NAME = "1.0.5"

BINTRAY_REPO = "Maven"
BINTRAY_NAME = "wisefy"

LIBRARY_DESCRIPTION = "Wrapper around WifiManager and ConfigurationManager for Android"

POM_PACKAGING = "aar"
POM_DESCRIPTION = "wisefy"
POM_URL = "https://github.com/isuPatches/WiseFy"

POM_SCM_URL = "https://github.com/isuPatches/WiseFy"
POM_SCM_ISSUE_URL = 'https://github.com/isuPatches/WiseFy/issues'
POM_SCM_CONNECTION = "scm:git:https://github.com/isuPatches/WiseFy.git"
POM_SCM_DEV_CONNECTION = "scm:git:git@github.com:isuPatches/WiseFy.git"

POM_LICENSE_NAME = "The Apache Software License, Version 2.0"
POM_LICENSE_URL = "http://www.apache.org/licenses/LICENSE-2.0.txt"
POM_LICENSE_DIST = "repo"
ALL_LICENSES = ["Apache-2.0"]

POM_DEVELOPER_ID = "isuPatches"
POM_DEVELOPER_NAME = "Patches Klinefelter"
POM_DEVELOPER_EMAIL = "isuPatches@yahoo.com"
}
40 changes: 40 additions & 0 deletions gradle/gradle-bintray-install.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Source: https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle

apply plugin: 'com.github.dcendents.android-maven'

group = GROUP // Maven Group ID for the artifact

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom.project {
packaging POM_PACKAGING
groupId GROUP
artifactId BINTRAY_NAME

name POM_DESCRIPTION
description LIBRARY_DESCRIPTION
url POM_URL

// Set your license
licenses {
license {
name POM_LICENSE_NAME
url POM_LICENSE_URL
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
email POM_DEVELOPER_EMAIL
}
}
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
}
}
}
66 changes: 66 additions & 0 deletions gradle/gradle-bintray-upload.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Source: https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle

apply plugin: 'com.jfrog.bintray'

version = VERSION_NAME

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

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
} else { // Java libraries
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
}

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

artifacts {
archives javadocJar
archives sourcesJar
}

// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

println("user: " + user)
println("key: " + key)


configurations = ['archives']
pkg {
repo = BINTRAY_REPO
name = BINTRAY_NAME
desc = LIBRARY_DESCRIPTION
websiteUrl = POM_URL
vcsUrl = POM_SCM_URL
issueTrackerUrl = POM_SCM_ISSUE_URL
licenses = ALL_LICENSES
labels = ['Wifi', 'WifiManager', 'ConnectivityManager', 'Android', 'isuPatches', 'Patches']
publish = true
publicDownloadNumbers = true
version {
desc = LIBRARY_DESCRIPTION
gpg {
sign = true // Determines whether to GPG sign the files. The default is false
passphrase = properties.getProperty("bintray.gpg.password") // Optional. The passphrase for GPG signing'
}
}
}
}

0 comments on commit 948493f

Please sign in to comment.