Skip to content

Commit 1651dea

Browse files
plumpygoogle-java-format Team
authored and
google-java-format Team
committed
Convert the gradle config to kotlin.
I moved the description out of the Gradle config and into the XML. (It was just in the gradle so we could add the gjf version number, but that seems unnecessary since I changed the versioning so that the plugin version matches the gjf version.) I also updated the IntelliJ Gradle plugin to 1.13.1 because plugin publishing is broken in 1.13.0. PiperOrigin-RevId: 513888985
1 parent 4f5ffd0 commit 1651dea

File tree

3 files changed

+73
-67
lines changed

3 files changed

+73
-67
lines changed

idea_plugin/build.gradle

-67
This file was deleted.

idea_plugin/build.gradle.kts

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright 2017 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins { id("org.jetbrains.intellij") version "1.13.1" }
18+
19+
apply(plugin = "org.jetbrains.intellij")
20+
21+
apply(plugin = "java")
22+
23+
repositories { mavenCentral() }
24+
25+
val googleJavaFormatVersion = "1.16.0"
26+
27+
java {
28+
sourceCompatibility = JavaVersion.VERSION_11
29+
targetCompatibility = JavaVersion.VERSION_11
30+
}
31+
32+
intellij {
33+
pluginName.set("google-java-format")
34+
plugins.set(listOf("java"))
35+
version.set("2021.3")
36+
}
37+
38+
tasks {
39+
patchPluginXml {
40+
version.set("${googleJavaFormatVersion}.0")
41+
sinceBuild.set("213")
42+
untilBuild.set("")
43+
}
44+
45+
publishPlugin {
46+
val jetbrainsPluginRepoToken: String by project
47+
token.set(jetbrainsPluginRepoToken)
48+
}
49+
50+
withType<Test>().configureEach {
51+
jvmArgs(
52+
"--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
53+
"--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
54+
"--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
55+
"--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
56+
"--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
57+
"--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
58+
)
59+
}
60+
}
61+
62+
dependencies {
63+
implementation("com.google.googlejavaformat:google-java-format:${googleJavaFormatVersion}")
64+
testImplementation("junit:junit:4.13.2")
65+
testImplementation("com.google.truth:truth:1.1.3")
66+
}

idea_plugin/src/main/resources/META-INF/plugin.xml

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
<depends>com.intellij.modules.lang</depends>
2727
<depends>com.intellij.modules.platform</depends>
2828

29+
<description><![CDATA[
30+
Formats source code using the google-java-format tool.<p>
31+
32+
This plugin requires additional IDE configuration. For more information,
33+
<a href="https://github.com/google/google-java-format/blob/master/README.md#intellij-jre-config">read
34+
the documentation.</a>
35+
]]></description>
2936
<change-notes><![CDATA[
3037
<dl>
3138
<dt>1.16.0.0</dt>

0 commit comments

Comments
 (0)