Skip to content

Source Code Metadata Features

Alex Bain edited this page Sep 28, 2016 · 4 revisions

Table of Contents

Source Code Metadata Features

(Since version 0.3.9) The Hadoop Plugin comes with features to record metadata about your source code and to build source code zips for your projects.

It is useful to include this information with your Hadoop zip artifacts. If something goes wrong with your workflow, you (or other developers, or the Hadoop development and operations teams) can download your zip file and examine the metadata and original source code for your project to help determine the problem.

If for some reason you need to disable the ScmPlugin, you can pass -PdisableScmPlugin on the Gradle command line or add disableScmPlugin=true to your gradle.properties file.

Source Code Metadata Features at LinkedIn

At LinkedIn, you don't need to run any of these tasks. They will be executed automatically when you build a Hadoop zip artifact declared with hadoopZip.

However, you can customize the generation of the sources zip by running the writeScmPluginJson task and editing the .scmPlugin.json file written by the task.

Source Code Metadata Tasks
printScmMetadata Task

This task prints information about your project's source control management system to standard output.

buildScmMetadata Task

This task writes information about your project's source control management system to the buildMetadata.json file in your project's build directory.

buildSourceZip Task

This task builds a sources zip, starting from the root Gradle project and excluding all project build directories and some known binary file types. This zip will be written to the build directory of the root project under the distributions folder.

writeScmPluginJson Task

This task writes out a default .scmPlugin.json file into your top-level project's root directory that contains the ScmPlugin's default configuration information.

Excluding Resource Files from the Sources Zip

(Since version 0.5.1 - Contributed by Anant Nag) By default, the buildSourceZip task excludes the project build directories and some known binary file types from the zip.

However, users with large resource files stored in their project folders may find that these resources are added to the sources zip. If the resource files are very large, this can cause your build to be much slower.

The buildSourceZip task supports an exclusion list. To add things to the exclusion list, do the following:

  • Run the writeScmPluginJson task to generate a default .scmPlugin.json file in your top-level project's root directory. You only need to run this task once. Add this file to your source control.
  • Edit this file and add entries to the "sourceExclude" entry in this JSON file. The entries can be Ant-style wildcard patterns like those under https://docs.gradle.org/1.7/userguide/working_with_files.html#sec:File_trees.

If you wish to disable the sources zip altogether, you can disable the ScmPlugin, although this is highly discouraged (as it will prevent your Hadoop team from being able to easily debug your code).