mirror of https://github.com/pf4j/pf4j.git
Anindya Chatterjee
8 years ago
committed by
Decebal Suiu
4 changed files with 105 additions and 1 deletions
@ -0,0 +1,49 @@
|
||||
buildscript { |
||||
ext.kotlin_version = '1.1.2-2' |
||||
|
||||
repositories { |
||||
mavenCentral() |
||||
} |
||||
dependencies { |
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
||||
} |
||||
} |
||||
|
||||
jar { |
||||
baseName = 'KotlinPlugin' |
||||
version = '0.1.0' |
||||
manifest { |
||||
attributes 'Plugin-Class' : 'ro.fortsoft.pf4j.demo.kotlin.KotlinPlugin', |
||||
'Plugin-Id' : 'KotlinPlugin', |
||||
'Plugin-Version' : '1.0.0', |
||||
'Plugin-Provider' : 'Anindya Chatterjee' |
||||
} |
||||
} |
||||
|
||||
task plugin(type: Jar) { |
||||
baseName = 'KotlinPlugin' |
||||
version = '0.1.0' |
||||
into('classes'){ |
||||
with jar |
||||
} |
||||
into('lib'){ |
||||
from configurations.compile |
||||
} |
||||
extension('zip') |
||||
} |
||||
assemble.dependsOn plugin |
||||
|
||||
apply plugin: 'kotlin' |
||||
apply plugin: 'kotlin-kapt' |
||||
|
||||
repositories { |
||||
mavenCentral() |
||||
} |
||||
|
||||
dependencies { |
||||
compileOnly project(':api') |
||||
kapt 'ro.fortsoft.pf4j:pf4j:1.+' |
||||
compile 'org.apache.commons:commons-lang3:3.0' |
||||
testCompile group: 'junit', name: 'junit', version: '4.+' |
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" |
||||
} |
@ -0,0 +1,46 @@
|
||||
/* |
||||
* Copyright (C) 2017 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package ro.fortsoft.pf4j.demo.kotlin |
||||
|
||||
import org.apache.commons.lang3.StringUtils |
||||
import ro.fortsoft.pf4j.Extension |
||||
import ro.fortsoft.pf4j.Plugin |
||||
import ro.fortsoft.pf4j.PluginWrapper |
||||
import ro.fortsoft.pf4j.demo.api.Greeting |
||||
|
||||
/** |
||||
* A sample plugin written in Kotlin |
||||
* |
||||
* @author Anindya Chatterjee |
||||
*/ |
||||
class KotlinPlugin(wrapper: PluginWrapper) : Plugin(wrapper) { |
||||
|
||||
override fun start() { |
||||
println("KotlinPlugin.start()") |
||||
println(StringUtils.upperCase("KotlinPlugin")) |
||||
} |
||||
|
||||
override fun stop() { |
||||
println("KotlinPlugin.stop()") |
||||
} |
||||
} |
||||
|
||||
@Extension |
||||
class KotlinGreeting : Greeting { |
||||
override fun getGreeting(): String { |
||||
return "KotlinGreetings" |
||||
} |
||||
} |
Loading…
Reference in new issue