Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make build names much smaller #2589

Merged
merged 2 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions source/dub/generators/build.d
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,21 @@ string getObjSuffix(const scope ref BuildPlatform platform)

string computeBuildName(string config, in GeneratorSettings settings, const string[][] hashing...)
{
import std.digest.sha : SHA256, toHexString;
import std.digest.sha : SHA256;
import std.base64 : Base64URL;

SHA256 hash;
hash.start();
void addHash(in string[] strings...) { foreach (s; strings) { hash.put(cast(ubyte[])s); hash.put(0); } hash.put(0); }
foreach(strings; hashing)
addHash(strings);
const hashstr = hash.finish().toHexString();
addHash(settings.platform.platform);
addHash(settings.platform.architecture);
addHash(settings.platform.compiler);
addHash(settings.platform.compilerVersion);
const hashstr = Base64URL.encode(hash.finish()[0 .. $ / 2]).stripRight("=");

return format("%s-%s-%s-%s-%s_v%s-%s", config, settings.buildType,
settings.platform.platform.join("."),
settings.platform.architecture.join("."),
settings.platform.compiler, settings.platform.compilerVersion, hashstr);
return format("%s-%s-%s", config, settings.buildType, hashstr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an aside - why is buildType there? I'm especially wondering about unittest - AFAIK, that only really applies to the main package. But all dependencies then get unittest too, although they aren't compiled with -unittest etc., so might likely have to be recompiled even if a suitable regular debug build might be in the build cache already.

}

class BuildGenerator : ProjectGenerator {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/+ dub.sdl:
name "issue2051_running_unittests_from_dub_single_file_packages_fails"
name "issue2051"
+/

import std.algorithm : any;
Expand Down
4 changes: 2 additions & 2 deletions test/removed-dub-obj.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ ${DUB} build --compiler=${DC}
[ -d "$DUB_CACHE_PATH/obj" ] && die $LINENO "$DUB_CACHE_PATH/obj was found"

if [[ ${DC} == *"ldc"* ]]; then
if [ ! -f $DUB_CACHE_PATH/~master/build/library-*ldc*/obj/test.o* ]; then
if [ ! -f $DUB_CACHE_PATH/~master/build/library-*/obj/test.o* ]; then
ls -lR $DUB_CACHE_PATH
die $LINENO '$DUB_CACHE_PATH/~master/build/library-*ldc*/obj/test.o* was not found'
die $LINENO '$DUB_CACHE_PATH/~master/build/library-*/obj/test.o* was not found'
fi
fi

Expand Down