Add distMacApp task to Gradle build script

I'm not a MAC user so I'd to do it blind !
but now it's migrated from Ant an can be fine tuned.
pull/461/head
unknown 3 years ago
parent 78c8ae7d05
commit 4a55bb7515

@ -187,7 +187,7 @@ Compiling YaCy:
- Compile: `gradlew build` - then you can `./startYACY.sh` or `./startYACY.bat`.
- Create a release tarball and zip archive: `gradlew packageDist`.
- Create a Windows installer release exe: `gradlew distWinInstaller`.
- Create a macOS release: not yet availabe with gradle (old build `ant distMacApp` (only works on macOS)).
- Create a macOS release: `gradlew distMacApp`.
- Work with Eclipse or other IDE: Within the IDE you also need to start the gradle build process
because the servlet pages are not compiled by the IDE build process.
after the dist procedure, the release can be found in the build/distributions subdirectory.

@ -218,7 +218,7 @@ task copyFilesToDistDir (type: Copy, dependsOn : ['compileJava', 'jar', 'compile
include 'gradle/**'
include 'htroot/**'
include 'langdetect/**'
include 'lib/**'
//include 'lib/**' // do not copy old ant lib, gradle dependencies will be copied into lib by task copy copyDependenciesForDistribution
include 'libbuild/**'
include 'locales/**'
include 'skins/**'
@ -265,8 +265,6 @@ distributions {
from 'build/RELEASE/MAIN'
exclude 'lib/*.jar'
// define unix/linux file permission
fileMode 0644
dirMode 0755
eachFile { file ->
if(file.getName().endsWith(".sh")) {
file.setMode(0755)
@ -439,4 +437,39 @@ def expandedTaskList = []
gradle.startParameter.taskNames.each {
expandedTaskList << (buildAliases[it] ? buildAliases[it] : it)
}
gradle.startParameter.taskNames = expandedTaskList.flatten()
gradle.startParameter.taskNames = expandedTaskList.flatten()
// create a Mac distribution archive
import org.apache.tools.ant.taskdefs.condition.Os
task distMacApp (type: Copy, dependsOn: ['copyFilesToDistDir'], group: 'distribution') {
description 'Bundles the project as a Mac distribution - task must run on Mac'
from 'build/RELEASE/MAIN'
into 'build/RELEASE/MAC/YaCy.app/Contents/MacOS'
eachFile { file ->
if(file.getName().endsWith(".sh")) {
file.setMode(0755)
}
}
copy {
from 'addon/YaCy.app'
into 'build/RELEASE/MAC/YaCy.app'
}
doLast {
if (Os.isFamily(Os.FAMILY_MAC)) {
String Dst = project.ext.filterTokens.get('REPL_DATE')
String rNr = project.ext.filterTokens.get('REPL_REVISION_NR')
String branch = project.ext.filterTokens.get('branch')
String theArchiveName = 'yacy' + branch + '_v' + project.version + '_' + Dst + '_' + rNr + '.dmg'
ant {
exec (executable:'hdiutil') {
arg (line:'create -srcfolder build/RELEASE/MAC/YaCy.app build/distributions/' + theArchiveName)
}
}
} else {
println "this task [distMacApp] can only run on a Mac"
}
}
}

Loading…
Cancel
Save