Просмотр исходного кода

macOS build: std::max/min for size_t (JUCE's jmax picks a SIMD overload there); CI retries the package install when the mirror does not resolve

Ka1-S 3 недель назад
Родитель
Сommit
22fbaa5411

+ 8 - 5
.github/workflows/tests.yml

@@ -20,7 +20,8 @@ jobs:
     runs-on: ubuntu-24.04
     steps:
       - uses: actions/checkout@v5
-      - run: sudo apt-get update -q && sudo apt-get install -y -q python3-aiohttp
+      # (the runners' package mirror sometimes fails to resolve for a minute: try again instead of failing the job)
+      - run: for i in 1 2 3 4 5 6; do sudo apt-get update -q && sudo apt-get install -y -q python3-aiohttp && break; [ $i = 6 ] && exit 1; sleep 30; done
       - run: /usr/bin/python3 -m unittest discover -s server/tests -p 'test_*.py' -v
 
   # Round speed185a: a Core job took 76-130 min, ~90 % of it compiling the core again for every tool (now once, in
@@ -46,7 +47,7 @@ jobs:
       - name: ccache
         shell: bash
         run: |
-          if [[ "$RUNNER_OS" == Linux ]]; then sudo apt-get install -y -q ccache > /dev/null || { sudo apt-get update -q && sudo apt-get install -y -q ccache; }
+          if [[ "$RUNNER_OS" == Linux ]]; then sudo apt-get install -y -q ccache > /dev/null || for i in 1 2 3 4 5 6; do sudo apt-get update -q && sudo apt-get install -y -q ccache && break; [ $i = 6 ] && exit 1; sleep 30; done
           else brew list ccache > /dev/null 2>&1 || brew install ccache; fi
       - uses: actions/cache/restore@v4
         with:
@@ -95,9 +96,11 @@ jobs:
       - name: Linux build dependencies
         if: runner.os == 'Linux'
         run: |
-          sudo apt-get update -q
-          sudo apt-get install -y -q ccache ninja-build pkg-config xvfb libasound2-dev libjack-jackd2-dev libx11-dev libxrandr-dev \
-            libxinerama-dev libxcursor-dev libxext-dev libxcomposite-dev libfreetype-dev libfontconfig1-dev libgl-dev
+          for i in 1 2 3 4 5 6; do
+            sudo apt-get update -q && sudo apt-get install -y -q ccache ninja-build pkg-config xvfb libasound2-dev libjack-jackd2-dev libx11-dev libxrandr-dev \
+              libxinerama-dev libxcursor-dev libxext-dev libxcomposite-dev libfreetype-dev libfontconfig1-dev libgl-dev && break
+            [ $i = 6 ] && exit 1; sleep 30
+          done
 
       - name: macOS build dependencies
         if: runner.os == 'macOS'

+ 1 - 1
src/Main.cpp

@@ -6811,7 +6811,7 @@ private:
                 s2 = s1;
                 s1 = s0;
             }
-            const auto a = std::sqrt (juce::jmax (0.0, s1 * s1 + s2 * s2 - 2.0 * std::cos (w) * s1 * s2)) * 2.0 / (double) juce::jmax<std::size_t> (1, x.size());
+            const auto a = std::sqrt (juce::jmax (0.0, s1 * s1 + s2 * s2 - 2.0 * std::cos (w) * s1 * s2)) * 2.0 / (double) std::max<std::size_t> (1, x.size());
             return a > 1e-7 ? 20.0 * std::log10 (a) : -140.0;
         };
         auto ok = true;

+ 2 - 2
src/engine/AudioEngine.cpp

