Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java11 Prerequisites #4340

Merged
merged 3 commits into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext.junitJupiterVersion = '5.6.1'
ext.pegasusVersion = '28.3.7'
ext.pegasusVersion = '29.22.16'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was bumped to support gradle 6, the old version did not support it. Decided to conservatively increase this version to what appeared to be the latest stable 29.x without moving to the very latest 30.x. Didn't want to move too fast here.

ext.mavenVersion = '3.6.3'
apply from: './repositories.gradle'
buildscript.repositories.addAll(project.repositories)
Expand Down Expand Up @@ -194,10 +194,14 @@ subprojects {
}
}

afterEvaluate {
if (project.plugins.hasPlugin('java')) {
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile).configureEach {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(8)
}
}
tasks.withType(Test).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
}
}

Expand Down
2 changes: 1 addition & 1 deletion datahub-graphql-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ graphqlCodegen {
}

clean {
delete 'mainGeneratedGraphQL'
delete 'src/mainGeneratedGraphQL'
}

tasks.withType(Checkstyle) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
i=$((i+1))
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,9 +175,14 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
3 changes: 3 additions & 0 deletions metadata-integration/java/datahub-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ shadowJar {
relocate 'org.abego.treelayout', 'datahub.shaded.treelayout'
relocate 'org.slf4j', 'datahub.shaded.slf4j'
relocate 'javax.annotation', 'datahub.shaded.javax.annotation'
relocate 'com.github.benmanes.caffeine', 'datahub.shaded.com.github.benmanes.caffeine'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were added due to the bump in pegasus version here.

relocate 'org.checkerframework', 'datahub.shaded.org.checkerframework'
relocate 'com.google.errorprone', 'datahub.shaded.com.google.errorprone'
finalizedBy checkShadowJar
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* In memory ranker that re-ranks results returned by the search backend
*/
public abstract class SearchRanker {
public abstract class SearchRanker<U extends Comparable<? super U>> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiles with java 11


/**
* List of feature extractors to use to fetch features for each entity returned by search backend
Expand All @@ -26,15 +26,15 @@ public abstract class SearchRanker {
/**
* Return a comparable score for each entity returned by search backend. The ranker will rank based on this score
*/
public abstract Comparable<?> score(SearchEntity searchEntity);
public abstract U score(SearchEntity searchEntity);

/**
* Rank the input list of entities
*/
public List<SearchEntity> rank(List<SearchEntity> originalList) {
return Streams.zip(originalList.stream(), fetchFeatures(originalList).stream(), this::updateFeatures)
.map(entity -> new ScoredEntity(entity, score(entity)))
.sorted(Comparator.<ScoredEntity, Comparable>comparing(ScoredEntity::getScore).reversed())
.map(entity -> new ScoredEntity<>(entity, score(entity)))
.sorted(Comparator.<ScoredEntity<U>, U>comparing(ScoredEntity::getScore).reversed())
.map(ScoredEntity::getEntity)
.collect(Collectors.toList());
}
Expand Down Expand Up @@ -62,9 +62,9 @@ private SearchEntity updateFeatures(SearchEntity originalEntity, Features featur
}

@Value
protected static class ScoredEntity {
protected static class ScoredEntity<U extends Comparable<? super U>> {
SearchEntity entity;
// Takes in any comparable object. Ranker uses it to order it in a descending manner
Comparable<?> score;
U score;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Simple ranker that diversifies the results between different entities. For the same entity, returns the same order from elasticsearch
*/
public class SimpleRanker extends SearchRanker {
public class SimpleRanker extends SearchRanker<Pair<Double, Double>> {

private final List<FeatureExtractor> featureExtractors;

Expand All @@ -26,7 +26,7 @@ public List<FeatureExtractor> getFeatureExtractors() {
}

@Override
public Comparable<?> score(SearchEntity searchEntity) {
public Pair<Double, Double> score(SearchEntity searchEntity) {
Features features = Features.from(searchEntity.getFeatures());
return Pair.of(-features.getNumericFeature(Features.Name.RANK_WITHIN_TYPE, 0.0),
features.getNumericFeature(Features.Name.NUM_ENTITIES_PER_TYPE, 0.0));
Expand Down