File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #
2+ # https://help.github.com/articles/dealing-with-line-endings/
3+ #
4+ # Linux start script should use lf
5+ /gradlew text eol =lf
6+
7+ # These are Windows script files and should use crlf
8+ * .bat text eol =crlf
9+
10+ # Binary files should be left untouched
11+ * .jar binary
12+
Original file line number Diff line number Diff line change 1+ name : Java CI with Gradle
2+
3+ on :
4+ push :
5+ branches : [ "master" ]
6+ pull_request :
7+ branches : [ "master" ]
8+
9+ jobs :
10+ build :
11+
12+ runs-on : ubuntu-latest
13+ permissions :
14+ contents : read
15+
16+ steps :
17+ - uses : actions/checkout@v5
18+ - name : Set up JDK 25
19+ uses : actions/setup-java@v5
20+ with :
21+ java-version : ' 25'
22+ distribution : ' temurin'
23+
24+ # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
25+ # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
26+ - name : Setup Gradle
27+ uses : gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
28+
29+ - name : Build with Gradle Wrapper
30+ run : ./gradlew build
31+
32+ dependency-submission :
33+
34+ runs-on : ubuntu-latest
35+ permissions :
36+ contents : write
37+
38+ steps :
39+ - uses : actions/checkout@v5
40+ - name : Set up JDK 25
41+ uses : actions/setup-java@v5
42+ with :
43+ java-version : ' 25'
44+ distribution : ' temurin'
45+
46+ # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
47+ # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
48+ - name : Generate and submit dependency graph
49+ uses : gradle/actions/dependency-submission@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Original file line number Diff line number Diff line change 1+ name : Generate JavaDoc and deploy to GitHub Pages
2+
3+ on :
4+ push :
5+ branches :
6+ [ "master" ]
7+
8+ jobs :
9+ build :
10+ permissions :
11+ contents : write
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout repo
16+ uses : actions/checkout@v5
17+
18+ - name : Set up JDK
19+ uses : actions/setup-java@v5
20+ with :
21+ distribution : ' temurin'
22+ java-version : ' 25'
23+
24+ - name : Generate JavaDoc
25+ run : ./gradlew javadoc
26+
27+ - name : Deploy to GitHub Pages
28+ uses : peaceiris/actions-gh-pages@v4
29+ with :
30+ github_token : ${{ secrets.GITHUB_TOKEN }}
31+ publish_dir : ./app/build/docs/javadoc
Original file line number Diff line number Diff line change 1+ name : Build and Upload Release Assets
2+
3+ on :
4+ release :
5+ types : [created]
6+
7+ jobs :
8+ build-and-upload :
9+ runs-on : ubuntu-latest
10+ permissions :
11+ contents : write
12+
13+ steps :
14+ - name : Checkout code
15+ uses : actions/checkout@v5
16+
17+ - name : Set up JDK 25
18+ uses : actions/setup-java@v5
19+ with :
20+ java-version : ' 25'
21+ distribution : ' temurin'
22+
23+ - name : Setup Gradle
24+ uses : gradle/actions/setup-gradle@v5
25+
26+ - name : Build JAR with Gradle
27+ run : ./gradlew build
28+
29+ - name : Upload release assets
30+ uses : softprops/action-gh-release@v2
31+ with :
32+ files : |
33+ ./app/build/libs/app-all.jar
Original file line number Diff line number Diff line change @@ -19,3 +19,6 @@ gradle-app.setting
1919.project
2020# JDT-specific (Eclipse Java Development Tools)
2121.classpath
22+
23+ # Ignore Gradle build output directory
24+ build
Original file line number Diff line number Diff line change 1+ {
2+ "recommendations" : [
3+ " vscjava.vscode-java-pack"
4+ ]
5+ }
Original file line number Diff line number Diff line change 1+ {
2+ "github.copilot.enable" : false ,
3+ "java.configuration.updateBuildConfiguration" : " automatic"
4+ }
Original file line number Diff line number Diff line change 1+ plugins {
2+ // Apply the application plugin to add support for building a CLI application in Java.
3+ id ' application'
4+ id ' com.diffplug.spotless' version ' 8.0.0'
5+ id ' com.gradleup.shadow' version ' 9.2.2'
6+ }
7+
8+ repositories {
9+ // Use Maven Central for resolving dependencies.
10+ mavenCentral()
11+ }
12+
13+ dependencies {
14+ // Use JUnit test framework.
15+ testImplementation libs. junit
16+
17+ // This dependency is used by the application.
18+ implementation libs. guava
19+ }
20+
21+ // Apply a specific Java toolchain to ease working on different environments.
22+ java {
23+ toolchain {
24+ languageVersion = JavaLanguageVersion . of(8 )
25+ }
26+ }
27+
28+ application {
29+ // Define the main class for the application.
30+ mainClass = ' org.example.App'
31+ }
32+
33+ compileJava. dependsOn spotlessApply
34+
35+ spotless {
36+ java {
37+ googleJavaFormat(' 1.28.0' ). aosp()
38+ target ' src/**/*.java'
39+ removeUnusedImports()
40+ }
41+ }
42+
43+ // Jar config
44+ jar {
45+ manifest {
46+ attributes(
47+ ' Main-Class' : ' org.example.App'
48+ )
49+ }
50+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * This source file was generated by the Gradle 'init' task
3+ */
4+ package org .example ;
5+
6+ public class App {
7+ public String getGreeting () {
8+ return "Hello World!" ;
9+ }
10+
11+ public static void main (String [] args ) {
12+ System .out .println (new App ().getGreeting ());
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * This source file was generated by the Gradle 'init' task
3+ */
4+ package org .example ;
5+
6+ import static org .junit .Assert .*;
7+
8+ import org .junit .Test ;
9+
10+ public class AppTest {
11+ @ Test
12+ public void appHasAGreeting () {
13+ App classUnderTest = new App ();
14+ assertNotNull ("app should have a greeting" , classUnderTest .getGreeting ());
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments