diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 6d1fe6c..1dbfcfa 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,16 +1,30 @@ import org.gradle.kotlin.dsl.* import org.gradle.plugin.use.* import org.jetbrains.kotlin.gradle.tasks.* +import org.gradle.plugins.ide.idea.model.* plugins { kotlin("jvm", "1.1.50") + id("idea") } group = "com.satori" version = "0.3.0-SNAPSHOT" - buildDir = file(".out") +idea { + project { + jdkName = JavaVersion.VERSION_1_8.toString() + languageLevel = IdeaLanguageLevel(JavaVersion.VERSION_1_8) + } + module { + inheritOutputDirs = false + outputDir = file("$buildDir/idea") + testOutputDir = file("$buildDir/idea-tests") + } +} + + java.sourceSets["main"].java.srcDir("src") java.sourceSets["main"].resources.srcDir("res") @@ -30,11 +44,14 @@ compileTestKotlin.kotlinOptions { repositories { mavenCentral() + jcenter() } val jacksonVer = "2.9.0" dependencies { + //compile("com.github.fge:uri-template:0.9") + compile("com.damnhandy:handy-uri-templates:2.1.6") compile(kotlin("stdlib-jre8", "1.1.50")) compile("com.fasterxml.jackson.core:jackson-core:$jacksonVer") compile("com.fasterxml.jackson.core:jackson-databind:$jacksonVer") diff --git a/buildSrc/src/GitHubPublishReleaseTask.kt b/buildSrc/src/GitHubPublishReleaseTask.kt index f7a5fe9..95117a0 100644 --- a/buildSrc/src/GitHubPublishReleaseTask.kt +++ b/buildSrc/src/GitHubPublishReleaseTask.kt @@ -1,3 +1,4 @@ +import com.damnhandy.uri.template.* import com.fasterxml.jackson.annotation.* import org.gradle.api.* import org.gradle.api.file.* @@ -75,29 +76,18 @@ open class GitHubPublishReleaseTask : GitHubTask() { println("publishing release to github... ") val createdRelease = post("releases", body).get()!! - - //val uploadUrl = createdRelease!!["assets_url"].asText() - val uploadUrl ="https://uploads.github.com/repos/satori-com/satori-composer/releases/${createdRelease["id"].asText()}/assets" + val uploadUrl =createdRelease!!["upload_url"].asText() assets.forEach { println("uploading asset '${it.name}'") Files.newInputStream(it.toPath()).use { content-> + val uri = UriTemplate.fromTemplate(uploadUrl) + .set("name", it.name) + .expand() upload( - "$uploadUrl?name=${urlEncode(it.name)}", - "application/zip", - content + uri, "application/zip", content ) } - //println("${URL("https://uploads.github.com/repos/satori-com/satori-composer/releases/7936971/assets{?name,label}")}") - /*parameters.put("name", "Arnold") - - val builder = UriBuilder.fromPath(template) - val output = builder.build(parameters) - parameters.put("name", "Arnold") - - val builder = UriBuilder.fromPath(template) - val output = builder.build(parameters)*/ - //POST https:///repos/:owner/:repo/releases/:id/assets?name=foo.zip } } } \ No newline at end of file