diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/pom.xml b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/pom.xml new file mode 100644 index 00000000000..b826aef0cf6 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + + + org.jetbrains.kotlin + kotlin-project + 0.1-SNAPSHOT + ../../pom.xml + + + test-moduleName + + + + junit + junit + 4.9 + + + org.jetbrains.kotlin + kotlin-runtime + ${project.version} + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-source-plugin + 2.1.2 + + + + + ${project.basedir}/src/main/kotlin + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${project.version} + + customName + + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + + + \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/src/main/kotlin/org/jetbrains/moduleName.kt b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/src/main/kotlin/org/jetbrains/moduleName.kt new file mode 100644 index 00000000000..5364e6f71ac --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/src/main/kotlin/org/jetbrains/moduleName.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2010-2015 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. + */ + +package org.jetbrains + +fun main(args : Array) { + System.out?.println(isModuleFileExists()) +} + +fun isModuleFileExists() : Boolean { + val systemClassLoader = ClassLoader.getSystemClassLoader() + val moduleFile = "META-INF/customName.kotlin_module" + val resourceAsStream = systemClassLoader.getResourceAsStream(moduleFile) + return resourceAsStream != null +} \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/src/test/java/org/jetbrains/ModuleNameJavaTest.java b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/src/test/java/org/jetbrains/ModuleNameJavaTest.java new file mode 100644 index 00000000000..a075827d7d7 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/src/test/java/org/jetbrains/ModuleNameJavaTest.java @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2015 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. + */ + +package org.jetbrains; + +import org.junit.Test; + +import static junit.framework.Assert.assertTrue; + +public class ModuleNameJavaTest { + + @Test + public void moduleFileExists() { + assertTrue(org.jetbrains.JetbrainsPackage.isModuleFileExists()); + } +} diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/verify.bsh b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/verify.bsh new file mode 100644 index 00000000000..92301bbdd77 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleName/verify.bsh @@ -0,0 +1,6 @@ +import java.io.*; + +File file = new File(basedir, "target/test-moduleName-0.1-SNAPSHOT.jar"); +if (!file.exists() || !file.isFile()) { + throw new FileNotFoundException("Could not find generated JAR: " + file); +} diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/pom.xml b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/pom.xml new file mode 100644 index 00000000000..c8765f09c01 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/pom.xml @@ -0,0 +1,75 @@ + + + 4.0.0 + + + org.jetbrains.kotlin + kotlin-project + 0.1-SNAPSHOT + ../../pom.xml + + + test-moduleNameDefault + + + + junit + junit + 4.9 + + + org.jetbrains.kotlin + kotlin-runtime + ${project.version} + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-source-plugin + 2.1.2 + + + + + ${project.basedir}/src/main/kotlin + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${project.version} + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + + + \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/src/main/kotlin/org/jetbrains/moduleName.kt b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/src/main/kotlin/org/jetbrains/moduleName.kt new file mode 100644 index 00000000000..39c93316570 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/src/main/kotlin/org/jetbrains/moduleName.kt @@ -0,0 +1,12 @@ +package org.jetbrains + +fun main(args : Array) { + System.out?.println(isModuleFileExists()) +} + +fun isModuleFileExists() : Boolean { + val systemClassLoader = ClassLoader.getSystemClassLoader() + val moduleFile = "META-INF/test-moduleNameDefault.kotlin_module" + val resourceAsStream = systemClassLoader.getResourceAsStream(moduleFile) + return resourceAsStream != null +} \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/src/test/java/org/jetbrains/ModuleNameJavaTest.java b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/src/test/java/org/jetbrains/ModuleNameJavaTest.java new file mode 100644 index 00000000000..a075827d7d7 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/src/test/java/org/jetbrains/ModuleNameJavaTest.java @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2015 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. + */ + +package org.jetbrains; + +import org.junit.Test; + +import static junit.framework.Assert.assertTrue; + +public class ModuleNameJavaTest { + + @Test + public void moduleFileExists() { + assertTrue(org.jetbrains.JetbrainsPackage.isModuleFileExists()); + } +} diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/verify.bsh b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/verify.bsh new file mode 100644 index 00000000000..278bd1ecd7e --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-moduleNameDefault/verify.bsh @@ -0,0 +1,6 @@ +import java.io.*; + +File file = new File(basedir, "target/test-moduleNameDefault-0.1-SNAPSHOT.jar"); +if (!file.exists() || !file.isFile()) { + throw new FileNotFoundException("Could not find generated JAR: " + file); +}