Skip to content

Commit

Permalink
Update Gradle setup to match other repositories (#61)
Browse files Browse the repository at this point in the history
* Change Gradle setup to match java-test-runner and java-representer

* Rename analyze.sh to run.sh
  • Loading branch information
sanderploegsma authored Oct 27, 2023
1 parent 30b8214 commit 8b29a63
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 171 deletions.
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

0 comments on commit 8b29a63

Please sign in to comment.