diff --git a/build.gradle b/build.gradle index 2aeff611518..5e4e42b0d0f 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ import org.jetbrains.kotlin.konan.* // Run './gradlew wrapper --gradle-version ' to update all the wrappers. apply plugin: org.jetbrains.kotlin.GradleWrappers -wrappers.projects = ['samples', 'samples/calculator', 'samples/androidNativeActivity'] +wrappers.projects = ['samples', 'samples/calculator', 'samples/androidNativeActivity', 'samples/curl'] wrapper.distributionType = Wrapper.DistributionType.ALL defaultTasks 'clean', 'dist' diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..29953ea141f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ab60aac4b66..d76b502e226 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-4.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar b/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..29953ea141f 100644 Binary files a/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar and b/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties b/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties index e6a30918ef8..d76b502e226 100644 --- a/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties +++ b/samples/androidNativeActivity/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/calculator/gradle/wrapper/gradle-wrapper.jar b/samples/calculator/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..29953ea141f 100644 Binary files a/samples/calculator/gradle/wrapper/gradle-wrapper.jar and b/samples/calculator/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/calculator/gradle/wrapper/gradle-wrapper.properties b/samples/calculator/gradle/wrapper/gradle-wrapper.properties index e6a30918ef8..d76b502e226 100644 --- a/samples/calculator/gradle/wrapper/gradle-wrapper.properties +++ b/samples/calculator/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/curl/gradle/wrapper/gradle-wrapper.jar b/samples/curl/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..29953ea141f 100644 Binary files a/samples/curl/gradle/wrapper/gradle-wrapper.jar and b/samples/curl/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/curl/gradle/wrapper/gradle-wrapper.properties b/samples/curl/gradle/wrapper/gradle-wrapper.properties index 16d28051c9c..d76b502e226 100644 --- a/samples/curl/gradle/wrapper/gradle-wrapper.properties +++ b/samples/curl/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/gradle/wrapper/gradle-wrapper.jar b/samples/gradle/wrapper/gradle-wrapper.jar index 91ca28c8b80..29953ea141f 100644 Binary files a/samples/gradle/wrapper/gradle-wrapper.jar and b/samples/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/gradle/wrapper/gradle-wrapper.properties b/samples/gradle/wrapper/gradle-wrapper.properties index e6a30918ef8..d76b502e226 100644 --- a/samples/gradle/wrapper/gradle-wrapper.properties +++ b/samples/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/tools/kotlin-native-gradle-plugin/build.gradle b/tools/kotlin-native-gradle-plugin/build.gradle index 3014c07a960..f0d797f658b 100644 --- a/tools/kotlin-native-gradle-plugin/build.gradle +++ b/tools/kotlin-native-gradle-plugin/build.gradle @@ -14,9 +14,6 @@ * limitations under the License. */ -import org.jetbrains.kotlin.konan.KonanVersion -import org.jetbrains.kotlin.konan.MetaVersion - /** * One may use bintrayUser/bintrayKey project properties or BINTRAY_USER/BINTRAY_KEY environment variables to upload * built plugin to bintray repository. @@ -36,7 +33,6 @@ buildscript { } dependencies { - classpath "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion" classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.0' } @@ -55,10 +51,19 @@ apply plugin: 'com.github.johnrengelman.shadow' group = 'org.jetbrains.kotlin' -if (KonanVersion.Companion.CURRENT.meta == MetaVersion.RELEASE) { +// With Gradle 4.10 we are no longer able to depend on +// a 'shared' build included into the root one and use the KonanVersion API provided +// by it. So we have to manually construct the version. +// TODO: Remove this code when 'shared' is built separately (from a separate repo). +def meta = findProperty('konanMetaVersion') ?: 'dev' +if (meta == 'release') { version = kotlinVersion } else { - version = "$kotlinVersion-native-${KonanVersion.Companion.CURRENT.toString()}" + def buildNumber = findProperty("build.number")?.tokenize('-')?.get(2) + version = "$kotlinVersion-native-$konanVersion-$meta" + if (buildNumber != null) { + version += "-$buildNumber" + } } repositories { @@ -132,7 +137,21 @@ jar { pluginUnderTestMetadata { dependsOn shadowJar - pluginClasspath = files(shadowJar.archivePath) + configurations.shadow + doLast { + // Since Gradle 4.10 it isn't possible to edit the pluginUnderTest classpath. + // So we have to manually set the implementation-classpath to get the output fat-jar. + def pluginMetadata = outputDirectory.get().file(PluginUnderTestMetadata.METADATA_FILE_NAME).getAsFile() + def classpath = files(shadowJar.archivePath) + configurations.shadow + new Properties().with { properties -> + pluginMetadata.withInputStream { + properties.load(it) + } + properties.setProperty(PluginUnderTestMetadata.IMPLEMENTATION_CLASSPATH_PROP_KEY , classpath.asPath) + pluginMetadata.withOutputStream { + properties.store(it, null) + } + } + } } test { diff --git a/tools/kotlin-native-gradle-plugin/settings.gradle b/tools/kotlin-native-gradle-plugin/settings.gradle index 3d4e8769a9e..391e1c9b290 100644 --- a/tools/kotlin-native-gradle-plugin/settings.gradle +++ b/tools/kotlin-native-gradle-plugin/settings.gradle @@ -1,6 +1,2 @@ rootProject.name = "kotlin-native-gradle-plugin" -// A hack to run the gradle plugin build not from the root build without -// specifying '--include-build ../../shared' in the command line. -if (gradle.parent == null) { - includeBuild '../../shared' -} \ No newline at end of file +includeBuild '../../shared' diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/tasks/KonanBaseTasks.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/tasks/KonanBaseTasks.kt index 162480be449..3d469ebb769 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/tasks/KonanBaseTasks.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/konan/tasks/KonanBaseTasks.kt @@ -20,10 +20,7 @@ import groovy.lang.Closure import org.gradle.api.Action import org.gradle.api.DefaultTask import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.DependencyConstraint -import org.gradle.api.artifacts.ModuleDependency -import org.gradle.api.artifacts.PublishArtifact +import org.gradle.api.artifacts.* import org.gradle.api.attributes.Attribute import org.gradle.api.attributes.AttributeContainer import org.gradle.api.attributes.Usage @@ -129,6 +126,7 @@ abstract class KonanArtifactTask: KonanTargetableTask(), KonanArtifactSpec { override fun getDependencyConstraints(): MutableSet = mutableSetOf() override fun getArtifacts(): MutableSet = platformConfiguration.allArtifacts override fun getAttributes(): AttributeContainer = platformConfiguration.attributes + override fun getGlobalExcludes(): Set = emptySet() }, platformConfiguration.allArtifacts, platformConfiguration) konanSoftwareComponent.addVariant(NativeVariantIdentity( variantName, diff --git a/tools/kotlin-native-gradle-plugin/src/test/kotlin/ExperimentalPluginTests.kt b/tools/kotlin-native-gradle-plugin/src/test/kotlin/ExperimentalPluginTests.kt index 60160e037c1..9a0a3d7fddc 100644 --- a/tools/kotlin-native-gradle-plugin/src/test/kotlin/ExperimentalPluginTests.kt +++ b/tools/kotlin-native-gradle-plugin/src/test/kotlin/ExperimentalPluginTests.kt @@ -65,8 +65,8 @@ class ExperimentalPluginTests { } val assembleResult = project.createRunner().withArguments("assemble").build() - assertEquals(TaskOutcome.SUCCESS, assembleResult.task(":compileDebugKotlinNative")?.outcome) - assertTrue(projectDirectory.resolve("build/exe/main/debug/test.$exeSuffix").exists()) + assertEquals(TaskOutcome.SUCCESS, assembleResult.task(":compileDebugExecutableKotlinNative")?.outcome) + assertTrue(projectDirectory.resolve("build/exe/main/debug/executable/test.$exeSuffix").exists()) } @Test