Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ build/**
.gradle/**
out/**
.idea/**
.composite-enable
.composite-enable
gradle.properties
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@ cache:
stages:
- name: test
- name: build
- name: snapshot
if: branch = master
- name: release
if: branch = release
before_script:
git checkout ${TRAVIS_BRANCH} # to fix issue with Grgit if travis checks out HEAD
jobs:
include:
- stage: test
script: "./gradlew test"
script: "./gradlew test -PcheckoutIfCloned=true"
- stage: build
script: "./gradlew build -x test"
- stage: snapshot
script: "./gradlew publish -x test -Dnexus.user=$NEXUS_USER -Dnexus.key=$NEXUS_KEY
-Dbuild.number=$TRAVIS_BUILD_NUMBER"
script: "./gradlew build -x test -PcheckoutIfCloned=true"
- stage: release
script: "./gradlew publish -x test -Ddisablesnapshot=true -Dnexus.user=$NEXUS_USER -Dnexus.key=$NEXUS_KEY
-Dbuild.number=$TRAVIS_BUILD_NUMBER"
Expand Down
32 changes: 32 additions & 0 deletions GRADLE_BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Composite Build
The **upb.crypto** libraries, except for **math** all depend on at least one of the other libraries.
Often times, when developing for example **craco**, you might also be doing some changes to **math**.
To include these changes faster, we make extensive use of Gradle`s [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) feature.
To make this easier to use, we have a composite build script contained in ``settings.gradle`` that decides when to enable composite builds and when not.
It also serves to enable composite builds on the Travis CI.

## Default Script Behaviour
By default, the script will automatically clone **upb.crypto** dependencies that are not stored in the local file system yet.
It clones them to the same folder that the top-level folder of the library being built is contained in.
Furthermore, it checks that the branch names match.
If the library is on branch ``branch1`` and a dependency is on ``branch2``, the script will complain and tell you to checkout out branch ``branch1`` in the dependency's git.
If no such branch exists, the library will instead want to use the ``master`` branch.

You can customize this behaviour via the properties detailed in the following section.

## Customizing the Script via Properties
The composite build script can be customized via the following properties.
The parameters can be set via the ``gradle.properties`` file or set via command line as detailed [here](https://docs.gradle.org/current/userguide/build_environment.html).

- ``useCurrentBranch``: If defined (any value), will cause the composite build to use the currently
checked out branch of the dependencies.
- ``checkoutIfCloned``: If defined (any value), will automatically check out the corresponding
dependency branch (branch with same name) given that the dependency was freshly cloned.
Used by the Travis CI to automatically switch to the right dependency branch for the build.

An example ``gradle.properties`` file:
```
useCurrentBranch=""
```
Here, ``useCurrentBranch`` is enabled by giving it an empty String value.

4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
id 'maven'
id 'maven-publish'
}

Expand Down Expand Up @@ -62,8 +61,7 @@ test {

//packaging tests
task packageTests(type: Jar) {
classifier = 'tests'
baseName = project.name + '-test'
archiveClassifier = 'tests'
from sourceSets.test.output+sourceSets.test.allSource
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Oct 29 17:01:07 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
53 changes: 33 additions & 20 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

188 changes: 104 additions & 84 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading