Pack scripting plugin into kotlin-scripting-embeddable for use in Gradle
This commit is contained in:
@@ -55,7 +55,7 @@ test.dependsOn(":kotlin-allopen:install",
|
||||
":examples:annotation-processor-example:install",
|
||||
":kotlin-scripting-common:install",
|
||||
":kotlin-scripting-jvm:install",
|
||||
":kotlin-scripting-gradle:install")
|
||||
":kotlin-scripting-compiler-embeddable:install")
|
||||
|
||||
|
||||
// Validate that all dependencies 'install' tasks are added to 'test' dependencies
|
||||
|
||||
@@ -56,16 +56,12 @@ dependencies {
|
||||
extension = 'jar'
|
||||
}
|
||||
}
|
||||
compileOnly project(':kotlin-scripting-gradle')
|
||||
|
||||
runtime project(path: ':kotlin-compiler-embeddable', configuration: "runtimeJar")
|
||||
runtime project(path: ':kotlin-annotation-processing-gradle', configuration: "runtimeJar")
|
||||
runtime project(path: ':kotlin-android-extensions', configuration: 'runtimeJar')
|
||||
runtime project(path: ':kotlin-compiler-runner', configuration: 'runtimeJar')
|
||||
runtime project(':kotlin-reflect')
|
||||
runtime project(':kotlin-scripting-common')
|
||||
runtime project(':kotlin-scripting-compiler')
|
||||
runtime project(path: ':kotlin-scripting-gradle', configuration: 'runtimeJar')
|
||||
|
||||
// com.android.tools.build:gradle has ~50 unneeded transitive dependencies
|
||||
agp25CompileOnly('com.android.tools.build:gradle:3.0.0-alpha1') { transitive = false }
|
||||
@@ -155,5 +151,9 @@ pluginBundle {
|
||||
id = 'org.jetbrains.kotlin.kapt'
|
||||
description = displayName = 'Kotlin Kapt plugin'
|
||||
}
|
||||
kotlinScriptingPlugin {
|
||||
id = 'org.jetbrains.kotlin.plugin.scripting'
|
||||
description = displayName = 'Gradle plugin for kotlin scripting'
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.scripting.gradle
|
||||
package org.jetbrains.kotlin.gradle.scripting
|
||||
|
||||
open class ScriptingExtension {
|
||||
internal val myScriptDefinitions = mutableListOf<String>()
|
||||
+7
-6
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.scripting.gradle
|
||||
package org.jetbrains.kotlin.gradle.scripting.internal
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
@@ -13,9 +13,9 @@ import org.jetbrains.kotlin.gradle.plugin.JetBrainsSubpluginArtifact
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact
|
||||
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
|
||||
import org.jetbrains.kotlin.gradle.scripting.ScriptingExtension
|
||||
|
||||
class ScriptingGradleSubplugin : Plugin<Project>
|
||||
{
|
||||
class ScriptingGradleSubplugin : Plugin<Project> {
|
||||
companion object {
|
||||
fun isEnabled(project: Project) = project.plugins.findPlugin(ScriptingGradleSubplugin::class.java) != null
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class ScriptingGradleSubplugin : Plugin<Project>
|
||||
|
||||
class ScriptingKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
|
||||
companion object {
|
||||
const val SCRIPTING_ARTIFACT_NAME = "kotlin-scripting"
|
||||
const val SCRIPTING_ARTIFACT_NAME = "kotlin-scripting-compiler-embeddable"
|
||||
|
||||
val SCRIPT_DEFINITIONS_OPTION = "script-definitions"
|
||||
val SCRIPT_DEFINITIONS_CLASSPATH_OPTION = "script-definitions-classpath"
|
||||
@@ -33,7 +33,8 @@ class ScriptingKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
|
||||
val LEGACY_SCRIPT_RESOLVER_ENVIRONMENT_OPTION = "script-resolver-environment"
|
||||
}
|
||||
|
||||
override fun isApplicable(project: Project, task: AbstractCompile) = ScriptingGradleSubplugin.isEnabled(project)
|
||||
override fun isApplicable(project: Project, task: AbstractCompile) =
|
||||
ScriptingGradleSubplugin.isEnabled(project)
|
||||
|
||||
override fun apply(
|
||||
project: Project,
|
||||
+1
@@ -0,0 +1 @@
|
||||
implementation-class=org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
||||
+1
@@ -0,0 +1 @@
|
||||
implementation-class=org.jetbrains.kotlin.gradle.scripting.internal.ScriptingGradleSubplugin
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
org.jetbrains.kotlin.gradle.internal.AndroidSubplugin
|
||||
org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin
|
||||
org.jetbrains.kotlin.gradle.internal.Kapt3KotlinGradleSubplugin
|
||||
org.jetbrains.kotlin.gradle.scripting.internal.ScriptingKotlinGradleSubplugin
|
||||
@@ -0,0 +1,24 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.jetbrains.kotlin.pill.PillExtension.Variant
|
||||
|
||||
plugins { java }
|
||||
|
||||
description = "Kotlin Scripting Compiler Plugin for embeddable compiler"
|
||||
|
||||
val packedJars by configurations.creating
|
||||
dependencies {
|
||||
packedJars(project(":kotlin-scripting-compiler")) { isTransitive = false }
|
||||
packedJars(project(":kotlin-scripting-common")) { isTransitive = false }
|
||||
packedJars(project(":kotlin-scripting-misc")) { isTransitive = false }
|
||||
packedJars(project(":kotlin-scripting-jvm")) { isTransitive = false }
|
||||
}
|
||||
|
||||
noDefaultJar()
|
||||
runtimeJar(rewriteDepsToShadedCompiler(
|
||||
task<ShadowJar>("shadowJar") {
|
||||
from(packedJars)
|
||||
}
|
||||
))
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
publish()
|
||||
@@ -1,63 +0,0 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.jetbrains.kotlin.pill.PillExtension.Variant
|
||||
|
||||
description = "Kotlin Scripting Compiler Plugin for Gradle"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("com.gradle.plugin-publish")
|
||||
`java-gradle-plugin`
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
pill {
|
||||
variant = Variant.FULL
|
||||
}
|
||||
|
||||
val packedJars by configurations.creating
|
||||
|
||||
dependencies {
|
||||
compile(project(":kotlin-gradle-plugin-api"))
|
||||
compileOnly(project(":kotlin-scripting-compiler"))
|
||||
packedJars(project(":kotlin-scripting-compiler")) { isTransitive = false }
|
||||
runtime(project(":kotlin-scripting-common"))
|
||||
runtime(project(":kotlin-scripting-jvm"))
|
||||
runtime(project(":kotlin-scripting-misc"))
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
val jar: Jar by tasks
|
||||
jar.apply {
|
||||
classifier = "base"
|
||||
}
|
||||
|
||||
runtimeJar(rewriteDepsToShadedCompiler(
|
||||
task<ShadowJar>("shadowJar") {
|
||||
from(packedJars)
|
||||
from(the<JavaPluginConvention>().sourceSets.getByName("main").output)
|
||||
}
|
||||
))
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
val gradlePluginId = "org.jetbrains.kotlin.plugin.scripting"
|
||||
|
||||
pluginBundle {
|
||||
(plugins) {
|
||||
gradlePluginId {
|
||||
id = gradlePluginId
|
||||
displayName = "Gradle plugin for kotlin scripting"
|
||||
description = displayName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
projectTest {
|
||||
workingDir = rootDir
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
apply from: "$rootDir/libraries/tools/gradle-tools/pluginMarkers.gradle"
|
||||
|
||||
pluginMarkerProject('kotlin-scripting-gradle')
|
||||
-1
@@ -1 +0,0 @@
|
||||
implementation-class=org.jetbrains.kotlin.scripting.gradle.ScriptingGradleSubplugin
|
||||
-1
@@ -1 +0,0 @@
|
||||
implementation-class=org.jetbrains.kotlin.scripting.gradle.ScriptingGradleSubplugin
|
||||
-1
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.scripting.gradle.ScriptingKotlinGradleSubplugin
|
||||
+2
-5
@@ -160,7 +160,7 @@ include ":kotlin-build-common",
|
||||
":kotlin-scripting-jvm-host",
|
||||
":kotlin-scripting-compiler",
|
||||
":kotlin-scripting-idea",
|
||||
":kotlin-scripting-gradle",
|
||||
":kotlin-scripting-compiler-embeddable",
|
||||
":examples:scripting-jvm-simple-script",
|
||||
":examples:scripting-jvm-simple-script-host",
|
||||
":examples:scripting-jvm-maven-deps",
|
||||
@@ -172,7 +172,6 @@ include ":kotlin-build-common",
|
||||
':kotlin-gradle-plugin:plugin-marker',
|
||||
':kotlin-allopen:plugin-marker',
|
||||
':kotlin-noarg:plugin-marker',
|
||||
':kotlin-scripting-gradle:plugin-marker',
|
||||
":test-instrumenter"
|
||||
|
||||
def isTeamcityBuild = hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
|
||||
@@ -267,8 +266,8 @@ project(':kotlin-scripting-misc').projectDir = "$rootDir/libraries/scripting/mis
|
||||
project(':kotlin-scripting-jvm').projectDir = "$rootDir/libraries/scripting/jvm" as File
|
||||
project(':kotlin-scripting-jvm-host').projectDir = "$rootDir/libraries/scripting/jvm-host" as File
|
||||
project(':kotlin-scripting-compiler').projectDir = "$rootDir/plugins/scripting/scripting-cli" as File
|
||||
project(':kotlin-scripting-compiler-embeddable').projectDir = "$rootDir/plugins/scripting/scripting-embeddable" as File
|
||||
project(':kotlin-scripting-idea').projectDir = "$rootDir/plugins/scripting/scripting-idea" as File
|
||||
project(':kotlin-scripting-gradle').projectDir = "$rootDir/plugins/scripting/scripting-gradle" as File
|
||||
project(':examples:scripting-jvm-simple-script').projectDir = "$rootDir/libraries/examples/scripting/jvm-simple-script/script" as File
|
||||
project(':examples:scripting-jvm-simple-script-host').projectDir = "$rootDir/libraries/examples/scripting/jvm-simple-script/host" as File
|
||||
project(':examples:scripting-jvm-maven-deps').projectDir = "$rootDir/libraries/examples/scripting/jvm-maven-deps/script" as File
|
||||
@@ -280,5 +279,3 @@ project(':kotlin-imports-dumper-compiler-plugin').projectDir = "$rootDir/plugins
|
||||
project(':kotlin-gradle-plugin:plugin-marker').projectDir = file("$rootDir/libraries/tools/kotlin-gradle-plugin/plugin-marker")
|
||||
project(':kotlin-allopen:plugin-marker').projectDir = file("$rootDir/libraries/tools/kotlin-allopen/plugin-marker")
|
||||
project(':kotlin-noarg:plugin-marker').projectDir = file("$rootDir/libraries/tools/kotlin-noarg/plugin-marker")
|
||||
project(':kotlin-scripting-gradle:plugin-marker').projectDir = file("$rootDir/plugins/scripting/scripting-gradle/plugin-marker")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user