|
15 | 15 | */
|
16 | 16 |
|
17 | 17 | apply plugin: 'java'
|
| 18 | +apply from: "https://raw.githubusercontent.com/gocd/gocd-plugin-gradle-task-helpers/master/helper.gradle?_=${(int) (new Date().toInstant().epochSecond / 60)}" |
| 19 | + |
| 20 | +gocdPlugin { |
| 21 | + id = 'cd.go.authorization.okta' |
| 22 | + pluginVersion = '2.0.1' |
| 23 | + goCdVersion = '19.2.0' |
| 24 | + name = 'Okta oauth authorization plugin' |
| 25 | + description = 'Okta oauth authorization plugin for GoCD' |
| 26 | + vendorName = 'Svetlin Zamfirov' |
| 27 | + vendorUrl = 'https://github.com/gocd-contrib/gocd-okta-oauth-authorization-plugin' |
| 28 | + |
| 29 | + githubRepo { |
| 30 | + owner = System.getenv('GITHUB_USER') ?: 'bob' |
| 31 | + repo = 'gocd-okta-oauth-authorization-plugin' |
| 32 | + token = System.getenv('GITHUB_TOKEN') ?: 'bad-token' |
| 33 | + } |
18 | 34 |
|
19 |
| -apply from: 'plugin-common.gradle' |
| 35 | + pluginProject = project |
20 | 36 |
|
21 |
| -project.ext.pluginVersion = '2.0.0' |
22 |
| -project.ext.fullVersion = project.distVersion ? "${project.pluginVersion}-${project.distVersion}" : project.pluginVersion |
| 37 | + prerelease = !"No".equalsIgnoreCase(System.getenv('PRERELEASE')) |
| 38 | + assetsToRelease = [project.tasks.jar] |
23 | 39 |
|
24 |
| -version = project.fullVersion |
25 |
| -group = 'cd.go' |
| 40 | + licenseReport { |
| 41 | + excludes = [ |
| 42 | + 'com.squareup.okio:okio' // Seems to not be able to resolve license, not sure if POM issue or jk1-license-report issue. Maybe due to no jar? |
| 43 | + ] |
| 44 | + } |
| 45 | +} |
26 | 46 |
|
27 |
| -project.ext.pluginDesc = [ |
28 |
| - id : 'cd.go.authorization.okta', |
29 |
| - version : project.fullVersion, |
30 |
| - goCdVersion: '19.2.0', |
31 |
| - name : 'Okta oauth authorization plugin', |
32 |
| - description: 'Okta oauth authorization plugin for GoCD', |
33 |
| - vendorName : 'szamfirov', |
34 |
| - vendorUrl : 'https://github.com/szamfirov/okta-oauth-authorization-plugin' |
35 |
| -] |
| 47 | +group = 'cd.go' |
| 48 | +version = gocdPlugin.fullVersion(project) |
36 | 49 |
|
37 | 50 | repositories {
|
38 |
| - jcenter() |
| 51 | + mavenCentral() |
39 | 52 | mavenLocal()
|
40 | 53 | }
|
41 | 54 |
|
42 |
| -dependencies { |
43 |
| - compileOnly group: 'cd.go.plugin', name: 'go-plugin-api', version: '23.3.0' |
44 |
| - compile group: 'com.google.code.gson', name: 'gson', version: '2.10.1' |
45 |
| - compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.8.1' |
46 |
| - |
47 |
| - testCompile group: 'cd.go.plugin', name: 'go-plugin-api', version: '23.3.0' |
48 |
| - testCompile group: 'junit', name: 'junit', version: '4.12' |
49 |
| - testCompile group: 'org.mockito', name: 'mockito-core', version: '2.2.28' |
50 |
| - testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3' |
51 |
| - testCompile group: 'org.skyscreamer', name: 'jsonassert', version: '1.4.0' |
52 |
| - testCompile group: 'org.jsoup', name: 'jsoup', version: '1.10.2' |
53 |
| - testCompile 'com.squareup.okhttp3:mockwebserver:3.8.1' |
| 55 | +java { |
| 56 | + sourceCompatibility = JavaVersion.VERSION_11 |
| 57 | + targetCompatibility = JavaVersion.VERSION_11 |
54 | 58 | }
|
55 | 59 |
|
56 |
| -processResources { |
57 |
| - from("src/main/resource-templates") { |
58 |
| - filesMatching('plugin.xml') { |
59 |
| - expand project.pluginDesc |
60 |
| - } |
61 |
| - |
62 |
| - filesMatching('plugin.properties') { |
63 |
| - expand project.pluginDesc |
64 |
| - } |
| 60 | +configurations.all { |
| 61 | + resolutionStrategy.dependencySubstitution { |
| 62 | + substitute module("junit:junit") using module("io.quarkus:quarkus-junit4-mock:3.0.0.Final") because "We don't want JUnit 4; but is an unneeded transitive of mockwebserver." |
65 | 63 | }
|
66 | 64 | }
|
67 | 65 |
|
68 |
| -tasks.withType(Jar) { jarTask -> |
69 |
| - preserveFileTimestamps = false |
70 |
| - reproducibleFileOrder = true |
| 66 | +ext { |
| 67 | + deps = [ |
| 68 | + gocdPluginApi: 'cd.go.plugin:go-plugin-api:23.3.0', |
| 69 | + ] |
71 | 70 |
|
72 |
| - ['MD5', 'SHA1', 'SHA-256'].each { algo -> |
73 |
| - jarTask.outputs.files("${jarTask.archivePath}.${algo}") |
74 |
| - jarTask.doLast { |
75 |
| - ant.checksum file: jarTask.archivePath, format: 'MD5SUM', algorithm: algo |
76 |
| - } |
77 |
| - } |
| 71 | + versions = project.ext.deps.collectEntries { lib, libGav -> [lib, libGav.split(':').last()] } |
| 72 | +} |
78 | 73 |
|
79 |
| - manifest { |
80 |
| - attributes( |
81 |
| - 'Go-Version': project.pluginDesc.goCdVersion, |
82 |
| - 'Plugin-Revision': project.pluginDesc.version, |
83 |
| - 'Implementation-Title': project.name, |
84 |
| - 'Implementation-Version': project.version, |
85 |
| - 'Source-Compatibility': project.sourceCompatibility, |
86 |
| - 'Target-Compatibility': project.targetCompatibility |
87 |
| - ) |
88 |
| - } |
| 74 | +dependencies { |
| 75 | + compileOnly project.deps.gocdPluginApi |
| 76 | + implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' |
| 77 | + implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.11.0' |
| 78 | + |
| 79 | + testImplementation project.deps.gocdPluginApi |
| 80 | + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.4.0' |
| 81 | + testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2' |
| 82 | + testImplementation group: 'org.skyscreamer', name: 'jsonassert', version: '1.5.1' |
| 83 | + testImplementation group: 'org.jsoup', name: 'jsoup', version: '1.16.1' |
| 84 | + testImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '4.11.0' |
| 85 | + |
| 86 | + testImplementation platform('org.junit:junit-bom:5.10.0') |
| 87 | + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api' |
| 88 | + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params' |
| 89 | + testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine' |
| 90 | + testRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-launcher' |
89 | 91 | }
|
90 | 92 |
|
91 |
| -sourceSets { |
92 |
| - test { |
93 |
| - java { |
94 |
| - compileClasspath += configurations.compileOnly |
95 |
| - runtimeClasspath += configurations.compileOnly |
96 |
| - } |
97 |
| - } |
| 93 | +test { |
| 94 | + useJUnitPlatform() |
98 | 95 | }
|
99 | 96 |
|
100 | 97 | jar {
|
101 |
| - from(configurations.compile) { |
| 98 | + from(configurations.runtimeClasspath) { |
102 | 99 | into "lib/"
|
103 | 100 | }
|
104 |
| - |
105 |
| -// This is useful for debugging |
106 |
| -// from(sourceSets.main.java) { |
107 |
| -// into "/" |
108 |
| -// } |
109 | 101 | }
|
0 commit comments