You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/03/25 11:59:47 UTC
[camel-k-runtime] branch master updated: Default to Java 11 #274
This is an automated email from the ASF dual-hosted git repository.
lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/master by this push:
new f6caf9a Default to Java 11 #274
f6caf9a is described below
commit f6caf9a823821ff1f7c14ccbee21fd39e41d4a36
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Tue Mar 24 21:53:57 2020 +0100
Default to Java 11 #274
---
.github/workflows/pr-build.yml | 9 ++--
.github/workflows/pr-validate.yml | 8 +--
camel-k-loader-kotlin/pom.xml | 59 +++++++++++++---------
.../camel/k/loader/kotlin/KotlinSourceLoader.kt | 10 ++--
.../k/loader/kotlin/dsl/BeansConfiguration.kt | 3 +-
.../loader/kotlin/dsl/IntegrationConfiguration.kt | 2 -
.../services/org/apache/camel/k/loader/kts | 19 +------
pom.xml | 16 ++++--
tooling/camel-k-maven-plugin/pom.xml | 2 +
9 files changed, 63 insertions(+), 65 deletions(-)
diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml
index 83f19c8..6493a72 100644
--- a/.github/workflows/pr-build.yml
+++ b/.github/workflows/pr-build.yml
@@ -25,10 +25,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - name: Set up JDK 8
+ - name: Set up JDK 11
uses: joschi/setup-jdk@v1
with:
- java-version: openjdk8
+ java-version: openjdk11
- name: mvn install
run: ./mvnw -V -B -ntp clean install
- name: Save Cache
@@ -43,7 +43,6 @@ jobs:
strategy:
matrix:
java:
- - openjdk11
- openjdk12
steps:
- uses: actions/checkout@v2
@@ -70,10 +69,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- - name: Set up JDK 8
+ - name: Set up JDK 11
uses: joschi/setup-jdk@v1
with:
- java-version: openjdk8
+ java-version: openjdk11
- name: Restore Cache
uses: actions/cache@v1
with:
diff --git a/.github/workflows/pr-validate.yml b/.github/workflows/pr-validate.yml
index 4f97d3f..421cd77 100644
--- a/.github/workflows/pr-validate.yml
+++ b/.github/workflows/pr-validate.yml
@@ -24,10 +24,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v1
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
+ - uses: actions/checkout@v2
+ - name: Set up JDK 11
+ uses: joschi/setup-jdk@v1
with:
- java-version: 1.8
+ java-version: openjdk11
- name: mvn package
run: ./mvnw -fae -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dcheckstyle.failOnViolation=true clean package -Psourcecheck,license -DskipTests
diff --git a/camel-k-loader-kotlin/pom.xml b/camel-k-loader-kotlin/pom.xml
index 82ce0ec..3dde92a 100644
--- a/camel-k-loader-kotlin/pom.xml
+++ b/camel-k-loader-kotlin/pom.xml
@@ -52,6 +52,11 @@
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-reflect</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-util</artifactId>
<version>${kotlin.version}</version>
</dependency>
@@ -71,12 +76,6 @@
<version>${kotlin.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-annotations</artifactId>
- <scope>provided</scope>
- </dependency>
-
<!-- ****************************** -->
<!-- -->
<!-- TESTS -->
@@ -136,37 +135,20 @@
<build>
<plugins>
<plugin>
- <artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<configuration>
<jvmTarget>${maven.compiler.target}</jvmTarget>
</configuration>
<executions>
<execution>
- <id>kapt</id>
- <goals>
- <goal>kapt</goal>
- </goals>
- <configuration>
- <sourceDirs>
- <sourceDir>src/main/kotlin</sourceDir>
- </sourceDirs>
- <annotationProcessorPaths>
- <annotationProcessorPath>
- <groupId>org.apache.camel.k</groupId>
- <artifactId>camel-k-apt</artifactId>
- <version>${project.version}</version>
- </annotationProcessorPath>
- </annotationProcessorPaths>
- </configuration>
- </execution>
- <execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
+ <jvmTarget>${kotlin.compiler.target}</jvmTarget>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
</sourceDirs>
@@ -178,6 +160,7 @@
<goal>test-compile</goal>
</goals>
<configuration>
+ <jvmTarget>${kotlin.compiler.target}</jvmTarget>
<sourceDirs>
<sourceDir>src/test/kotlin</sourceDir>
</sourceDirs>
@@ -187,6 +170,32 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <!-- Replacing default-compile as it is treated specially by maven -->
+ <execution>
+ <id>default-compile</id>
+ <phase>none</phase>
+ </execution>
+ <!-- Replacing default-testCompile as it is treated specially by maven -->
+ <execution>
+ <id>default-testCompile</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>java-compile</id>
+ <phase>compile</phase>
+ <goals> <goal>compile</goal> </goals>
+ </execution>
+ <execution>
+ <id>java-test-compile</id>
+ <phase>test-compile</phase>
+ <goals> <goal>testCompile</goal> </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>0</forkCount>
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt b/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt
index b5badb1..f245876 100644
--- a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt
+++ b/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/KotlinSourceLoader.kt
@@ -20,7 +20,6 @@ import org.apache.camel.builder.endpoint.EndpointRouteBuilder
import org.apache.camel.k.Runtime
import org.apache.camel.k.Source
import org.apache.camel.k.SourceLoader
-import org.apache.camel.k.annotation.Loader
import org.apache.camel.k.loader.kotlin.dsl.IntegrationConfiguration
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -34,7 +33,6 @@ import kotlin.script.experimental.jvmhost.BasicJvmScriptingHost
import kotlin.script.experimental.jvmhost.JvmScriptCompiler
import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
-@Loader("kts")
class KotlinSourceLoader : SourceLoader {
companion object {
val LOGGER : Logger = LoggerFactory.getLogger(KotlinSourceLoader::class.java)
@@ -64,14 +62,14 @@ class KotlinSourceLoader : SourceLoader {
//
// Arguments used to initialize the script base class
//
- constructorArgs(camelContext.registry, builder)
+ constructorArgs(builder)
}
)
for (report in result.reports) {
- when {
- report.severity == ScriptDiagnostic.Severity.ERROR -> LOGGER.error("{}", report.message, report.exception)
- report.severity == ScriptDiagnostic.Severity.WARNING -> LOGGER.warn("{}", report.message, report.exception)
+ when (report.severity) {
+ ScriptDiagnostic.Severity.ERROR -> LOGGER.error("{}", report.message, report.exception)
+ ScriptDiagnostic.Severity.WARNING -> LOGGER.warn("{}", report.message, report.exception)
else -> LOGGER.info("{}", report.message)
}
}
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/BeansConfiguration.kt b/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/BeansConfiguration.kt
index 13de3a7..9baf638 100644
--- a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/BeansConfiguration.kt
+++ b/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/BeansConfiguration.kt
@@ -21,12 +21,13 @@ import org.apache.camel.Exchange
import org.apache.camel.Predicate
import org.apache.camel.Processor
import org.apache.camel.builder.endpoint.EndpointBuilderFactory
+import kotlin.reflect.full.createInstance
class BeansConfiguration(
val context: CamelContext) : EndpointBuilderFactory {
inline fun <reified T : Any> bean(name: String, block: T.() -> Unit) {
- var bean = T::class.java.newInstance()
+ var bean = T::class.createInstance()
bean.block()
context.registry.bind(name, T::class.java, bean)
diff --git a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationConfiguration.kt b/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationConfiguration.kt
index a02c394..f5827e2 100644
--- a/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationConfiguration.kt
+++ b/camel-k-loader-kotlin/src/main/kotlin/org/apache/camel/k/loader/kotlin/dsl/IntegrationConfiguration.kt
@@ -23,12 +23,10 @@ import org.apache.camel.builder.endpoint.EndpointRouteBuilder
import org.apache.camel.k.loader.kotlin.KotlinCompilationConfiguration
import org.apache.camel.model.*
import org.apache.camel.model.rest.RestDefinition
-import org.apache.camel.spi.Registry
import kotlin.script.experimental.annotations.KotlinScript
@KotlinScript(fileExtension = "kts", compilationConfiguration = KotlinCompilationConfiguration::class)
abstract class IntegrationConfiguration(
- private val registry : Registry,
private val builder : EndpointRouteBuilder) : BuilderSupport(builder.context), Support, EndpointBuilderFactory {
fun rest(): RestDefinition {
diff --git a/.github/workflows/pr-validate.yml b/camel-k-loader-kotlin/src/main/resources/META-INF/services/org/apache/camel/k/loader/kts
similarity index 57%
copy from .github/workflows/pr-validate.yml
copy to camel-k-loader-kotlin/src/main/resources/META-INF/services/org/apache/camel/k/loader/kts
index 4f97d3f..6ad5636 100644
--- a/.github/workflows/pr-validate.yml
+++ b/camel-k-loader-kotlin/src/main/resources/META-INF/services/org/apache/camel/k/loader/kts
@@ -2,7 +2,7 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version 2.0
+# The ASF licenses this file to You 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
#
@@ -14,20 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-name: Validate PR
-on:
- pull_request:
- branches:
- - master
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v1
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
- with:
- java-version: 1.8
- - name: mvn package
- run: ./mvnw -fae -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dcheckstyle.failOnViolation=true clean package -Psourcecheck,license -DskipTests
+class=org.apache.camel.k.loader.kotlin.KotlinSourceLoader
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index efd15f6..59c5a28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,8 +33,12 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
+
+ <maven.compiler.release>11</maven.compiler.release>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ <kotlin.compiler.target>1.8</kotlin.compiler.target>
+
<camel.version>3.1.0</camel.version>
<camel-quarkus.version>1.0.0-M5</camel-quarkus.version>
<catalog.version>${camel.version}</catalog.version>
@@ -47,7 +51,7 @@
<log4j2.version>2.13.1</log4j2.version>
<slf4j.version>1.7.30</slf4j.version>
<groovy.version>3.0.2</groovy.version>
- <kotlin.version>1.3.70</kotlin.version>
+ <kotlin.version>1.3.71</kotlin.version>
<snakeyaml.version>1.26</snakeyaml.version>
<spock.version>2.0-M2-groovy-3.0</spock.version>
<jackson.version>2.10.3</jackson.version>
@@ -79,6 +83,8 @@
<maven-assembly-plugin.version>3.1.1</maven-assembly-plugin.version>
<jandex-maven-plugin.version>1.0.7</jandex-maven-plugin.version>
<build-helper-maven-plugin.version>3.1.0</build-helper-maven-plugin.version>
+ <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
+ <maven-invoker-plugin.version>3.2.1</maven-invoker-plugin.version>
</properties>
<developers>
@@ -114,8 +120,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
- <source>1.8</source>
- <target>1.8</target>
<compilerArgs>
<arg>-Xlint:deprecation</arg>
<arg>-Xlint:unchecked</arg>
@@ -758,6 +762,7 @@
</plugins>
</build>
</profile>
+
<profile>
<id>docker</id>
<activation>
@@ -768,6 +773,7 @@
<properties>
<quarkus.native.container-build>true</quarkus.native.container-build>
<quarkus.native.container-runtime>docker</quarkus.native.container-runtime>
+ <quarkus.native.builder-image>quay.io/quarkus/ubi-quarkus-native-image:${graalvm.version}-java11</quarkus.native.builder-image>
</properties>
</profile>
</profiles>
diff --git a/tooling/camel-k-maven-plugin/pom.xml b/tooling/camel-k-maven-plugin/pom.xml
index 13492ac..5029079 100644
--- a/tooling/camel-k-maven-plugin/pom.xml
+++ b/tooling/camel-k-maven-plugin/pom.xml
@@ -190,6 +190,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
+ <version>${maven-jar-plugin.version}</version>
<configuration>
<archive>
<manifest>
@@ -225,6 +226,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
+ <version>${maven-invoker-plugin.version}</version>
<configuration>
<scriptVariables>
<runtimeVersion>${project.version}</runtimeVersion>