1#----------------------------------------------------------------------------
2# Project:  Horizon
3# File:     packagedefs.om
4#
5# Copyright (C)2009-2011 Nintendo Co., Ltd.  All rights reserved.
6#
7# These coded instructions, statements, and computer programs contain
8# proprietary information of Nintendo of America Inc. and/or Nintendo
9# Company Ltd., and are protected by Federal copyright law. They may
10# not be disclosed to third parties or copied or duplicated in any form,
11# in whole or in part, without the prior written consent of Nintendo.
12#
13# $Rev: 34627 $
14#----------------------------------------------------------------------------
15
16#----------------------------------------------------------------------------
17# Class definitions
18#----------------------------------------------------------------------------
19
20PackageManager. =
21    class PackageManager
22
23    this.packages = $(EMPTY)
24
25    new() =
26        packages = $(Map)
27        return $(this)
28
29    add(name) =
30        packages = $(packages.add $(name), true)
31        return $(this)
32
33    isAvailable(name) =
34        return $(packages.mem $(name))
35
36    isPackaged() =
37        return $(isAvailable internal)
38
39    dump() =
40        println(dump packages)
41        packages.foreach(k, v)
42            println($"Package: "$(k))
43        return
44
45global.RegisterPackage(name) =
46    PACKAGE_MANAGER = $(PACKAGE_MANAGER.add $(name))
47    export
48
49
50#----------------------------------------------------------------------------
51# Variable Definitions
52#----------------------------------------------------------------------------
53
54global.PACKAGE_MANAGER = $(PackageManager.new)
55
56
57
58#----------------------------------------------------------------------------
59# Load package definitions
60#----------------------------------------------------------------------------
61
62private.root_packages = $(ROOT_OMAKE)/packages/$(TARGET_PLATFORM.Name)
63if $(test -d $(root_packages))
64    foreach(om,$(ls i,$(root_packages)/@*@.om))
65        include $(removesuffix $(om))
66        export
67    foreach(om,$(ls i,$(root_packages)/_*.om))
68        include $(removesuffix $(om))
69        export
70    export
71
72
73