Giter Club home page Giter Club logo

teapot's Introduction

Teapot

Teapot is a decentralised build tool for managing complex cross-platform projects. It has many goals but it is primarily designed to improve the experience for developers trying to make cross-platform applications and libraries with a minimum of overhead.

  • Provide useful feedback when dependencies are not met or errors are encountered.
  • Decentralised dependency management allows use within private organisations without exposing code.
  • Generators can simplify the construction of new projects as well as assist with the development of existing ones.
  • The build subsystem provides a simple set of canonical operations for building libraries and executables to minimise configuration overhead.

Development Status

Installation

Ensure that you already have a working install of Ruby 2.0.0+ and run the following to install teapot:

$ gem install teapot

Usage

Teapot doesn't have a default centralised package management system but there is a canonical one for developing cross-platform C++ applications. This example shows how to use this framework.

Create Project

Firstly, create your project by running:

$ teapot create "My Project" https://github.com/kurocha generate-project
$ cd my-project

You will be asked to merge the project file. At present, merge tools are not very good and thus you may need to take a moment to review the changes. You want to keep most of the original file, but you would like to add the define_target blocks which are being added.

In the resulting project directory that has been created, you can see the list of dependencies:

$ teapot list
... lots of output ...

To only see things exported by your current project, you can run:

$ teapot list root
Package root (from /private/tmp/my-project):
	#<Teapot::Project "my-project">
		My Project description.
		- Summary: A brief one line summary of the project.
		- License: MIT License
		- Version: 0.1.0
		- Author: Samuel Williams <[email protected]>
	#<Teapot::Target "my-project-library">
		- depends on "Build/Files"
		- depends on "Build/Clang"
		- depends on :platform
		- depends on "Language/C++14" {:private=>true}
		- provides "Library/MyProject"
	#<Teapot::Target "my-project-test">
		- depends on "Library/UnitTest"
		- depends on "Library/MyProject"
		- provides "Test/MyProject"
	#<Teapot::Target "my-project-executable">
		- depends on "Build/Files"
		- depends on "Build/Clang"
		- depends on :platform
		- depends on "Language/C++14" {:private=>true}
		- depends on "Library/MyProject"
		- provides "Executable/MyProject"
	#<Teapot::Target "my-project-run">
		- depends on "Executable/MyProject"
		- provides "Run/MyProject"
	#<Teapot::Configuration "development" visibility=private>
		- references root from /private/tmp/my-project
		- clones platforms from https://github.com/kurocha/platforms
		- clones unit-test from https://github.com/kurocha/unit-test
		- clones generate-cpp-class from https://github.com/kurocha/generate-cpp-class
		- clones generate-project from https://github.com/kurocha/generate-project
		- clones variants from https://github.com/kurocha/variants
		- clones platform-darwin-osx from https://github.com/kurocha/platform-darwin-osx
		- clones platform-darwin-ios from https://github.com/kurocha/platform-darwin-ios
		- clones build-clang from https://github.com/kurocha/build-clang
		- clones build-darwin from https://github.com/kurocha/build-darwin
		- clones build-files from https://github.com/kurocha/build-files
		- clones streams from https://github.com/kurocha/streams
		- clones generate-template from https://github.com/kurocha/generate-template
	#<Teapot::Configuration "my-project" visibility=public>
		- references root from /private/tmp/my-project

Run Tests

Testing is a good idea, and teapot supports test driven development.

$ teapot Test/MyProject

Wildcard Targets

To run all tests:

$ teapot "Test/*"

Provided you are using an environment that supports sanitizers, you can test more thoroughly using:

$ teapot "Test/*" variant-sanitize

Run Project

We can now build and run the project executable:

$ teapot Run/MyProject
I'm a little teapot,
Short and stout,
Here is my handle (one hand on hip),
Here is my spout (other arm out with elbow and wrist bent).
When I get all steamed up,
Hear me shout,
Tip me over and pour me out! (lean over toward spout)

                              ~
                   ___^___   __
               .- /       \./ /
              /  /          _/
              \__|         |
                  \_______/

The resulting executables and libraries will be framework dependent, but are typically located in:

$ cd teapot/platforms/development/$PLATFORM-debug/bin
$ ./$PROJECT_NAME

Cloning Project

You can clone another project which will fetch all dependencies:

$ teapot clone https://github.com/kurocha/tagged-format
$ cd tagged-format
$ teapot build Executable/TaggedFormat

Open Issues

  • Should packages be built into a shared prefix or should they be built into unique prefixes and joined together either via install or -L and -I?
    • Relative include paths might fail to work correctly if headers are not installed into same directory.
  • Should packages have some way to expose system requirements, e.g. installed compiler, libraries, etc. Perhaps some kind of Package#valid? which allows custom logic?

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Released under the MIT license.

Copyright, 2012, 2014, by Samuel G. D. Williams.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

teapot's People

Contributors

ioquatix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

teapot's Issues

When updating packages, if a package is updated with more dependencies, those dependencies aren't fetched.

