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

Update Gradle setup to match other repositories #61

Merged
merged 3 commits into from
Oct 27, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
FROM gradle:7.2-jdk8 as build
FROM gradle:8.4-jdk8 as build

COPY --chown=gradle:gradle . .
RUN gradle installDist --stacktrace
WORKDIR /app
COPY --chown=gradle:gradle . /app
RUN gradle -i --stacktrace clean build shadowJar

FROM openjdk:8-jre-alpine

RUN mkdir -p /opt/analyzer

COPY --from=build /home/gradle/build/install/gradle /opt/analyzer
COPY bin/analyze.sh /opt/analyzer/bin

WORKDIR /opt/analyzer
COPY bin/run.sh bin/run.sh
COPY --from=build /app/build/libs/java-analyzer.jar .

ENTRYPOINT ["/opt/analyzer/bin/analyze.sh"]
ENTRYPOINT ["sh", "/opt/analyzer/bin/run.sh"]
6 changes: 0 additions & 6 deletions bin/analyze.sh

This file was deleted.

3 changes: 3 additions & 0 deletions bin/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

java -jar /opt/analyzer/java-analyzer.jar "$@"
40 changes: 21 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
plugins {
id 'java'
id 'application'
id "com.github.johnrengelman.shadow" version "8.1.1"
id "java"
id "application"
}

mainClassName = 'analyzer.Main'

sourceCompatibility = 1.8
group = "org.exercism"
version = "1.0-SNAPSHOT"
mainClassName = "analyzer.Main"

repositories {
mavenCentral()
}

dependencies {
testImplementation "junit:junit:4.13.2"
implementation 'org.json:json:20180813'
implementation 'com.github.javaparser:javaparser-core:3.12.0'
implementation 'com.google.guava:guava:28.0-jre'
implementation "org.json:json:20180813"
implementation "com.github.javaparser:javaparser-core:3.12.0"
implementation "com.google.guava:guava:28.0-jre"
testImplementation "com.google.truth:truth:1.0"
testImplementation "com.google.truth.extensions:truth-java8-extension:1.0"
}

run {
if (project.hasProperty('args')) {
args findProperty('args').split(" ")
}
shadowJar {
mergeServiceFiles()
archiveFileName.set("java-analyzer.jar")
}

artifacts {
archives shadowJar
}

task runStats(type: JavaExec) {
group = "Execution"
description = "Run the Statistics class with JavaExecTask"
classpath = sourceSets.main.runtimeClasspath
main = 'analyzer.Statistics'
if (project.hasProperty('args')) {
args findProperty('args').split(" ")
test {
testLogging {
exceptionFormat = "full"
showStandardStreams = true
events = ["passed", "failed", "skipped"]
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading