Skip to content

Commit 20a2932

Browse files
committed
chore: add script to generate APIs
1 parent 4c5c678 commit 20a2932

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

scripts/generate-sources.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# How to run script from ROOT path:
5+
# docker run --rm -it -v "${PWD}":/code/client -v ~/.m2:/root/.m2 -w /code maven:3-openjdk-8 /code/client/scripts/generate-sources.sh
6+
#
7+
8+
#
9+
# Download customized generator
10+
#
11+
git clone --single-branch --branch master https://github.com/bonitoo-io/influxdb-clients-apigen "/code/influxdb-clients-apigen"
12+
mkdir -p /code/influxdb-clients-apigen/build/
13+
ln -s /code/client /code/influxdb-clients-apigen/build/influxdb-client-python
14+
cd /code/influxdb-clients-apigen/
15+
16+
#
17+
# Download APIs contracts
18+
#
19+
wget https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml -O "/code/influxdb-clients-apigen/oss.yml"
20+
wget https://raw.githubusercontent.com/influxdata/openapi/master/contracts/cloud.yml -O "/code/influxdb-clients-apigen/cloud.yml"
21+
wget https://raw.githubusercontent.com/influxdata/openapi/master/contracts/invocable-scripts.yml -O "/code/influxdb-clients-apigen/invocable-scripts.yml"
22+
23+
#
24+
# Build generator
25+
#
26+
mvn -DskipTests -f /code/influxdb-clients-apigen/openapi-generator/pom.xml clean install
27+
28+
#
29+
# Prepare customized contract
30+
#
31+
mvn -f /code/influxdb-clients-apigen/openapi-generator/pom.xml compile exec:java -Dexec.mainClass="com.influxdb.AppendCloudDefinitions" -Dexec.args="oss.yml cloud.yml"
32+
mvn -f /code/influxdb-clients-apigen/openapi-generator/pom.xml compile exec:java -Dexec.mainClass="com.influxdb.MergeContracts" -Dexec.args="oss.yml invocable-scripts.yml"
33+
34+
#
35+
# Generate sources
36+
#
37+
./generate-python.sh

0 commit comments

Comments
 (0)