-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated travis ci for gradle 5 support #19
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } | ||
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } | ||
} | ||
|
||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenCentral() | ||
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } | ||
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } | ||
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } | ||
} | ||
|
||
dependencies { | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
} | ||
} | ||
|
||
apply plugin: 'kotlin' | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' } | ||
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } | ||
maven { url 'https://plugins.gradle.org/m2/' } | ||
} | ||
|
||
dependencies { | ||
compileOnly gradleApi() | ||
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin' | ||
implementation 'org.jetbrains.kotlin:kotlin-stdlib' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Reuse Kotlin version from the root project. | ||
File rootProjectGradlePropertiesFile = file("${rootProject.projectDir}/../gradle.properties") | ||
if (!rootProjectGradlePropertiesFile.isFile()) { | ||
throw new Exception("File $rootProjectGradlePropertiesFile does not exist or is not a file") | ||
} | ||
|
||
Properties rootProjectProperties = new Properties() | ||
rootProjectGradlePropertiesFile.withInputStream { inputStream -> | ||
rootProjectProperties.load(inputStream) | ||
if (!rootProjectProperties.containsKey('kotlin_version')) { | ||
throw new Exception("No 'kotlin_version' property in $rootProjectGradlePropertiesFile file") | ||
} | ||
} | ||
|
||
gradle.beforeProject { project -> | ||
rootProjectProperties.forEach { String key, value -> | ||
if (!project.hasProperty(key)) | ||
project.ext[key] = value | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license | ||
* that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
import org.gradle.api.NamedDomainObjectCollection | ||
import org.gradle.api.NamedDomainObjectContainer | ||
import org.gradle.api.Project | ||
import org.gradle.api.plugins.ExtraPropertiesExtension | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation | ||
|
||
/* | ||
* This file includes internal short-cuts visible only inside of the 'buildSrc' module. | ||
*/ | ||
|
||
internal val hostOs by lazy { System.getProperty("os.name") } | ||
internal val userHome by lazy { System.getProperty("user.home") } | ||
|
||
internal val Project.ext: ExtraPropertiesExtension | ||
get() = extensions.getByName("ext") as ExtraPropertiesExtension | ||
|
||
internal val Project.kotlin: KotlinMultiplatformExtension | ||
get() = extensions.getByName("kotlin") as KotlinMultiplatformExtension | ||
|
||
internal val NamedDomainObjectCollection<KotlinTargetPreset<*>>.macosX64: KotlinTargetPreset<*> | ||
get() = getByName(::macosX64.name) as KotlinTargetPreset<*> | ||
|
||
internal val NamedDomainObjectCollection<KotlinTargetPreset<*>>.linuxX64: KotlinTargetPreset<*> | ||
get() = getByName(::linuxX64.name) as KotlinTargetPreset<*> | ||
|
||
internal val NamedDomainObjectCollection<KotlinTargetPreset<*>>.mingwX64: KotlinTargetPreset<*> | ||
get() = getByName(::mingwX64.name) as KotlinTargetPreset<*> | ||
|
||
internal val NamedDomainObjectContainer<out KotlinCompilation>.main: KotlinNativeCompilation | ||
get() = getByName(::main.name) as KotlinNativeCompilation |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license | ||
* that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
@file:JvmName("MPPTools") | ||
|
||
import groovy.lang.Closure | ||
import org.gradle.api.Project | ||
import org.gradle.api.Task | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset | ||
import java.nio.file.Paths | ||
|
||
/* | ||
* This file includes short-cuts that may potentially be implemented in Kotlin MPP Gradle plugin in the future. | ||
*/ | ||
|
||
// Short-cuts for detecting the host OS. | ||
@get:JvmName("isMacos") | ||
val isMacos by lazy { hostOs == "Mac OS X" } | ||
|
||
@get:JvmName("isWindows") | ||
val isWindows by lazy { hostOs.startsWith("Windows") } | ||
|
||
@get:JvmName("isLinux") | ||
val isLinux by lazy { hostOs == "Linux" } | ||
|
||
// Short-cuts for mostly used paths. | ||
@get:JvmName("mingwPath") | ||
val mingwPath by lazy { System.getenv("MINGW64_DIR") ?: "c:/msys64/mingw64" } | ||
|
||
@get:JvmName("kotlinNativeDataPath") | ||
val kotlinNativeDataPath by lazy { | ||
System.getenv("KONAN_DATA_DIR") ?: Paths.get(userHome, ".konan").toString() | ||
} | ||
|
||
// A short-cut for evaluation of the default host Kotlin/Native preset. | ||
@JvmOverloads | ||
fun defaultHostPreset( | ||
subproject: Project, | ||
whitelist: List<KotlinTargetPreset<*>> = listOf(subproject.kotlin.presets.macosX64, subproject.kotlin.presets.linuxX64, subproject.kotlin.presets.mingwX64) | ||
): KotlinTargetPreset<*> { | ||
|
||
if (whitelist.isEmpty()) | ||
throw Exception("Preset whitelist must not be empty in Kotlin/Native ${subproject.displayName}.") | ||
|
||
val presetCandidate = when { | ||
isMacos -> subproject.kotlin.presets.macosX64 | ||
isLinux -> subproject.kotlin.presets.linuxX64 | ||
isWindows -> subproject.kotlin.presets.mingwX64 | ||
else -> null | ||
} | ||
|
||
val preset = if (presetCandidate != null && presetCandidate in whitelist) | ||
presetCandidate | ||
else | ||
throw Exception("Host OS '$hostOs' is not supported in Kotlin/Native ${subproject.displayName}.") | ||
|
||
subproject.ext.set("hostPreset", preset) | ||
|
||
return preset | ||
} | ||
|
||
// A short-cut to add a Kotlin/Native run task. | ||
@JvmOverloads | ||
fun createRunTask( | ||
subproject: Project, | ||
name: String, | ||
target: KotlinTarget, | ||
configureClosure: Closure<Any>? = null | ||
): Task { | ||
val task = subproject.tasks.create(name, RunKotlinNativeTask::class.java, target) | ||
task.configure(configureClosure ?: task.emptyConfigureClosure()) | ||
return task | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license | ||
* that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
import groovy.lang.Closure | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.Task | ||
import org.gradle.api.tasks.TaskAction | ||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget | ||
import javax.inject.Inject | ||
|
||
open class RunKotlinNativeTask @Inject constructor( | ||
private val myTarget: KotlinTarget | ||
): DefaultTask() { | ||
|
||
var buildType = "RELEASE" | ||
var workingDir: Any = project.projectDir | ||
private var myArgs: List<String> = emptyList() | ||
private val myEnvironment: MutableMap<String, Any> = mutableMapOf() | ||
|
||
fun args(vararg args: Any) { | ||
myArgs = args.map { it.toString() } | ||
} | ||
|
||
fun environment(map: Map<String, Any>) { | ||
myEnvironment += map | ||
} | ||
|
||
override fun configure(configureClosure: Closure<Any>): Task { | ||
val task = super.configure(configureClosure) | ||
this.dependsOn += myTarget.compilations.main.linkTaskName("EXECUTABLE", buildType) | ||
return task | ||
} | ||
|
||
@TaskAction | ||
fun run() { | ||
project.exec { | ||
it.executable = myTarget.compilations.main.getBinary("EXECUTABLE", buildType).toString() | ||
it.args = myArgs | ||
it.environment = myEnvironment | ||
it.workingDir(workingDir) | ||
} | ||
} | ||
|
||
internal fun emptyConfigureClosure() = object : Closure<Any>(this) { | ||
override fun call(): RunKotlinNativeTask { | ||
return this@RunKotlinNativeTask | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
plugins { | ||
id 'org.jetbrains.kotlin.jvm' version '1.3.0' | ||
id 'org.jetbrains.kotlin.jvm' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No fixed version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed.. is defined in gradle properties |
||
id 'maven-publish' | ||
} | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
plugins { | ||
id 'org.jetbrains.kotlin.konan' version "1.3.11" | ||
id 'kotlin-multiplatform' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
} | ||
|
||
konan.targets = ['linux', 'macbook', 'mingw'] | ||
|
||
konanArtifacts { | ||
program("danger-kotlin") { | ||
enableOptimizations(true) | ||
kotlin { | ||
targets { | ||
fromPreset(MPPTools.defaultHostPreset(project), 'runner') { | ||
compilations.main.outputKinds 'EXECUTABLE' | ||
compilations.main.entryPoint 'com.danger.runner.main' | ||
} | ||
} | ||
} | ||
|
||
task('osName') { | ||
doLast { | ||
println "OS_TARGET=$org.jetbrains.kotlin.konan.target.HostManager.host" | ||
} | ||
|
||
MPPTools.createRunTask(project, 'runProgram', kotlin.targets.runner) { | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
kotlin.code.style=official | ||
kotlin.import.noCommonSourceSets=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
zipStorePath=wrapper/dists |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
package com.danger.runner | ||
import platform.posix.* | ||
|
||
fun runDangerJS(command: String, args: List<String>) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
package com.danger.runner | ||
|
||
import platform.posix.* | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed space |
||
fun main(args: Array<String>) { | ||
if (args.size > 0) { | ||
val command = args.first() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
package com.danger.runner | ||
import platform.posix.* | ||
|
||
fun runEditCommand() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
package com.danger.runner | ||
import platform.posix.* | ||
|
||
const val TMP_INPUT_JSON_FILE = "danger_in.json" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
kotlin.code.style=official | ||
kotlin.import.noCommonSourceSets=true | ||
kotlin_version=1.3.0 | ||
kotlin.code.style=official |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need two with dev and eap?