Skip to content

Commit

Permalink
Add options to disable multithreading to the CLI.
Browse files Browse the repository at this point in the history
Use the latest version of LDC in automated macOS builds.
  • Loading branch information
Dadoum committed May 17, 2024
1 parent 92c38fc commit 77d51fc
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 49 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ jobs:
- name: Set-up macOS cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cat << EOF | tee $HOME/.ldc/ldc2.conf
Expand All @@ -163,17 +164,17 @@ jobs:
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-1.33.0-osx-x86_64/import",
"-I$HOME/ldc2-$LDC_VERSION-osx-x86_64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-1.33.0-osx-x86_64/lib",
"$HOME/ldc2-$LDC_VERSION-osx-x86_64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v1.33.0/ldc2-1.33.0-osx-x86_64.tar.xz
tar -xf ./ldc2-1.33.0-osx-x86_64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-x86_64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-x86_64.tar.xz -C $HOME
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libz-dev elfutils clang lld
Expand Down Expand Up @@ -208,6 +209,7 @@ jobs:
- name: Set-up macOS cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cat << EOF | tee $HOME/.ldc/ldc2.conf
Expand All @@ -225,17 +227,17 @@ jobs:
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-1.33.0-osx-arm64/import",
"-I$HOME/ldc2-$LDC_VERSION-osx-arm64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-1.33.0-osx-arm64/lib",
"$HOME/ldc2-$LDC_VERSION-osx-arm64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v1.33.0/ldc2-1.33.0-osx-arm64.tar.xz
tar -xf ./ldc2-1.33.0-osx-arm64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-arm64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-arm64.tar.xz -C $HOME
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libz-dev elfutils clang lld
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/build-dlangui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ jobs:
- name: Set-up macOS cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cat << EOF | tee $HOME/.ldc/ldc2.conf
Expand All @@ -165,17 +166,17 @@ jobs:
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-1.33.0-osx-x86_64/import",
"-I$HOME/ldc2-$LDC_VERSION-osx-x86_64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-1.33.0-osx-x86_64/lib",
"$HOME/ldc2-$LDC_VERSION-osx-x86_64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v1.33.0/ldc2-1.33.0-osx-x86_64.tar.xz
tar -xf ./ldc2-1.33.0-osx-x86_64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-x86_64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-x86_64.tar.xz -C $HOME
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libz-dev elfutils clang lld
Expand Down Expand Up @@ -210,6 +211,7 @@ jobs:
- name: Set-up macOS cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cat << EOF | tee $HOME/.ldc/ldc2.conf
Expand All @@ -227,17 +229,17 @@ jobs:
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-1.33.0-osx-arm64/import",
"-I$HOME/ldc2-$LDC_VERSION-osx-arm64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-1.33.0-osx-arm64/lib",
"$HOME/ldc2-$LDC_VERSION-osx-arm64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v1.33.0/ldc2-1.33.0-osx-arm64.tar.xz
tar -xf ./ldc2-1.33.0-osx-arm64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-arm64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-arm64.tar.xz -C $HOME
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libz-dev elfutils clang lld
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/build-gtk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ jobs:
- name: Set-up macOS cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cat << EOF | tee $HOME/.ldc/ldc2.conf
Expand All @@ -164,17 +165,17 @@ jobs:
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-1.33.0-osx-x86_64/import",
"-I$HOME/ldc2-$LDC_VERSION-osx-x86_64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-1.33.0-osx-x86_64/lib",
"$HOME/ldc2-$LDC_VERSION-osx-x86_64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v1.33.0/ldc2-1.33.0-osx-x86_64.tar.xz
tar -xf ./ldc2-1.33.0-osx-x86_64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-x86_64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-x86_64.tar.xz -C $HOME
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libz-dev elfutils clang lld
Expand Down Expand Up @@ -210,6 +211,7 @@ jobs:
- name: Set-up macOS cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cat << EOF | tee $HOME/.ldc/ldc2.conf
Expand All @@ -227,17 +229,17 @@ jobs:
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-1.33.0-osx-arm64/import",
"-I$HOME/ldc2-$LDC_VERSION-osx-arm64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-1.33.0-osx-arm64/lib",
"$HOME/ldc2-$LDC_VERSION-osx-arm64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v1.33.0/ldc2-1.33.0-osx-arm64.tar.xz
tar -xf ./ldc2-1.33.0-osx-arm64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-arm64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-arm64.tar.xz -C $HOME
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libz-dev elfutils clang lld
Expand Down
36 changes: 20 additions & 16 deletions .github/workflows/build-qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ jobs:

