xref: /aosp_15_r20/external/jspecify/conformance-tests/build.gradle (revision 2167191df2fa07300797f1ac5b707370b5f38c48)
1/*
2 * Copyright 2023 The JSpecify Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import org.gradle.api.JavaVersion
18
19plugins {
20    id 'java-library'
21    id 'distribution'
22}
23
24group 'org.jspecify.conformance'
25version '0.0.0-SNAPSHOT'
26
27repositories {
28    mavenCentral()
29}
30
31sourceSets {
32    // Dependencies required by the assertions
33    deps {
34        java {}
35    }
36    // Java files with assertions
37    assertions {
38        java {
39            compileClasspath += sourceSets.deps.output
40        }
41    }
42}
43
44java {
45    sourceCompatibility JavaVersion.VERSION_1_8
46
47    // JAR artifact for dependencies required by the assertions
48    registerFeature("deps") {
49        usingSourceSet(sourceSets.deps)
50    }
51}
52
53distributions {
54    main {
55        contents {
56            into('/assertions') {
57                from sourceSets.assertions.java
58            }
59            into('/deps') {
60                from depsJar
61                from configurations.assertionsRuntimeClasspath
62            }
63            into('/samples') {
64                from '../samples'
65            }
66        }
67    }
68}
69
70dependencies {
71    assertionsImplementation "org.jspecify:jspecify:0.0.0-SNAPSHOT"
72    depsImplementation "org.jspecify:jspecify:0.0.0-SNAPSHOT"
73}
74
75// Make sure assertions compile.
76check.dependsOn(compileAssertionsJava)
77
78publishing {
79    publications {
80        conformanceTests(MavenPublication) {
81            pom {
82                groupId = 'org.jspecify.conformance'
83                artifactId = 'conformance-tests'
84                version = project.version
85                name = 'JSpecify Conformance Test Suite'
86                description = 'Assertions and dependencies representing a suite of conformance tests for JSpecify'
87                url = 'http://jspecify.org/'
88                artifact distZip
89                licenses {
90                    license {
91                        name = 'The Apache License, Version 2.0'
92                        url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
93                    }
94                }
95                scm {
96                    connection = 'scm:git:[email protected]:jspecify/jspecify.git'
97                    developerConnection = 'scm:git:[email protected]:jspecify/jspecify.git'
98                    url = 'https://github.com/jspecify/jspecify/'
99                }
100                developers {
101                    developer {
102                        id = 'netdpb'
103                        name = 'David P. Baker'
104                        email = '[email protected]'
105                    }
106                }
107            }
108        }
109    }
110}
111
112// For local builds to be able to depend on the conformance tests.
113configurations {
114    conformanceTestsZip {
115        canBeConsumed = true
116        canBeResolved = false
117        attributes {
118            attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, 'conformance-tests'))
119        }
120    }
121}
122
123artifacts {
124    conformanceTestsZip distZip
125}
126