Packages

A teapot package has a teapot.rb file which looks like:

# Teapot v2.0.0 configuration generated at 2017-09-20 02:17:19 +1200

required_version "2.0"

# Project Metadata

define_project "my-project" do |project|
	project.title = "My Project"
	project.summary = 'A brief one line summary of the project.'
	
	project.description = <<-EOF
		My Project description.
	EOF
	
	project.license = 'MIT License'
	
	project.add_author 'Samuel Williams', email: 'samuel.williams@oriontransfer.co.nz'
	# project.website = 'http://MyProject.com/'
	
	project.version = '0.1.0'
end

# Build Targets

define_target 'my-project-library' do |target|
	target.build do
		source_root = target.package.path + 'source'
		copy headers: source_root.glob('MyProject/**/*.{h,hpp}')
		build static_library: 'MyProject', source_files: source_root.glob('MyProject/**/*.cpp')
	end
	
	target.depends 'Build/Files'
	target.depends 'Build/Clang'
	
	target.depends :platform
	target.depends 'Language/C++14', private: true
	
	target.provides 'Library/MyProject' do
		append linkflags [
			->{install_prefix + 'lib/libMyProject.a'},
		]
	end
end

define_target 'my-project-test' do |target|
	target.build do |*arguments|
		test_root = target.package.path + 'test'
		
		run tests: 'MyProject', source_files: test_root.glob('MyProject/**/*.cpp'), arguments: arguments
	end
	
	target.depends 'Library/UnitTest'
	target.depends 'Library/MyProject'
	
	target.provides 'Test/MyProject'
end

define_target 'my-project-executable' do |target|
	target.build do
		source_root = target.package.path + 'source'
		
		build executable: 'MyProject', source_files: source_root.glob('MyProject.cpp')
	end
	
	target.depends 'Build/Files'
	target.depends 'Build/Clang'
	
	target.depends :platform
	target.depends 'Language/C++14', private: true
	
	target.depends 'Library/MyProject'
	target.provides 'Executable/MyProject'
end

define_target 'my-project-run' do |target|
	target.build do |*arguments|
		run executable: 'MyProject', arguments: arguments
	end
	
	target.depends 'Executable/MyProject'
	target.provides 'Run/MyProject'
end

# Configurations

define_configuration 'development' do |configuration|
	configuration[:source] = "https://github.com/kurocha/"
	configuration.import "my-project"
	
	# Provides all the build related infrastructure:
	configuration.require 'platforms'
	
	# Provides unit testing infrastructure and generators:
	configuration.require 'unit-test'
	
	# Provides some useful C++ generators:
	configuration.require 'generate-cpp-class'
	
	configuration.require "generate-project"
end

define_configuration "my-project" do |configuration|
	configuration.public!
end

This file has several top level definitions, including define_project, define_target and define_configuration.