api / org.gradle.plugins.ide / IdeWorkspace

IdeWorkspace

@Incubating interface IdeWorkspace : Describable

Represents an IDE "workspace" that is generated by Gradle and can be opened in the IDE.

Since
4.7

Functions

getLocation

abstract fun getLocation(): Provider<out FileSystemLocation>

Returns the location of the generated workspace.

Inherited Functions

getDisplayName

abstract fun getDisplayName(): String

Returns the display name of this object. It is strongly encouraged to compute it lazily, and cache the value if it is expensive.

Inheritors

IdeaProject

open class IdeaProject : IdeWorkspace

Enables fine-tuning project details (*.ipr file) of the IDEA plugin.

Example of use with a blend of all possible properties. Typically you don't have to configure IDEA module directly because Gradle configures it for you.

 import org.gradle.plugins.ide.idea.model.* apply plugin: 'java' apply plugin: 'idea' idea { project { //if you want to set specific jdk and language level jdkName = '1.6' languageLevel = '1.5' //you can update the source wildcards wildcards += '!?*.ruby' //you can configure the VCS used by the project vcs = 'Git' //you can change the modules of the *.ipr //modules = project(':someProject').idea.module //you can change the output file outputFile = new File(outputFile.parentFile, 'someBetterName.ipr') //you can add project-level libraries projectLibraries << new ProjectLibrary(name: "my-library", classes: [new File("path/to/library")]) } } 
For tackling edge cases users can perform advanced configuration on resulting XML file. It is also possible to affect the way IDEA plugin merges the existing configuration via beforeMerged and whenMerged closures.

beforeMerged and whenMerged closures receive Project object

Examples of advanced configuration:

 apply plugin: 'java' apply plugin: 'idea' idea { project { ipr { //you can tinker with the output *.ipr file before it's written out withXml { def node = it.asNode() node.appendNode('iLove', 'tinkering with the output *.ipr file!') } //closure executed after *.ipr content is loaded from existing file //but before gradle build information is merged beforeMerged { project -> //you can tinker with Project } //closure executed after *.ipr content is loaded from existing file //and after gradle build information is merged whenMerged { project -> //you can tinker with Project } } } } 

VisualStudioSolution

interface VisualStudioSolution : Named, Buildable, IdeWorkspace

A visual studio solution, representing one or more native binaries in a build.

The content and location of the generate solution file can be modified by the supplied methods:

 apply plugin: "visual-studio" model { visualStudio { solution { solutionFile.location = "vs/${name}.sln" solutionFile.withContent { TextProvider content -> content.asBuilder().insert(0, "# GENERATED FILE: DO NOT EDIT\n") content.text = content.text.replaceAll("HideSolutionNode = FALSE", "HideSolutionNode = TRUE") } } } } 

XcodeWorkspace

interface XcodeWorkspace : IdeWorkspace

Represents the generated Xcode workspace.