forked from skolson/sqlcipher-openssl-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
111 lines (97 loc) · 3.37 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
111 lines (97 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.gradle.ext.ProjectSettings
plugins {
kotlin("jvm") version "1.9.22"
`java-gradle-plugin`
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
id("com.gradle.plugin-publish") version "1.2.1"
`maven-publish`
}
val groupName = "com.oldguy.gradle"
val artifactName = "sqlcipher-openssl-build"
val versionString = "0.4.0"
group = groupName
version = versionString
repositories {
mavenCentral()
}
tasks.withType<Test> {
useJUnitPlatform()
}
java {
withSourcesJar()
withJavadocJar()
}
dependencies {
implementation("org.eclipse.jgit:org.eclipse.jgit:6.9.0.202403050737-r")
testImplementation(kotlin("test"))
}
gradlePlugin {
website = "https://github.com/skolson/sqlcipher-openssl-build"
vcsUrl = "https://github.com/skolson/sqlcipher-openssl-build.git"
plugins {
create(artifactName) {
// This ID is used by the dependent projects in the plugins block
id = "$groupName.$artifactName"
displayName = "OpenSSL and SqlCipher builds"
description = "Automated builds of OpenSSL and SqlCipher, 64 bit only, for Windows, Linux and Mac build hosts. Multiple target hosts including Android, VStudio, mingw, Linux. Mac, IOS"
implementationClass = "com.oldguy.gradle.SqlCipherPlugin"
tags = listOf("openssl", "sqlcipher")
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
}
afterEvaluate {
publishing {
repositories {
maven {
name = "localRepo"
url = uri("https://localhost/MavenRepo")
}
}
publications {
create<MavenPublication>("sqlcipherPlugin") {
from(components["java"])
groupId = groupName
artifactId = artifactName
version = versionString
}
}
}
}
/**
* The code below remedies a classpath issue with running unit tests using Gradle Runner using Idea. Unknown if
* this is required with Android Studio - it is untried there yet. But only applies to running unit tests.
*/
val fixIdeaPluginClasspath: Task = tasks.create("fixIdeaPluginClasspath") {
doFirst {
tasks.pluginUnderTestMetadata.configure {
val ideaClassesPath = project.layout.buildDirectory.get().asFile
.resolveSibling("out")
.resolve("production")
val newClasspath = pluginClasspath.toMutableList()
newClasspath.add(0, ideaClassesPath)
pluginClasspath.setFrom(newClasspath)
}
}
}
tasks.getByName("pluginUnderTestMetadata").mustRunAfter(fixIdeaPluginClasspath)
fun org.gradle.plugins.ide.idea.model.IdeaProject.settings(block: ProjectSettings.() -> Unit) =
(this@settings as ExtensionAware).extensions.configure(block)
fun ProjectSettings.taskTriggers(block: org.jetbrains.gradle.ext.TaskTriggersConfig.() -> Unit) =
(this@taskTriggers as ExtensionAware).extensions.configure("taskTriggers", block)
idea {
project {
settings {
taskTriggers {
beforeBuild(fixIdeaPluginClasspath, tasks.pluginUnderTestMetadata)
}
}
}
}