Cover image for Gradle Beyond the Basics

Book description

If you’re familiar with Gradle’s basics elements, this more advanced guide provides the recipes, techniques, and syntax to help you master this build automation tool. With clear, concise explanations and lots of ready-to-use code examples, you’ll explore four discrete areas of Gradle functionality: file operations, custom Gradle plugins, build lifecycle hooks, and dependency management.

Table of Contents

  1. Special Upgrade Offer
  2. Preface
    1. Conventions Used in This Book
    2. Safari® Books Online
    3. How to Contact Us
    4. Acknowledgments
  3. 1. File Operations
    1. Copy Task
      1. Transforming Directory Structure
      2. Renaming Files During Copy
    2. Filtering and Transforming Files
      1. Keyword Expansion
      2. Filtering Line by Line
      3. Filtering File by File
    3. The File Methods
      1. file()
      2. files()
      3. fileTree()
    4. The FileCollection Interface
      1. Converting to a Set
      2. Converting to a Path String
      3. Module Dependencies as FileCollections
      4. Adding and Subtracting FileCollections
      5. SourceSets as FileCollections
    5. Lazy Files
    6. Conclusion
  4. 2. Custom Plug-Ins
    1. Plug-In Philosophy
    2. The Plug-In API
    3. The Example Plug-In
    4. Setup
    5. Sketching Out Your Plug-In
      1. Custom Liquibase Tasks
      2. Applying Yourself
      3. Extensions
    6. Packaging a Plug-In
    7. Conclusion
  5. 3. Build Hooks
    1. The Gradle Lifecycle: A Review
    2. Advising the Build Graph
    3. Advising Project Evaluation
      1. Global Project Loading and Evaluation Hooks
      2. Build Finished
    4. Rules
      1. Creating a Rule
      2. Dealing with Imperative Rule Code
      3. Generalizing Rules Beyond Tasks
    5. Conclusion
  6. 4. Dependency Management
    1. What Is Dependency Management?
    2. Dependency Concepts
      1. Configurations
        1. Extending configurations
      2. Module Dependencies
      3. Dynamic Versions
      4. File Dependencies
      5. Project Dependencies
      6. Internal Dependencies
    3. Repositories: Dependency Resolution
      1. Maven Repositories
        1. Changing modules
      2. Ivy
      3. Repository Credentials
      4. Static Dependencies
    4. Buildscript Dependencies
    5. Dependency Caching
    6. Configuring Resolution Strategy
      1. Failing on Version Conflict
      2. Forcing Versions
      3. Cache Expiration
    7. Conclusion
  7. Afterword
  8. About the Author
  9. Colophon
  10. Special Upgrade Offer
  11. Copyright