Skip to content

Commit

Permalink
Update build script and require Java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
Petersoj committed Sep 27, 2024
1 parent 41bd30b commit d0fa074
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 102 deletions.
146 changes: 76 additions & 70 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import com.bmuschko.gradle.nexus.ExtraArchivePlugin
import org.jsonschema2pojo.gradle.GenerateJsonSchemaJavaTask

buildscript {
repositories {
mavenCentral()
}

dependencies {
// For Maven and Maven Central support
classpath group: 'com.bmuschko', name: 'gradle-nexus-plugin', version: '2.3.1'
// For JSONSchema2POJO
classpath group: 'org.jsonschema2pojo', name: 'jsonschema2pojo-gradle-plugin', version: 'latest.integration'
}
}

plugins {
id 'java'
id "java"
id "java-library"

// For Maven and Maven Central support
id 'maven-publish'
id 'com.bmuschko.nexus' version '2.3.1'
id 'io.codearte.nexus-staging' version '0.11.0'
// For Maven Central publishing
id "maven-publish"
id "signing"
}

// 'apply' here instead of in plugins closure because 'jsonschema2pojo' doesn't exist in the
// Gradle Central Plugin Repository (it's only in Maven central).
apply plugin: 'jsonschema2pojo'

group 'net.jacobpeterson'
version '6.2-1.7.1-SNAPSHOT'
final def projectGroup = "net.jacobpeterson"
final def projectArtifactID = "iqfeed4j"
final def projectVersion = "6.2-1.7.1-SNAPSHOT"

group = projectGroup
version = projectVersion

repositories {
mavenCentral()
Expand All @@ -52,79 +52,73 @@ dependencies {
implementation group: 'org.apache.commons', name: 'commons-pool2', version: '2.11.1'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
[compileJava, compileTestJava]*.options*.encoding = "UTF-8"

javadoc {
// Explicitly define source version
options.addStringOption('source', '8')
// Used to suppress Javadoc linting warnings
options.addStringOption('Xdoclint:none', '-quiet')
// Explicitly define Charset for Javadocs
options.addStringOption('charset', 'UTF-8')
// Add Java SE 8 link
options.addStringOption('link', 'https://docs.oracle.com/javase/8/docs/api/')
options.addStringOption("source", "17")
options.addStringOption("charset", "UTF-8")
options.addStringOption("Xdoclint:none", "-quiet") // Suppress Javadoc linting warnings
options.addStringOption("link", "https://docs.oracle.com/en/java/javase/17/docs/api/")
}

//
// START Publishing
// BEGIN Publishing
//
modifyPom {
project {
name = 'IQFeed4j'
description = 'A Java API for the market data vendor DTN IQFeed.'
url = 'https://github.com/Petersoj/IQFeed4j'
inceptionYear = '2021'

licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
}
}

developers {
developer {
id = 'Petersoj'
name = 'Jacob Peterson'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = projectGroup
artifactId = projectArtifactID
version = projectVersion
from(components["java"])
pom {
name = projectArtifactID
description = "A Java API for the market data vendor DTN IQFeed."
url = "https://github.com/Petersoj/IQFeed4j"
inceptionYear = "2021"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
id = "Petersoj"
name = "Jacob Peterson"
}
}
scm {
url = "https://github.com/Petersoj/IQFeed4j.git"
connection = "scm:git:https://github.com/Petersoj/IQFeed4j.git"
developerConnection = "scm:git:[email protected]/Petersoj/IQFeed4j.git"
}
}
}

scm {
url = 'https://github.com/Petersoj/IQFeed4j.git'
connection = 'scm:git:https://github.com/Petersoj/IQFeed4j.git'
developerConnection = 'scm:git:[email protected]/Petersoj/IQFeed4j.git'
}
}
}

extraArchive {
sources = true
tests = true
javadoc = true
}

// Lowercase all archive names
afterEvaluate {
jar.archiveBaseName.set(jar.archiveBaseName.get().toLowerCase())
for (taskName in [ExtraArchivePlugin.SOURCES_JAR_TASK_NAME,
ExtraArchivePlugin.TESTS_JAR_TASK_NAME,
ExtraArchivePlugin.JAVADOC_JAR_TASK_NAME]) {
final def taskArchiveBaseName = ((org.gradle.jvm.tasks.Jar) tasks.getByName(taskName)).archiveBaseName
taskArchiveBaseName.set(taskArchiveBaseName.get().toLowerCase())
repositories {
maven {
name = "OSSRH"
url = projectVersion.contains("SNAPSHOT") ? "https://oss.sonatype.org/content/repositories/snapshots/" :
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = project.property("nexus.username")
password = project.property("nexus.password")
}
}
}
}

