-
Notifications
You must be signed in to change notification settings - Fork 768
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1749 from puremourning/java-fix-gradle-root-detec…
…tion Java: Fix gradle project root detection
- Loading branch information
Showing
26 changed files
with
822 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
||
# Binary files should be left untouched | ||
*.jar binary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build | ||
.project | ||
.classpath | ||
.settings/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
id 'buildlogic.java-application-conventions' | ||
} | ||
|
||
dependencies { | ||
implementation 'org.apache.commons:commons-text' | ||
implementation project(':utilities') | ||
} | ||
|
||
application { | ||
// Define the main class for the application. | ||
mainClass = 'org.example.app.App' | ||
} |
22 changes: 22 additions & 0 deletions
22
ycmd/tests/java/testdata/gradle-init/app/src/main/java/org/example/app/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* This source file was generated by the Gradle 'init' task | ||
*/ | ||
package org.example.app; | ||
|
||
import org.example.list.LinkedList; | ||
|
||
import static org.example.utilities.StringUtils.join; | ||
import static org.example.utilities.StringUtils.split; | ||
import static org.example.app.MessageUtils.getMessage; | ||
|
||
import org.apache.commons.text.WordUtils; | ||
|
||
public class App { | ||
public static void main(String[] args) { | ||
String unused; | ||
LinkedList tokens; | ||
tokens = split(getMessage()); | ||
String result = join(tokens); | ||
System.out.println(WordUtils.capitalize(result)); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
ycmd/tests/java/testdata/gradle-init/app/src/main/java/org/example/app/MessageUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* This source file was generated by the Gradle 'init' task | ||
*/ | ||
package org.example.app; | ||
|
||
class MessageUtils { | ||
public static String getMessage() { | ||
return "Hello World!"; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
ycmd/tests/java/testdata/gradle-init/app/src/test/java/org/example/app/MessageUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* This source file was generated by the Gradle 'init' task | ||
*/ | ||
package org.example.app; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class MessageUtilsTest { | ||
@Test void testGetMessage() { | ||
assertEquals("Hello World!", MessageUtils.getMessage()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
ycmd/tests/java/testdata/gradle-init/buildSrc/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
// Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. | ||
id 'groovy-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
// Use the plugin portal to apply community plugins in convention plugins. | ||
gradlePluginPortal() | ||
} |
14 changes: 14 additions & 0 deletions
14
ycmd/tests/java/testdata/gradle-init/buildSrc/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This settings file is used to specify which projects to include in your build-logic build. | ||
*/ | ||
|
||
dependencyResolutionManagement { | ||
// Reuse version catalog from the main build. | ||
versionCatalogs { | ||
create('libs', { from(files("../gradle/libs.versions.toml")) }) | ||
} | ||
} | ||
|
||
rootProject.name = 'buildSrc' |
11 changes: 11 additions & 0 deletions
11
...tdata/gradle-init/buildSrc/src/main/groovy/buildlogic.java-application-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
// Apply the common convention plugin for shared build configuration between library and application projects. | ||
id 'buildlogic.java-common-conventions' | ||
|
||
// Apply the application plugin to add support for building a CLI application in Java. | ||
id 'application' | ||
} |
37 changes: 37 additions & 0 deletions
37
...a/testdata/gradle-init/buildSrc/src/main/groovy/buildlogic.java-common-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
// Apply the java Plugin to add support for Java. | ||
id 'java' | ||
} | ||
|
||
repositories { | ||
// Use Maven Central for resolving dependencies. | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
constraints { | ||
// Define dependency versions as constraints | ||
implementation 'org.apache.commons:commons-text:1.11.0' | ||
} | ||
|
||
// Use JUnit Jupiter for testing. | ||
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2' | ||
|
||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | ||
} | ||
|
||
// Apply a specific Java toolchain to ease working on different environments. | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(11) | ||
} | ||
} | ||
|
||
tasks.named('test') { | ||
// Use JUnit Platform for unit tests. | ||
useJUnitPlatform() | ||
} |
11 changes: 11 additions & 0 deletions
11
.../testdata/gradle-init/buildSrc/src/main/groovy/buildlogic.java-library-conventions.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
*/ | ||
|
||
plugins { | ||
// Apply the common convention plugin for shared build configuration between library and application projects. | ||
id 'buildlogic.java-common-conventions' | ||
|
||
// Apply the java-library plugin for API and implementation separation. | ||
id 'java-library' | ||
} |
2 changes: 2 additions & 0 deletions
2
ycmd/tests/java/testdata/gradle-init/gradle/libs.versions.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# This file was generated by the Gradle 'init' task. | ||
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format |
Binary file added
BIN
+42.5 KB
ycmd/tests/java/testdata/gradle-init/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
ycmd/tests/java/testdata/gradle-init/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.