Created
May 19, 2018 16:16
-
-
Save nwillc/4489aaa4629a64c68f6c943f51c2c075 to your computer and use it in GitHub Desktop.
Gradle task to build an OS X app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task osxApp { | |
dependsOn jar | |
doLast { | |
def dist = "${buildDir}/app/${project.name}.app" | |
mkdir("$dist/Contents/MacOS") | |
mkdir("$dist/Contents/Resources") | |
ant.copy(file: "src/main/app/Info.plist", todir: "$dist/Contents") | |
ant.copy(file: "src/main/app/launcher", todir: "$dist/Contents/MacOS") { | |
filterset { | |
filter(token: 'APP_JAR', value: "${project.name}-${version}.jar") | |
filter(token: 'APP_NAME', value: project.name) | |
filter(token: 'JAVA_VERSION', value: jvm_version) | |
} | |
} | |
ant.copy(file: "src/main/app/application.icns", todir: "$dist/Contents/Resources") | |
ant.copy(file: "build/libs/${project.name}-${version}.jar", todir: "$dist/Contents/MacOS") | |
project.exec { | |
commandLine('chmod', '+x', "$dist/Contents/MacOS/launcher") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment