diff --git a/README.md b/README.md index 65d64ad45..72bd2dc2a 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build.gradle b/build.gradle index be23d8927..5cadeba7f 100644 --- a/build.gradle +++ b/build.gradle @@ -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() \ No newline at end of file +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" + } + } +} +