mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix dependencies for android-plugin unit tests (merging Android Studio 3.5)
GitOrigin-RevId: de36ccad51c0c44b66424b4d6570888c51e5ea93
This commit is contained in:
committed by
intellij-monorepo-bot
parent
531483edd2
commit
13cc5f4bec
@@ -0,0 +1,57 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.OutputDirectory
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.util.GFileUtils
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.artifacts.component.ModuleComponentIdentifier
|
||||
import org.gradle.maven.MavenModule
|
||||
import org.gradle.maven.MavenPomArtifact
|
||||
|
||||
class OfflineMavenRepository extends DefaultTask {
|
||||
@Input
|
||||
String configurationName = 'compile'
|
||||
|
||||
@OutputDirectory
|
||||
File repoDir = new File(project.buildDir, 'offline-repo')
|
||||
|
||||
@TaskAction
|
||||
void build() {
|
||||
Configuration configuration = project.configurations.getByName(configurationName)
|
||||
copyJars(configuration)
|
||||
copyPoms(configuration)
|
||||
}
|
||||
|
||||
private void copyJars(Configuration configuration) {
|
||||
configuration.resolvedConfiguration.resolvedArtifacts.each { artifact ->
|
||||
def moduleVersionId = artifact.moduleVersion.id
|
||||
File moduleDir = new File(repoDir, "${moduleVersionId.group.replace('.','/')}/${moduleVersionId.name}/${moduleVersionId.version}")
|
||||
GFileUtils.mkdirs(moduleDir)
|
||||
|
||||
File target = new File(moduleDir, artifact.file.name)
|
||||
println "Copy: $artifact.file -> $target"
|
||||
GFileUtils.copyFile(artifact.file, target)
|
||||
}
|
||||
}
|
||||
|
||||
private void copyPoms(Configuration configuration) {
|
||||
def componentIds = configuration.incoming.resolutionResult.allDependencies.collect { it.selected.id }
|
||||
|
||||
def result = project.dependencies.createArtifactResolutionQuery()
|
||||
.forComponents(componentIds)
|
||||
.withArtifacts(MavenModule, MavenPomArtifact)
|
||||
.execute()
|
||||
|
||||
for(component in result.resolvedComponents) {
|
||||
def componentId = component.id
|
||||
|
||||
if(componentId instanceof ModuleComponentIdentifier) {
|
||||
File moduleDir = new File(repoDir, "${componentId.group.replace('.','/')}/${componentId.module}/${componentId.version}")
|
||||
GFileUtils.mkdirs(moduleDir)
|
||||
File pomFile = component.getArtifacts(MavenPomArtifact)[0].file
|
||||
GFileUtils.copyFile(pomFile, new File(moduleDir, pomFile.name))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
repositories {
|
||||
maven { url 'https://cache-redirector.jetbrains.com/repo.maven.apache.org/maven2/' }
|
||||
maven { url 'https://cache-redirector.jetbrains.com/jetbrains.bintray.com/intellij-third-party-dependencies/' }
|
||||
ivy {
|
||||
// TODO: re-publish android-sdk:android-sdk using maven layout and remove Ivy repository
|
||||
@@ -28,14 +29,32 @@ repositories {
|
||||
configurations {
|
||||
androidOfflineRepo
|
||||
androidSdk
|
||||
kotlinDeps
|
||||
}
|
||||
|
||||
def currentOs = org.gradle.internal.os.OperatingSystem.current()
|
||||
def osFamily = currentOs.familyName
|
||||
|
||||
dependencies {
|
||||
androidOfflineRepo "org.jetbrains.intellij.deps.android.tools:android-sdk-offline-repo:26.5.0@zip"
|
||||
ext.kotlin_version = "1.3.50"
|
||||
androidOfflineRepo "org.jetbrains.intellij.deps.android.tools:android-sdk-offline-repo:26.5.0.1@zip"
|
||||
androidSdk "android-sdk:android-sdk:${osFamily}.3.3.3:@tar.gz"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-android-extensions:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-android-extensions-runtime:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-annotation-processing-gradle:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-build-common:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-compiler-runner:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-gradle-plugin-api:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-gradle-plugin-model:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-scripting-common:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-scripting-jvm:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-test:${kotlin_version}"
|
||||
kotlinDeps "org.jetbrains.kotlin:kotlin-test-common:${kotlin_version}"
|
||||
}
|
||||
|
||||
/* First we setup an offline-repo. This will remove all the alien files from .../android-sdk.
|
||||
@@ -55,6 +74,12 @@ task syncAndroidSdk(dependsOn: [configurations.androidSdk, syncOfflineRepo], typ
|
||||
into "$buildDir/android-sdk/prebuilts/studio/sdk"
|
||||
}
|
||||
|
||||
task setupAndroidSdk(dependsOn: [syncOfflineRepo, syncKotlinPluginForAndroid, syncAndroidSdk]) {
|
||||
task updateKotlinLibs(dependsOn: [configurations.kotlinDeps, syncOfflineRepo], type: OfflineMavenRepository) {
|
||||
outputs.upToDateWhen { false }
|
||||
configurationName = "kotlinDeps"
|
||||
repoDir = file("$buildDir/android-sdk/prebuilts/tools/common/m2/repository")
|
||||
}
|
||||
|
||||
task setupAndroidSdk(dependsOn: [syncOfflineRepo, syncKotlinPluginForAndroid, syncAndroidSdk, updateKotlinLibs]) {
|
||||
// This is entry point: invoke this task to setup android sdk and all the artifacts required to run android-plugin unit tests
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user