Add DLL builds for Windows to CI and CQ.

They exercise the case of being built as a shared library, which is
interesting for symbol prefixing as DLLs behave rather different from
static libraries (e.g. a separate export name table).

Added to both win32 and win64 due to minor PE format differences in the
headers used to locate the export names.

Bug: 42220000
Change-Id: I4eca42278626e88269055aee33930a756a6a6964
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/88149
Auto-Submit: Rudolf Polzer <rpolzer@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/infra/config/generated/commit-queue.cfg b/infra/config/generated/commit-queue.cfg
index c96faa4..8a38b6f 100644
--- a/infra/config/generated/commit-queue.cfg
+++ b/infra/config/generated/commit-queue.cfg
@@ -218,6 +218,10 @@
         includable_only: true
       }
       builders {
+        name: "boringssl/try/win32_shared_compile"
+        includable_only: true
+      }
+      builders {
         name: "boringssl/try/win32_small"
       }
       builders {
@@ -242,6 +246,10 @@
         includable_only: true
       }
       builders {
+        name: "boringssl/try/win64_shared_compile"
+        includable_only: true
+      }
+      builders {
         name: "boringssl/try/win64_small"
       }
       builders {
diff --git a/infra/config/generated/cr-buildbucket.cfg b/infra/config/generated/cr-buildbucket.cfg
index 8a936ba..1bf90ca 100644
--- a/infra/config/generated/cr-buildbucket.cfg
+++ b/infra/config/generated/cr-buildbucket.cfg
@@ -2316,6 +2316,24 @@
       service_account: "boringssl-try-builder@chops-service-accounts.iam.gserviceaccount.com"
     }
     builders {
+      name: "win32_shared_compile"
+      swarming_host: "chromium-swarm.appspot.com"
+      dimensions: "cpu:x86-64"
+      dimensions: "os:Windows-10"
+      dimensions: "pool:luci.flex.try"
+      recipe {
+        name: "boringssl"
+        cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build"
+        cipd_version: "refs/heads/main"
+        properties_j: "cmake_args:{\"BUILD_SHARED_LIBS\":\"1\"}"
+        properties_j: "msvc_target:\"x86\""
+        properties_j: "run_ssl_tests:false"
+        properties_j: "run_unit_tests:false"
+      }
+      execution_timeout_secs: 1800
+      service_account: "boringssl-try-builder@chops-service-accounts.iam.gserviceaccount.com"
+    }
+    builders {
       name: "win32_small"
       swarming_host: "chromium-swarm.appspot.com"
       dimensions: "cpu:x86-64"
@@ -2433,6 +2451,24 @@
       service_account: "boringssl-try-builder@chops-service-accounts.iam.gserviceaccount.com"
     }
     builders {
+      name: "win64_shared_compile"
+      swarming_host: "chromium-swarm.appspot.com"
+      dimensions: "cpu:x86-64"
+      dimensions: "os:Windows-10"
+      dimensions: "pool:luci.flex.try"
+      recipe {
+        name: "boringssl"
+        cipd_package: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build"
+        cipd_version: "refs/heads/main"
+        properties_j: "cmake_args:{\"BUILD_SHARED_LIBS\":\"1\"}"
+        properties_j: "msvc_target:\"x64\""
+        properties_j: "run_ssl_tests:false"
+        properties_j: "run_unit_tests:false"
+      }
+      execution_timeout_secs: 1800
+      service_account: "boringssl-try-builder@chops-service-accounts.iam.gserviceaccount.com"
+    }
+    builders {
       name: "win64_small"
       swarming_host: "chromium-swarm.appspot.com"
       dimensions: "cpu:x86-64"
diff --git a/infra/config/main.star b/infra/config/main.star
index 7f6c2e1..2577dd4 100755
--- a/infra/config/main.star
+++ b/infra/config/main.star
@@ -232,6 +232,12 @@
     ],
 )
 
+def compile_only(properties):
+    compile_properties = dict(properties)
+    compile_properties["run_unit_tests"] = False
+    compile_properties["run_ssl_tests"] = False
+    return compile_properties
+
 def both_builders(
         name,
         host,
@@ -280,17 +286,13 @@
         properties = properties,
     )
     if cq_compile_only:
