aboutsummaryrefslogtreecommitdiffstats
path: root/z3/buildSrc/src/main/kotlin/tools/refinery/z3/gradle/java-library.gradle.kts
blob: 75d64a6f753660ad70b3a3d2ff95e8e3bab483b0 (plain) (blame)
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
/*
 * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
 *
 * SPDX-License-Identifier: Apache-2.0
 */
package tools.refinery.z3.gradle

plugins {
	`java-library`
	`maven-publish`
}

java {
	toolchain {
		languageVersion.set(JavaLanguageVersion.of(21))
	}
}

repositories {
	mavenCentral()

	// Configuration based on https://stackoverflow.com/a/34327202 to pretend that GitHub is an Ivy repository
	// in order to take advantage of Gradle dependency caching.
	val github = ivy {
		setUrl("https://github.com")
		patternLayout {
			artifact("/[organisation]/[module]/releases/download/[module]-[revision]/[classifier].[ext]")
			artifact("/[organisation]/[module]/archive/refs/tags/[module]-[revision].[ext]")
		}
		metadataSources {
			artifact()
		}
	}

	exclusiveContent {
		forRepositories(github)
		filter {
			includeGroup("Z3Prover")
		}
	}
}

val z3: Provider<Configuration> by configurations.registering {
	isCanBeConsumed = false
	isCanBeResolved = true
}

tasks {
	jar {
		manifest {
			attributes(
					"Bundle-SymbolicName" to "${project.group}.${project.name}",
					"Bundle-Version" to project.version
			)
		}
	}
}

publishing.publications {
	register<MavenPublication>("mavenJava") {
		from(components["java"])
		pom {
			licenses {
				license {
					name = "MIT License"
					url = "https://raw.githubusercontent.com/Z3Prover/z3/master/LICENSE.txt"
				}
				license {
					name = "The Apache License, Version 2.0"
					url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
				}
			}
		}
	}
}