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
Copy file name to clipboardExpand all lines: contributors/composite-builds.md
+35-5Lines changed: 35 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ toc: true
6
6
This documents explains the composite build process for snapshot builds.
7
7
Snapshot builds are non-release builds that are still subject to change.
8
8
9
-
Read about composite builds [here](https://docs.gradle.org/6.4.1/userguide/composite_builds.html).
9
+
Read about composite builds [here](https://docs.gradle.org/current/userguide/composite_builds.html).
10
10
This document assumes you know the basics of how they work.
11
11
12
12
To make composite builds easier to use, we have implemented a Gradle build script to automate some steps of the process.
@@ -17,25 +17,55 @@ To do this, every library that depends on some other Cryptimeleon library includ
17
17
This script clones the dependency to the same directory level as the library being built and includes it as a composite build if possible.
18
18
"If possible" means that the branches should follow some rules. Let `LB` be the name of the branch of the library being built and `DB` be the name of the branch of the dependency library. The composite build will only be enabled if either of the following hold:
19
19
20
-
- The dependency has no branch called `LB` and `DB == main`. In this case, the `main` branch of the dependency is used for the composite build.
20
+
- The dependency has no branch called `LB` and `DB == develop`. In this case, the `develop` branch of the dependency is used for the composite build.
21
21
- The dependency has a branch called `LB` and `DB = LB`. In this case, the `DB` branch of the dependency is used for the composite build.
22
22
23
-
To summarize, the build script will always try to use the branch with the same name as `LB` and use `main` if no such branch exists.
23
+
To summarize, the build script will always try to use the branch with the same name as `LB` and use `develop` if no such branch exists.
24
24
Importantly, no automatic checkout of branches is done.
25
25
This means that if the branches don't match, the build script will complain and fail.
26
26
You can adjust this behaviour using the **useCurrentBranch** parameter as explained below.
27
27
28
-
Keep in mind that this does not include any version checking!
28
+
Keep in mind that this does not include any version checking, i.e. the composite build will happily include the version of the dependency that is currently checked out, whether it matches the dependency version or not.
29
29
This means that you have to ensure that the version of the dependency being included by the composite build is the correct one.
30
30
31
31
## Customization
32
32
You can customize behaviour of the build script using certain properties.
33
33
34
34
These can either be set in the `gradle.properties` file in the top level folder of the project (on the same level as `build.gradle`), or be given as a parameter using the `-P` option for Gradle.
35
+
For examples of how this works see [the examples section](#examples).
35
36
36
37
-**useCurrentBranch**: If defined (any value) the branch selection checking will be skipped.
37
38
That means the composite build will be enabled no matter the dependency branches that are currently checked out.
38
-
This can be useful for when you need a version that is not on `main` but you also do not want to create a new branch.
39
+
This can be useful for when you need a version that is not on `develop` but you also do not want to create a new branch.
39
40
-**checkoutIfCloned**: If defined (any value), will automatically check out the corresponding
40
41
dependency branch (branch with same name) given that the dependency was freshly cloned.
41
42
Used by the Travis CI to automatically switch to the right dependency branch for the build.
43
+
44
+
These properties only affect the project they are set for, not any of its composite build dependencies.
45
+
For example, the Predenc library depends on the Craco library which depends on the Math library.
46
+
If you enable `useCurrentBranch` only for Predenc, but not for Craco, the following will happen:
47
+
Predenc will happily include whatever Craco branch is currently checked out.
48
+
Craco, however, will then only include Math if the checked out branch names of Craco and Math match.
49
+
50
+
More information on Gradle properties can be found in the [official documentation](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties).
51
+
52
+
### Examples
53
+
54
+
#### Customizing Settings Via `gradle.properties`
55
+
The `gradle.properties` file must be in the same directory as the project's `build.gradle` file.
56
+
Enabling `useCurrentBranch` then looks as follows:
57
+
```groovy
58
+
useCurrentBranch=""
59
+
```
60
+
We assign an empty string as any value suffices.
61
+
62
+
#### Customizing Settings Via Gradle's `-P` Parameter
63
+
When executing the Gradle wrapper, you can pass it properties via the `-P` parameter.
64
+
The property will then affect the project whose wrapper you executed.
65
+
The syntax is as follows:
66
+
```bash
67
+
./gradlew build -PuseCurrentBranch
68
+
```
69
+
After the `-P` the name of the property follows without spaces.
70
+
In this case `useCurrentBranch` does not need a value, but to set a value you would add an equals sign `=` followed by the property's desired value.
0 commit comments