- uses: dlang-community/setup-dlang@v1
with:
compiler: ldc-1.33.0
compiler: ldc-latest

- name: Set-up macOS cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cat << EOF | tee $HOME/.ldc/ldc2.conf
Expand All @@ -84,7 +85,7 @@ jobs:
"-Xcc=-isysroot",
"-Xcc=$HOME/MacOSX11.0.sdk",
"-Xcc=-F",
"-Xcc=$HOME/ldc2-1.33.0-osx-x86_64/lib",
"-Xcc=$HOME/ldc2-$LDC_VERSION-osx-x86_64/lib",
"-Xcc=-mmacosx-version-min=12.6",
"-L=-platform_version",
"-L=macos",
Expand All @@ -94,25 +95,26 @@ jobs:
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-1.33.0-osx-x86_64/import",
"-I$HOME/ldc2-$LDC_VERSION-osx-x86_64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-1.33.0-osx-x86_64/lib",
"$HOME/ldc2-$LDC_VERSION-osx-x86_64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v1.33.0/ldc2-1.33.0-osx-x86_64.tar.xz
tar -xf ./ldc2-1.33.0-osx-x86_64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-x86_64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-x86_64.tar.xz -C $HOME
brew fetch --force --bottle-tag=monterey llvm@16
brew install $(brew --cache --bottle-tag=monterey llvm@16)
cp /home/linuxbrew/.linuxbrew/Cellar/llvm@16/16.0.6/lib/c++/* $HOME/ldc2-1.33.0-osx-x86_64/lib
cp /home/linuxbrew/.linuxbrew/Cellar/llvm@16/16.0.6/lib/c++/* $HOME/ldc2-$LDC_VERSION-osx-x86_64/lib
rm -rf /home/linuxbrew/.linuxbrew
- name: Set-up Qt for cross-compilation
run:
cp -r $Qt5_DIR/lib/* $HOME/ldc2-1.33.0-osx-x86_64/lib
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
cp -r $Qt5_DIR/lib/* $HOME/ldc2-$LDC_VERSION-osx-x86_64/lib

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libz-dev elfutils clang lld-15
Expand Down Expand Up @@ -151,7 +153,7 @@ jobs:

- uses: dlang-community/setup-dlang@v1
with:
compiler: ldc-1.33.0
compiler: ldc-latest

- name: Set up Homebrew
id: set-up-homebrew
Expand All @@ -170,6 +172,7 @@ jobs:
- name: Set-up macOS cross-compilation
run: |
mkdir -p $HOME/.ldc/
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
curl -LO https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz
tar -xf ./MacOSX11.0.sdk.tar.xz -C $HOME
cat << EOF | tee $HOME/.ldc/ldc2.conf
Expand All @@ -184,7 +187,7 @@ jobs:
"-Xcc=-isysroot",
"-Xcc=$HOME/MacOSX11.0.sdk",
"-Xcc=-F",
"-Xcc=$HOME/ldc2-1.33.0-osx-arm64/lib",
"-Xcc=$HOME/ldc2-$LDC_VERSION-osx-arm64/lib",
"-Xcc=-mmacosx-version-min=12.6",
"-L=-platform_version",
"-L=macos",
Expand All @@ -194,25 +197,26 @@ jobs:
];
// default switches appended after all explicit command-line switches
post-switches = [
"-I$HOME/ldc2-1.33.0-osx-arm64/import",
"-I$HOME/ldc2-$LDC_VERSION-osx-arm64/import",
];
// default directories to be searched for libraries when linking
lib-dirs = [
"$HOME/ldc2-1.33.0-osx-arm64/lib",
"$HOME/ldc2-$LDC_VERSION-osx-arm64/lib",
];
};
EOF
mkdir $HOME/ldc-macos
curl -LO https://github.com/ldc-developers/ldc/releases/download/v1.33.0/ldc2-1.33.0-osx-arm64.tar.xz
tar -xf ./ldc2-1.33.0-osx-arm64.tar.xz -C $HOME
curl -LO https://github.com/ldc-developers/ldc/releases/download/v$LDC_VERSION/ldc2-$LDC_VERSION-osx-arm64.tar.xz
tar -xf ./ldc2-$LDC_VERSION-osx-arm64.tar.xz -C $HOME
brew fetch --force --bottle-tag=arm64_monterey llvm@16
brew install $(brew --cache --bottle-tag=arm64_monterey llvm@16)
cp /home/linuxbrew/.linuxbrew/Cellar/llvm@16/16.0.6/lib/c++/* $HOME/ldc2-1.33.0-osx-arm64/lib
cp /home/linuxbrew/.linuxbrew/Cellar/llvm@16/16.0.6/lib/c++/* $HOME/ldc2-$LDC_VERSION-osx-arm64/lib
rm -rf /home/linuxbrew/.linuxbrew
- name: Set-up Qt for cross-compilation
run:
cp -r $Qt5_DIR/lib/* $HOME/ldc2-1.33.0-osx-arm64/lib
LDC_VERSION=$(ldc2 --version | head -n 1 | grep -oE "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
cp -r $Qt5_DIR/lib/* $HOME/ldc2-$LDC_VERSION-osx-arm64/lib

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libz-dev elfutils clang lld-15
Expand Down
5 changes: 5 additions & 0 deletions frontends/cli/source/cli_frontend.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import std.array;
import std.datetime;
import std.exception;
import std.format;
import std.parallelism;
import std.path;
import std.process;
import std.stdio;
Expand Down Expand Up @@ -225,6 +226,7 @@ int entryPoint(Commands commands)
setlocale(LC_ALL, "");
}

defaultPoolThreads = commands.threadCount;
configureLoggingProvider(new shared DefaultProvider(true, commands.debug_ ? Levels.DEBUG : Levels.INFO));

try
Expand Down Expand Up @@ -252,6 +254,9 @@ struct Commands
@(NamedArgument("d", "debug").Description("Enable debug logging"))
bool debug_;

@(NamedArgument("thread-count").Description("Numbers of threads to be used for signing the application bundle"))
uint threadCount = uint.max;

@SubCommands
SumType!(AppIdCommand, CertificateCommand, InstallCommand, SignCommand, TeamCommand, ToolCommand, VersionCommand) cmd;
}
Expand Down
5 changes: 4 additions & 1 deletion frontends/cli/source/install.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ struct InstallCommand
@(NamedArgument("udid").Description("UDID of the device (if multiple are available)."))
string udid = null;

@(NamedArgument("singlethread").Description("Run the signature process on a single thread. Sacrifices speed for more consistency."))
bool singlethreaded;

int opCall()
{
Application app = openApp(appPath);
Expand Down Expand Up @@ -67,7 +70,7 @@ struct InstallCommand
message = action;
progressBar.index = cast(int) (progress * 100);
progressBar.update();
});
}, !singlethreaded);
progressBar.finish();

return 0;
Expand Down
10 changes: 7 additions & 3 deletions frontends/cli/source/sign.d
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ struct SignCommand
@(NamedArgument("m", "provision").Description("App's provisioning certificate.").Required())
string mobileProvisionPath;

@(NamedArgument("singlethread").Description("Run the signature process on a single thread. Sacrifices speed for more consistency."))
bool singlethreaded;

@(PositionalArgument(0, "app path").Description("App path."))
string appFolder;

Expand All @@ -54,11 +57,12 @@ struct SignCommand
sideloadSign(
app,
new CertificateIdentity(certificate, privateKey),
[app.bundleIdentifier(): ProvisioningProfile("", "", mobileProvisionFile)], // TODO make a better ctor
(p) {
[app.bundleIdentifier(): ProvisioningProfile("", "", mobileProvisionFile)], // TODO make a better ctor
(p) {
progressBar.index = cast(int) (progress += p * 100);
progressBar.update();
}
},
!singlethreaded
);
progressBar.finish();

Expand Down
1 change: 1 addition & 0 deletions source/sideload/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void sideloadFull(
DeveloperSession developer,
Application app,
void delegate(double progress, string action) progressCallback,
bool isMultithreaded = true,
) {
enum STEP_COUNT = 9.0;
auto log = getLogger();
Expand Down
Loading

0 comments on commit 77d51fc

Please sign in to comment.