Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hsz committed Dec 8, 2022
1 parent 002cd76 commit de61859
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,23 +320,6 @@ abstract class IdeaDependencyManager @Inject constructor(
else -> "zip"
},
) {

fun getAndroidStudioPath(parentPath: Path): Path {
val androidStudioPath = if (OperatingSystem.current().isMacOsX) {
// such as Android Studio.app/Contents
Files.list(parentPath).filter { child ->
child.extension == "app"
}.findFirst().get().resolve("Contents")
} else {
parentPath.resolve("android-studio")
}
info(
context, "Current system is ${OperatingSystem.current().name} " +
"and AndroidStudio path is $androidStudioPath"
)
return androidStudioPath
}

with(it.toPath()) {
Files.list(resolveAndroidStudioPath(this))
.forEach { entry -> Files.move(entry, resolve(entry.fileName), StandardCopyOption.REPLACE_EXISTING) }
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/org/jetbrains/intellij/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import org.gradle.api.logging.Logging
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.SourceSet
import org.gradle.internal.os.OperatingSystem
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.getPlugin
import org.gradle.process.JavaForkOptions
import org.jdom2.Document
import org.jdom2.JDOMException
Expand Down Expand Up @@ -61,7 +61,8 @@ import java.util.function.Predicate
val MAJOR_VERSION_PATTERN = "(RIDER-|GO-)?\\d{4}\\.\\d-(EAP\\d*-)?SNAPSHOT".toPattern()

fun mainSourceSet(project: Project): SourceSet = project
.extensions.getByType<JavaPluginConvention>()
.convention.getPlugin<JavaPluginConvention>()
// .extensions.getByType<JavaPluginConvention>() // available since Gradle 7.1
.sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME)

fun sourcePluginXmlFiles(project: Project) = mainSourceSet(project).resources.srcDirs.mapNotNull {
Expand Down

0 comments on commit de61859

Please sign in to comment.