diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-19 20:00:02 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-19 20:00:02 -0700 |
commit | de0836ae903ccd6ee75d27e4c7e59fbcc1eb364c (patch) | |
tree | d685276c24ec2bb3c12765e99e6d9beb3a59e70e /library | |
parent | 94defc1ab5f9f987d5c1b14c91613364ce4ed1ba (diff) | |
download | kau-de0836ae903ccd6ee75d27e4c7e59fbcc1eb364c.tar.gz kau-de0836ae903ccd6ee75d27e4c7e59fbcc1eb364c.tar.bz2 kau-de0836ae903ccd6ee75d27e4c7e59fbcc1eb364c.zip |
Add source dirs
Diffstat (limited to 'library')
-rw-r--r-- | library/build.gradle | 25 | ||||
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/library/build.gradle b/library/build.gradle index 44f22cf..e5d29ba 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,5 +1,6 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' +apply plugin: 'com.github.dcendents.android-maven' android { compileSdkVersion Integer.parseInt(project.TARGET_SDK) @@ -61,4 +62,28 @@ dependencies { compile "com.jakewharton:butterknife:${BUTTERKNIFE}" annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTERKNIFE}" +} + +// build a jar with source files +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +task javadoc(type: Javadoc) { + failOnError false + source = android.sourceSets.main.java.sourceFiles + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + classpath += configurations.compile +} + +// build a jar with javadoc +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar }
\ No newline at end of file diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt index cc72921..4db63d2 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -34,7 +34,7 @@ fun Activity.restart(extras: ((Intent) -> Unit)? = null) { fun Context.startActivity(clazz: Class<out Activity>, clearStack: Boolean = false, intentBuilder: Intent.() -> Unit = {}, bundle: Bundle? = null) { val intent = (Intent(this, clazz)) - if (clearStack) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK) + if (clearStack) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK) intent.intentBuilder() ContextCompat.startActivity(this, intent, bundle) if (this is Activity && clearStack) finish() |