-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2eca1e
commit b90a6ac
Showing
7 changed files
with
1,217 additions
and
17 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
216 changes: 216 additions & 0 deletions
216
...nctionalTest/groovy/net/neoforged/gradle/userdev/convention/IDEAIDEConventionTests.groovy
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,216 @@ | ||
package net.neoforged.gradle.userdev.convention | ||
|
||
import net.neoforged.trainingwheels.gradle.functional.BuilderBasedTestSpecification | ||
|
||
class IDEAIDEConventionTests extends BuilderBasedTestSpecification { | ||
|
||
@Override | ||
protected void configurePluginUnderTest() { | ||
pluginUnderTest = "net.neoforged.gradle.userdev"; | ||
injectIntoAllProject = true; | ||
} | ||
|
||
def "disabling conventions globally forces auto detection to be false"() { | ||
given: | ||
def project = create("disable_globally_disables_auto_detection", { | ||
it.property('neogradle.subsystems.conventions.enabled', 'false') | ||
//Force NeoGradle to think build with IDEA is enabled. | ||
it.file(".idea/gradle.xml", """ | ||
<option name=\"delegatedBuild\" value=\"false\" /> | ||
""") | ||
it.build(""" | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
afterEvaluate { | ||
logger.lifecycle("IDEA Run with IDEA: \${project.idea.project.runs.runWithIdea.get()}") | ||
} | ||
""") | ||
it.withToolchains() | ||
}) | ||
|
||
when: | ||
def run = project.run { | ||
it.tasks(':dependencies') | ||
} | ||
|
||
then: | ||
run.output.contains("IDEA Run with IDEA: false") | ||
} | ||
|
||
def "disabling ide conventions forces auto detection to be false"() { | ||
given: | ||
def project = create("disable_ide_disables_auto_detection", { | ||
it.property('neogradle.subsystems.conventions.ide.enabled', 'false') | ||
//Force NeoGradle to think build with IDEA is enabled. | ||
it.file(".idea/gradle.xml", """ | ||
<option name=\"delegatedBuild\" value=\"false\" /> | ||
""") | ||
it.build(""" | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
afterEvaluate { | ||
logger.lifecycle("IDEA Run with IDEA: \${project.idea.project.runs.runWithIdea.get()}") | ||
} | ||
""") | ||
it.withToolchains() | ||
}) | ||
|
||
when: | ||
def run = project.run { | ||
it.tasks(':dependencies') | ||
} | ||
|
||
then: | ||
run.output.contains("IDEA Run with IDEA: false") | ||
} | ||
|
||
def "disabling idea ide conventions forces auto detection to be false"() { | ||
given: | ||
def project = create("disable_idea_ide_disables_auto_detection", { | ||
it.property('neogradle.subsystems.conventions.ide.idea.enabled', 'false') | ||
//Force NeoGradle to think build with IDEA is enabled. | ||
it.file(".idea/gradle.xml", """ | ||
<option name=\"delegatedBuild\" value=\"false\" /> | ||
""") | ||
it.build(""" | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
afterEvaluate { | ||
logger.lifecycle("IDEA Run with IDEA: \${project.idea.project.runs.runWithIdea.get()}") | ||
} | ||
""") | ||
it.withToolchains() | ||
}) | ||
|
||
when: | ||
def run = project.run { | ||
it.tasks(':dependencies') | ||
} | ||
|
||
then: | ||
run.output.contains("IDEA Run with IDEA: false") | ||
} | ||
|
||
def "disabling compiler auto-detection conventions forces auto detection to be false"() { | ||
given: | ||
def project = create("disable_compiler_idea_ide_disables_auto_detection", { | ||
it.property('neogradle.subsystems.conventions.ide.idea.compiler-detection', 'false') | ||
//Force NeoGradle to think build with IDEA is enabled. | ||
it.file(".idea/gradle.xml", """ | ||
<option name=\"delegatedBuild\" value=\"false\" /> | ||
""") | ||
it.build(""" | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
afterEvaluate { | ||
logger.lifecycle("IDEA Run with IDEA: \${project.idea.project.runs.runWithIdea.get()}") | ||
} | ||
""") | ||
it.withToolchains() | ||
}) | ||
|
||
when: | ||
def run = project.run { | ||
it.tasks(':dependencies') | ||
} | ||
|
||
then: | ||
run.output.contains("IDEA Run with IDEA: false") | ||
} | ||
|
||
def "enabling compiler auto-detection conventions detects idea compiler"() { | ||
given: | ||
def project = create("disable_compiler_idea_ide_disables_auto_detection", { | ||
//Force NeoGradle to think build with IDEA is enabled. | ||
it.file(".idea/gradle.xml", """ | ||
<option name=\"delegatedBuild\" value=\"false\" /> | ||
""") | ||
it.build(""" | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
afterEvaluate { | ||
logger.lifecycle("IDEA Run with IDEA: \${project.idea.project.runs.runWithIdea.get()}") | ||
} | ||
""") | ||
it.withToolchains() | ||
}) | ||
|
||
when: | ||
def run = project.run { | ||
it.tasks(':dependencies') | ||
} | ||
|
||
then: | ||
run.output.contains("IDEA Run with IDEA: true") | ||
} | ||
|
||
def "enabling compiler auto-detection conventions detects gradle compiler"() { | ||
given: | ||
def project = create("disable_compiler_idea_ide_disables_auto_detection", { | ||
it.build(""" | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
afterEvaluate { | ||
logger.lifecycle("IDEA Run with IDEA: \${project.idea.project.runs.runWithIdea.get()}") | ||
} | ||
""") | ||
it.withToolchains() | ||
}) | ||
|
||
when: | ||
def run = project.run { | ||
it.tasks(':dependencies') | ||
} | ||
|
||
then: | ||
run.output.contains("IDEA Run with IDEA: false") | ||
} | ||
} |
Oops, something went wrong.