• Stars
    star
    153
  • Rank 243,368 (Top 5 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Samples of modern build automation for native languages with Gradle

Swift and C++ Sample Projects

This repository holds several sample Gradle builds which demonstrate how to use Gradle to build Swift/C++ libraries and applications as introduced in our blog post.

Each sample build is listed below with a bit of information related to the features of Gradle that are demonstrated in that build. Each sample is functionally the same for both Swift and C++ languages.

Each C++ sample works on macOS, Linux and Windows with GCC, Clang and Visual C++.

Each Swift sample works on macOS and Linux, with Swift 3 and later.

Deeper build insights with Build Scans

You can generate build-scans with these samples by running Gradle with --scan. At the end of the build, you will be prompted to upload build data to scans.gradle.com.

As an example of adding more data to a build scan, you can also run any sample with -I ../../build-scan/buildScanUserData.gradle in combination with --scan. This will add custom values that describe what is being built like these.

Contributing to these samples

If you want to contribute an improvement to the samples, please refer to the samples-dev subproject.

Suggesting new samples

If you have a use case that isn't covered by an existing sample, open an issue for gradle-native. Please describe what you're trying to accomplish so we can help you find a solution.

Visual Studio support

All of the C++ samples have Visual Studio support, added by applying the visual-studio plugin. To open a sample build in Visual Studio:

> cd <sample-dir>
> ./gradlew openVisualStudio

Xcode support

All of the samples have Xcode support, added by applying the xcode plugin. To open a sample build in Xcode:

> cd <sample-dir>
> ./gradlew openXcode

XCTest support

All Swift samples demonstrate XCTest support in Gradle. As a user, you can either interact with the test code as you would usually do through Xcode or you can run the test directly from the command line:

> cd <sample-dir>
> ./gradlew test

Google Test support

The C++ sample simple-library demonstrates some basic Google test support in Gradle. This is currently not as refined as the XCTest support.

To run the tests from the command line:

> cd <sample-dir>
> ./gradlew test

Incremental Swift compilation

The swiftc compiler has a built-in incremental compilation feature that tries to reduce the number of .swift files that need to be recompiled on each build by analyzing the dependencies between all files.

Gradle enables Swift incremental compilation by default, so no extra configuration is required to take advantage of this feature with your Swift projects.

Debug and release variants

The Swift and C++ plugins add a 'debug' and 'release' variant for each library or application. By default, the assemble task will build the debug variant only.

You can also use the assembleDebug and assembleRelease tasks to build a specific variant, or both variants.

At this stage, there are no convenience tasks to build all variants of a library or application.

Publishing binaries to a Maven repository

Some of the C++ samples are configured to publish binaries to a local Maven repository. For these samples you can run:

> cd <sample-dir>
> ./gradle publish
> tree ../repo/

This will build and publish the debug and release binaries. The binaries are published to a repository in the cpp/repo directory.

Simple application (application)

This sample shows how a simple Swift or C++ application can be built with Gradle. The application has no dependencies and the build has minimal configuration.

Although there is currently no out-of-the-box support for building applications and libraries from C, there is also a sample build that shows how the C++ support can be configured to build a C application.

C++

To build and run the application:

> cd cpp/application
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

Swift

To build and run the application:

> cd swift/application
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
Hello, World!

C

To build and run the application:

> cd c/application
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

Simple Library (simple-library)

This sample shows how a Swift or C++ library can be built with Gradle. The library has no dependencies. The build is configured to add unit tests. The C++ sample also adds binary publishing to a Maven repository.

C++

To build the library:

> cd cpp/simple-library
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> find build/lib/main/debug
build/lib/main/debug/liblist.dylib

To run the unit tests for the library:

> ./gradlew test

BUILD SUCCESSFUL in 1s

Swift

To build the library:

> cd swift/simple-library
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> find build/lib/main/debug
build/lib/main/debug/libList.dylib

To run the unit tests for the library:

> ./gradlew test
> open build/reports/tests/xcTest/index.html

Application with library dependencies in a single build (transitive-dependencies)

This sample shows how a C++ or Swift application and several libraries can be built with Gradle and linked together. The sample is structured as a multi-project build, with the application and each library as separate projects in this build. Dependencies are added using project dependencies.

In this sample, the application and libraries all use the same implementation language. Mixing C++ and Swift is shown in another sample below.

C++

To build and run the application:

> cd cpp/transitive-dependencies
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/app
Hello, World!

The build script also demonstrates how to configure convenience tasks like assembleDebuggable, which will assemble all "debuggable" binaries.

> ./gradlew assembleDebuggable

BUILD SUCCESSFUL in 1s

Swift

To build and run the application:

> cd swift/transitive-dependencies
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/App
Hello, World!

Application with Windows Resources (windows-resources)

This sample shows how Gradle is able to compile Windows Resources (rc) files and link them into a native binary. This sample applies the 'cpp-application' plugin. This sample requires you have VisualCpp toolchain installed

C++

To build and run the application: (Note the application only runs and build on Windows)

> cd cpp/windows-resources
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/exe/main/debug/app.exe
Hello, World!

Application with precompiled headers (precompiled-headers)

This sample shows how Gradle is able to compile code using precompiled headers. This sample applies the 'cpp-application' plugin.

C++

To build and run the application:

> cd cpp/precompiled-headers
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/exe/main/debug/app
Hello, World!

Application with library dependencies in a composite build (composite-build)

This sample shows how several otherwise independent Swift or C++ libraries can be built together with Gradle. The sample is structured as separate builds for each of the libraries and a composite build that includes these.

C++

To build and run the application:

> cd cpp/composite-build
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

Swift

To build and run the application:

> cd swift/composite-build
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
Hello, World!

Application with prebuilt library dependencies in a Maven repository (binary-dependencies)

This sample shows how to publish C++ libraries to a Maven repository and use them from another build. This is currently not supported for Swift.

C++

To use the sample, first publish a library to the repository using the simple-library build:

> cd cpp/binary-dependencies
> ./gradlew -p ../simple-library publish

BUILD SUCCESSFUL in 1s

You can find the repository in the cpp/repo directory.

Next, build the application that uses the library from this repository.

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

The build is also configured to download the Google test binaries from a Maven repository to build and run the unit tests:

> ./gradlew test

BUILD SUCCESSFUL in 1s

Application with prebuilt library dependencies (prebuilt-binaries)

This sample shows how to use pre-built binaries that are already available on the local machine. Currently, Gradle does not offer a convenient way to do this but it is possible to configure Gradle to use these binaries.

C++

To use the sample, first create the binaries using the simple-library build:

> cd cpp/prebuilt-binaries
> ./gradlew -p ../simple-library assembleDebug assembleRelease

BUILD SUCCESSFUL in 1s

Next, build and run the application that uses these binaries:

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

Swift

To use the sample, first create the binaries using the simple-library build:

> cd swift/prebuilt-binaries
> ./gradlew -p ../simple-library assembleDebug assembleRelease

BUILD SUCCESSFUL in 1s

Next, build and run the application that uses these binaries:

> ./gradlew assemble

BUILD SUCCESSFUL in 0s

> ./build/install/main/debug/App
Hello, World!

Application with Swift package manager conventions (swift-package-manager)

This sample shows how to configure Gradle to use a source layout that is different to its conventions. In this case, the sample uses the typical layout for a Swift Package Manager package. It contains an application and a single library. The source files for the application and libraries are all under a single Sources directory.

This sample also includes a Swift Package Manager build file, so the same source can be built using Swift Package Manager

C++

> cd cpp/swift-package-manager
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/app/install/main/debug/app
Hello, World!

Swift

> cd swift/swift-package-manager
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/app/install/main/debug/App
Hello, World!

Source generation (source-generation)

This sample demonstrates using a task to generate source code before building a Swift or C++ application.

C++

> cd cpp/source-generation
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

Generated sources will be under build/generated.

Swift

> cd swift/source-generation
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
Hello, World!

Generated sources will be under build/generated.

Application with source library dependencies (source-dependencies)

This sample demonstrates using external source dependencies to build Swift and C++ applications that require two libraries. The source for the libraries are hosted in separate Git repositories and declared as 'source dependencies' of the application. When Gradle builds the application, it first checks out a revision of the library source and uses this to build the binaries for the library.

The Git repositories to use are declared in the build's settings.gradle and then the libraries are referenced in the same way as binary dependencies in the build files.

Swift

To use this sample, build and run the application:

> cd swift/source-dependencies
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
World!

This will clone version 1.0 of the Git repository at https://github.com/gradle/native-samples-swift-library and build the library binaries.

You can see the application's output is incorrect. The build is configured to use version 1.0 of the utilities library from this repository and this version contains a bug. Let's fix this.

Version 1.1 of the library contains a bug fix. Update the application to use the new version:

> cd ../..
> edit build.gradle # change dependency on org.gradle.swift-samples:utilities:1.0 to org.gradle.swift-samples:utilities:1.1
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
Hello, World!

Dynamic dependencies are also supported, so you could also use 1.+, [1.1,2.0] or latest.release. Gradle matches the tags of the Git repository to determine which Git revision to use. Branches are also supported, but use a different syntax. See the following sample.

C++

To use this sample, build and run the application:

> cd cpp/source-dependencies
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
World!

This will clone version 1.0 of the Git repository at https://github.com/gradle/native-samples-cpp-library and build the library binaries.

The application output is incorrect because of a bug in the utilities library.

Update the application to use a new version that contains a fix:

> cd ../..
> edit build.gradle # change dependency on org.gradle.cpp-samples:utilities:1.0 to org.gradle.cpp-samples:utilities:1.1
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

Application with dependency on upstream branch (dependency-on-upstream-branch)

This sample shows how a source dependency on a particular branch can be used.

Swift

To use this sample, create the Git repositories containing the libraries:

> cd swift/dependency-on-upstream-branch/app
> ./gradlew -p ../../.. generateRepos

Now you can build and run the application:

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
World!

You can see the application's output is incorrect. The build is configured to use the most recent changes from the 'release' branch of the utilities library and this branch contains a bug. Let's fix this.

Edit the source of the utilities library to fix the bug:

> cd repos/utilities-library
> git checkout release
> edit src/main/swift/Util.swift # follow the instructions to fix the bug in function join()
> git commit -a -m 'fixed bug'

There's no need to create a tag, as Gradle will take care of checking out the new branch tip.

Now build and run the application:

> cd ../..
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
Hello, World!

C++

To use this sample, create the Git repositories containing the libraries:

> cd cpp/dependency-on-upstream-branch/app
> ./gradlew -p ../../.. generateRepos

Build and run the application:

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
World!

Edit the source of the utilities library to fix the bug:

> cd repos/utilities-library
> git checkout release
> edit src/main/cpp/join.cpp # follow the instructions to fix the bug in function join()
> git commit -a -m 'fixed bug'

Now build the application:

> cd ../..
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

Application with static library dependencies (static-library)

This sample demonstrates building and using static libraries.

C++

> cd cpp/static-library
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/app
Hello, World!

Swift

> cd swift/static-library
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/App
Hello, World!

Application with operating system specific library dependencies (operating-system-specific-dependencies)

This sample demonstrates an application that has dependencies on different libraries for each operating system. Currently, there are no conveniences for using libraries that are installed on the build machine.

Swift

> cd swift/operating-system-specific-dependencies
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> app/build/install/main/debug/App
Hello, World!

The application selects the 'MacOsConsole' library that prints the output in blue when building on macOS. On Linux, it selects the 'LinuxConsole' library that prints the output in green. Each console library is configured to only build on specific operating systems.

C++

> cd cpp/operating-system-specific-dependencies
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/app
Hello, World!

The application selects the 'ansiConsole' library on macOS and Linux and the 'winConsole' library when built on Windows. The output is blue on macOS and green on Linux and Windows. Each console library is configured to only build on specific operating systems, while the application is configured to build on all operating systems (Windows, Linux, macOS).

Swift application with C++ library dependencies (cpp-dependencies)

This sample demonstrates using a C++ library from Swift.

Swift

> cd swift/cpp-dependencies
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/app
Hello, World!

There are three projects in this sample: a shared C++ library (:list), a static C++ library (:listStatic), and a swift application with a dependency on the shared C++ library (:app).

By default, when building the application, only the shared library will be built and used. To change the application to use the static library instead, change the dependency in app/build.gradle to depend on the :listStatic project instead of :list. You'll also need to change app/src/main/swift/LinkedList.swift to import the "listStatic" module (rather than the "list" module).

Supporting multiple Swift versions (swift-versions)

This sample demonstrates using multiple versions of Swift in a single build. There are two projects that build identical applications. One is written in Swift 3 compatible code (swift3-app) and one is written with Swift 4 compatible code (swift4-app). When running the application, it will print a message about which version of Swift was used.

Swift 4

If you have the Swift 4 compiler installed, you can build both applications:

# NOTE: Needs Swift 4 tool chain
> cd swift/swift-versions
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./swift4-app/build/install/main/debug/App
Built for Swift 4
Hello, World!
> ./swift3-app/build/install/main/debug/App
Built for Swift 3
Hello, World!

By default, the tests for a given Swift production component will be compiled for the same version of Swift. For instance, in swift3-app, the production and test code will be built with Swift 3 source compatibility.

Swift 3

If you have the Swift 3 compiler installed, you can only build the Swift 3 application. Attempting to build the Swift 4 application will fail.

> cd swift/swift-versions
> ./gradlew swift3-app:assemble

BUILD SUCCESSFUL in 1s

> ./swift3-app/build/install/main/debug/app
Built for Swift 3
Hello, World!

Currently, Gradle does not offer a convenience to ignore projects that are not buildable due to missing or incompatible tool chains.

Application uses libraries that are not built by Gradle (injected-plugins)

Gradle can also consume source dependencies that come from repositories without Gradle builds. When declaring a source dependency's repository information, you can instruct Gradle to inject plugins into the source dependency. These plugins can configure a Gradle build based on the contents of the repository.

C++

To use the sample, create the Git repositories containing the libraries:

> cd cpp/injected-plugins
> ./gradlew -p ../.. generateRepos

Now build the application:

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

In the "repos" directory, you can find the source code without any Gradle configuration. The utilities and list builds are configured with the utilities-build and list-build plugins.

Swift

To use the sample, create the Git repositories containing the libraries:

> cd swift/injected-plugins
> ./gradlew -p ../.. generateRepos

Now build the application:

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
Hello, from Gradle build
Hello, World!

In the "repos" directory, you can find the source code without any Gradle configuration. The utilities and list builds are configured with the utilities-build and list-build plugins.

Application uses a library built by CMake (cmake-library)

This sample demonstrates integrating a library that is built by CMake into a Gradle build. The sample is structured as a multi-project build. There are two projects, 'app' and 'utilities', which are built by Gradle. Both of these depend on a library 'list' that is built using CMake. The 'list' library has a Gradle project that wraps the CMake build and exposes its outputs in a way that other Gradle builds can consume.

The sample packages the CMake integration logic as a 'cmake-library' plugin and applies the plugin to the 'library' project as a source dependency.

C++

To use the sample, first create the Git repository containing the sample plugin:

> cd cpp/cmake-library
> ./gradlew -p ../.. generateRepos

Now build the application:

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/app
Hello, World!

This generates the CMake build for the 'list' library, if required, and builds the libraries and application.

Application and libraries built by CMake (cmake-source-dependencies)

This sample demonstrates using Gradle's dependency management features to coordinate building an application and libraries built by CMake. The sample is composed of an application and two libraries. Each of these is hosted in a separate Git repository and connected together using source dependencies.

The sample packages the CMake integration logic as a 'cmake-application' and 'cmake-library' plugin and applies these to the different builds.

C++

To use the sample, first create the Git repository containing the sample plugin:

> cd cpp/cmake-source-dependencies/app
> ./gradlew -p ../../.. generateRepos

Now build the application:

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/debug/app
Hello, World!

This generates the CMake builds for each of the libraries and the application, then builds and links the libraries and applications.

Using Gradle builds from Swift Package Manager (swift-package-manager-publish)

This sample shows how libraries built with Gradle can be used by projects that are built with Swift Package Manager, without having to maintain separate Gradle and Swift PM build for the library.

The sample is made up of an application built using Swift PM, and two libraries that are built using Gradle. The sample also includes a 'release' plugin that takes care of generating a Swift PM build from a Gradle build.

Swift

To use the sample, setup the Git repositories for the libraries:

> ./gradlew generateRepos

Next, create a release of the list library that can be used by Swift PM. This generates a Package.swift file to be used by Swift PM, commits the changes and creates a tag:

> cd swift/swift-package-manager-publish/list-library
> ./gradlew build release

BUILD SUCCESSFUL in 1s

Do the same for the utilities library:

> cd ../utilities-library
> ./gradlew build release

BUILD SUCCESSFUL in 1s

Now build the application using Swift PM:

> cd ../app
> swift build

C++

> ./gradlew generateRepos
> cd cpp/swift-package-manager-publish/list-library
> ./gradlew build release

BUILD SUCCESSFUL in 1s

> cd ../utilities-library
> ./gradlew build release

BUILD SUCCESSFUL in 1s

> cd ../app
> swift build

Using a module for a system library with Swift (system-library-as-module)

Existing system libraries can be wrapped in user defined module.modulemap files.

Swift

This sample demonstrates a Swift application that uses libcurl to fetch example.com.

> cd swift/system-library-as-module
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App

Provisioning tool chains from within Gradle (provisionable-tool-chains)

This sample shows how to provision tool chains used by a Gradle build instead of the system tool chains. Please note the sample doesn't provision any tool chain for Windows yet. The sample can only provision tool chain at configuration. We use the buildSrc included build to use tasks for the provisioning.

Swift

This sample demonstrates a Swift tool chain provisioning under Linux.

> cd swift/provisionable-tool-chains
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App

C++

This sample demonstrates a Clang tool chain provisioning under macOS and Linux.

> cd cpp/provisionable-tool-chains
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app

Libraries build with autotools (autotools-library)

This sample demonstrates using Gradle's dependency management features to coordinate building libraries built by Autotools (i.e. configure and make). The sample is composed of an application and a curl library. The curl library is downloaded from the Curl home page and then built using the Autotools configuration provided with the library. The application is built with Gradle, linking the curl library statically. When run, the application uses curl to query a REST service to lookup the capital of Sweden and prints this to the console.

C++

To use the sample, create the Git repositories containing the libraries:

> cd cpp/autotools-library
> ./gradlew -p ../.. generateRepos

Now build the application:

> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/app

Libraries with tests (library-with-tests)

This sample demonstrates some basic Google test support in Gradle, building the GoogleTest library from source.

C++

To run the tests from the command line:

> cd cpp/library-with-tests
> ./gradlew -p ../.. generateRepos
> ./gradlew assemble
> ./gradlew test

Header-only libraries (header-only-library)

This sample demonstrates header-only libraries.

C++

To use the sample, run the tests from the command line:

> cd cpp/header-only-library
> ./gradlew assemble
> ./gradlew test

iOS Application (ios-application)

This sample demonstrates a iOS 11.2 application build for the iPhone simulator, allowing editing of the iOS specific files inside Xcode.

Swift

To use the sample, build the application:

> cd swift/ios-application
> ./gradlew assemble

Now install the application into an iOS simulator running iOS 11.2 by drag and dropping the app into a running simulator.

Finally, you can develop the application using Xcode IDE to edit the storyboard and asset catalog. Note that the sample doesn't allow running the iOS application from the IDE.

> ./gradlew openXcode

Publishing macros for transitive consumption by downstream projects (publish-macros)

This sample demonstrates how to publish macros to downstream projects.

C++

To build and run the application:

> cd cpp/publish-macros
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./app/build/install/main/debug/app
Hello, World!

Targetting multiple machines (multiple-target-machines)

This sample shows how a simple Swift or C++ application can target multiple machines with Gradle. The application has no dependencies and the build has minimal configuration.

C++

To build and run the application for the target machine of the same type as the current host:

> cd cpp/multiple-target-machines
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/app
Hello, World!

Swift

To build and run the application for the target machine of the same type as the current host:

> cd swift/multiple-target-machines
> ./gradlew assemble

BUILD SUCCESSFUL in 1s

> ./build/install/main/debug/App
Hello, World!

More Repositories

1

gradle

Adaptable, fast automation for all
Groovy
16,800
star
2

kotlin-dsl-samples

Samples builds using the Gradle Kotlin DSL
Kotlin
3,706
star
3

gradle-profiler

A tool for gathering profiling and benchmarking information for Gradle builds
Java
1,279
star
4

gradle-completion

Gradle tab completion for bash and zsh
Shell
966
star
5

gradle-build-action

Execute your Gradle build and trigger dependency submission
672
star
6

android-cache-fix-gradle-plugin

Gradle plugin that fixes Android build caching problems.
Groovy
440
star
7

wrapper-validation-action

Gradle Wrapper Validation Action
256
star
8

oreilly-gradle-book-examples

Java
249
star
9

test-retry-gradle-plugin

Gradle plugin to retry tests that have failed to mitigate test flakiness.
Groovy
219
star
10

actions

A collection of GitHub Actions to accelerate your Gradle Builds on GitHub
TypeScript
147
star
11

gradle-build-scan-quickstart

An example project to experience the Build Scanยฎ service of Gradle Enterprise with Gradle builds.
Kotlin
132
star
12

foojay-toolchains

Java Toolchain Resolve Plugin based on the foojay DiscoAPI
Kotlin
120
star
13

native-platform

Java bindings for various native APIs
Java
116
star
14

declarative-gradle

Declarative Gradle is a project targeting better isolation of concern and expressing any build in a clear and understandable way
Java
110
star
15

gradle-native

The home of Gradle's support for natively compiled languages
92
star
16

build-tool-training-exercises

Exercises for live gradle.com/training sessions
Java
90
star
17

gradle-enterprise-build-validation-scripts

Executable scripts to assist in validating that your Gradle and Maven builds are in an optimal state in terms of maximizing work avoidance when using Develocity.
Shell
86
star
18

github-dependency-graph-gradle-plugin

Gradle Plugin for Extracting Dependency Information to send to GitHub
Groovy
81
star
19

develocity-build-config-samples

Code samples that demonstrate how to customize your Develocity build configuration using Gradle, Maven, Bazel or sbt
Java
68
star
20

playframework

Gradle Play Support
Java
47
star
21

guides

The Gradle Guides at https://guides.gradle.org.
Java
47
star
22

wrapper-upgrade-gradle-plugin

Gradle plugin that detects and updates Gradle and Maven wrappers to the latest Gradle and Maven version.
Java
43
star
23

gradle-site-plugin

Kotlin
43
star
24

build-tool-roadmap

Gradle Build Tool roadmap
41
star
25

common-custom-user-data-gradle-plugin

Gradle plugin that enhances published build scans by adding a set of tags, links and custom values that have proven to be useful for many projects building with Develocity.
Java
41
star
26

kotlin-dsl-docs

Generates Kotlin DSL API reference
Kotlin
38
star
27

gradle-talks

A javascript based custom slide and build framework for presentations. Many of the Gradle engineers have been using this for their presentations. Those presentations are part of this repo and can be found in the talks directory.
Ruby
35
star
28

exemplar

Discover and verify code samples and services
Java
34
star
29

gradle2kts

Gradle Groovy to Gradle Kotlin conversion tool - discontinued spike
Kotlin
34
star
30

gradle-checksum

A Gradle plugin for creating checksums for files in your build.
Groovy
31
star
31

kotlin-dsl-conventions

Gradle Kotlin DSL conventional plugins
Kotlin
26
star
32

maven-build-scan-quickstart

An example project to experience the Build Scanยฎ service of Develocity with Maven builds.
Java
20
star
33

bazel-comparison

20
star
34

develocity-oss-projects

19
star
35

gradle-distributions

Repository for Gradle Build Tool distributions downloads
17
star
36

performance-comparisons

A set of synthetic projects used to benchmark Gradle against other build tools
16
star
37

community

Gradle Community content and Gradle Cookbook. Open for Contributions
HTML
16
star
38

gradle-java-modules

A (former) place for experimenting with Java 9's module system. Gradle officially supports Java Modules since version 6.4
Java
16
star
39

gcc2speedscope

Space usage analysis for the Gradle configuration cache via speedscope
Kotlin
15
star
40

cc-hackathon-2022

Configuration Cache Hackathon 2022
15
star
41

.github

Maintains all of the default policies for the Gradle organization
14
star
42

perf-enterprise-large

A large Java based build to use when benchmarking and profiling Gradle
Groovy
14
star
43

gradle-enterprise-export-api-samples

A repository of samples that demonstrate how to use the Gradle Enterprise Export API.
14
star
44

gradle-jdocbook

A Gradle plugin for jdocbook
Groovy
13
star
45

cucumber-companion

Maven & Gradle plugins providing convenient support for running Cucumber test directly from Maven/Gradle
Groovy
13
star
46

multi-project-composite-gradle-plugins-builds

Multi-project build using composite Gradle plugins
Kotlin
12
star
47

develocity-api-samples

A repository of samples that demonstrate how to use the Develocity API.
Java
12
star
48

webinar-getting-started-with-the-gradle-kotlin-dsl

Webinar - Getting Started with the Kotlin DSL
Kotlin
12
star
49

plugin-portal-requests

Gradle Plugin Portal issues and requests.
12
star
50

speed-challenge

Instructions and overview for the Gradle and Maven Speed Challenge event
11
star
51

imaginate

Using the Kotlin language for production, test and build makes it easier for everyone to work with your software code base. Letโ€™s go 100% Kotlin!
Kotlin
11
star
52

continuous-delivery-jump-start

Sample application used for training "Continuous Delivery Jump Start"
Java
11
star
53

santa-tracker-performance

Performance tests for Santa Tracker Android project
Shell
10
star
54

perf-android-large-2

Another large Android build for performance experiments
10
star
55

build-analysis-demo

Build data analysis applications
Kotlin
10
star
56

gradle-issue-reproducer

Template repository for providing Gradle issue reproducers
10
star
57

gradle-benchmark-base

Base scenarios for Gradle Profiler to benchmark Gradle builds
9
star
58

gradle-org-conventions-plugin

Java
9
star
59

gradle-hello-world-plugin

Groovy
9
star
60

gradle-profiler-plugin

Java
9
star
61

develocity-testing-annotations

Common annotations for Develocity and Test Retry
Java
9
star
62

tooling-commons

A small layer on top of the Gradle Tooling API that provides the Tooling Client and other convenience useful for IDE integration.
Java
9
star
63

gradle-client

Desktop application acting as a Gradle Tooling API client
Kotlin
9
star
64

configuration-cache-report

Kotlin
8
star
65

jfr-polyfill

A polyfill for JDK Flight Recorder (JFR) to avoid errors on JDKs that don't support JFR yet
Java
8
star
66

common-custom-user-data-maven-extension

Maven extension that enhances published build scans by adding a set of tags, links and custom values that have proven to be useful for many projects building with Develocity.
Java
8
star
67

develocity-gitlab-templates

GitLab CI/CD templates to automatically connect Gradle/Maven builds to Develocity
Shell
7
star
68

bt-dev-prod-data-collector

Data collector for Gradle Build Tool Developer productivity metrics
Kotlin
7
star
69

gradle-hazelcast-plugin

Groovy
6
star
70

source-resolution-demo

Java
6
star
71

gradle-enterprise-build-optimization-experiments

Self-guiding experiments to optimize the performance of your Gradle and Maven builds with Gradle Enterprise.
6
star
72

gradle-plugin-analyzer

Analyzes the bytecode of Gradle plugins
Java
6
star
73

integrations

A repository for Gradle Integrations and the related knowledge base
6
star
74

gradle-rules-configuration-workshop

6
star
75

gradle-project-templates

Learning day experiment: project init templates for Gradle
Java
5
star
76

greeting-plugin-example

Java
5
star
77

gradle-dependency-constrain

Java
5
star
78

maven-build-cache-unstable-inputs-samples

An example project containing a build with unstable inputs
Java
5
star
79

dpeuni-gradle-intro-devs-init

Hands-on exercise for DPE University
5
star
80

develocity-actions

Shared Github Actions
TypeScript
4
star
81

develocity-bamboo-plugin

Develocity plugin for Bamboo
Java
4
star
82

stable-plugins-dsl

Getting the plugins {} DSL block out of incubation
Java
4
star
83

perf-native-large

A Place to Profile Particularly Prickly Projects
C
4
star
84

backend-code-project

A scaffold for the Develocity Backend Engineer code project assignment.
Java
3
star
85

ide-smoke-tests

Java
3
star
86

gradle-all

A composite build that includes all the pieces of Gradle
Kotlin
3
star
87

ge-export

Java
3
star
88

webinar-dep-mgmt-part-1

Kotlin
3
star
89

gradle-to-trace-converter

Kotlin
3
star
90

provider-api-migration-testbed

A testbed to try out mitigation strategies for the provider API migration
Kotlin
3
star
91

gradle-model-vis

JavaScript
3
star
92

gradle-performance

Gradle performance benchmarks using the Gradle build tool itself
Shell
3
star
93

sbt-build-scan-quickstart

An example project showcasing how to experience the Build Scanยฎ service of Develocity with sbt
Scala
3
star
94

dpeuni-gradle-intro-devs-tasks

Hands-on exercise for DPE University
Java
3
star
95

declarative-samples-android-app

A sample Android application written in the Declarative Gradle DSL, using the prototype Declarative Android `androidApplication` Software Type defined in the `org.gradle.experimental.android-ecosystem` ecosystem plugin.
Kotlin
3
star
96

gradle-groovy-all

Replacement for groovy-all.jar discontinued in Groovy 2.5. This is intended to be used with Gradle only.
Kotlin
3
star
97

declarative-samples-java-app

A sample Java application written in the Declarative Gradle DSL, using the prototype Declarative Java java-application ecosystem plugin.
Java
2
star
98

apachecon2021

Instructions and code repository for the ApacheCon 2021 Gradle Virtual Booth Event
2
star
99

kotlin-relocation-test

Cache relocatability test for Kotlin using Spek
Groovy
2
star
100

github-dependency-submission-demo

Java
2
star