Skip to content

Commit

Permalink
build(gradle6): update to gradle 6 for toolchain suppoto support java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
leifker committed Mar 8, 2022
1 parent dc31cd3 commit f094a42
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 27 deletions.
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'
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'
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>> {

/**
* 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

0 comments on commit f094a42

Please sign in to comment.