Skip to content
This repository was archived by the owner on Dec 17, 2020. It is now read-only.

Commit ecb7266

Browse files
author
Rolf Smit
committed
Added bintray upload script.
1 parent ea7b68f commit ecb7266

File tree

9 files changed

+177
-26
lines changed

9 files changed

+177
-26
lines changed

build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:1.5.0'
9-
9+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
10+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
1213
}
1314
}
1415

1516
allprojects {
1617
repositories {
18+
maven {
19+
url 'https://dl.bintray.com/rolf-smit/maven'
20+
}
1721
jcenter()
1822
}
1923
}

demo/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ dependencies {
2424
testCompile 'junit:junit:4.12'
2525
compile 'com.android.support:appcompat-v7:23.2.0'
2626
compile 'com.android.support:design:23.2.0'
27+
2728
compile project(':library')
29+
//compile 'org.neotech.library:android-retainable-tasks:0.1.0'
2830

2931
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' // or 1.4-beta1
3032
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' // or 1.4-beta1

library/bintray-install.gradle

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apply plugin: 'com.github.dcendents.android-maven'
2+
3+
group = publishedGroupId // Maven Group ID for the artifact
4+
5+
install {
6+
repositories.mavenInstaller {
7+
// This generates POM.xml with proper parameters
8+
pom {
9+
10+
project {
11+
packaging 'aar'
12+
groupId publishedGroupId
13+
artifactId artifact
14+
15+
// Add your description here
16+
name libraryName
17+
description libraryDescription
18+
url siteUrl
19+
20+
// Set your license
21+
licenses {
22+
license {
23+
name licenseName
24+
url licenseUrl
25+
}
26+
}
27+
developers {
28+
developer {
29+
id developerId
30+
name developerName
31+
email developerEmail
32+
}
33+
}
34+
scm {
35+
connection gitUrl
36+
developerConnection gitUrl
37+
url siteUrl
38+
39+
}
40+
}
41+
}
42+
}
43+
}

library/bintray-upload.gradle

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
apply plugin: 'com.jfrog.bintray'
2+
3+
version = libraryVersion
4+
5+
if (project.hasProperty("android")) { // Android libraries
6+
task sourcesJar(type: Jar) {
7+
classifier = 'sources'
8+
from android.sourceSets.main.java.srcDirs
9+
}
10+
11+
task javadoc(type: Javadoc) {
12+
source = android.sourceSets.main.java.srcDirs
13+
failOnError = false
14+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
15+
}
16+
} else { // Java libraries
17+
task sourcesJar(type: Jar, dependsOn: classes) {
18+
classifier = 'sources'
19+
from sourceSets.main.allSource
20+
}
21+
}
22+
23+
task javadocJar(type: Jar, dependsOn: javadoc) {
24+
classifier = 'javadoc'
25+
from javadoc.destinationDir
26+
}
27+
28+
artifacts {
29+
archives javadocJar
30+
archives sourcesJar
31+
}
32+
33+
// Bintray
34+
Properties properties = new Properties()
35+
properties.load(project.rootProject.file('local.properties').newDataInputStream())
36+
37+
bintray {
38+
user = properties.getProperty("bintray.user")
39+
key = properties.getProperty("bintray.apikey")
40+
41+
configurations = ['archives']
42+
pkg {
43+
repo = bintrayRepo
44+
name = bintrayName
45+
desc = libraryDescription
46+
websiteUrl = siteUrl
47+
vcsUrl = gitUrl
48+
licenses = allLicenses
49+
publish = true
50+
publicDownloadNumbers = true
51+
version {
52+
desc = libraryDescription
53+
/*
54+
gpg {
55+
sign = true //Determines whether to GPG sign the files. The default is false
56+
passphrase = properties.getProperty("bintray.gpg.password")
57+
//Optional. The passphrase for GPG signing'
58+
}
59+
*/
60+
}
61+
}
62+
}

library/build.gradle

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
apply plugin: 'com.android.library'
22

3+
ext {
4+
5+
6+
/** JCenter/maven upload variables **/
7+
8+
/**
9+
* Upload the library using:
10+
* > gradlew install
11+
* > gradlew bintrayUpload
12+
*/
13+
14+
// Where you will see your artifact in Bintray's web interface
15+
// The "bintrayName" should match the name of the Bintray repro.
16+
bintrayRepo = 'maven'
17+
bintrayName = 'android-retainable-tasks'
18+
19+
// Maven metadata
20+
publishedGroupId = 'org.neotech.library'
21+
libraryName = 'Android-Retainable-Tasks'
22+
// Save yourself a head ache, and set this equal to the name of the Android Studio library
23+
// module. The artifact name needs to match the name of the library.
24+
artifact = 'android-retainable-tasks'
25+
26+
libraryDescription = 'Android-Retainable-Tasks is an easy to use mini-library for easy asynchronous background tasking with callback support to the UI. This library is based on the Android AsyncTask implementation but with support for retaining tasks and therefore surviving configuration changes (orientation).'
27+
libraryVersion = '0.1.0'
28+
29+
siteUrl = 'https://github.com/Rolf-Smit/Android-Retainable-Tasks'
30+
gitUrl = 'https://github.com/Rolf-Smit/Android-Retainable-Tasks.git'
31+
32+
developerId = 'rolf-smit'
33+
developerName = 'Rolf Smit'
34+
developerEmail = '[email protected]'
35+
36+
licenseName = 'The Apache Software License, Version 2.0'
37+
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
38+
allLicenses = ["Apache-2.0"]
39+
40+
41+
}
42+
43+
/**
44+
* Without this line the Bintray upload will fail as it uses the libraries directory name as artifactId
45+
*/
46+
archivesBaseName = 'android-retainable-tasks'
47+
348
android {
449
compileSdkVersion 23
550
buildToolsVersion "23.0.2"
@@ -8,7 +53,7 @@ android {
853
minSdkVersion 9
954
targetSdkVersion 23
1055
versionCode 1
11-
versionName "1.0"
56+
versionName "${libraryVersion}"
1257
}
1358
buildTypes {
1459
release {
@@ -18,8 +63,17 @@ android {
1863
}
1964
}
2065

66+
configurations {
67+
javadocCompile
68+
}
69+
2170
dependencies {
2271
compile fileTree(dir: 'libs', include: ['*.jar'])
2372
testCompile 'junit:junit:4.12'
2473
compile 'com.android.support:appcompat-v7:23.2.0'
74+
javadocCompile 'com.android.support:appcompat-v7:23.2.0'
2575
}
76+
77+
78+
apply from: 'bintray-install.gradle'
79+
apply from: 'bintray-upload.gradle'

library/src/main/AndroidManifest.xml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,2 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="org.neotech.library.retainabletasks">
3-
4-
<application
5-
android:allowBackup="true"
6-
android:label="@string/app_name"
7-
android:supportsRtl="true">
8-
9-
</application>
10-
1+
<manifest package="org.neotech.library.retainabletasks">
112
</manifest>

library/src/main/java/org/neotech/library/retainabletasks/Task.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* <pre class="prettyprint">
5151
* private class ExampleTask extends Task&lt;Integer, String&gt; {
5252
* protected String doInBackground() {
53-
* for(int i = 0; i < 100; i++) {
53+
* for(int i = 0; i &lt; 100; i++) {
5454
* if(isCancelled()){
5555
* break;
5656
* }
@@ -95,11 +95,11 @@
9595
* getTaskHandler().execute(task, this);
9696
* }
9797
*
98-
* public void onPreExecute(Task<?, ?> task) {
98+
* public void onPreExecute(Task&lt;?, ?&gt; task) {
9999
* //Task started
100100
* }
101101
*
102-
* public void onPostExecute(Task<?, ?> task) {
102+
* public void onPostExecute(Task&lt;?, ?&gt; task) {
103103
* //Task finished
104104
* Toast.makeText(this, "Task finished", Toast.LENGTH_SHORT).show();
105105
* }

library/src/main/java/org/neotech/library/retainabletasks/TaskHandler.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ public static TaskHandler getActivityTaskHandler(@NonNull FragmentManager manage
3939

4040
/**
4141
* Returns the global TaskHandler. The global TaskHandler isn't bound to the lifecycle of an
42-
* Activity and won't automatically remove
43-
* {@link org.neotech.library.retainabletasks.Task.Callback} set to
44-
* {@link android.support.v4.app.NotificationManagerCompat.Task Tasks} which are executed
45-
* trough this TaskHandler. You should be aware of this behaviour and remove any callback, which
46-
* might leak an Activity, Fragment, View etc., yourself. Good use cases for the global
47-
* TaskHandler are Tasks which don't necessarily need to update the UI. But in most cases you
48-
* really want to use the Activity TaskHandler.
42+
* Activity and won't automatically remove a {@link Task.Callback} listeners set to
43+
* {@link Task Tasks} which are executed trough this TaskHandler. You should be aware of this
44+
* behaviour and remove any callback listeners to avoid leaking an Activity, Fragment, View etc.
45+
* Good use cases for the global TaskHandler are Tasks which don't necessarily need to update
46+
* the UI. But in most cases you really want to use the Activity TaskHandler.
4947
* @return The global TaskHandler instance.
50-
* @see #getActivityTaskHandler(FragmentManager)
48+
* @see TaskHandler#getActivityTaskHandler(FragmentManager)
5149
*/
5250
public static TaskHandler getGlobalTaskHandler(){
5351
/**

library/src/main/res/values/strings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)