Skip to content

Commit

Permalink
Merge branch 'main' into sample-ide
Browse files Browse the repository at this point in the history
  • Loading branch information
c5inco committed Oct 17, 2023
2 parents 8ed6bf5 + 4da6105 commit bfb83d5
Show file tree
Hide file tree
Showing 263 changed files with 5,238 additions and 752 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ jobs:
assemble:
runs-on: ubuntu-latest

strategy:
matrix:
supported-ij-version:
- 232
- 233

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
Expand All @@ -20,11 +26,17 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run :assemble task
run: ./gradlew assemble
run: ./gradlew assemble -Psupported.ij.version=${{ matrix.supported-ij-version }}

checks:
runs-on: ubuntu-latest

strategy:
matrix:
supported-ij-version:
- 232
- 233

steps:
- uses: actions/checkout@v3

Expand All @@ -39,11 +51,11 @@ jobs:
run: chmod +x gradlew

- name: Run :check task
run: ./gradlew check --continue
run: ./gradlew check -Psupported.ij.version=${{ matrix.supported-ij-version }} --continue

- name: Merge SARIF reports
# Necessary because upload-sarif only takes up to 15 SARIF files and we have more
run: ./gradlew :mergeSarifReports
run: ./gradlew :mergeSarifReports -Psupported.ij.version=${{ matrix.supported-ij-version }}
if: ${{ always() }}

- uses: github/codeql-action/upload-sarif@v2
Expand Down
33 changes: 30 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ on:
push:
branches: [ main ]
jobs:
publish:
name: Publish
publish-core:
name: Publish Jewel Core
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand All @@ -17,7 +18,33 @@ jobs:
- name: Setup Gradle
run: chmod +x gradlew
- name: Run Gradle
run: ./gradlew publishAllPublicationsToSpaceRepository
# supported.ij.version is needed here for project configuration and won't be used during publishing
run: ./gradlew publishMainPublicationToSpaceRepository -Psupported.ij.version=232
env:
MAVEN_SPACE_USERNAME: ${{secrets.MAVEN_SPACE_USERNAME}}
MAVEN_SPACE_PASSWORD: ${{secrets.MAVEN_SPACE_PASSWORD}}

publish-ide:
name: Publish Jewel IDE part
needs: publish-core
runs-on: ubuntu-latest

