From 80c0d97b77dc2e5869d59136d022f36e30a56ded Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Fri, 24 Jul 2026 19:41:52 +0100 Subject: [PATCH] Fix `docs/_code/samples` build on Apple Silicon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spine Bootstrap 1.7.0 configures the samples build to resolve third-party artifacts (protoc, the gRPC codegen plugin) from JCenter, which is shut down, and pins protoc 3.13.0 / protoc-gen-grpc-java 1.28.1 — versions that predate Apple Silicon and have no `osx-aarch_64` build at any repository. As a result `:generateProto` fails on arm64 Macs, and the JCenter reference is dead weight everywhere else. Repoint third-party resolution to Maven Central (Spine's own artifacts keep resolving from the `spine.mycloudrepo.io` repositories Bootstrap also injects), and, on arm64 macOS only, force the `osx-x86_64` protoc and gRPC binaries so they run under Rosetta 2 while staying pinned at the exact Bootstrap-selected versions — generated code is byte-for-byte identical to every other platform. Non-mac platforms keep Bootstrap's auto-detected native binary, so the Linux CI job is unaffected. Verified with `./gradlew -p docs/_code/samples clean buildAll` (compileJava, compileTestJava, and test all pass) on an arm64 Mac. Co-Authored-By: Claude Fable 5 --- docs/_code/samples/build.gradle | 38 +++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/docs/_code/samples/build.gradle b/docs/_code/samples/build.gradle index 8b18b57..61bae02 100644 --- a/docs/_code/samples/build.gradle +++ b/docs/_code/samples/build.gradle @@ -1,11 +1,11 @@ /* - * Copyright 2020, TeamDev. All rights reserved. + * Copyright 2026, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Redistribution and use in source and/or binary forms, with or without * modification, must retain the above copyright notice and the following @@ -30,6 +30,40 @@ plugins { spine.enableJava().server() +// Spine Bootstrap 1.7.0 (released 2020) injects the now-defunct JCenter as the +// repository for third-party artifacts such as `protoc`. JCenter is shut down, so +// nothing resolves from it. Replace it with Maven Central. Spine's own artifacts +// keep resolving from the `spine.mycloudrepo.io` repositories that Bootstrap also +// injects, so only the third-party source needs repointing. +repositories { + removeIf { it.name == 'BintrayJCenter' } + mavenCentral() +} + +// protoc 3.13.0 and the gRPC codegen plugin 1.28.1 both predate Apple Silicon: +// no `osx-aarch_64` build of either was ever published to any repository, so +// resolution fails on arm64 Macs even with a live repo. Force the x86_64 binaries +// there — they run under Rosetta 2 and keep the tools pinned at exactly the +// Bootstrap-selected versions, so generated code is identical to every other +// platform. Everywhere else, keep Bootstrap's auto-detected native binaries. +def osName = System.getProperty('os.name').toLowerCase() +def osArch = System.getProperty('os.arch').toLowerCase() +def appleSilicon = osName.contains('mac') && (osArch == 'aarch64' || osArch == 'arm64') +protobuf { + protoc { + if (appleSilicon) { + artifact = 'com.google.protobuf:protoc:3.13.0:osx-x86_64@exe' + } + } + plugins { + grpc { + if (appleSilicon) { + artifact = 'io.grpc:protoc-gen-grpc-java:1.28.1:osx-x86_64@exe' + } + } + } +} + ext { junitVersion = '5.7.0' }