Add bat script to support sme openapi generation.
Add instruction in README to fix the git submodule update issue in windows.
Issue-ID: NONRTRIC-899
Signed-off-by: aravind.est <aravindhan.a@est.tech>
Change-Id: Id53fe50807bd5103f6a62495eb4b3527c7c9cdd5
ONAP ACM is used here as a backend of Rapp manager to lifecycle manage the deployment items as part of Rapp.
ONAP ACM related details can be found [here](https://docs.onap.org/projects/onap-policy-parent/en/london/clamp/clamp.html).
+
+
+## Maven Build
+
+This build supports Linux and Windows environments.
+
+In case of below error during the build in Windows environment,
+
+```
+[INFO] --- exec-maven-plugin:3.1.0:exec (git submodule update) @ rapp-manager-sme ---
+C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 7: basename: command not found
+C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 7: sed: command not found
+C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 22: .: git-sh-setup: file not found
+```
+
+It is necessary to append additional paths listed below to the <strong>System</strong> environment variable
+named "<strong>PATH</strong>". These paths can vary based on the git installation location.
+
+```
+C:\Program Files\Git\usr\bin
+C:\Program Files\Git\mingw64\libexec\git-core
+```
\ No newline at end of file
<goal>generate</goal>
</goals>
<configuration>
- <inputSpec>rapp-manager-acm/src/main/resources/openapi/acm-spec.yaml</inputSpec>
+ <inputSpec>${project.basedir}/src/main/resources/openapi/acm-spec.yaml</inputSpec>
<generatorName>java</generatorName>
<library>resttemplate</library>
<generateApiTests>false</generateApiTests>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
<exec-maven-plugin.version>3.1.0</exec-maven-plugin.version>
</properties>
+ <profiles>
+ <profile>
+ <id>Windows</id>
+ <activation>
+ <os>
+ <family>Windows</family>
+ </os>
+ </activation>
+ <properties>
+ <script.extension>.bat</script.extension>
+ <file.separator>\</file.separator>
+ </properties>
+ </profile>
+ <profile>
+ <id>unix</id>
+ <activation>
+ <os>
+ <family>unix</family>
+ </os>
+ </activation>
+ <properties>
+ <script.extension>.sh</script.extension>
+ <file.separator>/</file.separator>
+ </properties>
+ </profile>
+ </profiles>
+
<dependencies>
<dependency>
<groupId>com.oransc.rappmanager</groupId>
<goal>exec</goal>
</goals>
<configuration>
- <executable>bash</executable>
- <arguments>
- <argument>../scripts/init/init-sme-spec.sh</argument>
- </arguments>
+ <executable>
+ ..${file.separator}scripts${file.separator}init${file.separator}init-sme-spec${script.extension}
+ </executable>
</configuration>
</execution>
</executions>
</goals>
<configuration>
<inputSpec>
- rapp-manager-sme/src/main/resources/openapi/TS29222_CAPIF_API_Provider_Management_API.yaml
+ ${project.basedir}/src/main/resources/openapi/TS29222_CAPIF_API_Provider_Management_API.yaml
</inputSpec>
<generatorName>java</generatorName>
<library>resttemplate</library>
</goals>
<configuration>
<inputSpec>
- rapp-manager-sme/src/main/resources/openapi/TS29222_CAPIF_Publish_Service_API.yaml
+ ${project.basedir}/src/main/resources/openapi/TS29222_CAPIF_Publish_Service_API.yaml
</inputSpec>
<generatorName>java</generatorName>
<library>resttemplate</library>
</goals>
<configuration>
<inputSpec>
- rapp-manager-sme/src/main/resources/openapi/TS29222_CAPIF_API_Invoker_Management_API.yaml
+ ${project.basedir}/src/main/resources/openapi/TS29222_CAPIF_API_Invoker_Management_API.yaml
</inputSpec>
<generatorName>java</generatorName>
<library>resttemplate</library>
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
--- /dev/null
+:: ============LICENSE_START===============================================
+:: Copyright (C) 2023 Nordix Foundation. All rights reserved.
+:: ========================================================================
+:: Licensed 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.
+:: ============LICENSE_END=================================================
+::
+
+@echo off
+set SME_LOCATION="..\sme\capifcore"
+cp ..\scripts\init\getsmeswagger.go %SME_LOCATION%
+cd %SME_LOCATION%
+
+echo Generating SME openapi spec...
+
+IF EXIST getsmeswagger.go (
+ echo Generating...
+ go run getsmeswagger.go
+
+ echo Copying generated specs...
+ mkdir ..\..\rapp-manager-sme\src\main\resources\openapi
+ echo Copying CommonData.yaml
+ mv CommonData.yaml ..\..\rapp-manager-sme\src\main\resources\openapi
+ echo Copying TS29122_CommonData.yaml
+ mv TS29122_CommonData.yaml ..\..\rapp-manager-sme\src\main\resources\openapi
+ echo Copying TS29571_CommonData.yaml
+ mv TS29571_CommonData.yaml ..\..\rapp-manager-sme\src\main\resources\openapi
+ echo Copying TS29222_CAPIF_API_Invoker_Management_API.yaml
+ mv TS29222_CAPIF_API_Invoker_Management_API.yaml ..\..\rapp-manager-sme\src\main\resources\openapi
+ echo Copying TS29222_CAPIF_API_Provider_Management_API.yaml
+ mv TS29222_CAPIF_API_Provider_Management_API.yaml ..\..\rapp-manager-sme\src\main\resources\openapi
+ echo Copying TS29222_CAPIF_Publish_Service_API.yaml
+ mv TS29222_CAPIF_Publish_Service_API.yaml ..\..\rapp-manager-sme\src\main\resources\openapi
+) ELSE (
+ echo Unable to find the openapi spec generator.
+)