commit ec2ca3184ad0a74d0593a6df6631280c4f36faf3 Author: Erik C. Thauvin Date: Wed Jul 20 16:02:48 2016 -0700 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24f188e --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +**/.idea/dictionaries +**/.idea/gradle.xml +**/.idea/libraries +**/.idea/tasks.xml +**/.idea/workspace.xml +*.iws +.DS_Store +.classpath +.gradle +.kobalt +.nb-gradle +.project +.settings +/bin +/build +/deploy +/dist +/gen +/gradle.properties +/local.properties +/out +/proguard-project.txt +/project.properties +/target +/test-output +Thumbs.db +ehthumbs.db +kobaltBuild \ No newline at end of file diff --git a/example/kobalt/src/Build.kt b/example/kobalt/src/Build.kt new file mode 100644 index 0000000..c833369 --- /dev/null +++ b/example/kobalt/src/Build.kt @@ -0,0 +1,41 @@ +import com.beust.kobalt.* +import com.beust.kobalt.plugin.packaging.* +import com.beust.kobalt.plugin.application.* +import com.beust.kobalt.plugin.java.* +import net.thauvin.erik.kobalt.plugin.maven.local.* + +val repos = repos(localMaven()) + +val pl = plugins(file("../kobaltBuild/libs/kobalt-maven-local-0.4.0-beta.jar")) +//val pl = plugins("net.thauvin.erik:kobalt-maven-local:0.4.0-beta") + +val example = project { + + name = "example" + group = "com.example" + artifactId = name + version = "0.1" + + sourceDirectories { + path("src/main/java") + } + + sourceDirectoriesTest { + path("src/test/java") + } + + dependencies { + } + + dependenciesTest { + } + + assemble { + jar { + } + } + + application { + mainClass = "com.example.Main" + } +} \ No newline at end of file diff --git a/example/kobalt/wrapper/kobalt-wrapper.jar b/example/kobalt/wrapper/kobalt-wrapper.jar new file mode 100644 index 0000000..f40ec90 Binary files /dev/null and b/example/kobalt/wrapper/kobalt-wrapper.jar differ diff --git a/example/kobalt/wrapper/kobalt-wrapper.properties b/example/kobalt/wrapper/kobalt-wrapper.properties new file mode 100644 index 0000000..f94d8df --- /dev/null +++ b/example/kobalt/wrapper/kobalt-wrapper.properties @@ -0,0 +1 @@ +kobalt.version=0.861 \ No newline at end of file diff --git a/example/kobaltw b/example/kobaltw new file mode 100644 index 0000000..b27b3d8 --- /dev/null +++ b/example/kobaltw @@ -0,0 +1 @@ +java -jar $(dirname $0)/kobalt/wrapper/kobalt-wrapper.jar $* diff --git a/example/kobaltw.bat b/example/kobaltw.bat new file mode 100644 index 0000000..d578071 --- /dev/null +++ b/example/kobaltw.bat @@ -0,0 +1,4 @@ +@echo off +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +java -jar "%DIRNAME%/kobalt/wrapper/kobalt-wrapper.jar" %* diff --git a/example/src/main/java/com/example/Main.java b/example/src/main/java/com/example/Main.java new file mode 100644 index 0000000..c07945d --- /dev/null +++ b/example/src/main/java/com/example/Main.java @@ -0,0 +1,7 @@ +package com.example; + +class Main { + public static void main(String[] argv) { + System.out.println("\n\nHello Java world from Kobalt\n\n"); + } +} \ No newline at end of file diff --git a/example/src/test/java/com/example/ExampleTest.java b/example/src/test/java/com/example/ExampleTest.java new file mode 100644 index 0000000..2da4817 --- /dev/null +++ b/example/src/test/java/com/example/ExampleTest.java @@ -0,0 +1,9 @@ +package com.example; +import org.testng.annotations.Test; + +public class ExampleTest { + @Test + public void f() { + System.out.println("Running test"); + } +} \ No newline at end of file diff --git a/kobalt-maven-local.iml b/kobalt-maven-local.iml new file mode 100644 index 0000000..36626d0 --- /dev/null +++ b/kobalt-maven-local.iml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kobalt-maven-local.ipr b/kobalt-maven-local.ipr new file mode 100644 index 0000000..4eec4c6 --- /dev/null +++ b/kobalt-maven-local.ipr @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Android Lint + + + Java + + + Portability issuesJava + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.8.x + + + + + + + + \ No newline at end of file diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml new file mode 100644 index 0000000..7bc9dd6 --- /dev/null +++ b/kobalt/Build.kt.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt new file mode 100644 index 0000000..7d3397a --- /dev/null +++ b/kobalt/src/Build.kt @@ -0,0 +1,70 @@ +import com.beust.kobalt.plugin.packaging.assemble +import com.beust.kobalt.plugin.publish.bintray +import com.beust.kobalt.project +import com.beust.kobalt.repos +import org.apache.maven.model.Developer +import org.apache.maven.model.License +import org.apache.maven.model.Model +import org.apache.maven.model.Scm + +val repos = repos() + +val dev = false +val kobaltDependency = if (dev) "kobalt" else "kobalt-plugin-api" + +val p = project { + + name = "kobalt-maven-local" + group = "net.thauvin.erik" + artifactId = name + version = "0.4.0-beta" + + pom = Model().apply { + description = "Maven Local Repository plug-in for the Kobalt build system." + url = "https://github.com/ethauvin/kobalt-exec" + licenses = listOf(License().apply { + name = "BSD 3-Clause" + url = "https://opensource.org/licenses/BSD-3-Clause" + }) + scm = Scm().apply { + url = "https://github.com/ethauvin/kobalt-maven-local" + connection = "https://github.com/ethauvin/kobalt-maven-local.git" + developerConnection = "git@github.com:ethauvin/kobalt-maven-local.git" + } + developers = listOf(Developer().apply { + id = "ethauvin" + name = "Erik C. Thauvin" + email = "erik@thauvin.net" + }) + } + + sourceDirectories { + path("src/main/kotlin") + } + + sourceDirectoriesTest { + path("src/test/kotlin") + } + + dependencies { + compile("com.beust:$kobaltDependency:0.861") + compile("org.apache.maven:maven-settings-builder:3.3.9") + } + + dependenciesTest { + compile("org.testng:testng:") + + } + + assemble { + jar { + fatJar = true + } + + mavenJars {} + } + + bintray { + publish = false + } +} \ No newline at end of file diff --git a/kobalt/wrapper/kobalt-wrapper.jar b/kobalt/wrapper/kobalt-wrapper.jar new file mode 100644 index 0000000..3f59e09 Binary files /dev/null and b/kobalt/wrapper/kobalt-wrapper.jar differ diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties new file mode 100644 index 0000000..f94d8df --- /dev/null +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -0,0 +1 @@ +kobalt.version=0.861 \ No newline at end of file diff --git a/kobaltw b/kobaltw new file mode 100644 index 0000000..3633f46 --- /dev/null +++ b/kobaltw @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +java -jar $(dirname $0)/kobalt/wrapper/kobalt-wrapper.jar $* diff --git a/kobaltw.bat b/kobaltw.bat new file mode 100644 index 0000000..d578071 --- /dev/null +++ b/kobaltw.bat @@ -0,0 +1,4 @@ +@echo off +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +java -jar "%DIRNAME%/kobalt/wrapper/kobalt-wrapper.jar" %* diff --git a/libs/kobalt-maven-local-0.1.jar b/libs/kobalt-maven-local-0.1.jar new file mode 100644 index 0000000..e09cb6c Binary files /dev/null and b/libs/kobalt-maven-local-0.1.jar differ diff --git a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/maven/local/MavenLocalPlugin.kt b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/maven/local/MavenLocalPlugin.kt new file mode 100644 index 0000000..f6acccf --- /dev/null +++ b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/maven/local/MavenLocalPlugin.kt @@ -0,0 +1,42 @@ +package net.thauvin.erik.kobalt.plugin.maven.local + +import com.beust.kobalt.api.BasePlugin +import com.beust.kobalt.api.ILocalMavenRepoPathInterceptor +import com.beust.kobalt.api.KobaltContext +import com.beust.kobalt.api.Project +import com.beust.kobalt.misc.log +import org.apache.maven.settings.building.DefaultSettingsBuilderFactory +import org.apache.maven.settings.building.DefaultSettingsBuildingRequest +import java.io.File + +public class MavenLocalPlugin : BasePlugin(), ILocalMavenRepoPathInterceptor { + var mavenLocalPath: String = "" + + override val name = "kobalt-maven-local" + + override fun apply(project: Project, context: KobaltContext) { + val factory = DefaultSettingsBuilderFactory() + val builder = factory.newInstance() + val settings = DefaultSettingsBuildingRequest() + + settings.systemProperties = System.getProperties() + settings.userSettingsFile = File(System.getProperty("user.home"), ".m2/settings.xml") + + val m2Home = System.getProperty("M2_HOME") + if (m2Home != null) { + settings.globalSettingsFile = File(m2Home, "conf/settings.xml") + } + + val result = builder.build(settings) + mavenLocalPath = result.effectiveSettings.localRepository + } + + override fun repoPath(currentPath: String): String { + if (mavenLocalPath.isNotEmpty()) { + log(2, "Setting maven local repository path to: " + mavenLocalPath) + return mavenLocalPath + } else { + return currentPath + } + } +} \ No newline at end of file diff --git a/src/main/resources/META-INF/kobalt-plugin.xml b/src/main/resources/META-INF/kobalt-plugin.xml new file mode 100644 index 0000000..73cf93b --- /dev/null +++ b/src/main/resources/META-INF/kobalt-plugin.xml @@ -0,0 +1,6 @@ + + kobalt-maven-local + + net.thauvin.erik.kobalt.plugin.maven.local.MavenLocalPlugin + + \ No newline at end of file diff --git a/src/test/kotlin/com/example/MainTest.kt b/src/test/kotlin/com/example/MainTest.kt new file mode 100644 index 0000000..96458e9 --- /dev/null +++ b/src/test/kotlin/com/example/MainTest.kt @@ -0,0 +1,8 @@ +package com.example + +import org.testng.annotations.Test + +class ExampleTest { + @Test + fun f() = println("Running test") +} \ No newline at end of file