nexus {
sign = true
repositoryUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
snapshotRepositoryUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
signing {
sign publishing.publications.mavenJava
}

nexusStaging {
packageGroup = 'net.jacobpeterson'
}
//
// END Publishing
//
Expand Down Expand Up @@ -199,6 +193,18 @@ jsonSchema2Pojo {
includeGetters = true
includeSetters = true
}

javadocJar.dependsOn generatePOJOs
sourcesJar.dependsOn generatePOJOs
jar.dependsOn compileJava
javadocJar.dependsOn compileJava
sourcesJar.dependsOn compileJava
tasks.jar {
manifest {
attributes(Map.of("Automatic-Module-Name", "$projectGroup.$projectArtifactID"))
}
}

//
// END POJO generation
//
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'IQFeed4j'
rootProject.name = 'iqfeed4j'
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.util.concurrent.ExecutionException;

/**
* {@inheritDoc}
* <br>
* This will accumulate all data/messages in memory to be consumed later.
*/
public class MultiMessageAccumulator<T> extends MultiMessageListener<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.util.function.Supplier;

/**
* {@inheritDoc}
* <br>
* {@link AbstractIndexCSVMapper} mappings are based off of predefined CSV indices.
*/
public abstract class AbstractIndexCSVMapper<T> extends AbstractCSVMapper<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import static net.jacobpeterson.iqfeed4j.util.csv.CSVUtil.valueNotWhitespace;

/**
* {@inheritDoc}
* <br>
* {@link DirectIndexCSVMapper} mappings are based off of predefined CSV indices, but without any POJO instantiation and
* rather uses direct type conversion.
*/
Expand All @@ -32,8 +30,7 @@ public DirectIndexCSVMapper(int csvIndex, Function<String, T> stringToTypeConver
}

/**
* {@inheritDoc}
* <br>
* <br>
* Note: this will map to a type using the {@link #stringToTypeConverter}.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import static net.jacobpeterson.iqfeed4j.util.csv.CSVUtil.valueNotWhitespace;

/**
* {@inheritDoc}
*/
public class IndexCSVMapper<T> extends AbstractIndexCSVMapper<T> {

Expand Down Expand Up @@ -109,8 +108,7 @@ public void removeMapping(int csvIndex) {
}

/**
* {@inheritDoc}
* <br>
* <br>
* Note this will map with the mappings added via {@link #setMapping(int, BiConsumer, Function)}.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import static net.jacobpeterson.iqfeed4j.util.csv.CSVUtil.valueNotWhitespace;

/**
* {@inheritDoc}
* <br>
* {@link TrailingIndexCSVMapper} mappings are based off of predefined CSV indices, but with the ability to add a CSV
* mapping that accumulates all CSV values after a certain index into one mapping.
*/
Expand Down Expand Up @@ -83,8 +81,7 @@ public <P> void setTrailingMapping(BiConsumer<T, P> fieldSetter, Function<String
}

/**
* {@inheritDoc}
* <br>
* <br>
* Note this will map with the mappings added via {@link #setMapping(int, BiConsumer, Function)} and
* {@link #setTrailingMapping(BiConsumer, Function)}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.util.function.Supplier;

/**
* {@inheritDoc}
* <br>
* {@link AbstractListCSVMapper} maps a CSV list.
*/
public abstract class AbstractListCSVMapper<T> extends AbstractCSVMapper<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import static net.jacobpeterson.iqfeed4j.util.csv.CSVUtil.valueNotWhitespace;

/**
* {@inheritDoc}
* <br>
* {@link DirectListCSVMapper} maps a CSV list to a {@link List} using a direct type conversion.
*/
public class DirectListCSVMapper<T> extends AbstractListCSVMapper<T> {
Expand All @@ -34,8 +32,7 @@ public DirectListCSVMapper(Supplier<? extends List<T>> listInstantiator,
}

/**
* {@inheritDoc}
* <br>
* <br>
* Note: this will map to a list with the {@link #stringToTypeConverter} applied.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import static net.jacobpeterson.iqfeed4j.util.csv.CSVUtil.valueNotWhitespace;

/**
* {@inheritDoc}
* <br>
* {@link ListCSVMapper} maps a CSV list to a POJO {@link List}.
*/
public class ListCSVMapper<T> extends AbstractListCSVMapper<T> {
Expand Down Expand Up @@ -41,8 +39,7 @@ public ListCSVMapper(Supplier<? extends List<T>> listInstantiator, Supplier<T> p
}

/**
* {@inheritDoc}
* <br>
* <br>
* Note: this will map to a list of POJOs with the {@link #csvValueConsumer} applied.
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import static net.jacobpeterson.iqfeed4j.util.csv.CSVUtil.valueNotWhitespace;

/**
* {@inheritDoc}
* <br>
* {@link NestedListCSVMapper} mappings are based on a nested CSV lists inside a CSV list (e.g. a group of 3 CSV values
* that repeated in a CSV list).
*/
Expand Down Expand Up @@ -75,8 +73,7 @@ public void removeMapping(int csvIndex) {
}

/**
* {@inheritDoc}
* <br>
* <br>
* Note: this will map to a list of POJOs using the mappings added via
* {@link #setMapping(int, BiConsumer, Function)}. This will iterate through the list at {@link #nestedListLength}
* length.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import static net.jacobpeterson.iqfeed4j.util.csv.CSVUtil.valueNotWhitespace;

/**
* {@inheritDoc}
* <br>
* {@link NamedCSVMapper} mappings are based off of named CSV indices.
*/
public class NamedCSVMapper<T> extends AbstractCSVMapper<T> {
Expand Down

0 comments on commit d0fa074

Please sign in to comment.