-        compile_properties = dict(properties)
-        compile_properties["run_unit_tests"] = False
-        compile_properties["run_ssl_tests"] = False
         cq_builder(
             name + "_compile",
             cq_compile_only,
             recipe = recipe,
             cq_enabled = cq_enabled,
             execution_timeout = execution_timeout,
-            properties = compile_properties,
-        )
+            properties = compile_only(properties))
 
 LINUX_HOST = {
     "dimensions": {
@@ -527,16 +529,14 @@
     LINUX_HOST,
     category = "android|riscv64",
     short_name = "rel",
-    properties = {
+    properties = compile_only({
         "android": True,
         "cmake_args": {
             "ANDROID_ABI": "riscv64",
             "ANDROID_PLATFORM": "android-35",
             "CMAKE_BUILD_TYPE": "Release",
         },
-        "run_unit_tests": False,
-        "run_ssl_tests": False,
-    },
+    }),
 )
 
 both_builders("docs", LINUX_HOST, recipe = "boringssl_docs", short_name = "doc")
@@ -549,14 +549,12 @@
     MAC_X86_64_HOST,
     category = "ios",
     short_name = "64",
-    properties = {
+    properties = compile_only({
         "cmake_args": {
             "CMAKE_OSX_ARCHITECTURES": "arm64",
             "CMAKE_OSX_SYSROOT": "iphoneos",
         },
-        "run_unit_tests": False,
-        "run_ssl_tests": False,
-    },
+    }),
 )
 both_builders(
     "linux",
@@ -996,6 +994,21 @@
         "sde": True,
     },
 )
+cq_builder(
+    "win32_shared_compile",
+    WIN_HOST,
+    # TODO(crbug.com/42220000): Enable as both_builders once it's working.
+    # category = "win|x86",
+    # short_name = "sh",
+    # cq_compile_only = WIN_HOST,  # Reduce CQ cycle times.
+    cq_enabled = False,
+    properties = compile_only({
+        "msvc_target": "x86",
+        "cmake_args": {
+            "BUILD_SHARED_LIBS": "1",
+        },
+    }),
+)
 both_builders(
     "win32_small",
     WIN_HOST,
@@ -1077,6 +1090,21 @@
         "sde": True,
     },
 )
+cq_builder(
+    "win64_shared_compile",
+    WIN_HOST,
+    # TODO(crbug.com/42220000): Enable as both_builders once it's working.
+    # category = "win|x64",
+    # short_name = "sh",
+    # cq_compile_only = WIN_HOST,  # Reduce CQ cycle times.
+    cq_enabled = False,
+    properties = compile_only({
+        "msvc_target": "x64",
+        "cmake_args": {
+            "BUILD_SHARED_LIBS": "1",
+        },
+    }),
+)
 both_builders(
     "win64_small",
     WIN_HOST,
@@ -1112,7 +1140,7 @@
     WIN_HOST,
     category = "win|arm64",
     short_name = "clang",
-    properties = {
+    properties = compile_only({
         "clang": True,
         "cmake_args": {
             # Clang doesn't pick up arm64 from msvc_target. Specify it as a
@@ -1127,9 +1155,7 @@
             "checkout_nasm": False,
         },
         "msvc_target": "arm64",
-        "run_unit_tests": False,
-        "run_ssl_tests": False,
-    },
+    }),
 )
 
 both_builders(
@@ -1137,7 +1163,7 @@
     WIN_HOST,
     category = "win|arm64",
     short_name = "msvc",
-    properties = {
+    properties = compile_only({
         "cmake_args": {
             # This is a cross-compile, so CMake needs to be told the processor.
             # MSVC will pick up the architecture from msvc_target.
@@ -1150,7 +1176,5 @@
             "checkout_nasm": False,
         },
         "msvc_target": "arm64",
-        "run_unit_tests": False,
-        "run_ssl_tests": False,
-    },
+    }),
 )