forked from gluck/il-repack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
121 lines (103 loc) · 4.52 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import org.gradle.internal.os.OperatingSystem
plugins {
id "com.ullink.msbuild" version "2.10"
id "com.ullink.nuget" version "2.8"
id "com.ullink.nunit" version "1.2"
id "com.ullink.opencover" version "1.1"
}
archivesBaseName = 'ILRepack'
defaultTasks('nugetPack')
assemblyInfoPatcher {
version = project.version + '.0'
}
msbuild.dependsOn nugetRestore
msbuild {
solutionFile = 'ILRepack.sln'
configuration = OperatingSystem.current().unix ? 'Debug_unix' : 'Release'
projectName = 'ILRepack'
inputs.file(project.buildFile)
}
nunit {
exclude 'LongRunning'
testAssemblies = [ msbuild.projects['ILRepack.Tests'].properties.TargetPath, msbuild.projects['ILRepack.IntegrationTests'].properties.TargetPath ]
}
nunit.dependsOn msbuild
task nunitLongRunning(type: nunit.class) {
include 'LongRunning'
testAssemblies = [ msbuild.projects['ILRepack.IntegrationTests'].properties.TargetPath ]
}
nunitLongRunning.dependsOn msbuild
ext.repackList = ['ILRepack.exe', 'Fasterflect.dll', 'BamlParser.dll', '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, nunitLongRunning]) {
inputs.files {
def workingDir = msbuild.mainProject.getProjectPropertyPath('OutputPath')
return project.ext.repackList.collect { new File(workingDir, it) }
}
ext.repacked = new File(temporaryDir, 'ILRepack.exe')
ext.repackedLib = new File(temporaryDir, 'ILRepack.dll')
outputs.files([ext.repacked, ext.repackedLib, ext.repacked.path.replace('.exe','.pdb')])
}
repack << {
exec {
workingDir = msbuild.mainProject.getProjectPropertyPath('OutputPath')
commandLine = [new File(workingDir, 'ILRepack.exe'), '/log', '/wildcards', '/internalize', '/ndebug', '/out:'+ext.repacked] + project.ext.repackList
}
exec {
workingDir = msbuild.mainProject.getProjectPropertyPath('OutputPath')
commandLine = [new File(workingDir, 'ILRepack.exe'), '/log', '/wildcards', '/internalize', '/keyfile:'+file('ILRepack/ILRepack.snk'), '/out:'+ext.repackedLib, '/target:library'] + project.ext.repackList
}
}
def commonNuspecMetadata(def meta) {
meta.version version
meta.title 'ILRepack - Open-source alternative to ILMerge'
meta.authors 'Francois Valdy'
meta.owners 'Francois Valdy'
meta.projectUrl('https://github.com/gluck/il-repack')
meta.copyright 'Copyright © Francois Valdy 2011-2015'
}
// nuget package for upload to nuget
nugetPack {
nuspec {
metadata() {
commonNuspecMetadata(delegate)
id archivesBaseName
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'
}
delegate.files() {
delegate.file(src: repack.ext.repacked, target: 'tools')
}
}
}
task nugetPackLib(type: com.ullink.NuGetPack) {
nuspec {
metadata() {
commonNuspecMetadata(delegate)
id archivesBaseName+'.Lib'
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 provides a library, for use within tools/build projects.
If you need the tool as an executable, this is not the package you're looking for, this one is: http://www.nuget.org/packages/ILRepack/.'''
requireLicenseAcceptance false
summary 'ILRepack is a utility that can be used to merge multiple .NET assemblies into a single assembly (Packaged as library)'
}
delegate.files() {
delegate.file(src: repack.ext.repackedLib, target: 'lib/net40')
}
}
}
nugetPack.dependsOn([repack, nugetPackLib])
nugetPackLib.dependsOn repack
// nuget package upload, requires API key to be set
nugetPush {
apiKey = project.properties.nugetApiKey
nupkgFile = nugetPack.packageFile
}
task nugetPushLib(type: com.ullink.NuGetPush) {
apiKey = project.properties.nugetApiKey
nupkgFile = nugetPackLib.packageFile
}
nugetPush.dependsOn nugetPushLib