From 96c63d6b06abdd6a68a017a8e7d8e4ef915ff9e3 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Fri, 29 Apr 2022 15:28:11 +0200
Subject: [PATCH] Add build and plugin configuration

---
 .gitattributes                         |  1 +
 .gitignore                             |  3 +++
 .idea/runConfigurations/Plugin.xml     | 23 +++++++++++++++++
 build.gradle.kts                       | 35 ++++++++++++++++++++++++++
 gradle.properties                      |  1 +
 settings.gradle.kts                    |  1 +
 src/main/resources/META-INF/plugin.xml | 19 ++++++++++++++
 7 files changed, 83 insertions(+)
 create mode 100644 .gitattributes
 create mode 100644 .idea/runConfigurations/Plugin.xml
 create mode 100644 build.gradle.kts
 create mode 100644 gradle.properties
 create mode 100644 settings.gradle.kts
 create mode 100644 src/main/resources/META-INF/plugin.xml

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..6313b56
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto eol=lf
diff --git a/.gitignore b/.gitignore
index abc78ba..5684d9f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
+/.idea/*
+!/.idea/runConfigurations
+
 /.gradle/
 /build/
diff --git a/.idea/runConfigurations/Plugin.xml b/.idea/runConfigurations/Plugin.xml
new file mode 100644
index 0000000..3e6b64e
--- /dev/null
+++ b/.idea/runConfigurations/Plugin.xml
@@ -0,0 +1,23 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="Plugin" type="GradleRunConfiguration" factoryName="Gradle">
+    <ExternalSystemSettings>
+      <option name="executionName" />
+      <option name="externalProjectPath" value="$PROJECT_DIR$" />
+      <option name="externalSystemIdString" value="GRADLE" />
+      <option name="scriptParameters" value="" />
+      <option name="taskDescriptions">
+        <list />
+      </option>
+      <option name="taskNames">
+        <list>
+          <option value=":runIde" />
+        </list>
+      </option>
+      <option name="vmOptions" />
+    </ExternalSystemSettings>
+    <ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
+    <ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
+    <DebugAllEnabled>false</DebugAllEnabled>
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..b57715d
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,35 @@
+@file:Suppress("ConvertLambdaToReference")
+
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+	kotlin("jvm") version "1.8.0"
+	id("org.jetbrains.intellij") version "1.13.3"
+}
+
+group = "com.chylex.intellij.pinundockedtoolwindows"
+version = "0.0.1"
+
+repositories {
+	mavenCentral()
+}
+
+intellij {
+	version.set("2023.1")
+	updateSinceUntilBuild.set(false)
+}
+
+tasks.patchPluginXml {
+	sinceBuild.set("231")
+}
+
+tasks.buildSearchableOptions {
+	enabled = false
+}
+
+tasks.withType<KotlinCompile> {
+	kotlinOptions.jvmTarget = "17"
+	kotlinOptions.freeCompilerArgs = listOf(
+		"-Xjvm-default=enable"
+	)
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..0d6aa7b
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1 @@
+kotlin.stdlib.default.dependency=false
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..bae0303
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1 @@
+rootProject.name = "Pin-Undocked-Tool-Windows"
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
new file mode 100644
index 0000000..c4cd5e4
--- /dev/null
+++ b/src/main/resources/META-INF/plugin.xml
@@ -0,0 +1,19 @@
+<idea-plugin>
+  <id>com.chylex.intellij.pinundockedtoolwindows</id>
+  <name>Pin Undocked Tool Windows</name>
+  <vendor url="https://chylex.com">chylex</vendor>
+  
+  <description><![CDATA[
+    Forces tool windows in "Undock" mode to stay visible when something tries to steal focus.
+  ]]></description>
+  
+  <depends>com.intellij.modules.platform</depends>
+  
+  <extensions defaultExtensionNs="com.intellij">
+    <postStartupActivity implementation="com.chylex.intellij.pinundockedtoolwindows.ProjectActivityListener" />
+  </extensions>
+  
+  <applicationListeners>
+    <listener class="com.chylex.intellij.pinundockedtoolwindows.DynamicPluginListener" topic="com.intellij.ide.plugins.DynamicPluginListener" />
+  </applicationListeners>
+</idea-plugin>