Skip to content

Commit

Permalink
initial merge
Browse files Browse the repository at this point in the history
Signed-off-by: David Radley <[email protected]>
  • Loading branch information
davidradl committed Mar 20, 2023
2 parents 54269c9 + 5c48809 commit 9daba41
Show file tree
Hide file tree
Showing 41 changed files with 2,548 additions and 306 deletions.
4 changes: 4 additions & 0 deletions .github/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This enables DCO bot for you, please take a look https://github.com/probot/dco
# for more details.
require:
members: false
31 changes: 20 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Maven
target*
dependency-reduced-pom.xml
core*.dmp
pom.xml.releaseBackup

# IntelliJ
*.iml
**.iml
Expand All @@ -47,11 +38,13 @@ venv
.classpath
.project
.checkstyle

.settings
.externalToolBuilders
maven-eclipse.xml

# Python

#Python
*.pyc

# review board
Expand All @@ -61,21 +54,29 @@ maven-eclipse.xml
.cache-main
.cache-tests


# DrawIO temporary files
*.dtmp
*.bkp

# emacs files
*#
*~

# Mac OS
__MACOSX


# other files
.DS_Store
*.swp
.java-version
*.graphml

# Ignore private maven repo
.repository

*.dylib


# exclude temporary lock files
*.lock
Expand Down Expand Up @@ -104,3 +105,11 @@ jitdump*dmp
!gradle/**
.gradle/
build/

Footer
# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

1 change: 0 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

# Top level

# TODO: Update with new owners of files added
/* @davidradl
/.github @planetf1
/*gradle* @planetf1 @davidradl
283 changes: 22 additions & 261 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,279 +1,40 @@
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright Contributors to the ODPi Egeria project.
*/

plugins {
id 'java-library'
id "com.github.johnrengelman.shadow" version "8.1.0"
id 'idea'
id 'maven-publish'
// Checks for unnecessary dependencies
id 'com.autonomousapps.dependency-analysis' version "1.19.0"
// helps resolve log implementation clashes
id 'dev.jacomet.logging-capabilities' version "0.11.0"
// This plugin helps resolve jakarta/javax dev.jacomet.logging-capabilities
id 'org.gradlex.java-ecosystem-capabilities' version "1.1"
// copyright checks
id 'checkstyle'

id 'java'
}

// Mostly java, so default to this for now
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'org.gradlex.java-ecosystem-capabilities'
apply plugin: 'dev.jacomet.logging-capabilities'
// As we've migrated from maven - we'll assume all submodules publish directly to maven
apply plugin: 'maven-publish'

if (System.getenv("CI")) {
apply plugin: 'signing'
}
group 'org.example'
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
maven { url("https://oss.sonatype.org/content/repositories/snapshots") }
}

// ensures we pick up the very latest snapshots when built
configurations.all {
// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

// TODO: Specify group, description, version of new code being built. The name is in settings.gradle
group = 'org.odpi.egeria'
version = '1.0-SNAPSHOT'
description = 'New code for Egeria'

// TODO: Specify Dependency versions as variables
ext {
egeriaVersion = '4.0-SNAPSHOT'
}

// For a single module, add here. For multiple modules, refactor and use constraints (see main egeria build.gradle for an example)


dependencies {

// This will set constraints so that dependencies here follow egeria versions
implementation platform("org.odpi.egeria:egeria:${egeriaVersion}")

// Many of these dependencies are in the platform already - in which case leave version empty
// Only used for build - already present in server chassis at runtime - similar to 'provided' with maven
compileOnly "org.odpi.egeria:audit-log-framework"

// Needed for build and run - also found in the platform
compileOnly "org.slf4j:slf4j-api"

// Only needed to compile test code
testImplementation "com.fasterxml.jackson.core:jackson-annotations"
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"

}


// Testing
test {
useJUnitPlatform {
includeEngines 'junit-jupiter'
}
testLogging {
events "passed", "skipped", "failed"
}
reports {
html.required = true
}
}


// Maven Central (technically sonatype oss) requires we distribute source and javadoc.
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}

// More Java language settings
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
sourceCompatibility = "17"
targetCompatibility = "17"
options.incremental = true
options.fork = false
options.failOnError = true
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}

// For later java versions this is recommended - keep conditional in case we want to build on 8
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}

// code coverage
jacoco {
toolVersion = "0.8.8"
}