strategy:
matrix:
supported-ij-version:
- 232
- 233

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
run: chmod +x gradlew
- name: Run Gradle
run: ./gradlew publishIdeMainPublicationToSpaceRepository -Psupported.ij.version=${{ matrix.supported-ij-version }}
env:
MAVEN_SPACE_USERNAME: ${{secrets.MAVEN_SPACE_USERNAME}}
MAVEN_SPACE_PASSWORD: ${{secrets.MAVEN_SPACE_PASSWORD}}
1 change: 0 additions & 1 deletion .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2022 JetBrains
Copyright 2022–3 JetBrains s.r.o.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![JetBrains incubator](https://camo.githubusercontent.com/be6f8b50b2400e8b0dc74e58dd9a68803fe6698f5f30d843a7504888879f8392/68747470733a2f2f6a622e67672f6261646765732f696e63756261746f722d706c61737469632e737667)](https://github.com/JetBrains#jetbrains-on-github) [![CI checks](https://github.com/JetBrains/jewel/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/JetBrains/jewel/actions/workflows/build.yml)
[![JetBrains incubator](https://img.shields.io/badge/JetBrains-incubator-yellow)](https://github.com/JetBrains#jetbrains-on-github) [![CI checks](https://img.shields.io/github/actions/workflow/status/JetBrains/jewel/build.yml?logo=github)](https://github.com/JetBrains/jewel/actions/workflows/build.yml) [![Licensed under Apache 2.0](https://img.shields.io/github/license/JetBrains/jewel)](https://github.com/JetBrains/jewel/blob/main/LICENSE) [![Latest release](https://img.shields.io/github/v/release/JetBrains/jewel?include_prereleases&label=Latest%20Release&logo=github)](https://github.com/JetBrains/jewel/releases/latest)


# Jewel: a Compose for Desktop theme

Expand All @@ -9,10 +10,11 @@ desktop-optimized theme and set of components.

> [!WARNING]
>
> This project is in very early development and is probably not ready to be used in production projects. You _can_, but
> you should expect APIs to change fairly often, things to move around and/or break, and all that jazz.
> This project is in active development, and caution is advised when considering it for production uses. You _can_,
> but you should expect APIs to change often, things to move around and/or break, and all that jazz. Binary
> compatibility is not currently guaranteed across releases, but it is an eventual aim for 1.0, if it is possible.
>
> Use at your risk!
> Use at your own risk! (but have fun if you do!)
Jewel provides stand-alone implementations of the IntelliJ Platform themes that can be used in any Compose for Desktop
application, and a Swing LaF Bridge that only works in the IntelliJ Platform (i.e., used to create IDE plugins), but
Expand Down Expand Up @@ -90,3 +92,22 @@ you, but if you want to also enable it in other scenarios and in standalone appl
You can find help on the [`#jewel`](https://app.slack.com/client/T09229ZC6/C05T8U2C31T) channel on the Kotlin Slack.
If you don't already have access to the Kotlin Slack, you can request it
[here](https://surveys.jetbrains.com/s3/kotlin-slack-sign-up).

## License
Jewel is licensed under the [Apache 2.0 license](https://github.com/JetBrains/jewel/blob/main/LICENSE).

```
Copyright 2022–3 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
4 changes: 4 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ gradlePlugin {
id = "intellij-theme-generator"
implementationClass = "org.jetbrains.jewel.buildlogic.theme.IntelliJThemeGeneratorPlugin"
}
register("android-studio-releases-generator") {
id = "android-studio-releases-generator"
implementationClass = "org.jetbrains.jewel.buildlogic.demodata.AndroidStudioReleasesGeneratorPlugin"
}
}
}

Expand Down
37 changes: 37 additions & 0 deletions buildSrc/src/main/kotlin/IdeaConfiguration.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import java.util.concurrent.atomic.AtomicBoolean
import org.gradle.api.Project

enum class SupportedIJVersion {
IJ_232,
IJ_233
}

private var warned = AtomicBoolean(false)

fun Project.supportedIJVersion(): SupportedIJVersion {
val prop = kotlin.runCatching {
localProperty("supported.ij.version")
?: rootProject.property("supported.ij.version")?.toString()
}.getOrNull()

if (prop == null) {
if (!warned.getAndSet(true)) {
logger.warn(
"""
No 'supported.ij.version' property provided. Falling back to IJ 233.
It is recommended to provide it using local.properties file or -Psupported.ij.version to avoid unexpected behavior.
""".trimIndent()
)
}
return SupportedIJVersion.IJ_233
}

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')"
)
}
}
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/LocalProperties.kt
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)
}
35 changes: 35 additions & 0 deletions buildSrc/src/main/kotlin/PublishConfiguration.kt
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"
}
}
63 changes: 63 additions & 0 deletions buildSrc/src/main/kotlin/jewel-ij-publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@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.toString().withVersionSuffix("ij-$ijVersionRaw")
artifactId = "jewel-${project.name}"
pom {
configureJewelPom()
}
}
}
}

/**
* Adds suffix to the version taking SNAPSHOT suffix into account
*
* For example, if [this] is "0.0.1-SNAPSHOT" and [suffix] is "ij-233"
* then result will be "0.0.1-ij-233-SNAPSHOT"
*/
fun String.withVersionSuffix(suffix: String): String {
val splitString = this.split('-')
val snapshotRaw = "SNAPSHOT"
val withSnapshot = splitString.contains(snapshotRaw)

if (!withSnapshot) {
return "$this-$suffix"
}

val withoutSnapshot = splitString.filter { it != snapshotRaw }.joinToString("-")

return "$withoutSnapshot-$suffix-$snapshotRaw"
}
26 changes: 3 additions & 23 deletions buildSrc/src/main/kotlin/jewel-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,8 @@ val javadocJar by tasks.registering(Jar::class) {
}

publishing {
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")
}
}
}
configureJewelRepositories()

publications {
register<MavenPublication>("main") {
from(components["kotlin"])
Expand All @@ -36,20 +29,7 @@ publishing {
version = project.version.toString()
artifactId = "jewel-${project.name}"
pom {
name = "Jewel"
description = "intelliJ theming system in for Compose."
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"
}
configureJewelPom()
}
}
}
Expand Down
Loading

0 comments on commit bfb83d5

Please sign in to comment.