d32d5346a2
Merge-request: KT-MR-10267 Merged-by: Cristian Garcia <Cristian.Garcia-Marin@jetbrains.com>
117 lines
3.5 KiB
Groovy
117 lines
3.5 KiB
Groovy
import plugins.KotlinBuildPublishingPlugin
|
|
|
|
plugins {
|
|
id("java-gradle-plugin")
|
|
id("org.jetbrains.kotlin.jvm")
|
|
id("com.gradle.plugin-publish")
|
|
id("jps-compatible")
|
|
id("maven-publish")
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
}
|
|
|
|
pill {
|
|
variant = 'FULL'
|
|
}
|
|
|
|
dependencies {
|
|
api project(':kotlin-gradle-plugin-api')
|
|
// Use this dependency instead when building apart from the other modules:
|
|
// compile "org.jetbrains.kotlin:kotlin-gradle-plugin-api:$kotlin_version"
|
|
|
|
api project(':kotlin-test:kotlin-test-junit')
|
|
|
|
compileOnly kotlinStdlib()
|
|
compileOnly project(':compiler')
|
|
compileOnly project(':compiler:plugin-api')
|
|
compileOnly project(':compiler:cli-common')
|
|
compileOnly project(':compiler:cli')
|
|
|
|
compileOnly gradleApi()
|
|
|
|
compileOnly project(':dependencies:intellij-core')
|
|
}
|
|
|
|
GradleCommonKt.configureCommonPublicationSettingsForGradle(project, false)
|
|
GradleCommonKt.configureKotlinCompileTasksGradleCompatibility(project)
|
|
GradleCommonKt.excludeGradleCommonDependencies(project, sourceSets.main)
|
|
TasksKt.optInToExperimentalCompilerApi(project)
|
|
|
|
extensions.extraProperties["kotlin.stdlib.default.dependency"] = "false"
|
|
|
|
// You should configure your own Gradle plugin publication!
|
|
//extensions.configure(GradlePluginDevelopmentExtension) {
|
|
// it.setAutomatedPublishing(false)
|
|
//}
|
|
|
|
def sourceSet = sourceSets.main
|
|
def jarTask = tasks.named(sourceSet.jarTaskName, Jar)
|
|
def shadowJarTask = EmbeddableKt.embeddableCompilerDummyForDependenciesRewriting(
|
|
project,
|
|
"${EmbeddableKt.EMBEDDABLE_COMPILER_TASK_NAME}${sourceSet.jarTaskName.capitalize()}"
|
|
) {
|
|
ArtifactsKt.setupPublicJar(
|
|
it,
|
|
jarTask.flatMap { it.archiveBaseName },
|
|
jarTask.flatMap { it.archiveClassifier }
|
|
)
|
|
ArtifactsKt.addEmbeddedRuntime(it)
|
|
it.from(sourceSet.output)
|
|
|
|
// When Gradle traverses the inputs, reject the shaded compiler JAR,
|
|
// which leads to the content of that JAR being excluded as well:
|
|
def compilerDummyJarFile = project.provider { project.configurations.getByName("compilerDummyJar").singleFile }
|
|
it.exclude { it.file == compilerDummyJarFile.get() }
|
|
}
|
|
|
|
// Removing artifact produced by Jar task
|
|
configurations[sourceSet.runtimeElementsConfigurationName].artifacts.removeAll { true }
|
|
configurations[sourceSet.apiElementsConfigurationName].artifacts.removeAll { true }
|
|
|
|
// Adding instead artifact from shadow jar task
|
|
artifacts {
|
|
add(sourceSet.runtimeElementsConfigurationName, shadowJarTask)
|
|
add(sourceSet.apiElementsConfigurationName, shadowJarTask)
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
it.withType(MavenPublication).configureEach {
|
|
if (name.endsWith("PluginMarkerMaven")) {
|
|
pom {
|
|
// https://github.com/gradle/gradle/issues/8754
|
|
// and https://github.com/gradle/gradle/issues/6155
|
|
packaging = "pom"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
gradlePlugin {
|
|
plugins {
|
|
create("gradle-subplugin-example") {
|
|
id = "org.jetbrains.kotlin.gradle-subplugin-example"
|
|
implementationClass = "example.ExampleSubplugin"
|
|
displayName = "Kotlin Gradle subplugin example"
|
|
}
|
|
}
|
|
}
|
|
|
|
// Disable releasing for this plugin
|
|
// It is not intended to be released publicly
|
|
tasks.withType(PublishToMavenRepository)
|
|
.configureEach {
|
|
if (it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository")) {
|
|
setEnabled(false)
|
|
}
|
|
}
|
|
|
|
tasks.named("publishPlugins") {
|
|
enabled = false
|
|
}
|