Noarg: Add a kotlin-noarg Gradle plugin

This commit is contained in:
Yan Zhulanow
2016-10-05 21:56:50 +03:00
committed by Yan Zhulanow
parent e626b121ad
commit be26246a3e
12 changed files with 387 additions and 0 deletions
@@ -144,4 +144,17 @@ class SimpleKotlinGradleIT : BaseGradleIT() {
"public final method()V")
}
}
@Test
fun testKotlinJpaPlugin() {
Project("noArgJpa", GRADLE_VERSION).build("build") {
assertSuccessful()
val classesDir = File(project.projectDir, "build/classes/main")
val testClass = File(classesDir, "test/Test.class")
assertTrue(testClass.exists())
checkBytecodeContains(testClass, "public <init>()V")
}
}
}
@@ -0,0 +1,24 @@
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version"
}
}
apply plugin: "kotlin"
apply plugin: "kotlin-jpa"
repositories {
mavenLocal()
}
sourceSets {
main.kotlin.srcDir 'src'
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
@@ -0,0 +1,47 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* 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.
*/
/**
* This file was copied from the javax.persistence :
* https://github.com/eclipse/javax.persistence/blob/master/src/javax/persistence/Entity.java
*/
package javax.persistence;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Specifies that the class is an entity. This annotation is applied to the
* entity class.
*
* @since Java Persistence 1.0
*/
@Documented
@Target(TYPE)
@Retention(RUNTIME)
public @interface Entity {
/**
* (Optional) The entity name. Defaults to the unqualified
* name of the entity class. This name is used to refer to the
* entity in queries. The name must not be a reserved literal
* in the Java Persistence query language.
*/
String name() default "";
}
@@ -0,0 +1,4 @@
package test
@javax.persistence.Entity
class Test(a: String, b: Int)