Skip to content

Commit

Permalink
make build names much smaller (#2589)
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 authored Feb 25, 2023
1 parent 9b15ad0 commit b37c98e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
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);
}

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

0 comments on commit b37c98e

Please sign in to comment.