-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_reach_five_identity_api.bash
68 lines (53 loc) · 2.27 KB
/
generate_reach_five_identity_api.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
openApiCLIVersion="7.1.0"
openApiDartVersion="7.2"
# yaml basename
basename="reach_five_identity"
# Downloading yaml
yamlDefinition="${basename}_api.yaml"
# Downloading tools
if test -f "openapi-generator-cli-$openApiCLIVersion.jar"; then
echo "OpenApi java CLI installed"
else
echo "Downloading OpenApi java CLI...."
curl -O "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$openApiCLIVersion/openapi-generator-cli-$openApiCLIVersion.jar"
curl -O "https://repo1.maven.org/maven2/com/bluetrainsoftware/maven/openapi-dart-generator/$openApiDartVersion/openapi-dart-generator-$openApiDartVersion.jar"
fi
## Each one of the script arguments should be a swagger base name.
echo "==================================================================";
echo "Building : $yamlDefinition";
echo "==================================================================";
pubName="${basename}_repo"
pubLibrary=$pubName
pubAuthor="CDA"
pubAuthorEmail="[email protected]"
pubVersion="0.1.7"
pubHomepage="https://github.com/bamlab/Flutter-ReachFive"
# Moving LICENSE and CHANGELOD.md up to preserve them from deletion
mv $pubName/LICENSE ${pubName}LICENSE
mv $pubName/CHANGELOG.md ${pubName}CHANGELOG.md
# Deleting previous version
rm -rf "$pubName"
# Generting new classes
java -jar "openapi-generator-cli-$openApiCLIVersion.jar" generate \
-i $yamlDefinition \
-g dart-dio \
-o $pubName \
--additional-properties=pubName=$pubName,pubLibrary=$pubLibrary,pubAuthor=$pubAuthor,pubAuthorEmail=$pubAuthorEmail,pubHomepage=$pubHomepage,pubVersion=$pubVersion,disallowAdditionalPropertiesIfNotPresent=false,serializationLibrary=json_serializable,useEnumExtension=true
# Moving LICENSE and CHANGELOD.md back in the repo
mv ${pubName}LICENSE $pubName/LICENSE
mv ${pubName}CHANGELOG.md $pubName/CHANGELOG.md
# Deleting tests
rm -rf "$pubName/test"
rm -rf "$pubName/.gitignore"
## Each one of the script arguments should be a swagger base name.
echo "==================================================================";
echo "Dart build runner"
echo "==================================================================";
cd "$pubName"
# Was causing a race condition
sleep 3
dart run build_runner build --delete-conflicting-outputs
dart pub get
dart fix --apply
dart format .