diff --git a/.gitignore b/.gitignore index e64da9ed6d5..8baa6ecf0d7 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ kotstd/kotstd.iml *.kt.exe *.log test.output +*.kexe # Ignore Gradle GUI config gradle-app.setting diff --git a/samples/csvparser/build.gradle b/samples/csvparser/build.gradle index 7fec0cce7a0..9d47de7f388 100644 --- a/samples/csvparser/build.gradle +++ b/samples/csvparser/build.gradle @@ -1,12 +1,13 @@ buildscript { - ext.kotlin_version = '1.1.1' repositories { mavenCentral() + maven { + url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" + } } dependencies { - classpath files('../gradle-plugin.jar') - classpath "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.1" } } @@ -25,7 +26,6 @@ konanArtifacts { } } - build { doLast { copy { diff --git a/samples/gitchurn/build.gradle b/samples/gitchurn/build.gradle index 3e2b4edeebf..ff0cb7a5cbc 100644 --- a/samples/gitchurn/build.gradle +++ b/samples/gitchurn/build.gradle @@ -1,12 +1,13 @@ buildscript { - ext.kotlin_version = '1.1.1' repositories { mavenCentral() + maven { + url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" + } } dependencies { - classpath files('../gradle-plugin.jar') - classpath "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.1" } } @@ -21,7 +22,7 @@ konanInterop { } konanArtifacts { - gitchurn { + GitChurn { inputFiles project.fileTree('src') useInterop 'libgit2' linkerOpts "-L/opt/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lgit2" @@ -32,7 +33,7 @@ konanArtifacts { build { doLast { copy { - from compileKonanGitchurn.artifactPath + from compileKonanGitChurn.artifactPath into projectDir.canonicalPath } } diff --git a/samples/gradle-plugin.jar b/samples/gradle-plugin.jar deleted file mode 100644 index eca9734f997..00000000000 Binary files a/samples/gradle-plugin.jar and /dev/null differ diff --git a/samples/libcurl/build.gradle b/samples/libcurl/build.gradle index a6f1a73ae81..07ebb6bfc2b 100644 --- a/samples/libcurl/build.gradle +++ b/samples/libcurl/build.gradle @@ -1,12 +1,13 @@ buildscript { - ext.kotlin_version = '1.1.1' repositories { mavenCentral() + maven { + url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" + } } dependencies { - classpath files('../gradle-plugin.jar') - classpath "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.1" } } @@ -15,7 +16,7 @@ apply plugin: 'konan' konanInterop { libcurl { defFile 'libcurl.def' - includeDirs '/usr/include', '/opt/local/include', '/usr/local/opt/curl/include' + includeDirs '/usr/include', '/opt/local/include', '/usr/local/opt/curl/include', '.' } } diff --git a/samples/opengl/build.gradle b/samples/opengl/build.gradle index 0ec20a6821e..b61731ea928 100644 --- a/samples/opengl/build.gradle +++ b/samples/opengl/build.gradle @@ -1,12 +1,13 @@ buildscript { - ext.kotlin_version = '1.1.1' repositories { mavenCentral() + maven { + url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" + } } dependencies { - classpath files('../gradle-plugin.jar') - classpath "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.1" } } @@ -20,7 +21,7 @@ konanInterop { konanArtifacts { - openGlTeapot { + OpenGlTeapot { inputFiles project.file("OpenGlTeapot.kt") useInterop 'opengl' def osName = System.getProperty("os.name") diff --git a/samples/socket/build.gradle b/samples/socket/build.gradle index 6677b3b5838..8128d7bc6f9 100644 --- a/samples/socket/build.gradle +++ b/samples/socket/build.gradle @@ -1,12 +1,13 @@ buildscript { - ext.kotlin_version = '1.1.1' repositories { mavenCentral() + maven { + url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" + } } dependencies { - classpath files('../gradle-plugin.jar') - classpath "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.1" } } @@ -19,7 +20,7 @@ konanInterop { } konanArtifacts { - echoServer { + EchoServer { inputFiles project.file("EchoServer.kt") useInterop "sockets" } diff --git a/samples/tetris/build.gradle b/samples/tetris/build.gradle index 6f55e2fb77f..d7f97caca14 100644 --- a/samples/tetris/build.gradle +++ b/samples/tetris/build.gradle @@ -1,12 +1,18 @@ +/** + * Use `./gradlew build` to build the project. + * e.g. ./gradlew buildMacbook + */ + buildscript { - ext.kotlin_version = '1.1.1' repositories { mavenCentral() + maven { + url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" + } } dependencies { - classpath files('../gradle-plugin.jar') - classpath "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:0.1" } } @@ -41,7 +47,7 @@ konanInterop { } konanArtifacts { - tetrisMacbook { + TetrisMacbook { inputFiles project.file('Tetris.kt') useInterop 'sdlMacbook' //linkerOpts "-F /Library/Frameworks -framework SDL2 -L/opt/local/lib -lSDL2" @@ -49,7 +55,7 @@ konanArtifacts { target 'macbook' } - tetrisLinux { + TetrisLinux { inputFiles project.file('Tetris.kt') useInterop 'sdlLinux' @@ -57,7 +63,7 @@ konanArtifacts { target 'linux' } - tetrisIphone { + TetrisIphone { inputFiles project.file('Tetris.kt') useInterop 'sdlIphone' @@ -69,7 +75,7 @@ konanArtifacts { target 'iphone' } - tetrisRaspberry { + TetrisRaspberry { inputFiles project.file('Tetris.kt') useInterop 'sdlRaspberry' @@ -79,11 +85,10 @@ konanArtifacts { } -tasks.matching { it.name.startsWith("compileKonan") }.forEach { task -> - task.doLast { - copy { - from task.artifactPath - into projectDir.canonicalPath - } +tasks.matching { it.name.startsWith("compileKonan") }.asList().forEach { compileTask -> + task ("build${compileTask.name - "compileKonanTetris"}", type: Copy) { + dependsOn(compileTask) + from compileTask.artifactPath + destinationDir projectDir } } \ No newline at end of file diff --git a/tools/gradle-plugin/build.gradle b/tools/gradle-plugin/build.gradle index 8b86039b439..3e0fbafc50a 100644 --- a/tools/gradle-plugin/build.gradle +++ b/tools/gradle-plugin/build.gradle @@ -1,15 +1,24 @@ +/** + * One may use bintrayUser/bintrayKey project properties or BINTRAY_USER/BINTRAY_KEY environment variables to upload + * built plugin to bintray repository. + */ + buildscript { repositories { mavenCentral() + jcenter() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' } } -apply plugin: "java" -apply plugin: "kotlin" +apply plugin: 'java' +apply plugin: 'kotlin' +apply plugin: 'maven-publish' +apply plugin: 'com.jfrog.bintray' // TODO: move this code to top level (the same for backend.native) // Copied from backend.native @@ -55,20 +64,40 @@ jar { from (rootProject.findProject(':tools:helpers').sourceSets.main.output) } -task dist(type: Copy) { - dependsOn(jar) - destinationDir project.file('dist') - from jar.outputs.files -} - -task copy_to_samples(type: Copy) { - dependsOn(dist) - destinationDir rootProject.file('samples') - from dist.outputs.files -} - -clean { - doFirst { - delete project.file('dist') +publishing { + publications { + gradlePlugin(MavenPublication) { + artifact jar + groupId 'org.jetbrains.kotlin' + artifactId 'kotlin-native-gradle-plugin' + version '0.1' + pom.withXml { XmlProvider xml -> + def stdlibDep = xml.asNode().appendNode("dependencies").appendNode("dependency") + stdlibDep.appendNode("groupId", "org.jetbrains.kotlin") + stdlibDep.appendNode("artifactId", "kotlin-stdlib") + stdlibDep.appendNode("version", "$kotlin_version") + } + } } +} + + +bintray { + user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') + key = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY') + pkg { + repo = 'kotlin-native-dependencies' + name = 'kotlin-native-gradle-plugin' + userOrg = 'jetbrains' + // TODO: Specify license and github path + //licenses = ['Apache-2.0'] + //vcsUrl = 'https://github.com/...' + version { + name = '0.1' + desc = 'Kotlin Native Gradle plugin 0.1' + } + publish = true + override = true + } + publications = ['gradlePlugin'] } \ No newline at end of file