Skip to content

Commit 40fc34f

Browse files
committed
Update: Fixed combined build bug and now releasing combined builds
1 parent d8a5327 commit 40fc34f

File tree

3 files changed

+39
-13
lines changed

3 files changed

+39
-13
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ jobs:
4545
if: runner.os == 'macOS'
4646
run: |
4747
# Build arm64 version
48-
redub build -b release-debug --prefetch --arch=arm64-apple-darwin
48+
redub build -b release-debug --prefetch --arch=arm64-apple-darwin
4949
mv build/redub build/redub-arm64
5050
5151
# Build x86_64 version
52-
redub build -b release-debug --prefetch --arch=x86_64
52+
redub build -b release-debug --prefetch --arch=x86_64
5353
mv build/redub build/redub-x86_64
5454
5555
lipo -create build/redub-arm64 build/redub-x86_64 -output build/redub

source/redub/buildapi.d

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import redub.package_searching.api;
77

88

99
///vX.X.X
10-
enum RedubVersionOnly = "v1.26.3";
10+
enum RedubVersionOnly = "v1.26.4";
1111
///Redub vX.X.X
1212
enum RedubVersionShort = "Redub "~RedubVersionOnly;
1313
///Redub vX.X.X - Description
@@ -363,6 +363,32 @@ struct BuildConfiguration
363363
return ret;
364364
}
365365

366+
/**
367+
* This function is mainly used to merge a dependency with its parent.
368+
* Params:
369+
* other = The parent configuration
370+
* Returns:
371+
*/
372+
BuildConfiguration mergeForCombine(const ref BuildConfiguration other) const
373+
{
374+
BuildConfiguration ret = clone;
375+
ret.extraDependencyFiles.exclusiveMergePaths(other.extraDependencyFiles);
376+
ret.filesToCopy.exclusiveMergePaths(other.filesToCopy);
377+
ret.stringImportPaths.exclusiveMergePaths(other.stringImportPaths);
378+
ret.sourceFiles.exclusiveMerge(other.sourceFiles);
379+
ret.excludeSourceFiles.exclusiveMerge(other.excludeSourceFiles);
380+
ret.sourcePaths.exclusiveMergePaths(other.sourcePaths);
381+
ret.importDirectories.exclusiveMergePaths(other.importDirectories);
382+
ret.versions.exclusiveMerge(other.versions);
383+
ret.debugVersions.exclusiveMerge(other.debugVersions);
384+
ret.dFlags.exclusiveMerge(other.dFlags);
385+
ret.libraries.exclusiveMerge(other.libraries);
386+
ret.frameworks.exclusiveMerge(other.frameworks);
387+
ret.libraryPaths.exclusiveMergePaths(other.libraryPaths);
388+
ret.linkFlags.exclusiveMerge(other.linkFlags, null, linkerMergeKeep);
389+
return ret;
390+
}
391+
366392
BuildConfiguration mergeCommands(const ref BuildConfiguration other) const
367393
{
368394
BuildConfiguration ret = clone;
@@ -1329,8 +1355,8 @@ class ProjectNode
13291355
*/
13301356
void combine()
13311357
{
1358+
import redub.api;
13321359
ProjectNode[] leaves;
1333-
13341360
while(true)
13351361
{
13361362
leaves = findLeavesNodes();
@@ -1340,10 +1366,10 @@ class ProjectNode
13401366
{
13411367
foreach(ref leafParent; leaf.parent)
13421368
{
1369+
if(leafParent.requirements.cfg.language != leaf.requirements.cfg.language)
1370+
throw new RedubException("Can't combine "~leafParent.name~" with "~leaf.name~". Can only combine projects with same programming language");
13431371
///Keep the old target type.
1344-
TargetType oldTargetType = leafParent.requirements.cfg.targetType;
1345-
leafParent.requirements.cfg = leafParent.requirements.cfg.merge(leaf.requirements.cfg);
1346-
leafParent.requirements.cfg.targetType = oldTargetType;
1372+
leafParent.requirements.cfg = leafParent.requirements.cfg.mergeForCombine(leaf.requirements.cfg);
13471373
}
13481374
leaf.parent[0].requirements.cfg = leaf.parent[0].requirements.cfg.mergeCommands(leaf.requirements.cfg);
13491375
leaf.becomeIndependent();

source/redub/extensions/update.d

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ int updateMain(string[] args)
1313
import std.file;
1414
import std.path;
1515
import redub.misc.github_tag_check;
16+
import redub.misc.find_executable;
1617
import redub.libs.package_suppliers.utils;
1718
string redubExePath = thisExePath;
1819
string currentRedubDir = dirName(redubExePath);
@@ -47,14 +48,13 @@ int updateMain(string[] args)
4748
}
4849
setLogLevel(update.vverbose ? LogLevel.vverbose : LogLevel.info);
4950

50-
int gitCode = execute(["git", "--help"]).status;
5151
enum isNotGitRepo = 128;
52-
enum hasNoGitWindows = 9009;
53-
enum hasNoGitPosix = 127;
52+
int gitCode = isNotGitRepo;
53+
bool hasGit = findExecutable("git") != null;
5454

5555
bool replaceRedub = false || update.noPull;
5656

57-
if(gitCode == 0 && !update.noPull)
57+
if(hasGit && !update.noPull)
5858
{
5959
auto ret = execute(["git", "pull"], null, Config.none, size_t.max, redubPath);
6060
gitCode = ret.status;
@@ -70,7 +70,7 @@ int updateMain(string[] args)
7070
}
7171
}
7272

73-
if(gitCode == isNotGitRepo || gitCode == hasNoGitWindows || gitCode == hasNoGitPosix)
73+
if(gitCode == isNotGitRepo || hasGit)
7474
{
7575
import d_downloader;
7676
latest = getLatestRedubVersion();
@@ -97,7 +97,7 @@ int updateMain(string[] args)
9797
if(update.fast)
9898
bt = BuildType.debug_;
9999

100-
ProjectDetails d = redub.api.resolveDependencies(false, os, CompilationDetails(update.compiler), ProjectToParse(update.dev ? "cli-dev" : null, redubPath), InitialDubVariables.init, bt);
100+
ProjectDetails d = redub.api.resolveDependencies(false, os, CompilationDetails(compilerOrPath: update.compiler, combinedBuild:true), ProjectToParse(update.dev ? "cli-dev" : null, redubPath), InitialDubVariables.init, bt);
101101
enforce(d.tree.name == "redub", "Redub update should only be used to update redub.");
102102
d.tree.requirements.cfg.outputDirectory = buildNormalizedPath(tempDir, "redub_build");
103103
d = buildProject(d);

0 commit comments

Comments
 (0)