Skip to content

Commit

Permalink
Preparing for 233 publication
Browse files Browse the repository at this point in the history
  • Loading branch information
lamba92 committed Nov 29, 2023
1 parent 9ae22de commit 8f9cb12
Show file tree
Hide file tree
Showing 23 changed files with 164 additions and 312 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
name: Build Package Search

on: [push]
on: [ push, pull_request ]

jobs:
build:
strategy:
matrix:
supported-ij-version: [232, 233, 241]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- uses: gradle/gradle-build-action@v2
- name: Run :buildShadowPlugin task
run: ./gradlew :plugin:buildShadowPlugin -PintelliJversion=${{ matrix.supported-ij-version }}
run: ./gradlew :plugin:buildShadowPlugin
env:
GRADLE_ENTERPRISE_KEY: ${{ secrets.GRADLE_ENTERPRISE_KEY }}
25 changes: 25 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build Package Search

on:
release:
types: [published]

jobs:
publish:
name: Publish Package Search to Marketplace
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
- uses: gradle/gradle-build-action@v2
- name: Run :publishShadowPlugin task
run: ./gradlew :plugin:publishShadowPluginToMarketplace
env:
MARKETPLACE_TOKEN: ${{ secrets.MARKETPLACE_TOKEN }}
GRADLE_ENTERPRISE_KEY: ${{ secrets.GRADLE_ENTERPRISE_KEY }}
24 changes: 24 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Package Search

on:
push:
branches: [ master ]

jobs:
publish:
name: Publish Package Search Snapshot to TBE
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
cache: gradle
- uses: gradle/gradle-build-action@v2
- name: Run :publishShadowPlugin task
run: ./gradlew :plugin:publishShadowPlugin
env:
TOOLBOX_ENTERPRISE_TOKEN: ${{ secrets.TOOLBOX_ENTERPRISE_TOKEN }}
GRADLE_ENTERPRISE_KEY: ${{ secrets.GRADLE_ENTERPRISE_KEY }}
123 changes: 0 additions & 123 deletions .space.kts

This file was deleted.

11 changes: 8 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@file:Suppress("UnstableApiUsage")

import java.time.LocalDate
import java.lang.System.getenv
import kotlinx.datetime.Clock
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import org.jetbrains.packagesearch.gradle.pkgsSpace

