Skip to content

Commit

Permalink
restructuring...
Browse files Browse the repository at this point in the history
  • Loading branch information
akolomentsev committed Apr 6, 2018
1 parent 2a2d8aa commit a6b0bab
Show file tree
Hide file tree
Showing 25 changed files with 153 additions and 156 deletions.
26 changes: 15 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

import com.satori.libs.gradle.transform.*

gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS

apply plugin: 'idea'
Expand All @@ -18,16 +29,6 @@ idea {
}
}

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

ext {
pckg = group
pckgDir = pckg.replace('.', '/')
Expand Down Expand Up @@ -202,7 +203,10 @@ def publishingProjects = [
':libs-async-core',
':libs-async-kotlin',
':libs-gtfs',
':libs-composition-drawer'
':libs-composition-drawer',
':libs-gradle-utils',
':libs-gradle-transform',
':libs-gradle-github'
].collect { project(it) }

configure(publishingProjects) {
Expand Down
14 changes: 14 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
buildDir = '.out'

sourceSets.main.java.srcDirs = ['src']
sourceSets.main.resources.srcDirs = ['res']

repositories {
mavenCentral()
maven {url "https://oss.sonatype.org/content/repositories/snapshots/"}
}
dependencies {
compile "com.satori:satori-libs-gradle-transform:$scaffoldingVersion"
compile "com.satori:satori-libs-gradle-github:$scaffoldingVersion"
compile "com.satori:satori-libs-composition-drawer:$scaffoldingVersion"
}
60 changes: 0 additions & 60 deletions buildSrc/build.gradle.kts

This file was deleted.

1 change: 1 addition & 0 deletions buildSrc/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scaffoldingVersion=0.5.16-SNAPSHOT
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
group=com.satori
version=0.5.14-SNAPSHOT
version=0.5.17-SNAPSHOT

scaffoldingVersion=0.5.16-SNAPSHOT

#nexusUsername=
#nexusPassword=
Expand All @@ -13,5 +15,6 @@ jacksonVersion=2.9.4
vertxVersion=3.5.1
junitVersion=4.+
kotlinVersion=1.2.31
kotlinCoroutinesVersion=0.22.5
logbackVersion=1.2.3
groovyVersion=2.4.14
2 changes: 1 addition & 1 deletion libs/composition-drawer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies {
compile "org.slf4j:slf4j-api:$slf4jVersion"

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.5"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion"

compile "org.tinyjee.jgraphx:jgraphx:3.4.1.3"

Expand Down
6 changes: 3 additions & 3 deletions libs/composition-drawer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ buildscript{
}
}
dependencies {
classpath "com.satori:satori-libs-composition-drawer:0.5.14-SNAPSHOT"
classpath "com.satori:satori-libs-composition-drawer:0.5.17-SNAPSHOT"
}
}
Expand All @@ -47,7 +47,7 @@ repositories {
configurations{compositionDrawer}
dependencies {
compositionDrawer "com.satori:satori-libs-composition-drawer:0.5.14-SNAPSHOT"
compositionDrawer "com.satori:satori-libs-composition-drawer:0.5.17-SNAPSHOT"
}
task generateCompositionDiagram(type: JavaExec) {
Expand Down Expand Up @@ -85,7 +85,7 @@ task generateCompositionDiagram(type: JavaExec) {
<dependency>
<groupId>com.satori</groupId>
<artifactId>satori-libs-composition-drawer</artifactId>
<version>0.5.14-SNAPSHOT</version>
<version>0.5.17-SNAPSHOT</version>
</dependency>
```

Expand Down
21 changes: 21 additions & 0 deletions libs/gradle/github/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

// main dependencies
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion"

compile "com.fasterxml.jackson.core:jackson-core:$jacksonVersion"
compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion"
compile "com.fasterxml.jackson.module:jackson-module-afterburner:$jacksonVersion"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jacksonVersion"

compile("com.damnhandy:handy-uri-templates:2.1.6")

compile gradleApi()
}


// test dependencies
dependencies {
testCompile project(':libs-testlib')
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import com.fasterxml.jackson.databind.*
import org.gradle.api.tasks.*

open class GitHubDeleteReleaseTask : GitHubTask() {

var tag: String? = "v${project.version}"

@TaskAction
fun process() {

val release = get("releases/tags/$tag").run{
if(notFound()){
val release = get("releases/tags/$tag").run {
if (notFound()) {
return
}
if(!isSucceeded()){
if (!isSucceeded()) {
throw Exception("failed to delete release")
}
content!!
}
val apiResult = request("DELETE","releases/${release["id"].asText()}")
if(!apiResult.isSucceeded()){
val apiResult = request("DELETE", "releases/${release["id"].asText()}")
if (!apiResult.isSucceeded()) {
throw Exception("failed to delete release")
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.gradle.api.tasks.*

open class GitHubListReleasesTask : GitHubTask() {

@TaskAction
fun process() {
println("retrieving github releases...")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,69 +1,66 @@
import com.damnhandy.uri.template.*
import com.fasterxml.jackson.annotation.*
import org.gradle.api.*
import org.gradle.api.file.*
import org.gradle.api.tasks.*
import java.io.*
import java.net.*
import java.nio.charset.*
import java.nio.file.*

open class GitHubPublishReleaseTask : GitHubTask() {

var releaseTag: String? = "v${project.version}"
var releaseName: String? = "composer $releaseTag"
var releaseBranch: String? = null//"dev"
var releaseDescription: String? = "experimental version, API may change"
var releaseDraft: Boolean? = false
var releasePrerelease: Boolean? = false

@JsonInclude(JsonInclude.Include.NON_DEFAULT)
class Request{
class Request {
@JsonProperty("tag_name")
var tagName: String? = null

@JsonProperty("target_commitish")
var targetCommitish: String? = null

@JsonProperty("name")
var name: String? = null

@JsonProperty("body")
var body: String? = null

@JsonProperty("draft")
var draft: Boolean? = null

@JsonProperty("prerelease")
var prerelease: Boolean? = null
}

var createReleaseRequest:Request = Request().apply {

var createReleaseRequest: Request = Request().apply {
}

val assets = HashSet<File>()

fun asset(task: Task){
fun asset(task: Task) {
dependsOn(task)
task.outputs.files.forEach {
assets.add(it)
}
}

@TaskAction
fun process() {

run checkExists@{
val release = get("releases/tags/$releaseTag").run{
if(notFound()){
val release = get("releases/tags/$releaseTag").run {
if (notFound()) {
return@checkExists
}
get()!!
}
request("DELETE","releases/${release["id"].asText()}").get()
request("DELETE", "releases/${release["id"].asText()}").get()
}

val body = jsonTree(Request().apply {
tagName = releaseTag
targetCommitish = releaseBranch
Expand All @@ -72,15 +69,15 @@ open class GitHubPublishReleaseTask : GitHubTask() {
draft = releaseDraft
prerelease = releasePrerelease
})

println("publishing release to github... ")

val createdRelease = post("releases", body).get()!!
val uploadUrl =createdRelease!!["upload_url"].asText()

val uploadUrl = createdRelease["upload_url"].asText()
assets.forEach {
println("uploading asset '${it.name}'")
Files.newInputStream(it.toPath()).use { content->
Files.newInputStream(it.toPath()).use { content ->
val uri = UriTemplate.fromTemplate(uploadUrl)
.set("name", it.name)
.expand()
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions libs/gradle/transform/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

// main dependencies
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion"
compile gradleApi()
}

// test dependencies
dependencies {
testCompile project(':libs-testlib')
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.satori.libs.gradle.transform.*
import org.gradle.api.*
import org.gradle.api.tasks.*
import java.io.*
Expand All @@ -12,7 +13,6 @@ open class TransformTask : DefaultTask(), ITransformSpec {

var model = HashMap<String, Any>()


@TaskAction
fun process() {
Transform.execute(this, project, model)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.satori.libs.gradle.transform

import java.io.*

interface ITransformSpec {
Expand Down
Loading

0 comments on commit a6b0bab

Please sign in to comment.