|
1 | | -#!/bin/bash |
2 | | -# this bash script run the scripts for the 'mature' generators |
| 1 | +#!/usr/bin/env bash |
| 2 | +# this bash script runs the scripts for the 'mature' generators by default. |
| 3 | +# Supports --batch option which will compile all generators defined under bin/ci/*.json |
3 | 4 | # it ensures that all changes are committed into the 'samples/' folder |
| 5 | +# shellcheck disable=SC2155 |
| 6 | +declare cwd="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 7 | +declare root="$(cd "$cwd" && cd ../../ && pwd)" |
| 8 | +declare executable="${root}/modules/openapi-generator-cli/target/openapi-generator-cli.jar" |
| 9 | +declare batch_mode="false" |
| 10 | + |
4 | 11 |
|
5 | 12 | echo "# START SCRIPT: $0" |
6 | 13 |
|
7 | 14 | echo "IMPORTANT: this script should be run by the CI (e.g. Shippable) to ensure that the 'samples/' folder is up to date." |
| 15 | +if [ "--batch" = "$1" ]; then |
| 16 | + batch_mode="true" |
| 17 | + echo "Running in 'batch mode' (single JVM, mutliple threads)." |
| 18 | +else |
| 19 | + echo "When running locally execute with argument --batch." |
| 20 | +fi |
8 | 21 | echo "Please press CTRL+C to stop or the script will continue in 5 seconds." |
9 | 22 |
|
10 | 23 | sleep 5 |
11 | 24 |
|
12 | 25 | # LIST OF SCRIPTS: |
13 | 26 | declare -a scripts=( |
14 | 27 | # SAMPLES |
15 | | -"./bin/ruby-client-petstore.sh" |
16 | | -"./bin/ruby-client-petstore-faraday.sh" |
17 | | -"./bin/openapi3/ruby-client-petstore.sh" |
18 | | -"./bin/openapi3/ruby-client-faraday-petstore.sh" |
| 28 | +"${root}/bin/ruby-client-petstore.sh" |
| 29 | +"${root}/bin/ruby-client-petstore-faraday.sh" |
| 30 | +"${root}/bin/openapi3/ruby-client-petstore.sh" |
| 31 | +"${root}/bin/openapi3/ruby-client-faraday-petstore.sh" |
19 | 32 |
|
20 | | -"./bin/java-petstore-all.sh" |
21 | | -"./bin/java-jaxrs-petstore-server-all.sh" |
22 | | -"./bin/java-msf4j-petstore-server.sh" |
23 | | -"./bin/openapi3/jaxrs-jersey-petstore.sh" |
24 | | -"./bin/spring-all-petstore.sh" |
25 | | -"./bin/javascript-petstore-all.sh" |
26 | | -"./bin/kotlin-client-petstore-multiplatform.sh" |
27 | | -"./bin/kotlin-client-petstore.sh" |
28 | | -"./bin/kotlin-client-string.sh" |
29 | | -"./bin/kotlin-client-threetenbp.sh" |
30 | | -"./bin/kotlin-server-petstore.sh" |
31 | | -"./bin/kotlin-springboot-petstore-server.sh" |
32 | | -"./bin/kotlin-springboot-petstore-server-reactive.sh" |
33 | | -"./bin/mysql-schema-petstore.sh" |
34 | | -"./bin/nim-client-petstore.sh" |
35 | | -"./bin/python-petstore-all.sh" |
36 | | -"./bin/openapi3/python-petstore.sh" |
37 | | -"./bin/php-petstore.sh" |
38 | | -"./bin/php-silex-petstore-server.sh" |
39 | | -"./bin/php-symfony-petstore.sh" |
40 | | -"./bin/php-lumen-petstore-server.sh" |
41 | | -"./bin/php-slim-server-petstore.sh" |
42 | | -"./bin/php-slim4-server-petstore.sh" |
43 | | -"./bin/php-ze-ph-petstore-server.sh" |
44 | | -"./bin/openapi3/php-petstore.sh" |
45 | | -"./bin/typescript-angularjs-petstore.sh" |
46 | | -"./bin/typescript-angular-petstore-all.sh" |
47 | | -"./bin/typescript-aurelia-petstore.sh" |
48 | | -"./bin/typescript-axios-petstore-all.sh" |
49 | | -"./bin/typescript-fetch-petstore-all.sh" |
50 | | -"./bin/typescript-inversify-petstore.sh" |
51 | | -"./bin/typescript-jquery-petstore-all.sh" |
52 | | -"./bin/typescript-node-petstore-all.sh" |
53 | | -"./bin/typescript-rxjs-petstore-all.sh" |
54 | | -"./bin/rust-server-petstore.sh" |
55 | | -"./bin/r-petstore.sh" |
56 | | -"./bin/haskell-http-client-petstore.sh" |
57 | | -"./bin/csharp-petstore.sh" |
58 | | -"./bin/csharp-netcore-petstore-all.sh" |
59 | | -"./bin/elixir-petstore.sh" |
60 | | -"./bin/openapi3/go-petstore.sh" |
61 | | -"./bin/go-experimental-petstore.sh" |
62 | | -"./bin/go-petstore.sh" |
63 | | -"./bin/go-petstore-withxml.sh" |
64 | | -"./bin/go-petstore-server.sh" |
65 | | -"./bin/go-gin-petstore-server.sh" |
66 | | -"./bin/groovy-petstore.sh" |
67 | | -"./bin/apex-petstore.sh" |
68 | | -"./bin/perl-petstore-all.sh" |
69 | | -"./bin/dart-jaguar-petstore.sh" |
70 | | -#"./bin/dart-dio-petstore.sh" |
71 | | -"./bin/dart-petstore.sh" |
72 | | -"./bin/dart2-petstore.sh" |
73 | | -"./bin/java-play-framework-petstore-server-all.sh" |
74 | | -"./bin/elm-petstore-all.sh" |
75 | | -"./bin/meta-codegen.sh" |
| 33 | +"${root}/bin/java-petstore-all.sh" |
| 34 | +"${root}/bin/java-jaxrs-petstore-server-all.sh" |
| 35 | +"${root}/bin/java-msf4j-petstore-server.sh" |
| 36 | +"${root}/bin/openapi3/jaxrs-jersey-petstore.sh" |
| 37 | +"${root}/bin/spring-all-petstore.sh" |
| 38 | +"${root}/bin/javascript-petstore-all.sh" |
| 39 | +"${root}/bin/kotlin-client-petstore-multiplatform.sh" |
| 40 | +"${root}/bin/kotlin-client-petstore.sh" |
| 41 | +"${root}/bin/kotlin-client-string.sh" |
| 42 | +"${root}/bin/kotlin-client-threetenbp.sh" |
| 43 | +"${root}/bin/kotlin-server-petstore.sh" |
| 44 | +"${root}/bin/kotlin-springboot-petstore-server.sh" |
| 45 | +"${root}/bin/kotlin-springboot-petstore-server-reactive.sh" |
| 46 | +"${root}/bin/mysql-schema-petstore.sh" |
| 47 | +"${root}/bin/nim-client-petstore.sh" |
| 48 | +"${root}/bin/python-petstore-all.sh" |
| 49 | +"${root}/bin/openapi3/python-petstore.sh" |
| 50 | +"${root}/bin/php-petstore.sh" |
| 51 | +"${root}/bin/php-silex-petstore-server.sh" |
| 52 | +"${root}/bin/php-symfony-petstore.sh" |
| 53 | +"${root}/bin/php-lumen-petstore-server.sh" |
| 54 | +"${root}/bin/php-slim-server-petstore.sh" |
| 55 | +"${root}/bin/php-slim4-server-petstore.sh" |
| 56 | +"${root}/bin/php-ze-ph-petstore-server.sh" |
| 57 | +"${root}/bin/openapi3/php-petstore.sh" |
| 58 | +"${root}/bin/typescript-angularjs-petstore.sh" |
| 59 | +"${root}/bin/typescript-angular-petstore-all.sh" |
| 60 | +"${root}/bin/typescript-aurelia-petstore.sh" |
| 61 | +"${root}/bin/typescript-axios-petstore-all.sh" |
| 62 | +"${root}/bin/typescript-fetch-petstore-all.sh" |
| 63 | +"${root}/bin/typescript-inversify-petstore.sh" |
| 64 | +"${root}/bin/typescript-jquery-petstore-all.sh" |
| 65 | +"${root}/bin/typescript-node-petstore-all.sh" |
| 66 | +"${root}/bin/typescript-rxjs-petstore-all.sh" |
| 67 | +"${root}/bin/rust-server-petstore.sh" |
| 68 | +"${root}/bin/r-petstore.sh" |
| 69 | +"${root}/bin/haskell-http-client-petstore.sh" |
| 70 | +"${root}/bin/csharp-petstore.sh" |
| 71 | +"${root}/bin/csharp-netcore-petstore-all.sh" |
| 72 | +"${root}/bin/elixir-petstore.sh" |
| 73 | +"${root}/bin/openapi3/go-petstore.sh" |
| 74 | +"${root}/bin/go-experimental-petstore.sh" |
| 75 | +"${root}/bin/go-petstore.sh" |
| 76 | +"${root}/bin/go-petstore-withxml.sh" |
| 77 | +"${root}/bin/go-petstore-server.sh" |
| 78 | +"${root}/bin/go-gin-petstore-server.sh" |
| 79 | +"${root}/bin/groovy-petstore.sh" |
| 80 | +"${root}/bin/apex-petstore.sh" |
| 81 | +"${root}/bin/perl-petstore-all.sh" |
| 82 | +"${root}/bin/dart-jaguar-petstore.sh" |
| 83 | +#"${root}/bin/dart-dio-petstore.sh" |
| 84 | +"${root}/bin/dart-petstore.sh" |
| 85 | +"${root}/bin/dart2-petstore.sh" |
| 86 | +"${root}/bin/java-play-framework-petstore-server-all.sh" |
| 87 | +"${root}/bin/elm-petstore-all.sh" |
| 88 | +"${root}/bin/meta-codegen.sh" |
76 | 89 | # OTHERS |
77 | | -"./bin/utils/export_docs_generators.sh" |
78 | | -"./bin/utils/copy-to-website.sh" |
79 | | -"./bin/utils/export_generators_readme.sh") |
| 90 | +"${root}/bin/utils/export_docs_generators.sh" |
| 91 | +"${root}/bin/utils/copy-to-website.sh" |
| 92 | +"${root}/bin/utils/export_generators_readme.sh") |
80 | 93 |
|
81 | | -export JAVA_OPTS="-Djava.awt.headless=true" |
| 94 | +export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true" |
82 | 95 |
|
83 | | -for script in "${scripts[@]}"; do |
84 | | - if eval $script > /dev/null 2>&1; then |
85 | | - echo "Executed $script successfully!" |
86 | | - else |
87 | | - echo "ERROR: Failed to run $script" |
88 | | - exit 1 |
| 96 | +if [ "true" = "$batch_mode" ]; then |
| 97 | + if [ ! -f "$executable" ]; then |
| 98 | + (cd "${root}" && mvn -B clean package -DskipTests=true -Dmaven.javadoc.skip=true) |
89 | 99 | fi |
90 | | -done |
| 100 | + |
| 101 | + # shellcheck disable=SC2086 |
| 102 | + java $JAVA_OPTS -jar "$executable" batch --includes-base-dir "${root}" --fail-fast -- "${root}"/bin/ci/* |
| 103 | +else |
| 104 | + for script in "${scripts[@]}"; do |
| 105 | + if eval "$script" > /dev/null 2>&1; then |
| 106 | + echo "Executed $script successfully!" |
| 107 | + else |
| 108 | + echo "ERROR: Failed to run $script" |
| 109 | + exit 1 |
| 110 | + fi |
| 111 | + done |
| 112 | +fi |
91 | 113 |
|
92 | 114 | # Check: |
93 | 115 | if [ -n "$(git status --porcelain)" ]; then |
|
0 commit comments