Commit 4f5b4c26 authored by Mathias LANG's avatar Mathias LANG Committed by Rasmus Thomsen
Browse files

community/dub: upgrade to 1.25.0

parent 379047e4
Pipeline #80402 passed with stages
in 6 minutes and 1 second
From 4c37352b9ba6f85eac04dfa9a43fd3d3da25bf72 Mon Sep 17 00:00:00 2001
From: Geod24 <pro.mathias.lang@gmail.com>
Date: Mon, 22 Feb 2021 20:52:25 +0900
Subject: Revert "cache the generated test main file: dub_test_root.d"
This reverts commit df67d832c9a2911e30f19a01d9b5404d161b4215.
---
source/dub/dub.d | 17 +----
source/dub/generators/build.d | 62 ++++++++-----------
test/cache-generated-test-config.sh | 24 -------
test/cache-generated-test-config/.no_build | 0
test/cache-generated-test-config/.no_run | 0
test/cache-generated-test-config/.no_test | 0
test/cache-generated-test-config/dub.sdl | 3 -
.../cache-generated-test-config/source/test.d | 6 --
8 files changed, 29 insertions(+), 83 deletions(-)
delete mode 100755 test/cache-generated-test-config.sh
delete mode 100644 test/cache-generated-test-config/.no_build
delete mode 100644 test/cache-generated-test-config/.no_run
delete mode 100644 test/cache-generated-test-config/.no_test
delete mode 100644 test/cache-generated-test-config/dub.sdl
delete mode 100644 test/cache-generated-test-config/source/test.d
diff --git a/source/dub/dub.d b/source/dub/dub.d
index e88ece23..ec0fb331 100644
--- a/source/dub/dub.d
+++ b/source/dub/dub.d
@@ -658,7 +658,6 @@ class Dub {
}
// prepare the list of tested modules
-
string[] import_modules;
foreach (file; lbuildsettings.sourceFiles) {
if (file.endsWith(".d")) {
@@ -679,23 +678,11 @@ class Dub {
}
}
- NativePath mainfile;
- if (settings.tempBuild)
- mainfile = getTempFile("dub_test_root", ".d");
- else {
- import dub.generators.build : computeBuildName;
- mainfile = m_project.rootPackage.path ~ format(".dub/code/%s_dub_test_root.d", computeBuildName(test_config, settings, import_modules));
- }
-
- mkdirRecurse(mainfile.parentPath.toNativeString());
-
- bool regenerateMainFile = settings.force || !existsFile(mainfile);
-
// generate main file
+ NativePath mainfile = getTempFile("dub_test_root", ".d");
tcinfo.sourceFiles[""] ~= mainfile.toNativeString();
tcinfo.mainSourceFile = mainfile.toNativeString();
-
- if (!m_dryRun && regenerateMainFile) {
+ if (!m_dryRun) {
auto fil = openFile(mainfile, FileMode.createTrunc);
scope(exit) fil.close();
fil.write("module dub_test_root;\n");
diff --git a/source/dub/generators/build.d b/source/dub/generators/build.d
index 649fbe0b..75250f4b 100644
--- a/source/dub/generators/build.d
+++ b/source/dub/generators/build.d
@@ -32,24 +32,6 @@ string getObjSuffix(const scope ref BuildPlatform platform)
return platform.platform.canFind("windows") ? ".obj" : ".o";
}
-string computeBuildName(string config, GeneratorSettings settings, const string[][] hashing...)
-{
- import std.digest;
- import std.digest.md;
-
- MD5 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);
- auto hashstr = hash.finish().toHexString().idup;
-
- 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);
-}
-
class BuildGenerator : ProjectGenerator {
private {
PackageManager m_packageMan;
@@ -347,23 +329,33 @@ class BuildGenerator : ProjectGenerator {
private string computeBuildID(string config, in BuildSettings buildsettings, GeneratorSettings settings)
{
- const(string[])[] hashing = [
- buildsettings.versions,
- buildsettings.debugVersions,
- buildsettings.dflags,
- buildsettings.lflags,
- buildsettings.stringImportPaths,
- buildsettings.importPaths,
- settings.platform.architecture,
- [
- (cast(uint)buildsettings.options).to!string,
- settings.platform.compilerBinary,
- settings.platform.compiler,
- settings.platform.compilerVersion,
- ],
- ];
-
- return computeBuildName(config, settings, hashing);
+ import std.digest;
+ import std.digest.md;
+ import std.bitmanip;
+
+ MD5 hash;
+ hash.start();
+ void addHash(in string[] strings...) { foreach (s; strings) { hash.put(cast(ubyte[])s); hash.put(0); } hash.put(0); }
+ void addHashI(int value) { hash.put(nativeToLittleEndian(value)); }
+ addHash(buildsettings.versions);
+ addHash(buildsettings.debugVersions);
+ //addHash(buildsettings.versionLevel);
+ //addHash(buildsettings.debugLevel);
+ addHash(buildsettings.dflags);
+ addHash(buildsettings.lflags);
+ addHash((cast(uint)buildsettings.options).to!string);
+ addHash(buildsettings.stringImportPaths);
+ addHash(buildsettings.importPaths);
+ addHash(settings.platform.architecture);
+ addHash(settings.platform.compilerBinary);
+ addHash(settings.platform.compiler);
+ addHashI(settings.platform.frontendVersion);
+ auto hashstr = hash.finish().toHexString().idup;
+
+ return format("%s-%s-%s-%s-%s_%s-%s", config, settings.buildType,
+ settings.platform.platform.join("."),
+ settings.platform.architecture.join("."),
+ settings.platform.compiler, settings.platform.frontendVersion, hashstr);
}
private void copyTargetFile(NativePath build_path, BuildSettings buildsettings, GeneratorSettings settings)
diff --git a/test/cache-generated-test-config.sh b/test/cache-generated-test-config.sh
deleted file mode 100755
index 9f5ca6f7..00000000
--- a/test/cache-generated-test-config.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env bash
-
-. $(dirname "${BASH_SOURCE[0]}")/common.sh
-cd ${CURR_DIR}/cache-generated-test-config
-rm -rf .dub
-
-${DUB} test --compiler=${DC}
-
-STAT="stat -c '%Y'"
-[[ "$OSTYPE" == "darwin"* ]] && STAT="stat -f '%m' -t '%Y'"
-
-EXECUTABLE_TIME="$(${STAT} cache-generated-test-config-test-library)"
-[ -z "$EXECUTABLE_TIME" ] && die $LINENO 'no EXECUTABLE_TIME was found'
-MAIN_TIME="$(${STAT} "$(ls .dub/code/*dub_test_root.d)")"
-[ -z "$MAIN_TIME" ] && die $LINENO 'no MAIN_TIME was found'
-
-${DUB} test --compiler=${DC}
-MAIN_FILES_COUNT=$(ls .dub/code/*dub_test_root.d | wc -l)
-
-[ $MAIN_FILES_COUNT -ne 1 ] && die $LINENO 'DUB generated more then one main file'
-[ "$EXECUTABLE_TIME" != "$(${STAT} cache-generated-test-config-test-library)" ] && die $LINENO 'The executable has been rebuilt'
-[ "$MAIN_TIME" != "$(${STAT} "$(ls .dub/code/*dub_test_root.d | head -n1)")" ] && die $LINENO 'The test main file has been rebuilt'
-
-exit 0
\ No newline at end of file
diff --git a/test/cache-generated-test-config/.no_build b/test/cache-generated-test-config/.no_build
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cache-generated-test-config/.no_run b/test/cache-generated-test-config/.no_run
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cache-generated-test-config/.no_test b/test/cache-generated-test-config/.no_test
deleted file mode 100644
index e69de29b..00000000
diff --git a/test/cache-generated-test-config/dub.sdl b/test/cache-generated-test-config/dub.sdl
deleted file mode 100644
index ccfd0a22..00000000
--- a/test/cache-generated-test-config/dub.sdl
+++ /dev/null
@@ -1,3 +0,0 @@
-name "cache-generated-test-config"
-
-targetType "staticLibrary"
\ No newline at end of file
diff --git a/test/cache-generated-test-config/source/test.d b/test/cache-generated-test-config/source/test.d
deleted file mode 100644
index c6e2276c..00000000
--- a/test/cache-generated-test-config/source/test.d
+++ /dev/null
@@ -1,6 +0,0 @@
-module test;
-
-unittest
-{
- assert(true);
-}
\ No newline at end of file
--
2.24.3 (Apple Git-128)
# Contributor: Mathias LANG <pro.mathias.lang@gmail.com>
# Maintainer: Mathias LANG <pro.mathias.lang@gmail.com>
pkgname=dub
pkgver=1.23.0
pkgver=1.25.0
pkgrel=0
pkgdesc="Package and build management system for D"
url="https://code.dlang.org/"
arch="aarch64 x86_64" # gdc does not work on 32 bit at this point
license="MIT"
depends="libcurl"
makedepends="gcc-gdc gdmd bash curl-dev"
makedepends="ldc bash curl-dev"
subpackages="$pkgname-zsh-completion:zsh:noarch $pkgname-doc:doc:noarch"
source="$pkgname-$pkgver.zip::https://github.com/dlang/dub/archive/v$pkgver.zip"
build() {
# Default abuild.conf has '-Os' which gdmd doesn't support
DFLAGS="" DMD=gdmd GITVER="v$pkgver" gdmd -run "$builddir/build.d"
# Since we later build the man pages using dub, make it persistent
DFLAGS=""
# The build script needs a DMD-like interface to pass its arguments, so use ldmd2
DMD=ldmd2 GITVER="v$pkgver" ldc2 -run "$builddir/build.d"
# Build man pages
"$builddir/bin/dub" scripts/man/gen_man.d
"$builddir/bin/dub" --compiler=ldc2 --single scripts/man/gen_man.d
}
check() {
......@@ -56,4 +60,4 @@ doc() {
rmdir "$pkgdir"/usr/share/man/
}
sha512sums="7e9bf5dbb4395a590c1bf9345d6aedfbff29549c86e8c49f951794576bb5f5a291a92f71c21ca8e205ee921b2e85d26160a9c61c17a5e2ae45dafa67313a93e0 dub-1.23.0.zip"
sha512sums="3b8ac295cbccf5829ce7a5f95a224333cc83341beafcb56e64e3e934ff643bc8f7519f6877648fc4d3ac783c5fa8bc86ea83ba575664342ac006ea31c4ea815f dub-1.25.0.zip"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment