-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support different IntelliJ versions (#165)
--------- Co-authored-by: Sebastiano Poggi <[email protected]>
- Loading branch information
Showing
13 changed files
with
231 additions
and
38 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,26 @@ | ||
import org.gradle.api.Project | ||
|
||
enum class SupportedIJVersion { | ||
IJ_232, | ||
IJ_233 | ||
} | ||
|
||
fun Project.supportedIJVersion(): SupportedIJVersion { | ||
val prop = localProperty("supported.ij.version") | ||
?: rootProject.property("supported.ij.version") | ||
?: error( | ||
"'supported.ij.version' gradle property is missing. " + | ||
"Please, provide it using local.properties file or -Psupported.ij.version argument in CLI" | ||
) | ||
|
||
return when (prop) { | ||
"232" -> SupportedIJVersion.IJ_232 | ||
"233" -> SupportedIJVersion.IJ_233 | ||
else -> { | ||
error( | ||
"Invalid 'supported.ij.version' with value '$prop' is provided. " + | ||
"It should be in set of these values: ('232', '233')" | ||
) | ||
} | ||
} | ||
} |
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 @@ | ||
import org.gradle.api.Project | ||
import java.util.Properties | ||
|
||
internal fun Project.localProperty(propertyName: String): String? { | ||
val localPropertiesFile = rootProject.file("local.properties") | ||
if (!localPropertiesFile.exists()) { | ||
return null | ||
} | ||
val properties = Properties() | ||
localPropertiesFile.inputStream().use { properties.load(it) } | ||
return properties.getProperty(propertyName) | ||
} |
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,35 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPom | ||
import org.gradle.kotlin.dsl.assign | ||
import org.gradle.kotlin.dsl.maven | ||
|
||
internal fun PublishingExtension.configureJewelRepositories() { | ||
repositories { | ||
maven("https://packages.jetbrains.team/maven/p/kpm/public") { | ||
name = "Space" | ||
credentials { | ||
username = System.getenv("MAVEN_SPACE_USERNAME") | ||
password = System.getenv("MAVEN_SPACE_PASSWORD") | ||
} | ||
} | ||
} | ||
} | ||
|
||
internal fun MavenPom.configureJewelPom() { | ||
name = "Jewel" | ||
description = "A theme for Compose for Desktop that implements the IntelliJ Platform look and feel." | ||
url = "https://github.com/JetBrains/jewel" | ||
licenses { | ||
license { | ||
name = "Apache License 2.0" | ||
url = "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
} | ||
} | ||
scm { | ||
connection = "scm:git:https://github.com/JetBrains/jewel.git" | ||
developerConnection = "scm:git:https://github.com/JetBrains/jewel.git" | ||
url = "https://github.com/JetBrains/jewel" | ||
} | ||
} |
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,43 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
import SupportedIJVersion.IJ_232 | ||
import SupportedIJVersion.IJ_233 | ||
|
||
plugins { | ||
kotlin("jvm") | ||
`maven-publish` | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
val sourcesJar by tasks.registering(Jar::class) { | ||
from(kotlin.sourceSets.main.map { it.kotlin }) | ||
archiveClassifier = "sources" | ||
destinationDirectory = layout.buildDirectory.dir("artifacts") | ||
} | ||
|
||
val javadocJar by tasks.registering(Jar::class) { | ||
from(tasks.dokkaHtml) | ||
archiveClassifier = "javadoc" | ||
destinationDirectory = layout.buildDirectory.dir("artifacts") | ||
} | ||
|
||
publishing { | ||
configureJewelRepositories() | ||
|
||
publications { | ||
register<MavenPublication>("IdeMain") { | ||
from(components["kotlin"]) | ||
artifact(javadocJar) | ||
artifact(sourcesJar) | ||
val ijVersionRaw = when (supportedIJVersion()) { | ||
IJ_232 -> "232" | ||
IJ_233 -> "233" | ||
} | ||
version = "${project.version}-ij-$ijVersionRaw" | ||
artifactId = "jewel-${project.name}" | ||
pom { | ||
configureJewelPom() | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,17 +1,29 @@ | ||
import SupportedIJVersion.* | ||
|
||
plugins { | ||
jewel | ||
`jewel-publish` | ||
`jewel-ij-publish` | ||
alias(libs.plugins.composeDesktop) | ||
} | ||
|
||
dependencies { | ||
api(projects.intUi.intUiStandalone) { | ||
exclude(group = "org.jetbrains.kotlinx") | ||
} | ||
compileOnly(libs.bundles.idea) | ||
when (supportedIJVersion()) { | ||
IJ_232 -> { | ||
api(projects.ideLafBridge.ideLafBridge232) | ||
compileOnly(libs.bundles.idea232) | ||
} | ||
|
||
IJ_233 -> { | ||
api(projects.ideLafBridge.ideLafBridge233) | ||
compileOnly(libs.bundles.idea233) | ||
} | ||
} | ||
|
||
testImplementation(compose.desktop.uiTestJUnit4) | ||
testImplementation(compose.desktop.currentOs) { | ||
exclude(group = "org.jetbrains.compose.material") | ||
} | ||
} | ||
} |
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,15 @@ | ||
plugins { | ||
jewel | ||
`jewel-ij-publish` | ||
alias(libs.plugins.composeDesktop) | ||
} | ||
|
||
dependencies { | ||
api(projects.intUi.intUiStandalone) | ||
compileOnly(libs.bundles.idea232) | ||
} | ||
|
||
tasks.withType<AbstractPublishToMaven>().configureEach { | ||
publication.artifactId = "jewel-ide-laf-bridge-platform-specific" | ||
enabled = supportedIJVersion() == SupportedIJVersion.IJ_232 | ||
} |
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,15 @@ | ||
plugins { | ||
jewel | ||
`jewel-ij-publish` | ||
alias(libs.plugins.composeDesktop) | ||
} | ||
|
||
dependencies { | ||
api(projects.intUi.intUiStandalone) | ||
compileOnly(libs.bundles.idea233) | ||
} | ||
|
||
tasks.withType<AbstractPublishToMaven>().configureEach { | ||
publication.artifactId = "jewel-ide-laf-bridge-platform-specific" | ||
enabled = supportedIJVersion() == SupportedIJVersion.IJ_233 | ||
} |
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
Oops, something went wrong.