Skip to content

Commit

Permalink
Added a first version of Camel-Kamelets-Bom
Browse files Browse the repository at this point in the history
  • Loading branch information
oscerd committed Jan 5, 2022
1 parent cef0153 commit fe5bdfd
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 2 deletions.
Empty file modified kamelets/pulsar-sink.kamelet.yaml
100755 → 100644
Empty file.
Empty file modified kamelets/pulsar-source.kamelet.yaml
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion kamelets/redis-sink.kamelet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ spec:
parameters:
command: "{{command}}"
channels: "{{channels}}"
serializer: "#class:{{serializer}}"
serializer: "#class:{{serializer}}"
Empty file modified kamelets/wttrin-source.kamelet.yaml
100755 → 100644
Empty file.
45 changes: 45 additions & 0 deletions library/camel-kamelets-bom/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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 "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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.camel.kamelets</groupId>
<artifactId>camel-kamelets-parent</artifactId>
<version>main-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>camel-kamelets-bom</artifactId>
<packaging>pom</packaging>

<name>Camel Kamelets BOM</name>
<description>Camel Kamelets BOM</description>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${version.org.apache.commons.commons-dbcp2}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ spec:
parameters:
command: "{{command}}"
channels: "{{channels}}"
serializer: "#class:{{serializer}}"
serializer: "#class:{{serializer}}"
30 changes: 30 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<module>library/camel-kamelets</module>
<module>library/camel-kamelets-catalog</module>
<module>library/camel-kamelets-utils</module>
<module>library/camel-kamelets-bom</module>
</modules>

<properties>
Expand All @@ -53,6 +54,7 @@
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-checksum-maven-plugin.version>1.11</maven-checksum-maven-plugin.version>
<maven-antrun-plugin.version>3.0.0</maven-antrun-plugin.version>
<maven-groovy-plugin.version>2.1.1</maven-groovy-plugin.version>
<apache-rat-plugin.version>0.13</apache-rat-plugin.version>

<camel.version>3.14.0</camel.version>
Expand All @@ -63,6 +65,8 @@
<commons.io.version>2.11.0</commons.io.version>
<junit.jupiter.version>5.8.1</junit.jupiter.version>
<classgraph.version>4.8.138</classgraph.version>

<version.org.apache.commons.commons-dbcp2>2.8.0</version.org.apache.commons.commons-dbcp2>
</properties>

<developers>
Expand Down Expand Up @@ -278,6 +282,32 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>${maven-groovy-plugin.version}</version>
<inherited>false</inherited>
<executions>
<execution>
<id>UpdateKamelets</id>
<phase>process-resources</phase>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
<configuration>
<scriptpath>
<path>${project.basedir}/script/version</path>
</scriptpath>
<source>
import UpdateDepsVersionKamelets
new UpdateDepsVersionKamelets().updateKameletDirectory("./kamelets/", [
"version.org.apache.commons.commons-dbcp2": "${version.org.apache.commons.commons-dbcp2}"
])
</source>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
64 changes: 64 additions & 0 deletions script/version/UpdateDepsVersionKamelets.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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 "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.
*/

import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
import java.util.regex.Pattern
import java.util.Map
import java.util.Properties

def updateKameletDirectory(String directoryName, Map properties) {
println "#### Update Dependencies Version Kamelets BEGIN"

// compute version replacement
def libVersions = [:]
properties.each {prop ->
if (prop.key.startsWith("version.")) {
String ga = prop.key.substring("version.".length())
int split = ga.lastIndexOf(".")
if (split > 0 && split < ga.length() - 1) {
String groupId = ga.substring(0, split)
String artifactId = ga.substring(split + 1)
String libSelector = "mvn:" + Pattern.quote(groupId) + ":" + Pattern.quote(artifactId) + ":[A-Za-z0-9-.]+"
String libNewVersion = "mvn:" + groupId + ":" + artifactId + ":" + prop.value
libVersions[libSelector] = libNewVersion
println "#### Going to replace in all files \"${libSelector}\" with \"${libNewVersion}\""
}
}
}

File directory = new File(directoryName)
File[] files = directory.listFiles()

for (File f in files) {
if (f.getName().endsWith(".kamelet.yaml")) {
String kameletFile = f.getName()
new File( kameletFile + ".bak" ).withWriter { w ->
new File( directoryName + kameletFile ).eachLine { line ->
libVersions.each { line = line.replaceAll(it.key, it.value)
w << line + System.getProperty("line.separator") }
}
}
Files.copy(Paths.get(kameletFile + ".bak"), Paths.get(directoryName + kameletFile), StandardCopyOption.REPLACE_EXISTING)
boolean deleted = new File(kameletFile + ".bak").delete()
}
}

println "#### Update Dependencies Version Kamelets END"
}

0 comments on commit fe5bdfd

Please sign in to comment.