-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
93 lines (77 loc) · 2.56 KB
/
build.gradle
File metadata and controls
93 lines (77 loc) · 2.56 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
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.codehaus.groovy:groovy-all:2.3.6'
classpath 'nu.studer:gradle-plugindev-plugin:1.0.3'
}
}
apply plugin: 'cpp'
apply plugin: 'objective-c'
apply plugin: 'groovy'
apply plugin: 'nu.studer.plugindev'
group = 'com.github.cr0'
// find osx sdk
def osxSDKRoot = new File("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/")
if (!osxSDKRoot.exists()) throw new GradleException("SDK root does not exist")
def sdk = null
for (def c : osxSDKRoot.listFiles()) {
if (c.name.compareTo("MacOSX10.8.sdk") < 0) continue // fancy ;)
if (sdk == null) sdk = c.name
else if (sdk.compareTo(c.name) < 0) sdk = c.name
}
if (sdk == null) throw new GradleException("No feasible SDK found")
def osxSDK = new File(osxSDKRoot, sdk)
model {
platforms {
osx {
operatingSystem "osx"
}
}
buildTypes {
release
}
}
executables {
main {
baseName "JavaAppLauncher"
}
all {
binaries.all {
if (targetPlatform.operatingSystem.macOsX) {
objcCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
objcCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/darwin"
objcCompiler.args '-F', "${org.gradle.internal.jvm.Jvm.current().javaHome}/../../"
linker.args '-framework', "Cocoa"
linker.args '-isysroot', osxSDK.absolutePath
}
}
}
}
plugindev {
pluginId 'com.github.cr0.macappbundle'
pluginName 'gradle-macappbundle-plugin'
pluginImplementationClass 'com.github.cr0.gradle.macAppBundle.MacAppBundlePlugin'
pluginDescription 'A Gradle Plugin to create a Mac OSX .app application based on the project with customizable class paths.'
pluginLicenses 'Apache-2.0'
pluginTags 'gradle', 'osx', 'appbundle'
authorId 'cr0'
authorName 'Christian Roth'
authorEmail 'christian.roth@port17.de'
projectUrl 'https://github.com/cr0/gradle-macappbundle-plugin'
projectInceptionYear '2015'
done() // do not omit this
}
bintray {
user = System.properties['bintray_user']
key = System.properties['bintray_api_key']
pkg.repo = 'gradle-plugins'
}
task copyStub(type: Copy, dependsOn: 'mainExecutable') {
from 'build/binaries/mainExecutable/'
into 'src/main/resources/com/github/cr0/macAppBundle/'
outputs.upToDateWhen { false }
}
compileGroovy.dependsOn += copyStub