• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

nebula-plugins/nebula-kotlin-plugin: Provides the Kotlin plugin via the Gradle p ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

nebula-plugins/nebula-kotlin-plugin

开源软件地址(OpenSource Url):

https://github.com/nebula-plugins/nebula-kotlin-plugin

开源编程语言(OpenSource Language):

Groovy 72.7%

开源软件介绍(OpenSource Introduction):

Nebula Kotlin Plugin

Support Status Gradle Plugin Portal Maven Central Build Apache 2.0

This plugin is in maintenance mode but will continue to receive 1.2 and 1.3 Kotlin releases. JetBrains has deprecated the existing jvm plugin and replaced it with the multiplatform plugin. If you use 1.3.70 or later you'll receive the warning:

The 'org.jetbrains.kotlin.platform.*' plugins are deprecated and will no longer be available in Kotlin 1.4.
Please migrate the project to the 'org.jetbrains.kotlin.multiplatform' plugin. 
See: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html

The multiplatform plugin is a complete migration from the legacy plugin and provides many of the ergonomic features, such as JVM target configuration and Kotlin library version management that this plugin provided. If you have a project that will move to 1.4 once it's released you should migrate to multiplatform.

Features

Provides the Kotlin plugin via the Gradle plugin portal, and adds ergonomic improvements over the default plugin:

  • Automatically depends on the standard library
  • Allows Kotlin library versions to be omitted, inferring them automatically from the plugin version
  • For Kotlin 1.1 and later, sets the -jvm-target and uses the jre standard library based on the sourceCompatibility
  • Bundles the kotlin-allopen and kotlin-noarg plugins to allow them to be applied without adding them manually to the classpath

Quick Start

Refer to the Gradle Plugin Portal for instructions on how to apply the main plugin.

Basic Build

The plugin simplifies a basic Kotlin build script to:

plugins {
    id 'nebula.kotlin' version '1.3.70'
}

repositories {
    mavenCentral() 
}

Additional library

plugins {
    id 'nebula.kotlin' version '1.3.70'
}

repositories {
    mavenCentral() 
}

dependencies {
    implementation 'org.jetbrains.kotlin:kotlin-reflect'
}

Default configuration ( >= 1.3.70)

There are cases were we only want to use kotlin for specific configurations and applying the plugin added stdlib to implementation by default.

Starting on 1.3.70, it is possible to set the default configurations for stdlib via stdlibConfiguration. For example:

plugins {
    id 'nebula.kotlin' version '1.3.70'
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.jetbrains.kotlin:kotlin-reflect'
}

configurations {
   myConfig
}

nebulaKotlin {
     stdlibConfigurations = ["myConfig"]
}

If you use kotlin buildscripts:

nebulaKotlin {
  stdlibConfigurations.set(listOf("implementation", "testFixturesImplementation"))
}

Nodep plugin ( >= 1.3.70)

This plugin will apply our opinions for default version of additional dependencies but won't add stdlib by default

plugins {
    id 'nebula.kotlin-nodep' version '1.3.70'
}

The version for kotlin-reflect will be automatically set to match the Kotlin version (1.3.70).

Caveats

  • IntelliJ doesn't set the -jvm-target compiler option based on the Java SDK setting for the project, and can cause the compiler inlining failure if it tries to inline classes compiled with Gradle. Configure the JVM target in IntelliJ preferences to avoid this



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap