Skip to content

Commit

Permalink
Build Fix (#800)
Browse files Browse the repository at this point in the history
* Retire pyatlas, update date range, latest spotless

* back to java11

* Ubuntu-latest

* Retire sonar
  • Loading branch information
matthieun authored May 1, 2024
1 parent 08a08d8 commit bf5cb90
Show file tree
Hide file tree
Showing 38 changed files with 138 additions and 135 deletions.
37 changes: 19 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@ on:
jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-latest

steps:

# Setup
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1.4.3
uses: actions/setup-java@v4
with:
java-version: 11.0.2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Virtualenv
run: pip install virtualenv
distribution: 'zulu'
java-version: 11
# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.7
# - name: Install Virtualenv
# run: pip install virtualenv
- name: Install GEOS
run: sudo apt-get install libgeos-dev
- name: Grant execute permission for gradlew
Expand All @@ -43,19 +44,19 @@ jobs:
run: .github/workflow_scripts/update_project_version.sh

# Quality Checks
- name: ShellCheck PyAtlas
run: shellcheck pyatlas/*.sh
- name: Build PyAtlas
run: ./gradlew cleanPyatlas buildPyatlas
# - name: ShellCheck PyAtlas
# run: shellcheck pyatlas/*.sh
# - name: Build PyAtlas
# run: ./gradlew cleanPyatlas buildPyatlas
- name: Quality checks (No tests)
run: ./gradlew jar check -x test -x integrationTest
- name: Tests
run: ./gradlew check build
- name: Sonar
env:
SONAR_TOKEN: 374d4e512b90257ba50c21c37202ee01af40c6a0
SONAR_PR_DECORATION_GITHUB_TOKEN: ${{ secrets.SONAR_PR_DECORATION_GITHUB_TOKEN }}
run: .github/workflow_scripts/sonar.sh
# - name: Sonar
# env:
# SONAR_TOKEN: 374d4e512b90257ba50c21c37202ee01af40c6a0
# SONAR_PR_DECORATION_GITHUB_TOKEN: ${{ secrets.SONAR_PR_DECORATION_GITHUB_TOKEN }}
# run: .github/workflow_scripts/sonar.sh

# Merge to Main
- name: Merge dev to main
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2023, Apple Inc. All rights reserved.
Copyright (c) 2015-2024, Apple Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.diffplug.spotless' version '6.3.0'
id 'com.diffplug.spotless' version '6.25.0'
id 'com.google.protobuf' version '0.8.18'
id 'org.sonarqube' version '3.3'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ public void readAtlases()
this.before = new TextAtlasBuilder()
.read(new InputStreamResource(() -> AtlasDeltaIntegrationTest.class
.getResourceAsStream("DMA_9-168-233-base.txt.gz"))
.withDecompressor(Decompressor.GZIP)
.withName("DMA_9-168-233-base.txt.gz"));
.withDecompressor(Decompressor.GZIP).withName("DMA_9-168-233-base.txt.gz"));
this.after = new TextAtlasBuilder()
.read(new InputStreamResource(() -> AtlasDeltaIntegrationTest.class
.getResourceAsStream("DMA_9-168-233-alter.txt.gz"))
.withDecompressor(Decompressor.GZIP)
.withName("DMA_9-168-233-alter.txt.gz"));
.withDecompressor(Decompressor.GZIP)
.withName("DMA_9-168-233-alter.txt.gz"));
this.delta = new AtlasDelta(this.before, this.after, false).generate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ public void testDiff()
final Atlas before = new TextAtlasBuilder()
.read(new InputStreamResource(() -> AtlasDeltaIntegrationTest.class
.getResourceAsStream("DMA_9-168-233-base.txt.gz"))
.withDecompressor(Decompressor.GZIP)
.withName("DMA_9-168-233-base.txt.gz"));
.withDecompressor(Decompressor.GZIP).withName("DMA_9-168-233-base.txt.gz"));
final Atlas after = new TextAtlasBuilder()
.read(new InputStreamResource(() -> AtlasDeltaIntegrationTest.class
.getResourceAsStream("DMA_9-168-233-alter.txt.gz"))
.withDecompressor(Decompressor.GZIP)
.withName("DMA_9-168-233-alter.txt.gz"));
.withDecompressor(Decompressor.GZIP)
.withName("DMA_9-168-233-alter.txt.gz"));
final AtlasDelta delta = new AtlasDelta(before, after, true).generate();
final SortedSet<Diff> differences = delta.getDifferences();
final long size = differences.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class DynamicAtlasIntegrationTest
final String fileName = "DMA_" + shard.getName() + ".atlas.txt.gz";
return Optional.of(new TextAtlasBuilder().read(new InputStreamResource(
() -> DynamicAtlasIntegrationTest.class.getResourceAsStream(fileName))
.withName(fileName).withDecompressor(Decompressor.GZIP)));
.withName(fileName).withDecompressor(Decompressor.GZIP)));
}, new SlippyTileSharding(9), SlippyTile.forName("9-168-234"), Rectangle.MAXIMUM);

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public void testWaysSpanningOutsideOfCountry()
final CountryBoundaryMap map = CountryBoundaryMap
.fromPlainText(new InputStreamResource(() -> OsmPbfIngestIntegrationTest.class
.getResourceAsStream("CUB_osm_boundaries.txt.gz"))
.withDecompressor(Decompressor.GZIP));
.withDecompressor(Decompressor.GZIP));
final SlippyTile tile = SlippyTile.forName("8-72-111");
final MultiPolygon boundary = new JtsPolygonToMultiPolygonConverter()
.convert(map.countryBoundary("CUB").get(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class RawAtlasIntegrationTest
final CountryBoundaryMap boundary = CountryBoundaryMap
.fromPlainText(new InputStreamResource(() -> RawAtlasIntegrationTest.class
.getResourceAsStream("CIV_GIN_LBR_osm_boundaries_with_grid_index.txt.gz"))
.withDecompressor(Decompressor.GZIP));
.withDecompressor(Decompressor.GZIP));
loadingOptionAll = AtlasLoadingOption.createOptionWithAllEnabled(boundary);

loadingOptionIvoryCoast = AtlasLoadingOption.createOptionWithAllEnabled(boundary)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public List<Relation> allRelationsWithSameOsmIdentifier()
{
return attribute(Relation::allRelationsWithSameOsmIdentifier,
"all relations with same osm identifier").stream()
.map(relation -> getChangeAtlas().relation(relation.getIdentifier()))
.collect(Collectors.toList());
.map(relation -> getChangeAtlas().relation(relation.getIdentifier()))
.collect(Collectors.toList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ public final class MemberMergeStrategies
*/
final Map<RelationBeanItem, Integer> removedFromLeftView = computeMapDifferenceCounts(
beforeBeanMap, afterLeftBeanMap).entrySet().stream()
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
final Map<RelationBeanItem, Integer> removedFromRightView = computeMapDifferenceCounts(
beforeBeanMap, afterRightBeanMap).entrySet().stream()
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

/*
* Compute the difference set between the afterViews and the beforeView (which is equivalent
Expand All @@ -292,12 +292,12 @@ public final class MemberMergeStrategies
*/
final Map<RelationBeanItem, Integer> addedToLeftView = computeMapDifferenceCounts(
afterLeftBeanMap, beforeBeanMap).entrySet().stream()
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
final Map<RelationBeanItem, Integer> addedToRightView = computeMapDifferenceCounts(
afterRightBeanMap, beforeBeanMap).entrySet().stream()
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

/*
* Check for REMOVE/REMOVE conflicts. A REMOVE/REMOVE conflict occurs when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public Optional<Change> generateChange()
*/
createFeatureChangesBasedOnEntitySets(addedEntities, removedEntities,
potentiallyModifiedEntities, this.before, this.after, this.saveAllGeometries)
.stream().forEach(changeBuilder::add);
.stream().forEach(changeBuilder::add);

if (changeBuilder.peekNumberOfChanges() == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public static CompleteArea from(final Area area)
}
return new CompleteArea(area.getIdentifier(), area.asPolygon(), area.getTags(),
area.relations().stream().map(Relation::getIdentifier).collect(Collectors.toSet()))
.withGeometricRelationIdentifiers(
area.relations().stream().filter(Relation::isGeometric)
.filter(relation -> relation.asMultiPolygon().isPresent()
&& !relation.asMultiPolygon().get().isEmpty())
.map(Relation::getIdentifier).collect(Collectors.toSet()));
.withGeometricRelationIdentifiers(
area.relations().stream().filter(Relation::isGeometric)
.filter(relation -> relation.asMultiPolygon().isPresent()
&& !relation.asMultiPolygon().get().isEmpty())
.map(Relation::getIdentifier).collect(Collectors.toSet()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public static CompleteEdge from(final Edge edge)
return new CompleteEdge(edge.getIdentifier(), edge.asPolyLine(), edge.getTags(),
edge.start().getIdentifier(), edge.end().getIdentifier(),
edge.relations().stream().map(Relation::getIdentifier).collect(Collectors.toSet()))
.withGeometricRelationIdentifiers(
edge.relations().stream().filter(Relation::isGeometric)
.filter(relation -> relation.asMultiPolygon().isPresent()
&& !relation.asMultiPolygon().get().isEmpty())
.map(Relation::getIdentifier).collect(Collectors.toSet()));
.withGeometricRelationIdentifiers(
edge.relations().stream().filter(Relation::isGeometric)
.filter(relation -> relation.asMultiPolygon().isPresent()
&& !relation.asMultiPolygon().get().isEmpty())
.map(Relation::getIdentifier).collect(Collectors.toSet()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public static CompleteLine from(final Line line)
}
return new CompleteLine(line.getIdentifier(), line.asPolyLine(), line.getTags(),
line.relations().stream().map(Relation::getIdentifier).collect(Collectors.toSet()))
.withGeometricRelationIdentifiers(
line.relations().stream().filter(Relation::isGeometric)
.filter(relation -> relation.asMultiPolygon().isPresent()
&& !relation.asMultiPolygon().get().isEmpty())
.map(Relation::getIdentifier).collect(Collectors.toSet()));
.withGeometricRelationIdentifiers(
line.relations().stream().filter(Relation::isGeometric)
.filter(relation -> relation.asMultiPolygon().isPresent()
&& !relation.asMultiPolygon().get().isEmpty())
.map(Relation::getIdentifier).collect(Collectors.toSet()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,7 @@ private void newShapeLog(final GeometryPrintable geometry, final AtlasEntity...
source.length > 0
? "Atlas " + new StringList(Iterables.stream(Iterables.asList(source))
.map(item -> item.getType() + " " + item.getIdentifier()))
.join(", ")
+ " with shape "
.join(", ") + " with shape "
: "",
geometry.toWkt());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ protected String toString(final String header)
this.outline == null ? "MISSING" : this.outline.toReadableString(),
new StringList(
this.subAreas.stream().map(subArea -> subArea.toString(header + "\t"))
.collect(Collectors.toList())).join("\n"));
.collect(Collectors.toList()))
.join("\n"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ private boolean isInvalidWay(final Way way)
return wayNodes.size() < 2
|| wayNodes.size() == 2
&& wayNodes.get(0).getNodeId() == wayNodes.get(1).getNodeId()
|| wayNodes.size() < MINIMUM_CLOSED_WAY_LENGTH
&& getNodeLocation(padIdentifier(wayNodes.get(0).getNodeId()))
.equals(getNodeLocation(padIdentifier(
wayNodes.get(wayNodes.size() - 1).getNodeId())));
|| wayNodes.size() < MINIMUM_CLOSED_WAY_LENGTH && getNodeLocation(
padIdentifier(wayNodes.get(0).getNodeId()))
.equals(getNodeLocation(
padIdentifier(wayNodes.get(wayNodes.size() - 1).getNodeId())));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,8 @@ private Atlas buildExpandedAtlas(final Shard initialShard, final Sharding shardi

final DynamicAtlasPolicy policy = new DynamicAtlasPolicy(fullySlicedAtlasFetcher, sharding,
initialShard.bounds().expand(SHARD_EXPANSION_DISTANCE), Rectangle.MAXIMUM)
.withDeferredLoading(true).withExtendIndefinitely(false)
.withAtlasEntitiesToConsiderForExpansion(
this.dynamicAtlasExpansionFilter::test);
.withDeferredLoading(true).withExtendIndefinitely(false)
.withAtlasEntitiesToConsiderForExpansion(this.dynamicAtlasExpansionFilter::test);

final DynamicAtlas atlas = new DynamicAtlas(policy);
atlas.preemptiveLoad();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public ConfiguredTaggableFilter(final Configuration configuration)
{
this.filters = ((List<String>) configuration.get(FILTERS_CONFIGURATION_NAME).valueOption()
.orElseThrow(() -> new CoreException("No filters defined in configuration {}",
configuration))).stream().map(TaggableFilter::forDefinition)
.collect(Collectors.toList());
configuration)))
.stream().map(TaggableFilter::forDefinition).collect(Collectors.toList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected static String toTaggableMatcherDefinition(final TaggableFilter filter)
+ new StringList(filter.getChildren().stream()
.map(TaggableFilterToMatcherConverter::toTaggableMatcherDefinition)
.collect(Collectors.toList()))
.join(" " + filter.getTreeBoolean().separator() + " ")
.join(" " + filter.getTreeBoolean().separator() + " ")
+ Token.TokenType.PAREN_CLOSE.getLiteralValue();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public ConfiguredTaggableMatcher(final Configuration configuration)
{
this.matchers = ((List<String>) configuration.get(MATCHERS_CONFIGURATION_NAME).valueOption()
.orElseThrow(() -> new CoreException("No matchers defined in configuration {}",
configuration))).stream().map(TaggableMatcher::from)
.collect(Collectors.toList());
configuration)))
.stream().map(TaggableMatcher::from).collect(Collectors.toList());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void registerManualPageSections(final AbstractAtlasShellToolsCommand pare
new ByteArrayInputStream(
("This is an example man page section for the ListOfNumbersTemplate! "
+ "This template adds an option that reads a list of numbers.")
.getBytes(StandardCharsets.UTF_8)));
.getBytes(StandardCharsets.UTF_8)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void testContract()
Assert.assertEquals(Math.round(contractRectangle1Distance.asMeters()),
Math.round(new Location(this.rectangle1.lowerLeft().getLatitude(),
collapsedHorizontally.middle().getLongitude())
.distanceTo(collapsedHorizontally.lowerLeft()).asMeters()));
.distanceTo(collapsedHorizontally.lowerLeft()).asMeters()));

// test collapse vertically
final Location rectangle2UpperLeft = Iterables.asList(this.rectangle2).get(1);
Expand All @@ -114,7 +114,7 @@ public void testContract()
Assert.assertEquals(Math.round(contractRectangle2Distance.asMeters()),
Math.round(new Location(collapsedVertically.middle().getLatitude(),
this.rectangle2.lowerLeft().getLongitude())
.distanceTo(collapsedVertically.lowerLeft()).asMeters()));
.distanceTo(collapsedVertically.lowerLeft()).asMeters()));

// Test fully collapse Collapsed
Assert.assertEquals(this.rectangle1.center().bounds(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class ChangeAtlasTest
boundary = CountryBoundaryMap
.fromPlainText(new InputStreamResource(() -> RawAtlasSlicerTest.class
.getResourceAsStream("CIV_GIN_LBR_osm_boundaries.txt.gz"))
.withDecompressor(Decompressor.GZIP));
.withDecompressor(Decompressor.GZIP));
}

@Rule
Expand Down
Loading

0 comments on commit bf5cb90

Please sign in to comment.