diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 723a4b29..98591c3f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -93,3 +93,14 @@ updates: - "junit:*" - "org.mockito:*" open-pull-requests-limit: 7 + # Maven in /gtfs/pom.xml + - package-ecosystem: "maven" + directory: "/gtfs" + schedule: + interval: "weekly" + day: "wednesday" + time: "16:00" + timezone: "America/Montreal" + assignees: + - "montransit" + open-pull-requests-limit: 7 diff --git a/.gitignore b/.gitignore index 4b3d9e28..b7b3e600 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,8 @@ *.iml # TOML Dependency updater file -*.updates.toml \ No newline at end of file +*.updates.toml + +# Gradle local caches and build outputs +shared/.gradle/ +shared/build/ \ No newline at end of file diff --git a/gtfs/gtfs-validator-8.0.0-cli.jar b/gtfs/gtfs-validator-8.0.0-cli.jar deleted file mode 100644 index 7d707b13..00000000 Binary files a/gtfs/gtfs-validator-8.0.0-cli.jar and /dev/null differ diff --git a/gtfs/gtfs-validator.sh b/gtfs/gtfs-validator.sh index df3af209..adaf798c 100755 --- a/gtfs/gtfs-validator.sh +++ b/gtfs/gtfs-validator.sh @@ -27,9 +27,40 @@ fi # gh release list --limit 1 --repo github.com/MobilityData/gtfs-validator; # echo "> GTFS Validator latest release... DONE"; -JAR_FILE_PATTERN="$SCRIPT_DIR/gtfs-validator-*.jar"; -JAR_FILES=($JAR_FILE_PATTERN); -JAR_FILE="${JAR_FILES[0]}"; +VERSION_FILE="$SCRIPT_DIR/pom.xml"; +if [ ! -f "$VERSION_FILE" ]; then + echo "> GTFS Validator version file '$VERSION_FILE' not found!"; + exit 1; +fi +GTFS_VALIDATOR_VERSION=$(sed -n 's/.*\([^<]*\)<\/gtfs.validator.version>.*/\1/p' "$VERSION_FILE" | head -n 1 | tr -d '[:space:]'); +if [ -z "$GTFS_VALIDATOR_VERSION" ]; then + echo "> GTFS Validator version not found in '$VERSION_FILE'!"; + exit 1; +fi +JAR_FILE="$SCRIPT_DIR/gtfs-validator-$GTFS_VALIDATOR_VERSION-cli.jar"; +if [ ! -s "$JAR_FILE" ]; then + rm -f "$JAR_FILE"; + if ! command -v gh >/dev/null 2>&1; then + echo "> GitHub CLI (gh) is required to download GTFS Validator '$GTFS_VALIDATOR_VERSION' (https://cli.github.com/)!"; + exit 1; + fi + echo "> Downloading GTFS Validator '$GTFS_VALIDATOR_VERSION'..."; + gh release download "v$GTFS_VALIDATOR_VERSION" \ + --repo MobilityData/gtfs-validator \ + --pattern "gtfs-validator-$GTFS_VALIDATOR_VERSION-cli.jar" \ + --dir "$SCRIPT_DIR"; + DOWNLOAD_RESULT=$?; + if [[ ${DOWNLOAD_RESULT} -ne 0 ]]; then + echo "> Error while downloading GTFS Validator '$GTFS_VALIDATOR_VERSION'!"; + exit ${DOWNLOAD_RESULT}; + fi + if [ ! -s "$JAR_FILE" ]; then + echo "> Downloaded GTFS Validator JAR '$JAR_FILE' is missing or empty!"; + exit 1; + fi + echo "> Downloading GTFS Validator '$GTFS_VALIDATOR_VERSION'... DONE"; +fi +echo "> GTFS Validator version: '$GTFS_VALIDATOR_VERSION'."; echo "> GTFS Validator JAR file: '$JAR_FILE'."; echo "> Launching GTFS Validator..."; diff --git a/gtfs/pom.xml b/gtfs/pom.xml new file mode 100644 index 00000000..6b0f364f --- /dev/null +++ b/gtfs/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + org.mtransitapps.commons + gtfs-validator-version + 1.0.0 + + + 8.0.1 + + + + + org.mobilitydata + gtfs-validator + ${gtfs.validator.version} + + +