summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <b.buelte@yahoo.com>2022-01-27 20:30:09 +0100
committerunknown <b.buelte@yahoo.com>2022-01-27 20:30:09 +0100
commit4a55bb751516bcd97505e6a573effe7ac0e594e8 (patch)
treea5868cae4e8956b6060884e112d3141d5625e1a8
parent78c8ae7d054abf5d5f1d756b9e5a570cca301360 (diff)
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.
-rw-r--r--README.md2
-rw-r--r--build.gradle41
2 files changed, 38 insertions, 5 deletions
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"
+ }
+ }
+}
+