|
| 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 | +} |
0 commit comments