blob: db8b6f61a4eb2af9cbf6fc66a28c60c3da76e1be [file] [log] [blame]
# swift_build_support/products/product.py -----------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
# ----------------------------------------------------------------------------
class Product(object):
@classmethod
def product_name(cls):
"""product_name() -> str
The identifier-style name to use for this product.
"""
return cls.__name__.lower()
@classmethod
def product_source_name(cls):
"""product_source_name() -> str
The name of the source code directory of this product.
It provides a customization point for Product subclasses. It is set to
the value of product_name() by default for this reason.
"""
return cls.product_name()
@classmethod
def is_build_script_impl_product(cls):
"""is_build_script_impl_product -> bool
Whether this product is produced by build-script-impl.
"""
return True
def build(self, host_target):
"""build() -> void
Perform the build, for a non-build-script-impl product.
"""
raise NotImplementedError
def test(self, host_target):
"""test() -> void
Run the tests, for a non-build-script-impl product.
"""
raise NotImplementedError
def __init__(self, args, toolchain, source_dir, build_dir):
self.args = args
self.toolchain = toolchain
self.source_dir = source_dir
self.build_dir = build_dir
self.cmake_options = []