Skip to content

Build process improvements#2

Open
suokko wants to merge 7 commits into
online-bridge-hackathon:masterfrom
suokko:build_process_improvements
Open

Build process improvements#2
suokko wants to merge 7 commits into
online-bridge-hackathon:masterfrom
suokko:build_process_improvements

Conversation

@suokko
Copy link
Copy Markdown

@suokko suokko commented Jul 7, 2020

These changes require repository to have a tag named exactly same as ${VERSION} in Makefile.

.dockerignore is a symbolic link to .gitignore.

Set default build type to Release

The build type is left empty if CMakeLists.txt doesn't set it before
first project call.

Add install target for api-server

Use standard way to set C++ version and link to threads

CMake offers standardized way to select C++ version. This method checks
if requested version is supported and sets correct compiler flags.

Thread support should use find_package to get system specific compiler
and linker flags.

Use target include directories

Preferred method to change any compiler settings is to set them for a
specific target with visibility flags. PRIVATE means include directories
are used only compiling the target. Any depending target won't inherit
directories listed for the target.

Forward prefix and build type to external projects

External projects should be build with same build type and prefix. This
allows better control over build process. I also added RPATH
configuration to make sure installed binary can find libpistache.so.

Use submodules for external projects and optimize image build

My target was to reduce build times for local testing and images. There
is many interlinked changes to image building which should make caching
better.

The biggest changes is external projects using submodules for sources.
This allows build process to reduce numbers of times sources are
downloaded. Image building still uses remote source. Changes allow
better caching for sources. Submodules use relative paths to make sure
submodule update uses same protocol as clone.

Image build is split two variants. The developer build uses local/* tag
to allow quick testing using sources from the working tree. On other
hand release builds use git repository with a tag. This makes sure
release build will use correct sources without any local changes.

Base image and build dependencies install was changed. Base image was
upgraded to the latest Debian stable release. Package install command
specifies all build dependencies explicitly and avoids install
recommendations.

The last bit of changes makes sure deployed image includes only runtime
dependencies. It adds an empty image where binaries are copied from the
build image.

suokko added 5 commits July 7, 2020 20:24
The build type is left empty if CMakeLists.txt doesn't set it before
first project call.

Signed-off-by: Pauli <suokkos@gmail.com>
Signed-off-by: Pauli <suokkos@gmail.com>
CMake offers standardized way to select C++ version. This method checks
if requested version is supported and sets correct compiler flags.

Thread support should use find_package to get system specific compiler
and linker flags.

Signed-off-by: Pauli <suokkos@gmail.com>
Preferred method to change any compiler settings is to set them for a
specific target with visibility flags. PRIVATE means include directories
are used only compiling the target. Any depending target won't inherit
directories listed for the target.

Signed-off-by: Pauli <suokkos@gmail.com>
External projects should be build with same build type and prefix. This
allows better control over build process. I also added RPATH
configuration to make sure installed binary can find libpistache.so.

Signed-off-by: Pauli <suokkos@gmail.com>
@suokko suokko added the build Changes to the build system label Jul 7, 2020
@suokko suokko requested review from angshenting and kiat-huang July 7, 2020 21:17
@suokko suokko force-pushed the build_process_improvements branch from 6b2295b to 601612b Compare July 7, 2020 21:26
suokko added 2 commits July 8, 2020 14:26
My target was to reduce build times for local testing and images. There
is many interlinked changes to image building which should make caching
better.

The biggest changes is external projects using submodules for sources.
This allows build process to reduce numbers of times sources are
downloaded. Image building still uses remote source. Changes allow
better caching for sources. Submodules use relative paths to make sure
submodule update uses same protocol as clone.

Image build is split two variants. The developer build uses local/* tag
to allow quick testing using sources from the working tree. On other
hand release builds use git repository with a tag. This makes sure
release build will use correct sources without any local changes.

Base image and build dependencies install was changed. Base image was
upgraded to the latest Debian stable release. Package install command
specifies all build dependencies explicitly and avoids install
recommendations.

The last bit of changes makes sure deployed image includes only runtime
dependencies. It adds an empty image where binaries are copied from the
build image.

Signed-off-by: Pauli <suokkos@gmail.com>
It appears that .dockerignore use different syntax compared to
.gitignore. This requires a bit processing to reuse .gitignore for
Docker build.
@suokko suokko force-pushed the build_process_improvements branch from 601612b to 37aeebb Compare July 8, 2020 11:28
@woefulwabbit
Copy link
Copy Markdown

Most of the proposed changes are made to files that are generated using openapi generator. I agree that modern cmake and git submodules practices are preferred, but I'm not keen to have these files changed unnecessarily as the changes will only be overwritten if the generator is rerun.

@suokko
Copy link
Copy Markdown
Author

suokko commented Jul 17, 2020

Most of the proposed changes are made to files that are generated using openapi generator. I agree that modern cmake and git submodules practices are preferred, but I'm not keen to have these files changed unnecessarily as the changes will only be overwritten if the generator is rerun.

In that case I propose we generate openapi changes to openapi. When a new generated server has been committed to the branch then simple merge will update only changed code in the master. Conflicts will be easy to resolve. I'm assuming the generator generates same code for unchanged parts of api.

Copy link
Copy Markdown
Contributor

@kiat-huang kiat-huang left a comment

Choose a reason for hiding this comment

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

Any blockers to merging this?

@woefulwabbit woefulwabbit requested review from woefulwabbit and removed request for woefulwabbit October 5, 2020 21:06
@woefulwabbit
Copy link
Copy Markdown

Any blockers to merging this?

In theory, the proposal to generate openapi changes into a separate branch to be merged into the main branch should work. I'm not sure about the east of resolving the conflicts until this has been tested. Perhaps we can put this in a different branch until we have a chance to test it when an api change comes in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Changes to the build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants