Skip to content

Commit

Permalink
Set project name in IDE (apache#23)
Browse files Browse the repository at this point in the history
Sets the project name to `Polaris <version>` for IntelliJ.

It _should_ do the same for Eclipse (not tested).

Co-authored-by: Anna Filippova <[email protected]>
Co-authored-by: JB Onofré <[email protected]>
  • Loading branch information
3 people authored and sfc-gh-mcollado committed Jul 30, 2024
1 parent 77becc8 commit 8534cf4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ buildscript {

plugins {
id 'idea'
id 'eclipse'
}

allprojects {
Expand Down Expand Up @@ -110,3 +111,16 @@ subprojects {
}
}
}

def projectName = rootProject.file("ide-name.txt").text.trim()
def ideName = "$projectName ${rootProject.version.toString().replace("^([0-9.]+).*", "\1")}"

if (System.getProperty("idea.sync.active").asBoolean()) {
// There's no proper way to set the name of the IDEA project (when "just importing" or
// syncing the Gradle project)
def ideaDir = rootProject.layout.projectDirectory.dir(".idea")
ideaDir.asFile.mkdirs()
ideaDir.file(".name").asFile.text = ideName
}

eclipse { project { name = ideName } }
1 change: 1 addition & 0 deletions ide-name.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Polaris

0 comments on commit 8534cf4

Please sign in to comment.