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