Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#104] Add rat plugin to check for missing headers (#119)

Justin Mclean96bbbe6753b3
diff --git a/README.md b/README.md
index b233776827..1c286f8db3 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,5 @@
+<!--
+ Copyright 2023 Datastrato.
+ This software is licensed under the Apache License version 2.
+-->
# Graviton
\ No newline at end of file
diff --git a/api/build.gradle.kts b/api/build.gradle.kts
index 5d82877ded..f880582980 100644
--- a/api/build.gradle.kts
+++ b/api/build.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
plugins {
`maven-publish`
id("java")
@@ -23,4 +27,4 @@ dependencies {
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.params)
testRuntimeOnly(libs.junit.jupiter.engine)
-}
\ No newline at end of file
+}
diff --git a/build.gradle.kts b/build.gradle.kts
index 54a26f5b81..2dbdd9ff44 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
import com.diffplug.gradle.spotless.SpotlessExtension
import com.diffplug.gradle.spotless.SpotlessPlugin
import com.github.vlsi.gradle.dsl.configureEach
@@ -9,6 +13,8 @@ plugins {
alias(libs.plugins.gradle.extensions)
alias(libs.plugins.spotless)
alias(libs.plugins.publish)
+ // Apply one top level rat plugin to perform any required license enforcement analysis
+ alias(libs.plugins.rat)
}
repositories { mavenCentral() }
@@ -63,3 +69,32 @@ nexusPublishing {
}
}
}
+
+tasks.rat {
+ substringMatcher("DS", "Datastrato", "Copyright 2023 Datastrato.")
+ approvedLicense("Datastrato")
+ approvedLicense("Apache License Version 2.0")
+
+ // Set input directory to that of the root project instead of the CWD. This
+ // makes .gitignore rules (added below) work properly.
+ inputDir.set(project.rootDir)
+
+ val exclusions = mutableListOf(
+ // Ignore files we track but do not distribute
+ "**/.github/**/*",
+ )
+
+ // Add .gitignore excludes to the Apache Rat exclusion list.
+ val gitIgnore = project(":").file(".gitignore")
+ if (gitIgnore.exists()) {
+ val gitIgnoreExcludes = gitIgnore.readLines().filter {
+ it.isNotEmpty() && !it.startsWith("#")
+ }
+ exclusions.addAll(gitIgnoreExcludes)
+ }
+
+ verbose.set(true)
+ failOnError.set(true)
+ setExcludes(exclusions)
+}
+tasks.check.get().dependsOn(tasks.rat)
diff --git a/catalog-hive/build.gradle.kts b/catalog-hive/build.gradle.kts
index b6fb957019..e86f273a51 100644
--- a/catalog-hive/build.gradle.kts
+++ b/catalog-hive/build.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
description = "hive catalog"
plugins {
@@ -79,4 +83,4 @@ task("copyDependencies", type = Copy::class) {
tasks.named("build") {
finalizedBy("copyDependencies")
-}
\ No newline at end of file
+}
diff --git a/catalog-hive/src/main/resources/META-INF/services/com.datastrato.graviton.CatalogProvider b/catalog-hive/src/main/resources/META-INF/services/com.datastrato.graviton.CatalogProvider
index fcd49d42cc..b3075a56f4 100644
--- a/catalog-hive/src/main/resources/META-INF/services/com.datastrato.graviton.CatalogProvider
+++ b/catalog-hive/src/main/resources/META-INF/services/com.datastrato.graviton.CatalogProvider
@@ -1 +1,5 @@
+#
+# Copyright 2023 Datastrato.
+# This software is licensed under the Apache License version 2.
+#
com.datastrato.graviton.catalog.hive.HiveCatalog
\ No newline at end of file
diff --git a/client-java/build.gradle.kts b/client-java/build.gradle.kts
index 3d0bfbb5b6..da260eeaad 100644
--- a/client-java/build.gradle.kts
+++ b/client-java/build.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
plugins {
`maven-publish`
id("java")
@@ -36,4 +40,4 @@ dependencies {
testImplementation(libs.mockito.core)
testImplementation(libs.mockserver.netty)
testImplementation(libs.mockserver.client.java)
-}
\ No newline at end of file
+}
diff --git a/common/build.gradle.kts b/common/build.gradle.kts
index ecdc44626d..dd806e97b3 100644
--- a/common/build.gradle.kts
+++ b/common/build.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
plugins {
`maven-publish`
id("java")
@@ -30,4 +34,4 @@ dependencies {
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.params)
testRuntimeOnly(libs.junit.jupiter.engine)
-}
\ No newline at end of file
+}
diff --git a/core/build.gradle.kts b/core/build.gradle.kts
index c947dde435..cae7036a07 100644
--- a/core/build.gradle.kts
+++ b/core/build.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
plugins {
`maven-publish`
id("java")
diff --git a/gradle.properties b/gradle.properties
index c4280a441d..8f81733712 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,8 @@
+#
+# Copyright 2023 Datastrato.
+# This software is licensed under the Apache License version 2.
+#
+
org.gradle.parallel=true
# Build cache can be disabled with --no-build-cache option
org.gradle.caching=true
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 175b283f2b..74c4da189b 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,3 +1,7 @@
+#
+# Copyright 2023 Datastrato.
+# This software is licensed under the Apache License version 2.
+#
[versions]
junit = "5.8.1"
protoc = "3.17.3"
@@ -24,6 +28,8 @@ protobuf-plugin = "0.9.2"
spotless-plugin = '6.11.0'
gradle-extensions-plugin = '1.74'
publish-plugin = '1.1.0'
+rat-plugin = '0.8.0'
+
[libraries]
protobuf-java = { group = "com.google.protobuf", name = "protobuf-java", version.ref = "protoc" }
@@ -77,3 +83,4 @@ protobuf = { id = "com.google.protobuf", version.ref = "protobuf-plugin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless-plugin" }
gradle-extensions = { id = "com.github.vlsi.gradle-extensions", version.ref = "gradle-extensions-plugin" }
publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "publish-plugin" }
+rat = { id = "org.nosphere.apache.rat", version.ref = "rat-plugin" }
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 4a0a58d550..3c257a15ac 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,3 +1,7 @@
+#
+# Copyright 2023 Datastrato.
+# This software is licensed under the Apache License version 2.
+#
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
# checksum was taken from https://gradle.org/release-checksums
diff --git a/meta/build.gradle.kts b/meta/build.gradle.kts
index 3b0cc3ad0b..c834dc1d15 100644
--- a/meta/build.gradle.kts
+++ b/meta/build.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
import com.google.protobuf.gradle.*
plugins {
diff --git a/meta/src/main/proto/graviton_meta.proto b/meta/src/main/proto/graviton_meta.proto
index 3338eec5cf..2c1d68d7a2 100644
--- a/meta/src/main/proto/graviton_meta.proto
+++ b/meta/src/main/proto/graviton_meta.proto
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
syntax = "proto3";
import "google/protobuf/timestamp.proto";
diff --git a/rfc/rfc-1/rfc-1.md b/rfc/rfc-1/rfc-1.md
index 00e9f98178..e17fb39cdd 100644
--- a/rfc/rfc-1/rfc-1.md
+++ b/rfc/rfc-1/rfc-1.md
@@ -1,3 +1,7 @@
+<!--
+ Copyright 2023 Datastrato.
+ This software is licensed under the Apache License version 2.
+-->
# RFC-1: Metadata Spec Design
| Revision | Owner |
diff --git a/server/build.gradle.kts b/server/build.gradle.kts
index a84e3aad9e..c539673d1f 100644
--- a/server/build.gradle.kts
+++ b/server/build.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
plugins {
`maven-publish`
id("java")
@@ -33,4 +37,4 @@ dependencies {
exclude(group = "org.junit.jupiter")
}
testImplementation(libs.mockito.core)
-}
\ No newline at end of file
+}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index e0bb5e6eb8..405100a019 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,3 +1,7 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
rootProject.name = "Graviton"
include("api", "client-java", "common", "core", "meta", "server", "catalog-hive")