Skip to content

Commit

Permalink
Update to platform plugin 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPirates committed Oct 24, 2024
1 parent 55c33ab commit 64d43b8
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
- name: Fetch Sources
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'

- name: Restore Gradle Cache
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ build
/src/main/resources/sentry.properties
/src/main/web-view/node_modules/
!.idea/icon.png
.intellijPlatform
kotlin-js-store
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pluginName = intellij-pdf-viewer
group = com.firsttimeinforever.intellij.pdf.viewer
version = 0.17.1-alpha.1
version = 0.17.1-alpha.2

# To run with AS 2021.3.1 Canary 5
#platformVersion = 213.6777.52

#IntelliJ IDEA 2021.1.2 Preview
platformVersion = 2024.2
platformVersion = 2024.2.3
pluginSinceVersion = 241
pluginVerifierIdeVersions = 241, 242

Expand Down
77 changes: 51 additions & 26 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
import org.jetbrains.intellij.tasks.RunIdeTask
import java.nio.file.Files
import java.nio.file.Paths
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

fun fromProperties(key: String) = project.findProperty(key).toString()

plugins {
id("java")
kotlin("jvm")
kotlin("plugin.serialization")
id("org.jetbrains.intellij") version "1.17.3"
id("org.jetbrains.changelog") version "2.2.0"
id("org.jetbrains.intellij.platform") version "2.1.0"
id("org.jetbrains.changelog") version "2.2.1"
id("com.github.ben-manes.versions") version "0.51.0"
// Plugin which can update Gradle dependencies, use the help/useLatestVersions task.
id("se.patrikerdes.use-latest-versions") version "0.2.18"
}

group = fromProperties("group")
Expand All @@ -27,13 +28,26 @@ val webViewSourceDirectory = file("$projectDir/src/main/web-view")

repositories {
mavenCentral()
maven("https://www.jetbrains.com/intellij-repository/snapshots")
// maven("http://maven.geotoolkit.org/")

intellijPlatform {
defaultRepositories()
maven("https://www.jetbrains.com/intellij-repository/snapshots")
}
}

dependencies {
// implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
// implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxSerializationJsonVersion")
intellijPlatform {
instrumentationTools()
zipSigner()
pluginVerifier()
testFramework(TestFrameworkType.Platform)

intellijIdeaCommunity(fromProperties("platformVersion"))

plugin("nl.rubensten.texifyidea:${fromProperties("texifyVersion")}")
}

implementation("io.sentry:sentry:1.7.30") {
// Included in IJ
exclude("org.slf4j")
Expand All @@ -49,18 +63,10 @@ dependencies {
webView(project(":web-view:bootstrap"))
}

intellij {
version.set(fromProperties("platformVersion"))
sameSinceUntilBuild.set(true)
updateSinceUntilBuild.set(false)
pluginName.set(fromProperties("pluginName"))
plugins.set(listOf("nl.rubensten.texifyidea:${fromProperties("texifyVersion")}"))
}

tasks {
compileKotlin {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
jvmTarget = JavaVersion.VERSION_21.toString()
freeCompilerArgs += listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xjvm-default=all")
}
}
Expand All @@ -78,20 +84,40 @@ tasks {
keepUnreleasedSection = true
unreleasedTerm = "Unreleased"
}
withType<PatchPluginXmlTask> {
sinceBuild.set(fromProperties("pluginSinceVersion"))
changeNotes.set(changelog.renderItem(changelog.getLatest().withHeader(true), Changelog.OutputType.HTML))
pluginDescription.set(extractPluginDescription())
}
runPluginVerifier {
ideVersions.set(fromProperties("pluginVerifierIdeVersions").split(", "))
}

// // https://youtrack.jetbrains.com/issue/KTIJ-782
// buildSearchableOptions {
// enabled = false
// }
}

intellijPlatform {
pluginConfiguration {
name = fromProperties("pluginName")
description = extractPluginDescription()
// Get the latest available change notes from the changelog file
changeNotes = (
provider {
with(changelog) {
renderItem(changelog.getLatest().withHeader(true), Changelog.OutputType.HTML)
}
}
)
}

pluginVerification {
ides {
recommended() }
}

publishing {
token.set(properties["intellijPublishToken"].toString())

// Specify channel based on version
channels.set(listOf(fromProperties("version").split('-').getOrElse(1) { "stable" }.split('.').first()))
}
}

@Throws(GradleException::class)
fun extractPluginDescription(): String {
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
Expand All @@ -117,10 +143,9 @@ tasks.getByName("processResources") {
inputs.dir(copyWebViewBuildResults.map { it.outputs.files.singleFile })
}

tasks.withType<RunIdeTask> {
tasks.runIde {
// Some warning asked for this to be set explicitly
systemProperties["idea.log.path"] = file("build/idea-sandbox/system/log").absolutePath
jbrVariant.set("jcef")
systemProperties["ide.browser.jcef.enabled"] = true
systemProperties["pdf.viewer.debug"] = true
jvmArgs("--add-exports", "java.base/jdk.internal.vm=ALL-UNNAMED", "-Xmx4096m", "-Xms128m")
Expand Down

0 comments on commit 64d43b8

Please sign in to comment.