// Can remove the shadowJar definitions if a jar with dependencies is not needed
// compileonly content won't be included, so even an uber jar should not contain egeria dependencies already in chassis.
shadowJar {
archiveClassifier = 'jar-with-dependencies'
}

// We want to built a jar with dependencies in a normal build, so to avoid specifying task explicitly
build.dependsOn shadowJar


// We only have a single artifact for now - this additional metadata is
// required for publishing to maven central. Only doing signing in 'CI'
publishing {
publications {
connector(MavenPublication) {
from components.java
pom {
url = 'http://egeria.odpi.org'
licenses {
// Code
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
// Docs
license {
name = 'Creative Commons Attribution 4.0 International (CC BY 4.0)'
url = 'https://creativecommons.org/licenses/by/4.0'
}
}
developers {
developer {
id = 'planetf1'
name = 'Nigel Jones'
email = '[email protected]'
}
}
scm {
// TODO: Update references to git source for this particular repository
connection = 'scm:git:git://github.com/odpi/egeria-template-newrepo.git'
developerConnection = 'scm:git:ssh://github.com/odpi/egeria/egeria-template-newrepo.git'
url = 'http://github.com/odpi/egeria-template-newrepo/'
}
}
// The maven artifact name comes from settings.gradle, if not found there defaults to directory name
pom.withXml {
asNode().appendNode('description', "${project.description}")
}
sourceSets {
main {
java {
sourceSets.main.java.srcDirs = ['src/main/java']
}
}

// Release versions get pushed to staging area on maven central, snapshots to snapshot repo
// Secrets for credentials
if (System.getenv("CI")) {
repositories {
maven {
name = 'OSSRH'
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// User token (under profile) on oss.sonatype.org
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_TOKEN")
}
test {
java {
sourceSets.test.java.srcDirs = ['src/test/java']
}
}
}
}

// To publish to ossrh we need to sign the artifacts - only in CI
if (System.getenv("CI")) {
signing {
// This is the publication to sign
sign publishing.publications.connector
// gpg --export-secret-keys [email protected] | base64
def signingKey = System.getenv("OSSRH_GPG_PRIVATE_KEY")
// Passphrase for key
def signingPassword = System.getenv("OSSRH_GPG_PASSPHRASE")
// public key id (last 8 characters only) - note keys also need uploading to all the main registries
def signingKeyId = System.getenv("OSSRH_GPG_KEYID")
// We use these values from secrets rather than gradle.properties
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
}
}

/*
* Additional useful tasks
*/
task printAllDependencies(type: DependencyReportTask) {}
task printSubDependencies(type: DependencyReportTask) {}
task findDependency(type: DependencyInsightReportTask) {}


/*
* Configuration for sub projects only
*/
subprojects {
// All tasks currently will run under allProjects - which includes root.
}

/*
* Additional aggregate tasks run only at parent
*/

// Jacoco reporting -- from gradle docs
task codeCoverageReport(type: JacocoReport) {
// Gather execution data from all subprojects
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")

// Add all relevant sourcesets from the subprojects
subprojects.each {
sourceSets it.sourceSets.main
}

// enable the different report types (html, xml, csv)
reports {
// xml is usually used to integrate code coverage with
// other tools like SonarQube, Coveralls or Codecov
xml.required = true

// HTML reports can be used to see code coverage
// without any external tools
html.required = true
csv.required = true
}

}
// always run the tests before generating the report
codeCoverageReport.dependsOn {
subprojects*.test
}

// Dependency checking - see https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin
dependencyAnalysis {
issues {
all {
onAny {
severity('fail')
}
onUnusedDependencies {
exclude("junit:junit", "org.junit.jupiter:junit-jupiter-api", "org.junit.jupiter:junit-jupiter-engine", "com.fasterxml.jackson.core:jackson-annotations")
}
}
}
}
dependencies {
implementation 'org.junit.jupiter:junit-jupiter:5.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
implementation 'org.apache.hive:hive-metastore:3.1.3'
implementation 'org.apache.kafka:kafka-clients:3.3.1'

// Checking of javaheaders for license & copyright
checkstyle {
toolVersion = '10.7.0'
showViolations = true
implementation 'org.apache.logging.log4j:log4j-api:2.19.0'
implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.19.0'
}

// Always run dependency check for every regular build
build.dependsOn("buildHealth")


test {
useJUnitPlatform()
}
Loading

0 comments on commit 9daba41

Please sign in to comment.