plugins {
Expand All @@ -11,8 +14,10 @@ plugins {

allprojects {
group = "org.jetbrains.packagesearch"
version = project.properties["pluginVersion"]?.toString()
?: "2.0.0"
version = when (val ref = getenv("GITHUB_REF")) {
null -> "2.0.0-SNAPSHOT"
else -> ref.substringAfterLast("/")
}

repositories {
mavenCentral()
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ dependencies {
implementation(packageSearchCatalog.kotlinx.serialization.json)
implementation("com.squareup:kotlinpoet:1.14.2")
implementation("io.github.pdvrieze.xmlutil:serialization:0.86.2")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun Project.configureGradleIntellijPlugin(packageSearchExtension: PackageSearchE

plugins.withId("org.jetbrains.intellij") {
extensions.withType<IntelliJPluginExtension> {
version = "2023.2.5"
version = "233-EAP-SNAPSHOT"
instrumentCode = false
downloadSources = !isCI
}
Expand All @@ -32,6 +32,7 @@ fun Project.configureGradleIntellijPlugin(packageSearchExtension: PackageSearchE
&& !it.name.containsAny(packageSearchExtension.librariesToKeep.get())
}
exclude { it.name == "module-info.class" }
exclude { it.name.endsWith("kotlin_module") }
}
named<PrepareSandboxTask>("prepareSandbox") {
pluginJar = shadowJar.flatMap { it.archiveFile }
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ org.gradle.jvmargs=-Xmx10g
kotlin.native.ignoreDisabledTargets=true
org.gradle.java.installations.auto-detect=false
kotlin.incremental.useClasspathSnapshot=false
org.gradle.parallel=true
org.gradle.parallel=true
pkgsPluginId = "com.jetbrains.packagesearch.intellij-plugin"
66 changes: 36 additions & 30 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@file:Suppress("UnstableApiUsage")

import kotlinx.datetime.Clock
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toLocalDateTime
import org.jetbrains.intellij.tasks.PublishPluginTask
import org.jetbrains.packagesearch.gradle.GeneratePackageSearchObject
import org.jetbrains.packagesearch.gradle.lafFile
import org.jetbrains.packagesearch.gradle.logCategoriesFile
import org.jetbrains.packagesearch.gradle.patchLafFile
Expand Down Expand Up @@ -51,7 +53,7 @@ dependencies {
implementation(compose.desktop.macos_x64)
implementation(compose.desktop.windows_x64)
implementation(packageSearchCatalog.kotlinx.serialization.core)
implementation(packageSearchCatalog.jewel.bridge.ij232)
implementation(packageSearchCatalog.jewel.bridge.ij233)
implementation(packageSearchCatalog.ktor.client.logging)
implementation(packageSearchCatalog.packagesearch.api.models)
implementation(projects.plugin.gradle.base)
Expand All @@ -71,13 +73,7 @@ dependencies {
testRuntimeOnly(packageSearchCatalog.junit.jupiter.engine)
}

val pkgsPluginId = "com.jetbrains.packagesearch.intellij-plugin"

val generatedDir: Provider<Directory> = layout.buildDirectory.dir("generated/main/kotlin")

kotlin.sourceSets.main {
kotlin.srcDirs(generatedDir)
}
val pkgsPluginId: String by project

tasks {
val patchIdeSettings by registering {
Expand All @@ -96,36 +92,39 @@ tasks {
runIde {
dependsOn(patchIdeSettings)
}
val generatePluginDataSources by registering(GeneratePackageSearchObject::class) {
pluginId = pkgsPluginId
outputDir = generatedDir
packageName = "com.jetbrains.packagesearch.plugin"
}
sourcesJar {
dependsOn(generatePluginDataSources)
}
dokkaHtml {
dependsOn(generatePluginDataSources)
}
shadowJar {
archiveBaseName = "packagesearch-plugin"
}
prepareSandbox {
runtimeClasspathFiles = tooling
}
compileKotlin {
dependsOn(generatePluginDataSources)
val snapshotDateSuffix = buildString {
val now = Clock.System.now().toLocalDateTime(TimeZone.UTC)
append(now.year)
append(now.monthNumber)
append(now.dayOfMonth)
append(now.hour.toString().padStart(2, '0'))
append(now.minute.toString().padStart(2, '0'))
append(now.second.toString().padStart(2, '0'))
}
patchPluginXml {
pluginId = pkgsPluginId
sinceBuild = "232.*"
untilBuild = "232.*"
version = when {
project.version.toString().endsWith("-SNAPSHOT") -> "${project.version}-$snapshotDateSuffix"
else -> project.version.toString()
}
}

val buildShadowPlugin by registering(Zip::class) {
group = "intellij"
from(shadowJar, tooling, jarSearchableOptions)
into("com.jetbrains.packagesearch.intellij-plugin/lib") // <-- ONLY ONE into()!
from(shadowJar) {
rename {
"package-search-plugin" + when {
it.endsWith("-SNAPSHOT.jar") -> it.replace(".jar", "-$snapshotDateSuffix.jar")
else -> it
}
}
}
from(tooling) {
rename { "gradle-tooling.jar" }
}
into("$pkgsPluginId/lib")
archiveFileName.set("packagesearch-plugin.zip")
destinationDirectory = layout.buildDirectory.dir("distributions")
}
Expand All @@ -140,4 +139,11 @@ tasks {
channels = listOf("Stable")
}

register<PublishPluginTask>("publishShadowPluginToMarketplace") {
group = "publishing"
distributionFile = buildShadowPlugin.flatMap { it.archiveFile }
token = project.properties["marketplaceToken"]?.toString()
?: System.getenv("MARKETPLACE_TOKEN")
}

}
Loading

0 comments on commit 8f9cb12

Please sign in to comment.