Skip to content

Commit

Permalink
gradle-codegen: add DependencyExec task
Browse files Browse the repository at this point in the history
  • Loading branch information
akolomentsev committed Apr 13, 2018
1 parent c9f157d commit f2a52b3
Show file tree
Hide file tree
Showing 18 changed files with 136 additions and 43 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
}
}

allprojects{
allprojects {
apply plugin: "com.satori.transform"
apply plugin: "com.satori.github"
apply plugin: "com.satori.docker"
Expand Down Expand Up @@ -60,7 +60,7 @@ task build {
dependsOn classes
group "build"
}
task publishRelease{
task publishRelease {
group 'build'
}

Expand Down Expand Up @@ -118,7 +118,7 @@ subprojects {
}
}

task testPreapare{
task testPreapare {
group "verification"
}
test.dependsOn testPreapare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
package com.satori.codegen.yaml.file.merger

object MetaInfo {
val version = "0.5.43-SNAPSHOT"
val version = "0.5.44-SNAPSHOT"
val project = "codegen-yaml-file-merger"
val group = "com.satori"
val pckg = "com.satori.codegen.yaml.file.merger"

val sha:String? = "845ad89ca4cabc9584a056481ce59bcd377c2a01"
val sha:String? = "c9f157d9b64ccf5fc280e2c839983f80d5af3eca"


val tags:Array<String>? = null
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
group=com.satori
version=0.5.43-SNAPSHOT
version=0.5.44-SNAPSHOT

scaffoldingVersion=0.5.43-SNAPSHOT
scaffoldingVersion=0.5.44-SNAPSHOT

#nexusUsername=
#nexusPassword=
Expand Down
10 changes: 5 additions & 5 deletions libs/composition-drawer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ buildscript{
maven {url "https://oss.sonatype.org/content/repositories/snapshots"}
}
dependencies {
classpath "com.satori:satori-libs-composition-drawer:0.5.43-SNAPSHOT"
classpath "com.satori:satori-libs-composition-drawer:0.5.44-SNAPSHOT"
}
}
apply plugin: "com.satori.composition.drawer"
Expand All @@ -43,7 +43,7 @@ buildscript{
maven { url "https://oss.sonatype.org/content/repositories/snapshots"}
}
dependencies {
classpath "com.satori:satori-libs-composition-drawer:0.5.43-SNAPSHOT"
classpath "com.satori:satori-libs-composition-drawer:0.5.44-SNAPSHOT"
}
}
Expand Down Expand Up @@ -72,7 +72,7 @@ repositories {
configurations{compositionDrawer}
dependencies {
compositionDrawer "com.satori:satori-libs-composition-drawer:0.5.43-SNAPSHOT"
compositionDrawer "com.satori:satori-libs-composition-drawer:0.5.44-SNAPSHOT"
}
task generateCompositionDiagram(type: JavaExec) {
Expand Down Expand Up @@ -110,13 +110,13 @@ task generateCompositionDiagram(type: JavaExec) {
<dependency>
<groupId>com.satori</groupId>
<artifactId>satori-libs-composition-drawer</artifactId>
<version>0.5.43-SNAPSHOT</version>
<version>0.5.44-SNAPSHOT</version>
</dependency>
```


### Download
[satori-libs-composition-drawer.v0.5.43-SNAPSHOT.zip](https://github.com/satori-com/satori-composer/releases/download/v0.5.43-SNAPSHOT/satori-libs-composition-drawer.v0.5.43-SNAPSHOT.zip)<br/>
[satori-libs-composition-drawer.v0.5.44-SNAPSHOT.zip](https://github.com/satori-com/satori-composer/releases/download/v0.5.44-SNAPSHOT/satori-libs-composition-drawer.v0.5.44-SNAPSHOT.zip)<br/>
[or see latest releases](https://github.com/satori-com/satori-composer/releases/latest)

### Example of generated diagram
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
package com.satori.libs.gradle.codegen

object MetaInfo {
val version = "0.5.43-SNAPSHOT"
val version = "0.5.44-SNAPSHOT"
val project = "libs-gradle-codegen"
val group = "com.satori"
val pckg = "com.satori.libs.gradle.codegen"

val sha:String? = "845ad89ca4cabc9584a056481ce59bcd377c2a01"
val sha:String? = "c9f157d9b64ccf5fc280e2c839983f80d5af3eca"


val tags:Array<String>? = null
Expand Down
6 changes: 3 additions & 3 deletions libs/gradle/codegen/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Maven](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.satori/satori-libs-gradle-codegen.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/satori/satori-libs-gradle-codegen/0.5.43-SNAPSHOT/)
[![Maven](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.satori/satori-libs-gradle-codegen.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/satori/satori-libs-gradle-codegen/0.5.44-SNAPSHOT/)

## 'codegen' gradle plugin

Expand All @@ -13,7 +13,7 @@ buildscript{
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "com.satori:satori-libs-gradle-codegen:0.5.43-SNAPSHOT"
classpath "com.satori:satori-libs-gradle-codegen:0.5.44-SNAPSHOT"
}
}
apply plugin: "com.satori.codegen"
Expand Down Expand Up @@ -122,6 +122,6 @@ task generateGraphqlClasses {
<dependency>
<groupId>com.satori</groupId>
<artifactId>satori-libs-gradle-codegen</artifactId>
<version>0.5.43-SNAPSHOT</version>
<version>0.5.44-SNAPSHOT</version>
</dependency>
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.satori.libs.gradle.codegen
import com.satori.libs.gradle.utils.*
import groovy.lang.*
import org.gradle.api.*
import org.gradle.api.artifacts.*
import org.gradle.api.plugins.*
import org.gradle.api.tasks.*
import org.gradle.process.*
Expand All @@ -11,6 +12,7 @@ import org.gradle.util.*
open class CodeGenPluginConvention(val project: Project) {
val ProjectExec = ProjectExecTask::class.java
val SourceSetExec = SourceSetExecTask::class.java
val DependencyExec = DependencyExecTask::class.java

fun projectExec(name: String, closure: Closure<*>) {
projectExec(name, ConfigureUtil.configureUsing(closure))
Expand All @@ -33,7 +35,7 @@ open class CodeGenPluginConvention(val project: Project) {
fun sourceSetExec(name: String, closure: Action<JavaExecSpec>) {
val javaConv = project.convention.getPlugin<JavaPluginConvention>()
val forSourceSet = javaConv.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME)

project.javaexec { spec ->
spec.classpath = forSourceSet.runtimeClasspath
closure.execute(spec)
Expand All @@ -43,4 +45,24 @@ open class CodeGenPluginConvention(val project: Project) {
fun sourceSetExec(name: String, closure: Closure<*>) {
sourceSetExec(name, ConfigureUtil.configureUsing(closure))
}


fun dependencyExec(name: String, closure: Action<DependencyExecSpec>) {
val configuration = project.configurations.detachedConfiguration()

project.javaexec { spec ->
spec.classpath = configuration
closure.execute(object: DependencyExecSpec, JavaExecSpec by spec{
override val configuration = configuration
override fun dependency(dependencyNotation: Any) {
val dependency = project.dependencies.create(dependencyNotation)
configuration.dependencies.add(dependency)
}
})
println(spec.commandLine.joinToString(" "))
}
}
fun dependencyExec(name: String, closure: Closure<*>) {
sourceSetExec(name, ConfigureUtil.configureUsing(closure))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.satori.libs.gradle.codegen

import org.gradle.api.artifacts.*
import org.gradle.process.*

interface DependencyExecSpec : JavaExecSpec {
val configuration: Configuration
fun dependency(dependencyNotation: Any)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.satori.libs.gradle.codegen

import org.gradle.api.tasks.*

open class DependencyExecTask : JavaExec(), DependencyExecSpec {

@Input
override val configuration = project.configurations.detachedConfiguration()

init {
group = "codegen"
classpath = configuration
}

override fun dependency(dependencyNotation: Any) {
val dependency = project.dependencies.create(dependencyNotation)
configuration.dependencies.add(dependency)
}

override fun exec() {
println(commandLine.joinToString(" "))
super.exec()
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.satori.libs.gradle.codegen

import com.satori.libs.gradle.utils.*
import org.gradle.api.*
import org.gradle.api.plugins.*
import org.gradle.api.tasks.*

Expand All @@ -25,4 +24,19 @@ open class SourceSetExecTask : JavaExec() {
println(commandLine.joinToString(" "))
super.exec()
}

/*fun test() {
val javaConv = project.convention.getPlugin<JavaPluginConvention>()
val appConv = project.convention.getPlugin<ApplicationPluginConvention>()
val dependency = project.dependencies.create(getMarkerDependency(request))
val configurations = project.configurations
val configuration = configurations.detachedConfiguration()
configuration.setTransitive(false)
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
package com.satori.libs.gradle.docker

object MetaInfo {
val version = "0.5.43-SNAPSHOT"
val version = "0.5.44-SNAPSHOT"
val project = "libs-gradle-docker"
val group = "com.satori"
val pckg = "com.satori.libs.gradle.docker"

val sha:String? = "845ad89ca4cabc9584a056481ce59bcd377c2a01"
val sha:String? = "c9f157d9b64ccf5fc280e2c839983f80d5af3eca"


val tags:Array<String>? = null
Expand Down
6 changes: 3 additions & 3 deletions libs/gradle/docker/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Maven](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.satori/satori-libs-gradle-docker.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/satori/satori-libs-gradle-docker/0.5.43-SNAPSHOT/)
[![Maven](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.satori/satori-libs-gradle-docker.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/satori/satori-libs-gradle-docker/0.5.44-SNAPSHOT/)

## Gradle plugin 'com.satori.transform'

Expand All @@ -14,7 +14,7 @@ buildscript{
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "com.satori:satori-libs-gradle-docker:0.5.43-SNAPSHOT"
classpath "com.satori:satori-libs-gradle-docker:0.5.44-SNAPSHOT"
}
}
apply plugin: "com.satori.docker"
Expand Down Expand Up @@ -146,6 +146,6 @@ stop docker container
<dependency>
<groupId>com.satori</groupId>
<artifactId>satori-libs-gradle-docker</artifactId>
<version>0.5.43-SNAPSHOT</version>
<version>0.5.44-SNAPSHOT</version>
</dependency>
```
6 changes: 3 additions & 3 deletions libs/gradle/github/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Maven](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.satori/satori-libs-gradle-github.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/satori/satori-libs-gradle-github/0.5.43-SNAPSHOT/)
[![Maven](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.satori/satori-libs-gradle-github.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/satori/satori-libs-gradle-github/0.5.44-SNAPSHOT/)
## 'github' gradle plugin
tasks for management github releases using [Github Releases API v3](https://developer.github.com/v3/repos/releases/)

Expand All @@ -10,7 +10,7 @@ buildscript{
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "com.satori:satori-libs-gradle-github:0.5.43-SNAPSHOT"
classpath "com.satori:satori-libs-gradle-github:0.5.44-SNAPSHOT"
}
}
apply plugin: "com.satori.github"
Expand Down Expand Up @@ -43,6 +43,6 @@ task githubPublishRelease(type: GitHubPublishReleaseTask) {
<dependency>
<groupId>com.satori</groupId>
<artifactId>satori-libs-gradle-github</artifactId>
<version>0.5.43-SNAPSHOT</version>
<version>0.5.44-SNAPSHOT</version>
</dependency>
```
6 changes: 3 additions & 3 deletions libs/gradle/transform/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Maven](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.satori/satori-libs-gradle-transform.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/satori/satori-libs-gradle-transform/0.5.43-SNAPSHOT/)
[![Maven](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.satori/satori-libs-gradle-transform.svg)](https://oss.sonatype.org/content/repositories/snapshots/com/satori/satori-libs-gradle-transform/0.5.44-SNAPSHOT/)
## Gradle plugin 'com.satori.transform'

gradle task wrappers around groovy [GStringTemplateEngine](http://docs.groovy-lang.org/next/html/documentation/template-engines.html#_gstringtemplateengine)
Expand All @@ -12,7 +12,7 @@ buildscript{
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath "com.satori:satori-libs-gradle-docker:0.5.43-SNAPSHOT"
classpath "com.satori:satori-libs-gradle-docker:0.5.44-SNAPSHOT"
}
}
apply plugin: "com.satori.docker"
Expand Down Expand Up @@ -59,6 +59,6 @@ task generateReadme {
<dependency>
<groupId>com.satori</groupId>
<artifactId>satori-libs-gradle-transform</artifactId>
<version>0.5.43-SNAPSHOT</version>
<version>0.5.44-SNAPSHOT</version>
</dependency>
```
4 changes: 2 additions & 2 deletions libs/gtfs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ classes are generated based on [gtfs-realtime.proto](https://developers.google.c
<dependency>
<groupId>com.satori</groupId>
<artifactId>satori-libs-gtfs</artifactId>
<version>0.5.43-SNAPSHOT</version>
<version>0.5.44-SNAPSHOT</version>
</dependency>
```


### Download
[satori-libs-gtfs.v0.5.43-SNAPSHOT.zip](https://github.com/satori-com/satori-composer/releases/download/v0.5.43-SNAPSHOT/satori-libs-gtfs.v0.5.43-SNAPSHOT.zip)<br/>
[satori-libs-gtfs.v0.5.44-SNAPSHOT.zip](https://github.com/satori-com/satori-composer/releases/download/v0.5.44-SNAPSHOT/satori-libs-gtfs.v0.5.44-SNAPSHOT.zip)<br/>
[or see latest releases](https://github.com/satori-com/satori-composer/releases/latest)

### Examples
Expand Down
Loading

0 comments on commit f2a52b3

Please sign in to comment.