The unit-test package was updated, to include streams as a dependency, but it must be fetched twice to get to a fixed point:

^_^ > teapot fetch --update
Processing clones platforms from http://github.com/kurocha/platforms...
Updating package at path async/teapot/packages/development/platforms...
Processing clones build-files from http://github.com/kurocha/build-files...
Updating package at path async/teapot/packages/development/build-files...
Processing clones unit-test from http://github.com/kurocha/unit-test...
Updating package at path async/teapot/packages/development/unit-test...
Updating lockfile for package unit-test: 73aa1c21098fbe4ee28abf5d9d1fceb77d64ed07...
Processing clones generate-travis from http://github.com/kurocha/generate-travis...
Updating package at path async/teapot/packages/development/generate-travis...
Processing clones generate-project from http://github.com/kurocha/generate-project...
Updating package at path async/teapot/packages/development/generate-project...
Processing clones generate-cpp-class from http://github.com/kurocha/generate-cpp-class...
Updating package at path async/teapot/packages/development/generate-cpp-class...
Processing clones concurrent from http://github.com/kurocha/concurrent...
Updating package at path async/teapot/packages/development/concurrent...
Updating lockfile for package concurrent: d78f217f6f01656a503ebee11bab1e1a6435a3da...
Processing clones time from http://github.com/kurocha/time...
Updating package at path async/teapot/packages/development/time...
Processing clones memory from http://github.com/kurocha/memory...
Updating package at path async/teapot/packages/development/memory...
Processing clones variants from http://github.com/kurocha/variants...
Updating package at path async/teapot/packages/development/variants...
Processing clones platform-darwin-osx from http://github.com/kurocha/platform-darwin-osx...
Updating package at path async/teapot/packages/development/platform-darwin-osx...
Processing clones platform-darwin-ios from http://github.com/kurocha/platform-darwin-ios...
Updating package at path async/teapot/packages/development/platform-darwin-ios...
Processing clones build-clang from http://github.com/kurocha/build-clang...
Updating package at path async/teapot/packages/development/build-clang...
Processing clones build-darwin from http://github.com/kurocha/build-darwin...
Updating package at path async/teapot/packages/development/build-darwin...
Processing clones generate-template from http://github.com/kurocha/generate-template...
Updating package at path async/teapot/packages/development/generate-template...
Completed fetch successfully.
Elapsed Time: 20.654s
^_^ > teapot fetch --update
Processing clones platforms from http://github.com/kurocha/platforms...
Updating package at path async/teapot/packages/development/platforms...
Processing clones build-files from http://github.com/kurocha/build-files...
Updating package at path async/teapot/packages/development/build-files...
Processing clones unit-test from http://github.com/kurocha/unit-test...
Updating package at path async/teapot/packages/development/unit-test...
Processing clones generate-travis from http://github.com/kurocha/generate-travis...
Updating package at path async/teapot/packages/development/generate-travis...
Processing clones generate-project from http://github.com/kurocha/generate-project...
Updating package at path async/teapot/packages/development/generate-project...
Processing clones generate-cpp-class from http://github.com/kurocha/generate-cpp-class...
Updating package at path async/teapot/packages/development/generate-cpp-class...
Processing clones concurrent from http://github.com/kurocha/concurrent...
Updating package at path async/teapot/packages/development/concurrent...
Processing clones time from http://github.com/kurocha/time...
Updating package at path async/teapot/packages/development/time...
Processing clones memory from http://github.com/kurocha/memory...
Updating package at path async/teapot/packages/development/memory...
Processing clones variants from http://github.com/kurocha/variants...
Updating package at path async/teapot/packages/development/variants...
Processing clones platform-darwin-osx from http://github.com/kurocha/platform-darwin-osx...
Updating package at path async/teapot/packages/development/platform-darwin-osx...
Processing clones platform-darwin-ios from http://github.com/kurocha/platform-darwin-ios...
Updating package at path async/teapot/packages/development/platform-darwin-ios...
Processing clones build-clang from http://github.com/kurocha/build-clang...
Updating package at path async/teapot/packages/development/build-clang...
Processing clones build-darwin from http://github.com/kurocha/build-darwin...
Updating package at path async/teapot/packages/development/build-darwin...
Processing clones streams from http://github.com/kurocha/streams...
Cloning package at path async/teapot/packages/development/streams...
Updating lockfile for package streams: 05b488f43f01f4a0c483a89c178f673c8e818e22...
Processing clones generate-template from http://github.com/kurocha/generate-template...
Updating package at path async/teapot/packages/development/generate-template...
Completed fetch successfully.
Elapsed Time: 19.052s
^_^ > 

The suggested fix would be to reload the teapot.rb file if the package was updated.

Isolated Build Directories

Individual packages will be built into discrete directories:

teapot/#{platform}/libpng-#{checksum}/include/png.h
teapot/#{platform}/libpng-#{checksum}/lib/libpng.a

failed ubuntu install

sudo gem install teapot

