Skip to content

Commit

Permalink
Maven publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
pardom committed Oct 7, 2014
1 parent df29214 commit 08c6335
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 18 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ ActiveAndroid is an active record style ORM ([object relational mapper](http://e

ActiveAndroid does so much more than this though. Accessing the database is a hassle, to say the least, in Android. ActiveAndroid takes care of all the setup and messy stuff, and all with just a few simple steps of configuration.

## Download

Grab via Maven:
```xml
<dependency>
<groupId>com.michaelpardo</groupId>
<artifactId>activeandroid</artifactId>
<version>3.1.0-SNAPSHOT</version>
</dependency>
```
or Gradle:
```groovy
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
```

## Documentation

* [Getting started](http://github.com/pardom/ActiveAndroid/wiki/Getting-started)
Expand Down
16 changes: 3 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
apply plugin: 'java'
apply from: 'gradle-mvn-push.gradle'

sourceCompatibility = 1.6

jar.baseName = 'activeandroid'
archivesBaseName = 'activeandroid'
targetCompatibility = '1.6'
sourceCompatibility = '1.6'

sourceSets {
main {
Expand All @@ -16,12 +15,3 @@ sourceSets {
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}

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

artifacts {
archives sourcesJar
}
115 changes: 115 additions & 0 deletions gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* Copyright 2013 Chris Banes
* Copyright 2014 Michael Pardo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

apply plugin: 'maven'
apply plugin: 'signing'

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 : ""
}

afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

repository(url: getReleaseRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}

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
}
}
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

task javadocs(type: Javadoc) {
source = sourceSets.main.allJava
classpath = configurations.compile
}

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

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

artifacts {
archives sourcesJar
archives javadocsJar
}
}
18 changes: 18 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
VERSION_NAME=3.1.0-SNAPSHOT
VERSION_CODE=1
GROUP=com.michaelpardo

POM_DESCRIPTION=Active record style SQLite persistence for Android.
POM_URL=https://github.com/pardom/ActiveAndroid
POM_SCM_URL=https://github.com/pardom/ActiveAndroid
POM_SCM_CONNECTION=scm:git@github.com:pardom/ActiveAndroid.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:pardom/ActiveAndroid.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=michaelpardo
POM_DEVELOPER_NAME=Michael Pardo

POM_NAME=ActiveAndroid
POM_ARTIFACT_ID=activeandroid
POM_PACKAGING=jar
6 changes: 4 additions & 2 deletions src/com/activeandroid/util/IOUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
public class IOUtils {

/**
* <p>
* Unconditionally close a {@link Closeable}.
* <p/>
* </p>
* Equivalent to {@link Closeable#close()}, except any exceptions will be ignored. This is
* typically used in finally blocks.
* @param closeable A {@link Closeable} to close.
Expand All @@ -48,8 +49,9 @@ public static void closeQuietly(final Closeable closeable) {
}

/**
* <p>
* Unconditionally close a {@link Cursor}.
* <p/>
* </p>
* Equivalent to {@link Cursor#close()}, except any exceptions will be ignored. This is
* typically used in finally blocks.
* @param cursor A {@link Cursor} to close.
Expand Down
6 changes: 3 additions & 3 deletions src/com/activeandroid/widget/ModelAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public ModelAdapter(Context context, int resource, int textViewResourceId, List<

/**
* Clears the adapter and, if data != null, fills if with new Items.
*
* @param collection A Collection<? extends T> which members get added to the adapter.
*
* @param collection A Collection&lt;? extends T&gt; which members get added to the adapter.
*/
public void setData(Collection<? extends T> collection) {
clear();
Expand All @@ -54,4 +54,4 @@ public long getItemId(int position) {
return -1;
}
}
}
}

0 comments on commit 08c6335

Please sign in to comment.