@@ -113,7 +113,7 @@ const natives::FlAccess& flStudioAccess()
             const auto folder = PluginHost::settingsFolder().getChildFile ("flp-embedded");
             folder.createDirectory();
             const auto hash = juce::String::toHexString ((juce::int64) juce::DefaultHashFunctions::generateHash (
-                juce::String::createStringFromData (wav.data(), (int) juce::jmin<std::size_t> (wav.size(), 65536)) + juce::String ((juce::int64) wav.size()),
+                juce::String::createStringFromData (wav.data(), (int) std::min<std::size_t> (wav.size(), 65536)) + juce::String ((juce::int64) wav.size()),
                 0x7FFFFFFF));
             const auto file = folder.getChildFile (juce::File::createLegalFileName (juce::String::fromUTF8 (name.c_str())) + "-" + hash + ".wav");
             if (! file.existsAsFile() && ! file.replaceWithData (wav.data(), wav.size()))
@@ -3358,7 +3358,7 @@ void AudioEngine::prepareFlpImport (const juce::File& file, const std::map<std::
             const auto folder = PluginHost::settingsFolder().getChildFile ("flp-embedded");
             folder.createDirectory();
             const auto hash = juce::String::toHexString ((juce::int64) juce::DefaultHashFunctions::generateHash (
-                juce::String::createStringFromData (wav.data(), (int) juce::jmin<std::size_t> (wav.size(), 65536)) + juce::String ((juce::int64) wav.size()),
+                juce::String::createStringFromData (wav.data(), (int) std::min<std::size_t> (wav.size(), 65536)) + juce::String ((juce::int64) wav.size()),
                 0x7FFFFFFF));
             const auto file = folder.getChildFile (juce::File::createLegalFileName (juce::String::fromUTF8 (name.c_str())) + "-" + hash + ".wav");
 

+ 1 - 1
src/ui/BrowserComponent.cpp

@@ -2229,7 +2229,7 @@ public:
                     peaks.assign (count, 0.0f);
                     const auto* l = sample->leftData();
                     const auto* r = sample->rightData();
-                    const auto stride = juce::jmax<std::size_t> (1, frames / (count * 64)); // look at up to 64 points per peak
+                    const auto stride = std::max<std::size_t> (1, frames / (count * 64)); // look at up to 64 points per peak
 
                     for (std::size_t i = 0; i < count; ++i)
                     {

+ 1 - 1
src/ui/PianoRollComponent.cpp

@@ -2448,7 +2448,7 @@ void PianoRollComponent::mouseDrag (const juce::MouseEvent& e)
 void PianoRollComponent::postDragHint (const juce::MouseEvent& e)
 {
     const auto& notes = currentPattern (engine.getSong()).notes;
-    const auto count = juce::String ((int) juce::jmax<std::size_t> (1, dragIndices.size()));
+    const auto count = juce::String ((int) std::max<std::size_t> (1, dragIndices.size()));
     auto steps = [] (std::int64_t ticks) {
         const auto value = (double) ticks / ticksPerStep;
         return (value > 0 ? "+" : "") + juce::String (value, std::abs (value - std::round (value)) < 1e-9 ? 0 : 2);

+ 1 - 1
src/ui/PlaylistComponent.cpp

@@ -4839,7 +4839,7 @@ void PlaylistComponent::mouseDrag (const juce::MouseEvent& e)
 void PlaylistComponent::postDragHint()
 {
     const auto& song = engine.getSong();
-    const auto count = juce::String ((int) juce::jmax<std::size_t> (1, dragIndices.size()));
+    const auto count = juce::String ((int) std::max<std::size_t> (1, dragIndices.size()));
     auto position = [&song] (std::int64_t tick) {
         const auto bar = song.barAt (juce::jmax<std::int64_t> (0, tick));
         const auto beat = (tick - bar.tick) / ppq + 1;

+ 1 - 1
src/ui/VisualEditors.cpp

@@ -1900,7 +1900,7 @@ public:
         {
 #if JUCE_WINDOWS
             DWORD done = 0;
-            if (writeEnd == nullptr || ! WriteFile (writeEnd, p, (DWORD) juce::jmin<std::size_t> (bytes, 1 << 24), &done, nullptr) || done == 0)
+            if (writeEnd == nullptr || ! WriteFile (writeEnd, p, (DWORD) std::min<std::size_t> (bytes, 1 << 24), &done, nullptr) || done == 0)
                 return false;
 #else
             const auto done = ::write (fd, p, bytes);