Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set SDK env #173

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=11.0.20-zulu
java=11.0.24-zulu
3 changes: 3 additions & 0 deletions plugins/protocw-checker/.sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=11.0.24-zulu
49 changes: 26 additions & 23 deletions plugins/protocw-checker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,18 @@
</developers>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<kotlin.version>1.9.24</kotlin.version>
<arrow-core.version>0.10.5</arrow-core.version>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven-release-plugin.version>3.1.1</maven-release-plugin.version>

<plugin.id>protocw-checker</plugin.id>
<plugin.class>com.freenow.sauron.plugins.SauronPlugin</plugin.class>
<plugin.provider>freenow</plugin.provider>
<plugin.dependencies />
<kotlin.version>1.3.72</kotlin.version>
<arrow-core.version>0.10.5</arrow-core.version>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<scm.url>scm:git:[email protected]:freenowtech/sauron.git</scm.url>
</properties>

Expand Down Expand Up @@ -87,23 +90,17 @@
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
<version>2.10.4</version>
<version>2.11.2</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>io.github.microutils</groupId>
<artifactId>kotlin-logging</artifactId>
<version>1.6.26</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
<groupId>io.github.oshai</groupId>
<artifactId>kotlin-logging-jvm</artifactId>
<version>7.0.0</version>
</dependency>

<dependency>
Expand All @@ -119,7 +116,6 @@
<version>4.13.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -140,11 +136,18 @@
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
<execution>
<id>kapt</id>
<goals>
Expand All @@ -158,9 +161,9 @@
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
<jvmTarget>${maven.compiler.target}</jvmTarget>
<args>-java-parameters
<arg>-Xinline-classes</arg>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
Expand Down Expand Up @@ -188,7 +191,6 @@
<Plugin-Dependencies>${plugin.dependencies}</Plugin-Dependencies>
</manifestEntries>
</archive>
<finalName>${project.build.finalName}</finalName>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
Expand All @@ -208,6 +210,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<executions>
<execution>
<id>compile</id>
Expand Down Expand Up @@ -252,7 +255,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -266,7 +269,7 @@
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId>
<version>1.4.30</version>
<version>1.9.20</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -280,7 +283,7 @@
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>kotlin-as-java-plugin</artifactId>
<version>1.4.30</version>
<version>1.9.20</version>
</plugin>
</dokkaPlugins>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package com.freenow.sauron.plugins

import com.freenow.sauron.model.DataSet
import com.freenow.sauron.plugins.SauronExtension
import com.freenow.sauron.plugins.protocw.Checker
import com.freenow.sauron.plugins.protocw.DefaultChecker
import com.freenow.sauron.plugins.protocw.DefaultService
import com.freenow.sauron.plugins.protocw.DefaultValidator
import com.freenow.sauron.properties.PluginsConfigurationProperties
import mu.KLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.pf4j.Extension

@Extension
class ProtocwChecker(
private val checker: Checker = DefaultChecker(DefaultService(), DefaultValidator())
) : SauronExtension, KLogging() {
) : SauronExtension {

override fun apply(properties: PluginsConfigurationProperties, input: DataSet): DataSet {
checker.apply(
Expand All @@ -32,6 +31,7 @@ class ProtocwChecker(
}

companion object {
private val logger = KotlinLogging.logger {}
const val PROP_PROTOC_FILE_NAME = "protocw-file-name"
const val PROP_PROTOCW_PROPERTIRES_FILE_NAME = "protocw-properties-file-name"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ class DefaultService : Service {
return "malformed_version"
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class DefaultValidator : Validator {
override fun check(repository: Path): Either<String, Unit> {

return Either.fx {
!checkRepositorExists(repository)
!checkRepositoryExists(repository)
!checkNeedsProtoc(repository)
Unit
}
}

private fun checkRepositorExists(repository: Path): Either<String, Unit> {
private fun checkRepositoryExists(repository: Path): Either<String, Unit> {
return Either.cond(Files.isDirectory(repository),
{ Unit },
{ "Repository is not a directory" }
Expand All @@ -36,5 +36,4 @@ class DefaultValidator : Validator {
)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ import java.nio.file.Path

interface Validator {
fun check(repository: Path): Either<String, Unit>

}
3 changes: 3 additions & 0 deletions sauron-service/.sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=11.0.24-zulu
Loading