Skip to content

Commit

Permalink
feat(monorepo): improve create connector script
Browse files Browse the repository at this point in the history
  • Loading branch information
chillleader committed Dec 29, 2022
1 parent ae8ded4 commit 991ae47
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 35 deletions.
22 changes: 0 additions & 22 deletions add_new_connector.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<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/xsd/maven-4.0.0.xsd">
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.camunda.connector</groupId>
<artifactId>connector-function-parent</artifactId>
<version>0.14.3-SNAPSHOT</version>
<version>${archetypeVersion}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>${artifactId}</name>
<description>${artifactId} for Camunda 8</description>
<description>${connectorName} cnnector for Camunda 8</description>
<artifactId>${artifactId}</artifactId>
<packaging>jar</packaging>

Expand All @@ -24,16 +26,6 @@
</licenses>

<dependencies>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
24 changes: 24 additions & 0 deletions connectors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,27 @@ is run as a Google Cloud Function.
The element templates can be found in the `element-templates` directory of each connector.

Example: [aws-lambda/element-templates](aws-lambda/element-templates/aws-lambda-connector.json)

## Development guidelines

### Create a new Connector

To create a new Connector, simply use the [script](add_new_connector.sh) or generate a new
project from the [Maven archetype](../connector-archetype-internal).

Execute from the repository root directory:
```shell
chmod +x connectors/add_new_connector.sh
./connectors/add_new_connector.sh ${YOUR_CONNECTOR_NAME}
```
Substitute `${YOUR_CONNECTOR_NAME}` with the name of your new Connector.
**Please provide the name in a short format:** e.g. use simply `slack`, **not** `connector-slack`.

The script will create a Maven sub-module in the `connectors` directory. You will likely
need to import the project in your IDE manually.

### Add new Connector to the bundle

As a next step, please include your Connector in the connectors bundle.
- Add it to the `dependencyManagement` section of [bundle parent POM](../bundle/mvn/pom.xml)
- Add it to the `dependencies` section of [default bundle POM](../bundle/mvn/default-bundle/pom.xml)
23 changes: 23 additions & 0 deletions connectors/add_new_connector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

CONNECTORS_DIR='connectors'

CONNECTOR_NAME=${1}
ARTIFACT_NAME="connector-${CONNECTOR_NAME}"

VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)

# Using old (3.1.0) version due to a bug in the newer one (3.2.1)
# https://issues.apache.org/jira/browse/ARCHETYPE-584
mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.0:generate \
-DarchetypeGroupId=io.camunda.connector \
-DarchetypeArtifactId=connector-archetype-internal \
-DarchetypeVersion=${VERSION} \
-DinteractiveMode=false \
-DconnectorName=${CONNECTOR_NAME} \
-DoutputDirectory=${CONNECTORS_DIR}

# Rename directory to follow convention
mv "${CONNECTORS_DIR}/${ARTIFACT_NAME}" "${CONNECTORS_DIR}/${CONNECTOR_NAME}"
sed "s/${ARTIFACT_NAME}/${CONNECTOR_NAME}/" ${CONNECTORS_DIR}/pom.xml \
| diff -p ${CONNECTORS_DIR}/pom.xml /dev/stdin | patch

0 comments on commit 991ae47

Please sign in to comment.