Skip to content

Commit

Permalink
1.0.9 Release - New source set config
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshg committed May 15, 2017
1 parent f1fc10a commit 9b10ebf
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 23 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 1.0.9

### Changes

* Add source set config.

## 1.0.8

### Changes

* Doc generation from template.
* Misc fixes.

## 1.0.7

### Changes
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
```
> The binary would be located at `build/libs/kotlin-starter`

Inorder to build a new version, change `appVersion` in the [gradle.properties](gradle.properties) or pass it to `./gradlew -q -PappVersion=1.0.8`
Inorder to build a new version, change `appVersion` in the [gradle.properties](gradle.properties) or pass it to `./gradlew -q -PappVersion=1.0.9`

* API Doc

Expand Down Expand Up @@ -101,15 +101,15 @@
[apidoc-url]: https://sureshg.github.io/kotlin-starter/
[apidoc-svg]: https://img.shields.io/badge/api--doc-latest-ff69b4.svg?style=flat-square

[cl-url]: https://github.com/sureshg/kotlin-starter/blob/master/CHANGELOG.md#108
[cl-svg]: https://img.shields.io/badge/change--log-1.0.8-blue.svg?style=flat-square
[cl-url]: https://github.com/sureshg/kotlin-starter/blob/master/CHANGELOG.md#109
[cl-svg]: https://img.shields.io/badge/change--log-1.0.9-blue.svg?style=flat-square

[release-url]: https://github.com/sureshg/kotlin-starter/releases/latest
[download-url]: https://github.com/sureshg/kotlin-starter/releases/download/1.0.8/kotlin-starter
[download-url]: https://github.com/sureshg/kotlin-starter/releases/download/1.0.9/kotlin-starter
[release-svg]: https://img.shields.io/github/release/sureshg/kotlin-starter.svg?style=flat-square

[execjar-url]: https://github.com/sureshg/kotlin-starter/releases/download/1.0.8/kotlin-starter.jar
[execjar-svg]: https://img.shields.io/badge/exec--jar-1.0.8-00BCD4.svg?style=flat-square
[execjar-url]: https://github.com/sureshg/kotlin-starter/releases/download/1.0.9/kotlin-starter.jar
[execjar-svg]: https://img.shields.io/badge/exec--jar-1.0.9-00BCD4.svg?style=flat-square

[license-url]: https://github.com/sureshg/kotlin-starter/blob/master/LICENSE
[license-svg]: https://img.shields.io/github/license/sureshg/kotlin-starter.svg?style=flat-square
Expand Down
22 changes: 13 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,21 @@ dependencies {
val Project.kotlinPluginVersion get() = plugins.filterIsInstance<KotlinBasePluginWrapper>().firstOrNull()?.kotlinPluginVersion

/**
* Show source sets.
* Source set configuration
*/
val compileJava: JavaCompile by tasks
compileJava.doFirst {
println("====== Source Sets ======")
java.sourceSets.asMap.forEach { name, srcSet ->
val ktSrcSet = (srcSet as HasConvention).convention.getPlugin<KotlinSourceSet>()
println("Java-${name.capitalize()} => ${srcSet.allSource.srcDirs.map { it.name }}")
println("Kotlin-${name.capitalize()} => ${ktSrcSet.kotlin.srcDirs.map { it.name }}")
val SourceSet.kotlin: SourceDirectorySet get() = (this as HasConvention).convention.getPlugin<KotlinSourceSet>().kotlin

tasks.withType<JavaCompile> {
doFirst {
sourceSets {
main {
println("${name.capitalize()} => Java : ${java.srcDirs}, Kotlin: ${kotlin.srcDirs}, Resource: ${resources.srcDirs}".dot)
}
test {
println("${name.capitalize()} => Java : ${java.srcDirs}, Kotlin: ${kotlin.srcDirs}, Resource: ${resources.srcDirs}".dot)
}
}
}
println("=========================")
}

/**
Expand Down
31 changes: 25 additions & 6 deletions buildSrc/src/main/kotlin/BuildExtns.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import term.*
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import kotlin.coroutines.experimental.buildSequence
import org.gradle.api.tasks.wrapper.Wrapper.*
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL
import org.gradle.script.lang.kotlin.*
import term.*
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import kotlin.coroutines.experimental.buildSequence

/**
* Kotlin build script extension functions.
Expand Down Expand Up @@ -78,6 +81,22 @@ fun Project.printHeader(version: Any?, embdKtVersion: String = embeddedKotlinVer
println()
}

/**
* Java/Kotlin source set extensions.
*
* @see https://goo.gl/1FR6qw
*/
fun Project.sourceSets(block: SourceSetContainer.() -> Unit) = convention.getPlugin<JavaPluginConvention>().sourceSets.apply(block)


/**
* Main and test source config extensions.
*/
val SourceSetContainer.main: SourceSet get() = this["main"]
val SourceSetContainer.test: SourceSet get() = this["test"]
fun SourceSetContainer.main(block: SourceSet.() -> Unit) = main.apply(block)
fun SourceSetContainer.test(block: SourceSet.() -> Unit) = test.apply(block)

/**
* Gets the value of the specified environment variable. If it's not set (null),
* it will prompt the user to enter value on the system console. For password
Expand Down
2 changes: 1 addition & 1 deletion docs/alltypes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" href="../style.css">
</HEAD>
<BODY>
<h2>1.0.7</h2>
<h2>1.0.9</h2>
<h3>All Types</h3>
<table>
<tbody>
Expand Down
9 changes: 9 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
<BODY>
<br/>
<br/>
<h2>1.0.9</h2>
<h3>Changes</h3>
<ul><li>Add source set config.</li>
</ul>
<h2>1.0.8</h2>
<h3>Changes</h3>
<ul><li>Doc generation from template.</li>
<li>Misc fixes.</li>
</ul>
<h2>1.0.7</h2>
<h3>Changes</h3>
<ul><li>Added executable jar for windows users.</li>
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ org.gradle.script.lang.kotlin.accessors.auto=true

# App properties
appAuthor=Suresh
appVersion=1.0.8
appVersion=1.0.9

# Misc system properties
systemProp.console=plain
Expand Down

0 comments on commit 9b10ebf

Please sign in to comment.