forked from gluck/il-repack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
134 lines (113 loc) · 4.61 KB
/
build.gradle
File metadata and controls
134 lines (113 loc) · 4.61 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
ext.ullinkGradleScripts = 'https://raw.github.com/gluck/gradle-scripts/master'
apply from: "${ext.ullinkGradleScripts}/task-rules.gradle"
apply from: "${ext.ullinkGradleScripts}/functions.gradle"
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "com.ullink.gradle:gradle-msbuild-plugin:1.9"
classpath "com.ullink.gradle:gradle-nuget-plugin:1.1"
}
}
apply plugin:'msbuild'
apply plugin:'nuget'
archivesBaseName = 'ILRepack'
version = '1.24.0'
defaultTasks('nugetPack', 'zip')
def removeExtension(String path) {
path.replaceFirst(~/(?<=.)\.[^\.]+$/, '')
}
msbuild {
def netVersion = project.version + '.0'
replaceAssemblyAttribute('ILRepack/Properties/AssemblyInfo.cs', 'AssemblyVersion', netVersion)
replaceAssemblyAttribute('ILRepack/Properties/AssemblyInfo.cs', 'AssemblyFileVersion', netVersion)
solutionFile = 'ILRepack.sln'
configuration = 'Debug'
projectName = 'ILRepack'
inputs.file(project.buildFile)
}
ext.repackList = ['ILRepack.exe', 'Mono.Cecil.dll', 'Mono.Cecil.Mdb.dll', 'Mono.Cecil.Pdb.dll', 'Mono.Posix.dll']
// repacking of all dependencies in a single exe
task repack(dependsOn: msbuild) {
inputs.files {
workingDir = msbuild.mainProject.getProjectPropertyPath('OutputPath')
return project.ext.repackList.collect { new File(workingDir, it) }
}
ext.repacked = new File(temporaryDir, 'ILRepack.exe')
outputs.files([ext.repacked, removeExtension(ext.repacked.path)+'.pdb'])
}
repack << {
exec {
workingDir = msbuild.mainProject.getProjectPropertyPath('OutputPath')
commandLine = [new File(workingDir, 'ILRepack.exe'), '/log', '/wildcards', '/out:'+ext.repacked] + project.ext.repackList
}
}
// bootstrap ILRepack exe for integrity checking
task bootstrap(dependsOn: repack) {
inputs.files repack.outputs
ext.tmp = new File(temporaryDir, 'ILRepack_tmp.exe')
outputs.files([ext.tmp, removeExtension(ext.tmp.path)+'.pdb'])
}
bootstrap << {
exec {
commandLine = [repack.ext.repacked, '/log', '/out:'+ext.tmp, repack.ext.repacked]
}
}
// target package for upload to github
task zip(type: Zip) {
from repack.outputs.getFiles()
archiveName = "${archivesBaseName}_${version}.zip"
}
// nuget package for upload to nuget
nugetPack {
nuspec {
metadata() {
id archivesBaseName
delegate.version version
title 'ILRepack - Open-source alternative to ILMerge'
authors 'Francois Valdy'
owners 'Francois Valdy'
projectUrl('https://github.com/gluck/il-repack')
delegate.description '''ILRepack is meant at replacing ILMerge / Mono.Merge.
The former being closed-source, impossible to customize, slow, resource consuming and many more. The later being deprecated, unsupported, and based on an old version of Mono.Cecil.'''
requireLicenseAcceptance false
summary 'ILRepack is a utility that can be used to merge multiple .NET assemblies into a single assembly'
copyright 'Copyright © Francois Valdy 2011-2012'
}
delegate.files() {
delegate.file(src: repack.ext.repacked, target: 'tools')
}
}
}
task nugetPackLib(type: com.ullink.NuGetPack) {
nuspec {
metadata() {
id archivesBaseName+'.Lib'
delegate.version version
title 'ILRepack.Lib - Open-source alternative to ILMerge'
authors 'Francois Valdy'
owners 'Francois Valdy'
projectUrl('https://github.com/gluck/il-repack')
delegate.description '''ILRepack is meant at replacing ILMerge / Mono.Merge.
The former being closed-source, impossible to customize, slow, resource consuming and many more. The later being deprecated, unsupported, and based on an old version of Mono.Cecil.
This package includes the exe as a library, for use within tools/build projects.'''
requireLicenseAcceptance false
summary 'ILRepack is a utility that can be used to merge multiple .NET assemblies into a single assembly (Packaged as library)'
copyright 'Copyright © Francois Valdy 2011-2012'
}
delegate.files() {
delegate.file(src: repack.ext.repacked, target: 'lib')
}
}
}
nugetPack.dependsOn([repack, bootstrap, msbuild, nugetPackLib])
// nuget package upload, requires API key to be set
nugetPush {
nupkgFile = nugetPack.getPackageFile()
}
task nugetPushLib(type: com.ullink.NuGetPush) {
nupkgFile = nugetPackLib.getPackageFile()
}
nugetPush.dependsOn(nugetPushLib)