Skip to content

Conversation

@MartinDelille
Copy link
Contributor

@MartinDelille MartinDelille commented Mar 8, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

I would like to fix #7784 by adding client.pri generation. This is a work in progress but I open this PR to address some problem I have with its implementation.

For the Pet Store example, the resulting file should look like this:

QT += network

HEADERS += \
	$${PWD}/SWGApiResponse.h \
	$${PWD}/SWGCategory.h \
	$${PWD}/SWGHelpers.h \
	$${PWD}/SWGHttpRequest.h \
	$${PWD}/SWGModelFactory.h \
	$${PWD}/SWGObject.h \
	$${PWD}/SWGOrder.h \
	$${PWD}/SWGPet.h \
	$${PWD}/SWGPetApi.h \
	$${PWD}/SWGStoreApi.h \
	$${PWD}/SWGTag.h \
	$${PWD}/SWGUser.h \
	$${PWD}/SWGUserApi.h

SOURCES += \
	$${PWD}/SWGApiResponse.cpp \
	$${PWD}/SWGCategory.cpp \
	$${PWD}/SWGHelpers.cpp \
	$${PWD}/SWGHttpRequest.cpp \
	$${PWD}/SWGOrder.cpp \
	$${PWD}/SWGPet.cpp \
	$${PWD}/SWGPetApi.cpp \
	$${PWD}/SWGStoreApi.cpp \
	$${PWD}/SWGTag.cpp \
	$${PWD}/SWGUser.cpp \
	$${PWD}/SWGUserApi.cpp

Here are the tasks to do:

  • Add optionalProjectFile switch to the command line
  • Generate client.pri
  • Add test

Ping @ravinikam @stkrwork @fvarose

@wing328 wing328 added this to the v2.4.0 milestone Mar 8, 2018
@MartinDelille
Copy link
Contributor Author

MartinDelille commented Mar 8, 2018

As you can see, the tests are failing:
https://travis-ci.org/swagger-api/swagger-codegen/builds/350829855#L2556

What am I missing?

@MartinDelille MartinDelille changed the title starting adding qt project generation fix #7784 Adding qt project generation fix #7784 Mar 8, 2018
supportingFiles.add(new SupportingFile("modelFactory.mustache", sourceFolder, PREFIX + "ModelFactory.h"));
supportingFiles.add(new SupportingFile("object.mustache", sourceFolder, PREFIX + "Object.h"));
if (optionalProjectFileFlag) {
supportingFiles.add(new SupportingFile("Project.mustache", "", "client.pri"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are missing the mustache file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also check the processOpts function

@MartinDelille
Copy link
Contributor Author

travis build failed but it doesn't seems to be related to my modification, am I right?

Now I just need to fill Project.mustache file but since I'm new to mustache, someone could give me a clue how to list the headers and sources files generated?

@stkrwork
Copy link
Contributor

stkrwork commented Mar 8, 2018

QT += network

HEADERS += \
{{#operations}}
	$${PWD}/{{classname}}.h \
{{/operations}}
{{#models}}
{{#model}}
	$${PWD}/{{classname}}.h \
{{/model}}
{{/models}}

SOURCES += \
{{#operations}}
	$${PWD}/{{classname}}.cpp \
{{/operations}}
{{#models}}
{{#model}}
	$${PWD}/{{classname}}.cpp \
{{/model}}
{{/models}}

I think, but i am not sure

@MartinDelille
Copy link
Contributor Author

Ok I implemented the mustache part. Let me know if it looks good to you!

Ping @ravinikam @stkrwork @fvarose

{{/apis}}
{{/apiInfo}}
# Others
$${PWD}/SWGHelpers.cpp \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$${PWD}/{{prefix}}Helpers.cpp \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{{/apiInfo}}
# Others
$${PWD}/SWGHelpers.cpp \
$${PWD}/SWGHttpRequest.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

{{/apis}}
{{/apiInfo}}
# Others
$${PWD}/SWGHelpers.h \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see below

@wing328
Copy link
Contributor

wing328 commented Mar 14, 2018

@MartinDelille thanks for the PR, which has been merged into master.

cc @etherealjoy as well

@wing328 wing328 merged commit d824999 into swagger-api:master Mar 14, 2018
@MartinDelille MartinDelille deleted the add-qt-project-generation branch March 15, 2018 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[qt5cpp] Generate project include file (*.pri)

3 participants