Skip to content

Commit

Permalink
1.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshg committed May 22, 2017
1 parent d172bee commit 11a954a
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 33 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.1.0

### Changes

* Maven Pom file generation
* Upgrade to GSK 0.9.0

## 1.0.9

### Changes
Expand Down
13 changes: 7 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.9`
Inorder to build a new version, change `appVersion` in the [gradle.properties](gradle.properties) or pass it to `./gradlew -q -PappVersion=1.1.0`

* API Doc

Expand All @@ -47,6 +47,7 @@
```ruby
$ export GITHUB_TOKEN=<token>
$ cd kotlin-starter
$ ./gradlew prepareRelease
$ ./gradlew githubRelease -q
```

Expand Down Expand Up @@ -101,15 +102,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#109
[cl-svg]: https://img.shields.io/badge/change--log-1.0.9-blue.svg?style=flat-square
[cl-url]: https://github.com/sureshg/kotlin-starter/blob/master/CHANGELOG.md#110
[cl-svg]: https://img.shields.io/badge/change--log-1.1.0-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.9/kotlin-starter
[download-url]: https://github.com/sureshg/kotlin-starter/releases/download/1.1.0/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.9/kotlin-starter.jar
[execjar-svg]: https://img.shields.io/badge/exec--jar-1.0.9-00BCD4.svg?style=flat-square
[execjar-url]: https://github.com/sureshg/kotlin-starter/releases/download/1.1.0/kotlin-starter.jar
[execjar-svg]: https://img.shields.io/badge/exec--jar-1.1.0-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
61 changes: 48 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
import term.*
import BuildInfo.*
import org.gradle.jvm.tasks.Jar
import co.riiid.gradle.ReleaseTask
import org.gradle.api.tasks.wrapper.Wrapper
import org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL
import org.gradle.language.jvm.tasks.ProcessResources
import org.jetbrains.kotlin.gradle.dsl.Coroutines.ENABLE
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import us.kirchmeier.capsule.manifest.CapsuleManifest
import us.kirchmeier.capsule.spec.ReallyExecutableSpec
import us.kirchmeier.capsule.task.*
import kotlinx.coroutines.experimental.*
import org.gradle.api.internal.HasConvention
import org.gradle.api.tasks.compile.JavaCompile
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import io.spring.gradle.dependencymanagement.DependencyManagementPlugin
import org.gradle.jvm.tasks.Jar
import org.gradle.script.lang.kotlin.*
import org.jetbrains.dokka.gradle.*
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper
import com.github.benmanes.gradle.versions.updates.*
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.apache.tools.ant.filters.ReplaceTokens


buildscript {
var javaVersion: JavaVersion by extra
var kotlinVersion: String by extra
Expand Down Expand Up @@ -68,11 +64,13 @@ plugins {
val dokkaPlugin = "dokka.version".sysProp
val bootPlugin = "springboot.version".sysProp
val shadowPlugin = "shadow.version".sysProp
val buildScan = "build-scan.version".sysProp

id("com.gradle.build-scan") version "1.7.1"
id("com.gradle.build-scan") version buildScan
application
java
idea
maven
jacoco
`help-tasks`
id("org.jetbrains.kotlin.jvm") version ktPlugin
Expand All @@ -81,15 +79,13 @@ plugins {
id("org.jetbrains.kotlin.plugin.noarg") version ktPlugin
id("org.jetbrains.kotlin.plugin.spring") version ktPlugin
id("org.jetbrains.kotlin.plugin.jpa") version ktPlugin
id("org.jetbrains.kotlin.android") version ktPlugin apply false
id("org.jetbrains.kotlin.android.extensions") version ktPlugin apply false
id("org.springframework.boot") version bootPlugin
id("com.github.johnrengelman.shadow") version shadowPlugin
// id("org.jetbrains.dokka") version dokkaPlugin
id("us.kirchmeier.capsule") version "1.0.2"
id("com.dorongold.task-tree") version "1.3"
id("co.riiid.gradle") version "0.4.2"
id("com.github.ben-manes.versions") version "0.14.0"
// id("org.jetbrains.dokka") version dokkaPlugin
}

/**
Expand Down Expand Up @@ -147,6 +143,44 @@ buildScan {
}
}

/**
* A Configuration represents a group of artifacts and their dependencies.
*/
configurations {
"testConfig" {
configurations.compile.extendsFrom(this)
isTransitive = false
}
}

/**
* Maven pom config. Can use [GenerateMavenPom] if you are
* using maven-publish plugin .
*/
maven {
mvnpom {
withXml {
val deps = asNode().appendNode("dependencies")
configurations.compile.dependencies.forEach {
with(deps.appendNode("dependency")) {
appendNode("groupId", it.group)
appendNode("artifactId", it.name)
appendNode("version", it.version)
}
}
}
}
}

task("generatePom") {
doLast {
println("Generating the Maven POM file.".fg256())
maven.pom().writeTo("build/resources/main/META-INF/maven/${project.group}/${project.name}/pom.xml")
}
tasks.getByName("jar").dependsOn(this)
description = "Generates the Maven POM file for ${project.name} v$appVersion"
}

/**
* Java code coverage metrics.
*/
Expand Down Expand Up @@ -216,6 +250,7 @@ dependencies {
compile("org.springframework.boot:spring-boot-starter")
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
testCompile("org.springframework.boot:spring-boot-starter-test")
"testConfig"("com.google.code.findbugs:jsr305:3.0.2")
}

/**
Expand All @@ -232,10 +267,10 @@ tasks.withType<JavaCompile> {
doFirst {
sourceSets {
main {
println("${name.capitalize()} => Java : ${java.srcDirs}, Kotlin: ${kotlin.srcDirs}, Resource: ${resources.srcDirs}".dot)
println("${name.capitalize()} => Java : ${java.srcDirs}, Kotlin: ${kotlin.srcDirs}, Resource: ${resources.srcDirs}".dot.fg256())
}
test {
println("${name.capitalize()} => Java : ${java.srcDirs}, Kotlin: ${kotlin.srcDirs}, Resource: ${resources.srcDirs}".dot)
println("${name.capitalize()} => Java : ${java.srcDirs}, Kotlin: ${kotlin.srcDirs}, Resource: ${resources.srcDirs}".dot.fg256())
}
}
}
Expand Down Expand Up @@ -413,7 +448,7 @@ tasks.withType<ReleaseTask> {
*/
task<Wrapper>("wrapper") {
description = "Generate Gradle Script Kotlin wrapper v$wrapperVersion"
distributionType = ALL
distributionType = Wrapper.DistributionType.ALL
distributionUrl = getGskURL(wrapperVersion)
doFirst {
println(description)
Expand Down
6 changes: 2 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import org.gradle.script.lang.kotlin.*
import org.jetbrains.kotlin.gradle.dsl.Coroutines
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.dsl.*

buildscript {
repositories {
Expand All @@ -9,7 +7,7 @@ buildscript {
}

plugins {
val kotlinVersion = System.getProperty("kotlin.version")
val kotlinVersion = System.getProperty("kotlin.version") ?: "1.1.2-2"
id("org.jetbrains.kotlin.jvm") version kotlinVersion
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"conventions": {
"base": "org.gradle.api.plugins.BasePluginConvention",
"java": "org.gradle.api.plugins.JavaPluginConvention",
"application": "org.gradle.api.plugins.ApplicationPluginConvention"
"application": "org.gradle.api.plugins.ApplicationPluginConvention",
"maven": "org.gradle.api.plugins.MavenPluginConvention"
},
"extensions": {
"ext": "org.gradle.api.plugins.ExtraPropertiesExtension",
"buildScan": "com.gradle.scan.plugin.internal.api.c",
"buildScan": "com.gradle.scan.plugin.internal.api.f",
"kotlin": "org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension",
"kapt": "org.jetbrains.kotlin.gradle.plugin.KaptExtension",
"defaultArtifacts": "org.gradle.api.internal.plugins.DefaultArtifactPublicationSet",
Expand Down
17 changes: 14 additions & 3 deletions buildSrc/src/main/kotlin/BuildExtns.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.artifacts.maven.MavenPom
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.plugins.MavenPluginConvention
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 term.bold
import term.cyan
import term.fg256
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
import kotlin.coroutines.experimental.buildSequence
Expand All @@ -20,6 +24,8 @@ import kotlin.coroutines.experimental.buildSequence

val String.sysProp: String get() = System.getProperty(this, "")

fun sysprop(name: String): String? = System.getProperty(name)

val GRADLE_SNAPSHOT_URL = "gradle.snap.url".sysProp

fun getGskURL(version: String, type: DistributionType = ALL) = "$GRADLE_SNAPSHOT_URL/gradle-script-kotlin-$version-${type.name.toLowerCase()}.zip"
Expand Down Expand Up @@ -81,13 +87,17 @@ fun Project.printHeader(version: Any?, embdKtVersion: String = embeddedKotlinVer
println()
}

/**
* Maven pom config convenient extensions.
*/
fun MavenPluginConvention.mvnpom(config: MavenPom.() -> Unit) = pom().apply(config)

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

fun Project.sourceSets(block: SourceSetContainer.() -> Unit) = the<JavaPluginConvention>().sourceSets.apply(block)

/**
* Main and test source config extensions.
Expand All @@ -97,6 +107,7 @@ 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
11 changes: 11 additions & 0 deletions buildSrc/src/main/kotlin/Commons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import kotlin.reflect.KClass
import kotlin.text.Charsets.US_ASCII
import kotlin.text.Charsets.UTF_8
import sun.misc.HexDumpEncoder
import java.net.URL
import java.util.jar.Attributes.Name.*

/**
Expand Down Expand Up @@ -325,6 +326,16 @@ inline val <T : Any> KClass<T>.jarManifest: Manifest? get() {
return if (conn is JarURLConnection) conn.manifest else null
}

/**
* Returns the jar url of the class. Returns the class file url
* if the class is not bundled in a jar.
*/
inline val <T : Any> KClass<T>.jarFileURL: URL get() {
val res = java.getResource("${java.simpleName}.class")
val conn = res.openConnection()
return if (conn is JarURLConnection) conn.jarFileURL else conn.url
}

/**
* Common build info attributes
*/
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.9</h2>
<h2>1.1.0</h2>
<h3>All Types</h3>
<table>
<tbody>
Expand Down
5 changes: 5 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<BODY>
<br/>
<br/>
<h2>1.1.0</h2>
<h3>Changes</h3>
<ul><li>Maven Pom file generation</li>
<li>Upgrade to GSK 0.9.0</li>
</ul>
<h2>1.0.9</h2>
<h3>Changes</h3>
<ul><li>Add source set config.</li>
Expand Down
1 change: 1 addition & 0 deletions docs/templates/README_TMPL.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
```ruby
$ export GITHUB_TOKEN=<token>
$ cd @project@
$ ./gradlew prepareRelease
$ ./gradlew githubRelease -q
```

Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ org.gradle.script.lang.kotlin.accessors.auto=true

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

# Misc system properties
systemProp.console=plain
systemProp.kotlin.version=1.1.2-2
systemProp.kotlinx.version=0.15
systemProp.dokka.version=0.9.13
systemProp.shadow.version=1.2.4
systemProp.wrapper.version=4.0-20170504144001+0000
systemProp.build-scan.version=1.7.3
systemProp.wrapper.version=4.0-20170518042627+0000
systemProp.springboot.version=1.5.3.RELEASE
systemProp.kotlin.eap.repo=https://dl.bintray.com/kotlin/kotlin-eap-1.1
systemProp.kotlinx.repo=https://dl.bintray.com/kotlin/kotlinx
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon May 08 20:00:23 PDT 2017
#Mon May 22 11:40:50 PDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://repo.gradle.org/gradle/dist-snapshots/gradle-script-kotlin-4.0-20170504144001+0000-all.zip
distributionUrl=https\://repo.gradle.org/gradle/dist-snapshots/gradle-script-kotlin-4.0-20170518042627+0000-all.zip

0 comments on commit 11a954a

Please sign in to comment.