diff --git a/.gitignore b/.gitignore index e81a4e379c838..69373cba747b2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ # Ignore files generated by the Gradle build process. **/.gradle/**/* **/.gogradle/**/* +**/gogradle.lock **/build/**/* **/vendor/**/* **/.gradletasknamecache @@ -22,7 +23,9 @@ sdks/java/maven-archetypes/examples/src/main/resources/archetype-resources/src/ sdks/java/maven-archetypes/examples-java8/src/main/resources/archetype-resources/src/ # Ignore files generated by the Python build process. -**/*.py[cod] +**/*.pyc +**/*.pyo +**/*.pyd **/*.egg-info/ **/.eggs/ **/nose-*.egg/ diff --git a/build.gradle b/build.gradle index 1c5c04fcdb678..e924202df6dad 100644 --- a/build.gradle +++ b/build.gradle @@ -68,71 +68,8 @@ apply plugin: "base" // Apply one top level rat plugin to perform any required license enforcement analysis apply plugin: "org.nosphere.apache.rat" -def findIgnoresForRat = { +rat { def exclusions = [ - // Ignore any offline repositories the user may have created. - "**/${offlineRepositoryRoot}/**/*", - - // Exclude files generated by the Gradle build process - "**/.gradle/**/*", - "**/.gogradle/**/*", - "**/gogradle.lock", - "**/build/**/*", - "**/vendor/**/*", - "**/.gradletasknamecache", - - // .gitignore: Ignore files generated by the Maven build process - "**/target/**/*", - "**/bin/**/*", - "**/dependency-reduced-pom.xml", - - // .gitignore: Ignore files generated by the Python build process - "**/*.pyc", - "**/*.pyo", - "**/*.pyd", - "**/*.egg-info/**/*", - "**/.eggs/**/*", - "**/nose-*.egg/**/*", - "**/.tox/**/*", - "**/dist/**/*", - "**/distribute-*/**/*", - "**/env/**/*", - "sdks/python/**/*.c", - "sdks/python/**/*.so", - "sdks/python/**/*.egg", - "sdks/python/LICENSE", - "sdks/python/NOTICE", - "sdks/python/README.md", - "sdks/python/apache_beam/portability/api/*pb2*.*", - // .gitignore: Ignore IntelliJ files. - "**/.idea/**/*", - "**/*.iml", - "**/*.ipr", - "**/*.iws", - "**/out/**/*", - - // .gitignore: Ignore Eclipse files. - "**/.classpath", - "**/.project", - "**/.factorypath", - "**/.checkstyle", - "**/.fbExcludeFilterFile", - "**/.apt_generated/**/*", - "**/.settings/**/*", - - // .gitignore: Ignore Visual Studio Code files. - "**/.vscode/**/*", - - // .gitignore: Hotspot VM leaves this log in a non-target directory when java crashes - "**/hs_err_pid*.log", - - // .gitignore: Ignore files that end with "~", since they - // are most likely auto-save files produced by a text editor. - "**/*~", - - // .gitignore: Ignore MacOSX files. - "**/.DS_Store/**/*", - // Ignore files we track but do not distribute ".github/**/*", @@ -142,6 +79,7 @@ def findIgnoresForRat = { "**/test/**/.placeholder", // Default eclipse excludes neglect subprojects + // Proto/grpc generated wrappers "**/apache_beam/portability/api/*_pb2*.py", "**/go/pkg/beam/**/*.pb.go", @@ -153,23 +91,21 @@ def findIgnoresForRat = { "**/apache_beam/testing/data/vcf/*", ] - // merge with .gitignore as maven plugin does but gradle/ant one doesn't - def gitIgnore = new File(project.rootDir, '.gitignore') + // Add .gitignore excludes to the Apache Rat exclusion list. We re-create the behavior + // of the Apache Maven Rat plugin since the Apache Ant Rat plugin doesn't do this + // automatically. + def gitIgnore = project(':').file('.gitignore') if (gitIgnore.exists()) { def gitIgnoreExcludes = gitIgnore.readLines().findAll { !it.isEmpty() && !it.startsWith('#') } - logger.info('Adding {} gitignores exclusions to rat', gitIgnoreExcludes.size()) + println "Adding ${gitIgnoreExcludes.size()} .gitignore exclusions to Apache Rat" exclusions.addAll(gitIgnoreExcludes) } - exclusions -} - -rat { plainOutput = true xmlOutput = false htmlOutput = false failOnError = true - excludes = findIgnoresForRat() + excludes = exclusions } check.dependsOn rat