`Building native extensions. This could take a while...
ERROR: Error installing teapot:
ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/rainbow-2.2.2/ext

/usr/bin/ruby2.3 mkrf_conf.rb

current directory: /var/lib/gems/2.3.0/gems/rainbow-2.2.2/ext
/usr/bin/ruby2.3 -rubygems /usr/share/rubygems-integration/all/gems/rake-10.5.0/bin/rake RUBYARCHDIR=/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/rainbow-2.2.2 RUBYLIBDIR=/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/rainbow-2.2.2`

Ubuntu 16.04

color method does not exist on ruby String

I just installed teapot on my Ubuntu 13.10 box with gem install teapot.

Now when I try to follow the docs I get this:

$ teapot create "My Project" https://github.com/dream-framework/ project
/var/lib/gems/1.9.1/gems/teapot-0.9.9/bin/teapot:119:in `ensure in
track_time': undefined method `color' for "Elapsed Time: 0.000s":String
(NoMethodError)
       from /var/lib/gems/1.9.1/gems/teapot-0.9.9/bin/teapot:119:in
`track_time'
       from /var/lib/gems/1.9.1/gems/teapot-0.9.9/bin/teapot:132:in
`<top (required)>'
       from /usr/local/bin/teapot:23:in `load'
       from /usr/local/bin/teapot:23:in `<main>'

I have never tried to read or write ruby code before.

Improved Unit Test

Teapot has not got a lot of unit tests. While most of the gems which were extracted from teapot are well tested, teapot itself is not. It would be good to add unit tests for all commands. As part of this, Teapot::Controller was removed and all commands refactored into Samovar::Command.

Time outs when `fetch` on MacOS

Trying to fetch dependencies for a project, teapot keeps looping over dependencies for an hour until git timesout.
Recent timeout:

Package locked to commit: master/4d95d75cbb3df6a20defefcdbdcf8f5f103ba9ea
Updating package at path (filtered)/build-darwin...
Processing clones platform-darwin-osx from https://github.com/kurocha/platform-darwin-osx...
Package locked to commit: master/d352ae8d26a35585bc74b83c5fbace3c317f7bb7
Updating package at path (filtered)/platform-darwin-osx...
Processing clones build-darwin from https://github.com/kurocha/build-darwin...
Package locked to commit: master/4d95d75cbb3df6a20defefcdbdcf8f5f103ba9ea
Updating package at path (filtered)/build-darwin...
Processing clones platform-darwin-osx from https://github.com/kurocha/platform-darwin-osx...
Package locked to commit: master/d352ae8d26a35585bc74b83c5fbace3c317f7bb7
Updating package at path (filtered)/platform-darwin-osx...
Elapsed Time: 5105.826s
curl error: Connection timed out after 2087426 milliseconds

(filtered).gem/ruby/2.2.5/gems/rugged-0.26.0/lib/rugged/repository.rb:215:in `fetch'
(filtered).gem/ruby/2.2.5/gems/rugged-0.26.0/lib/rugged/repository.rb:215:in `fetch'
(filtered).gem/ruby/2.2.5/gems/teapot-2.2.0/lib/teapot/command/fetch.rb:153:in `clone_or_pull_package'
(filtered).gem/ruby/2.2.5/gems/teapot-2.2.0/lib/teapot/command/fetch.rb:198:in `fetch_package'
(filtered).gem/ruby/2.2.5/gems/teapot-2.2.0/lib/teapot/command/fetch.rb:67:in `block in invoke'
(filtered).rubies/ruby-2.2.5/lib/ruby/2.2.0/set.rb:283:in `each_key'
(filtered).rubies/ruby-2.2.5/lib/ruby/2.2.0/set.rb:283:in `each'
(filtered).gem/ruby/2.2.5/gems/teapot-2.2.0/lib/teapot/command/fetch.rb:66:in `invoke'
(filtered).gem/ruby/2.2.5/gems/teapot-2.2.0/lib/teapot/command.rb:112:in `block in invoke'
(filtered).gem/ruby/2.2.5/gems/samovar-1.7.0/lib/samovar/command/track_time.rb:28:in `track_time'
(filtered).gem/ruby/2.2.5/gems/teapot-2.2.0/lib/teapot/command.rb:111:in `invoke'
(filtered).gem/ruby/2.2.5/gems/teapot-2.2.0/bin/teapot:28:in `<top (required)>'
(filtered).gem/ruby/2.2.5/bin/teapot:23:in `load'
(filtered).gem/ruby/2.2.5/bin/teapot:23:in `<top (required)>'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
(filtered).gem/ruby/2.2.5/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
(filtered).gem/ruby/2.2.5/bin/bundle:23:in `load'
(filtered).gem/ruby/2.2.5/bin/bundle:23:in `<main>'

Migrate to Rugged (libgit2)

A lot of the internals of teapot directly invoke the git command line which is a pretty basic way of interacting with the repositories. Using Rugged provides structured interface to git. It makes it easier to implement more advanced commands without needing to parse the output of git commands.

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.