jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 1 | # Standard constraint_setting and constraint_values to be used in platforms. |
| 2 | |
John Cater | 58a8f07 | 2017-03-23 16:55:41 +0000 | [diff] [blame] | 3 | package( |
| 4 | default_visibility = ["//visibility:public"], |
| 5 | ) |
| 6 | |
| 7 | filegroup( |
| 8 | name = "package-srcs", |
| 9 | srcs = [ |
| 10 | "platforms.BUILD", |
John Cater | 58a8f07 | 2017-03-23 16:55:41 +0000 | [diff] [blame] | 11 | ], |
| 12 | ) |
| 13 | |
| 14 | filegroup( |
| 15 | name = "srcs", |
| 16 | srcs = glob(["**"]), |
| 17 | ) |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 18 | |
ajmichael | a5bda13 | 2018-03-19 09:30:22 -0700 | [diff] [blame] | 19 | # These match values in //src/main/java/com/google/devtools/build/lib/util:CPU.java |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 20 | constraint_setting(name = "cpu") |
| 21 | |
| 22 | constraint_value( |
| 23 | name = "x86_32", |
| 24 | constraint_setting = ":cpu", |
| 25 | ) |
| 26 | |
| 27 | constraint_value( |
| 28 | name = "x86_64", |
| 29 | constraint_setting = ":cpu", |
| 30 | ) |
| 31 | |
| 32 | constraint_value( |
| 33 | name = "ppc", |
| 34 | constraint_setting = ":cpu", |
| 35 | ) |
| 36 | |
| 37 | constraint_value( |
| 38 | name = "arm", |
| 39 | constraint_setting = ":cpu", |
| 40 | ) |
| 41 | |
| 42 | constraint_value( |
Arielle Albon | 886d01c | 2018-06-20 05:51:18 -0700 | [diff] [blame] | 43 | name = "aarch64", |
| 44 | constraint_setting = ":cpu", |
| 45 | ) |
| 46 | |
| 47 | constraint_value( |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 48 | name = "s390x", |
| 49 | constraint_setting = ":cpu", |
| 50 | ) |
| 51 | |
ajmichael | a5bda13 | 2018-03-19 09:30:22 -0700 | [diff] [blame] | 52 | # These match values in //src/main/java/com/google/devtools/build/lib/util:OS.java |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 53 | constraint_setting(name = "os") |
| 54 | |
| 55 | constraint_value( |
| 56 | name = "osx", |
| 57 | constraint_setting = ":os", |
| 58 | ) |
| 59 | |
| 60 | constraint_value( |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 61 | name = "ios", |
| 62 | constraint_setting = ":os", |
| 63 | ) |
| 64 | |
| 65 | constraint_value( |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 66 | name = "freebsd", |
| 67 | constraint_setting = ":os", |
| 68 | ) |
| 69 | |
| 70 | constraint_value( |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 71 | name = "android", |
| 72 | constraint_setting = ":os", |
| 73 | ) |
| 74 | |
| 75 | constraint_value( |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 76 | name = "linux", |
| 77 | constraint_setting = ":os", |
| 78 | ) |
| 79 | |
| 80 | constraint_value( |
| 81 | name = "windows", |
| 82 | constraint_setting = ":os", |
| 83 | ) |
| 84 | |
| 85 | # A default platform with nothing defined. |
| 86 | platform(name = "default_platform") |
| 87 | |
| 88 | # A default platform referring to the host system. This only exists for |
| 89 | # internal build configurations, and so shouldn't be accessed by other packages. |
| 90 | platform( |
| 91 | name = "host_platform", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 92 | constraint_values = [ |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 93 | ], |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 94 | cpu_constraints = [ |
| 95 | ":x86_32", |
| 96 | ":x86_64", |
| 97 | ":ppc", |
| 98 | ":arm", |
Arielle Albon | 886d01c | 2018-06-20 05:51:18 -0700 | [diff] [blame] | 99 | ":aarch64", |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 100 | ":s390x", |
| 101 | ], |
| 102 | host_platform = True, |
| 103 | os_constraints = [ |
| 104 | ":osx", |
| 105 | ":freebsd", |
| 106 | ":linux", |
| 107 | ":windows", |
| 108 | ], |
| 109 | ) |
| 110 | |
| 111 | platform( |
| 112 | name = "target_platform", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 113 | constraint_values = [ |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 114 | ], |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 115 | cpu_constraints = [ |
| 116 | ":x86_32", |
| 117 | ":x86_64", |
| 118 | ":ppc", |
| 119 | ":arm", |
Arielle Albon | 886d01c | 2018-06-20 05:51:18 -0700 | [diff] [blame] | 120 | ":aarch64", |
cpeyser | d852e48 | 2017-09-07 22:16:06 +0200 | [diff] [blame] | 121 | ":s390x", |
| 122 | ], |
| 123 | os_constraints = [ |
| 124 | ":osx", |
| 125 | ":freebsd", |
| 126 | ":linux", |
| 127 | ":windows", |
| 128 | ], |
| 129 | target_platform = True, |
| 130 | ) |