-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
99 lines (82 loc) · 2.68 KB
/
build.gradle
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
plugins {
id "com.gradle.plugin-publish" version "0.20.0"
id 'groovy'
id 'java-gradle-plugin'
}
group = 'io.pry.gradle.offline_dependencies'
version = '0.7.0-SNAPSHOT'
description = 'Store project dependencies alongside your code for reproducible offline builds'
repositories {
mavenCentral()
maven { url 'https://repo.gradle.org/gradle/libs-releases' }
}
ext {
mavenVersion = '3.8.5'
jarjarVersion = '1.2.1'
thirdpartyLibsDir = file('libs')
}
configurations {
thirdparty
jarjar
}
dependencies {
implementation gradleApi()
implementation localGroovy()
implementation fileTree(thirdpartyLibsDir)
// thirdparty dependencies and repackaging
jarjar "org.gradle.jarjar:jarjar:$jarjarVersion"
thirdparty "org.apache.maven:maven-model-builder:$mavenVersion"
}
task repackageDependencies(type: Jar) {
archiveBaseName = 'offline-dependencies-plugin-thirdparty-repackaged-all'
archiveVersion = project.version
destinationDirectory = thirdpartyLibsDir
doLast {
project.ant {
taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask", classpath: configurations.jarjar.asPath
jarjar(destfile: archiveFile.get().asFile) {
configurations.thirdparty.each { originalJar ->
zipfileset(src: originalJar)
}
rule(pattern: 'org.**', result: 'io.pry.gradle.offline_dependencies.repackaged.org.@1')
rule(pattern: 'com.**', result: 'io.pry.gradle.offline_dependencies.repackaged.com.@1')
rule(pattern: 'licenses.**', result: 'io.pry.gradle.offline_dependencies.repackaged.licenses.@1')
}
}
}
}
compileJava.dependsOn 'repackageDependencies'
jar {
from(zipTree(repackageDependencies.outputs.files.singleFile)) {
include '**'
}
archivesBaseName = 'offline-dependencies-plugin'
manifest {
attributes(
'Created-By': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})".toString(),
'Implementation-Title': project.description,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Marc Dietrichstein'
)
}
}
gradlePlugin {
plugins {
gradleOfflineDependenciesPlugin {
id = 'io.pry.gradle.offline_dependencies'
implementationClass = 'io.pry.gradle.offline_dependencies.OfflineDependenciesPlugin'
}
}
}
pluginBundle {
website = 'https://github.com/mdietrichstein/gradle-offline-dependencies-plugin'
vcsUrl = 'https://github.com/mdietrichstein/gradle-offline-dependencies-plugin'
description = project.description
tags = ['offline', 'buildscript-dependency', 'buildscript-configurations', 'jar', 'pom', 'reproducible', 'offline-dependencies']
plugins {
offlineDependenciesPlugin {
id = project.group
displayName = 'Gradle Offline Dependencies Plugin'
}
}
}