Code Monkey home page Code Monkey logo

conan_packager's Introduction

conan_packager

This is an attempt to integrate conan into my TeamCity build system. The top project and all dependencies are built by executing the following steps in TeamCity. Old versions of the top package are cleaned up, the top package and missing dependencies are built and all built packages are uploaded to to my conan server. Lastly the artifacts are deployed and gathered to the TeamCity server.

Step 1: Clean

Perform a cleanup of the local package that we are going to build. The varaibles channel_name and profile_name are set from TeamCity.

from packager import ConanPackager


packager = ConanPackager(channel="%channel_name%", profile="%profile_name%")
packager.remove()

Step 2: Determine pacakges to upload

Obtain a list of packages that will be built. This will be used later when uploading packages.

from cmake import ConanPackager
import os
import json


packages_file = "%package_list%"
packager = ConanPackager(channel="%channel_name%", profile="%profile_name%")

if os.path.isfile(packages_file):
    os.remove(packages_file)

to_upload = packager.determine_packages_to_upload()
with open(packages_file, 'w') as outfile:
    json.dump(to_upload, outfile)

Step 3: Build

Perform a build of the package, including dependencies if necesarry.

from packager import ConanPackager


packager = ConanPackager(channel="%channel_name%", profile="%profile_name%")
packager.create()

Step 4: Upload packages

Upload package and all built dependencies.

from cmake import ConanPackager
import os
import json


packages_file = "%package_list%"
packager = ConanPackager(channel="%channel_name%", profile="%profile_name%")

to_upload = None
with open(packages_file, 'r') as infile:
    to_upload = json.load(infile)

packager.upload_packages(to_upload)

Step 5: Deploy

As the packages are built in the conan data directory, deploy the packages to the build directory for TeamCity to pick up.

from cmake import ConanPackager
import os
import json


metadata_file = "%metadata_file%"
packager = ConanPackager(channel="%channel_name%", profile="%profile_name%")
if os.path.isfile(metadata_file):
    os.remove(metadata_file)

with open(metadata_file, 'w') as outfile:
    json.dump(packager.metadata, outfile)

packager.deploy()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.