Skip to content

Commit

Permalink
Merge remote-tracking branch 'aSemy/fix/respect_xdg_cache_dir'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGES.md
#	src/main/kotlin/org/jetbrains/intellij/tasks/RunPluginVerifierTask.kt
  • Loading branch information
hsz committed Sep 27, 2022
2 parents 0d81f1d + b44b4e4 commit 4f96f31
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
11 changes: 4 additions & 7 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Revert pushing project resource directories to the end of classpath in the test task context. ([#1101](../../issues/1101))
- Avoid unnecessary task configuration during Gradle configuration phase [#1110](../../issues/1110) by @3flex
- Replace internal Gradle ConventionTask with DefaultTask [#1115](../../issues/1115) by @aSemy
- Plugin Verifier cache directory now follows XDG cache standards [#1119](../../issues/1119) by @aSemy

## [1.9.0]
### Added
Expand All @@ -16,9 +17,6 @@
### Changed
- Change `IntelliJPluginConstants.ANDROID_STUDIO_PRODUCTS_RELEASES_URL` to `https://jb.gg/android-studio-releases-list.xml`

### Fixed
- Revert pushing project resource directories to the end of classpath in the test task context. ([#1101](../../../1161))

## [1.8.1]
### Added
- Configure classpath for run-based tasks using `Info.plist` provided with IntelliJ SDK 2022.3+
Expand All @@ -38,7 +36,7 @@

### Removed
- Remove the `DEPENDENCY_FIRST` resolution strategy set by default along with its `BuildFeature.USE_DEPENDENCY_FIRST_RESOLUTION_STRATEGY` flag.
- Remove setting of the `java.system.class.loader` property from tests configuration.
- Remove setting of the `java.system.class.loader` property from tests configuration.

### Fixed
- Exclude non-jar files from the classpath [#1009](../../issues/1009)
Expand Down Expand Up @@ -294,7 +292,7 @@

## 0.4.20
- fixed caching builtin plugins data
- add annotations-19.0.0 to compile classpath by default
- add annotations-19.0.0 to compile classpath by default
- fix setting plugin name for Gradle 5.1-5.3 [#481](../../issues/481)

## 0.4.19
Expand Down Expand Up @@ -336,7 +334,7 @@
- Introduced `intellij.useProductionClassLoaderInTests` option to control how plugin is going to be loaded in tests

## 0.4.11
- Fix setting archive name for Gradle 5.1 and higher [#436](../../issues/436)
- Fix setting archive name for Gradle 5.1 and higher [#436](../../issues/436)
- Fix forms compilation for Rider and Python snapshot builds. Works for Rider-2019.3-SNAPSHOT and higher [#403](../../issues/403)

## 0.4.10
Expand Down Expand Up @@ -576,4 +574,3 @@

## 0.0.10
- Support for attaching IntelliJ sources in IDEA

4 changes: 1 addition & 3 deletions src/main/kotlin/org/jetbrains/intellij/IntelliJPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,7 @@ open class IntelliJPlugin : Plugin<Project> {
verificationReportsDir.convention(project.provider {
"${project.buildDir}/reports/pluginVerifier"
})
downloadDir.convention(project.provider {
ideDownloadDir().toString()
})
downloadDir.convention(ideDownloadDir().map { it.toFile().invariantSeparatorsPath })
teamCityOutputFormat.convention(false)
subsystemsToCheck.convention("all")
ideDir.convention(runIdeTaskProvider.get().ideDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
package org.jetbrains.intellij.tasks

import com.jetbrains.plugin.structure.base.utils.createDir
import org.apache.commons.io.FileUtils
import org.apache.tools.ant.util.TeeOutputStream
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.InvalidUserDataException
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.DefaultTask
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.ProviderFactory
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Internal
Expand Down Expand Up @@ -42,14 +42,14 @@ import java.io.File
import java.io.IOException
import java.net.HttpURLConnection
import java.net.URL
import java.nio.file.Path
import java.nio.file.Paths
import java.util.EnumSet
import javax.inject.Inject

open class RunPluginVerifierTask @Inject constructor(
abstract class RunPluginVerifierTask @Inject constructor(
private val objectFactory: ObjectFactory,
private val execOperations: ExecOperations,
private val providers: ProviderFactory,
) : DefaultTask() {

companion object {
Expand Down Expand Up @@ -286,7 +286,7 @@ open class RunPluginVerifierTask @Inject constructor(
debug(context, "Failing task on '$failureLevel' failure level")
throw GradleException(
"$level: ${level.message} Check Plugin Verifier report for more details.\n" +
"Incompatible API Changes: https://jb.gg/intellij-api-changes"
"Incompatible API Changes: https://jb.gg/intellij-api-changes"
)
}
}
Expand Down Expand Up @@ -411,18 +411,11 @@ open class RunPluginVerifierTask @Inject constructor(
*
* @return Plugin Verifier home directory
*/
private fun verifierHomeDir(): Path {
System.getProperty("plugin.verifier.home.dir")?.let {
return Paths.get(it)
}

System.getProperty("user.home")?.let {
return Paths.get(it, ".pluginVerifier")
}

return FileUtils.getTempDirectory().toPath().resolve(".pluginVerifier")
}

private fun verifierHomeDir() = providers.systemProperty("plugin.verifier.home.dir")
.orElse(providers.environmentVariable("XDG_CACHE_HOME").map { "$it/pluginVerifier" })
.orElse(providers.systemProperty("user.home").map { "$it/.cache/pluginVerifier" })
.map { Paths.get(it) }
.orElse(temporaryDir.resolve("pluginVerifier").toPath())

/**
* Resolves the Plugin Verifier version.
Expand Down Expand Up @@ -549,7 +542,7 @@ open class RunPluginVerifierTask @Inject constructor(
*
* @return directory for downloaded IDEs
*/
internal fun ideDownloadDir() = verifierHomeDir().resolve("ides").createDir()
internal fun ideDownloadDir() = verifierHomeDir().map { it.resolve("ides").createDir() }

enum class FailureLevel(val sectionHeading: String, val message: String) {
COMPATIBILITY_WARNINGS(
Expand Down

0 comments on commit 4f96f31

Please sign in to comment.