You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have you ever wondered why [dub](https://github.com/dlang/dub) was slow? I tried solving it, but its codebase was fairly unreadable. After building this project, I've implemented features that dub don't use
6
+
7
+
- Lazy build project configuration evaluation
8
+
- Parallelization on build sorted by dependency
9
+
- Faster JSON parsing
10
+
- Fully parallelized build when only link is waiting for dependencies
11
+
12
+
### Philosophy
13
+
14
+
- Separate build system from package manager.
15
+
- Have total backward compatibility on dub for initial versions.
16
+
- On initial versions, develop using phobos only
17
+
- Make it less stateful.
18
+
- Achieve at least 90% of what dub does.
19
+
- Isolate each process. This will make easier for adding and future contributors
20
+
21
+
## Achieving it
22
+
23
+
### Legend
24
+
- api -> Can be freely be imported from any module
25
+
- module -> Needs to be isolated as much as possible from each module. If one needs to communicate with other, a bridge/api may be created after the initial idea
26
+
27
+
### How it works
28
+
Here are described the modules which do most of the work if someone wants to contribute.
29
+
30
+
- buildapi: Defines the contents of build configurations, tree of projects and commons for them
31
+
- parsers.json: Parse dub.json into a build configuration
32
+
- parsers.automatic: Parse using an automatic parser identification
33
+
- cli.dub + app: Parse CLI to get the build root and an initial build configuration
34
+
- parsers.environment: Merge environment variables into build configuration
35
+
- tree_generators.dub: Output build dependency tree while merging their configurations
36
+
- command_generator.automatic: Convert build configuration into compilation flags
37
+
- buildapi + building.compile: Transform build tree into dependency order tree
38
+
- building.compile: Spawn build processes for the dependencies until it links
39
+
40
+
41
+
### Contributor Attracting
42
+
- Isolate module as much as possible to attract contributors working on self contained modules which only gets input and returns an output
43
+
44
+
### Starting small
45
+
- No need to handle edge cases in the beginning. They may become even separate modules.
46
+
47
+
### A week project
48
+
- This project had a small start. I gave one week for doing it, but since it was very succesful on its
49
+
achievements, I decided to extend a little the deadline for achieving support.
50
+
Right now, it has been tested with
51
+
52
+
### Working examples
53
+
Those projects were fairly tested while building this one
[](https://github.com/MrcSnm/redub/actions/workflows/ci.yml)
3
3
4
-
5
-
## Running redub without having it on path
4
+
## Redub for dub users
6
5
- Change directory to the project you want to build and enter in terminal `dub run redub`
7
-
- You may also get help by running `dub run redub -- --help`
8
-
- If you're unsure on how to update redub to the latest version using dub, you may also do `dub run redub -- update`
6
+
> To fully take advantage of redub speed, you might as well use redub directly.
9
7
10
8
## Building redub
11
-
- Enter in terminal and execute `dub`
9
+
- Enter in terminal and execute [`dub`](https://github.com/dlang/dub)
12
10
- Highly recommended that you build it with `dub build -b release-debug --compiler=ldc2` since this will also improve its speed on dependency resolution
13
-
- I would also add redub/bin to the environment variables, with that, you'll be able to simply execute `redub` in the folder you're in and get your project built and running
14
-
- After having your first redub version, you may also update redub by entering on terminal `redub update`. This will download the latest version, rebuild redub with optimizations and replace your current redub executable
15
11
16
-
## Using its library API
17
12
18
-
The usage of the library APIispretty straightforward. You get mainly 2 functions
19
-
1.`resolveDependencies` which will parse the project and its dependencies, after that, you got all the project information
20
-
2.`buildProject` which will get the project information and build in parallel
13
+
# Redub Additions
14
+
Those are the additions I've made over dub
15
+
-**Self Update**: `redub update` will either sync to the latest repo (and build it) or replace it with latest release
16
+
-[**Compiler Management**](#compiler-management) - Support to change default compiler and install on command line
17
+
-[**Redub Plugins**](#redub-plugins) - Alternative to rdmd. Execute arbitrary D code in the build steps.
18
+
-[**Multi Language**](#multi-language) - Compile a C project together and include it on the linking step
19
+
-[**Library API**](#using-its-library-api) - Integrate redub directly in your application
20
+
-**Watching Directories** - `redub watch`- Builds dependents automatically on changes. Add `--run` to run the program after building.
21
+
-**MacOS Universal Builds** - `redub build-universal` - Generates a single binary containing arm64 and x86_64 architectures on MacOS
21
22
22
-
```d
23
-
import redub.api;
24
-
import redub.logging;
25
23
26
-
void main()
27
-
{
28
-
import std.file;
29
-
//Enables logging on redub
30
-
setLogLevel(LogLevel.verbose);
24
+
## Redub Help
25
+
-[Original Dub Documentation](https://dub.pm/)
26
+
- You may also get help by running `dub run redub -- --help` or simply `redub --help`
31
27
32
-
//Gets the project information
33
-
ProjectDetails d = resolveDependencies(
34
-
invalidateCache: false,
35
-
std.system.os,
36
-
CompilationDetails("dmd", "arch not yet implemented", "dmd v[2.105.0]"),
/** Optionally, you can change some project information by accessing the details.tree (a ProjectNode), from there, you can freely modify the BuildRequirements of the project
@@ -95,67 +94,45 @@ Redub has also an experimental support for building and linking C/C++ code toget
95
94
}
96
95
```
97
96
98
-
With that, you'll be able to specify that your dependency is a C/C++ dependency. then, you'll be able to build it by calling `redub --cc=gcc`. You can also
99
-
specify both D and C at the same time `redub --cc=gcc --dc=dmd`. Which will use DMD to build D and GCC to C.
100
-
101
-
You can see that in the example project: [**Multi Language Redub Project**](./tests/multi_lang/dub.json)
102
-
103
-
104
-
# Project Meta
105
-
106
-
107
-
## Making it faster
108
-
Have you ever wondered why [dub](https://github.com/dlang/dub) was slow? I tried solving it, but its codebase was fairly unreadable. After building this project, I've implemented features that dub don't use
109
-
110
-
- Lazy build project configuration evaluation
111
-
- Parallelization on build sorted by dependency
112
-
- Faster JSON parsing
113
-
- Fully parallelized build when only link is waiting for dependencies
97
+
## Using its library API
114
98
115
-
### Philosophy
99
+
The usage of the library APIispretty straightforward. You get mainly 2 functions
100
+
1.`resolveDependencies` which will parse the project and its dependencies, after that, you got all the project information
101
+
2.`buildProject` which will get the project information and build in parallel
116
102
117
-
- Separate build system from package manager.
118
-
- Have total backward compatibility on dub for initial versions.
119
-
- On initial versions, develop using phobos only
120
-
- Make it less stateful.
121
-
- Achieve at least 90% of what dub does.
122
-
- Isolate each process. This will make easier for adding and future contributors
103
+
```d
104
+
import redub.api;
105
+
import redub.logging;
123
106
124
-
## Achieving it
107
+
void main()
108
+
{
109
+
import std.file;
110
+
//Enables logging on redub
111
+
setLogLevel(LogLevel.verbose);
125
112
126
-
### Legend
127
-
- api -> Can be freely be imported from any module
128
-
- module -> Needs to be isolated as much as possible from each module. If one needs to communicate with other, a bridge/api may be created after the initial idea
113
+
//Gets the project information
114
+
ProjectDetails d = resolveDependencies(
115
+
invalidateCache: false,
116
+
std.system.os,
117
+
CompilationDetails("dmd", "arch not yet implemented", "dmd v[2.105.0]"),
Here are described the modules which do most of the work if someone wants to contribute.
121
+
/** Optionally, you can change some project information by accessing the details.tree (a ProjectNode), from there, you can freely modify the BuildRequirements of the project
- buildapi: Defines the contents of build configurations, tree of projects and commons for them
134
-
- parsers.json: Parse dub.json into a build configuration
135
-
- parsers.automatic: Parse using an automatic parser identification
136
-
- cli.dub + app: Parse CLI to get the build root and an initial build configuration
137
-
- parsers.environment: Merge environment variables into build configuration
138
-
- tree_generators.dub: Output build dependency tree while merging their configurations
139
-
- command_generator.automatic: Convert build configuration into compilation flags
140
-
- buildapi + building.compile: Transform build tree into dependency order tree
141
-
- building.compile: Spawn build processes for the dependencies until it links
126
+
//Execute the build process
127
+
buildProject(d);
128
+
}
129
+
```
142
130
143
131
144
-
### Contributor Attracting
145
-
- Isolate module as much as possible to attract contributors working on self contained modules which only gets input and returns an output
132
+
With that, you'll be able to specify that your dependency is a C/C++ dependency. then, you'll be able to build it by calling `redub --cc=gcc`. You can also
133
+
specify both D and C at the same time `redub --cc=gcc --dc=dmd`. Which will use DMD to build D and GCC to C.
146
134
147
-
### Starting small
148
-
- No need to handle edge cases in the beginning. They may become even separate modules.
135
+
You can see that in the example project: [**Multi Language Redub Project**](./tests/multi_lang/dub.json)
149
136
150
-
### A week project
151
-
- This project had a small start. I gave one week for doing it, but since it was very succesful on its
152
-
achievements, I decided to extend a little the deadline for achieving support.
153
-
Right now, it has been tested with
154
137
155
-
### Working examples
156
-
Those projects were fairly tested while building this one
0 commit comments