diff --git a/README.md b/README.md index 8c937731e..816df45c9 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,13 @@ To start developing YaCy in Eclipse: - → Name: "YaCy Build" → Buildfile: Browse Workspace → build.xml → Run - In the Package Explorer, right-click on YaCy → Run as → Java Application -> Select "yacy - net.yacy" -> OK +To start developing YaCy in Netbeans: + +- clone https://github.com/yacy/yacy_search_server.git (Team → Git → Clone) + - if you checked "scan for project" you'll be ask to open the project +- Open the project (File → Open Project) +- you may directly use all the Netbeans build feature. + To join our development community, got to https://searchlab.eu Send pull requests to https://github.com/yacy/yacy_search_server diff --git a/build.gradle b/build.gradle index 11c0b89c0..36acf219e 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ buildscript { plugins { id 'java' + id 'distribution' id 'maven-publish' id 'com.github.johnrengelman.shadow' version '5.1.0' } @@ -71,7 +72,9 @@ tasks.withType(JavaCompile) { } dependencies { - implementation project ('libbuild:J7Zip-modified') // support library in libbuild +// implementation project ('libbuild:J7Zip-modified') // support library in libbuild (fyi: downside groovy/gradle use internal *.class instead of *.jar = trouble in task packageDist) +// implementation 'net.yacy.extlib:J7Zip-modified:1.02' // alternatively support library from mavenLocal() repo (use publishToMavenLocal in subproject first) + implementation fileTree(dir: 'lib', include: 'J7Zip-modified.jar') // switched back to use local lib/jar for this one library (avoiding sub-project execution w/o need) implementation 'org.apache.james:apache-mime4j:0.6' implementation 'org.apache.calcite.avatica:avatica-core:1.13.0' @@ -216,7 +219,7 @@ task runGitComInf(type: JavaExec) { // prepare yacyBuildProperties.java from template (needed after commits or new versions) // read values from property file generated by GitComInf tool import org.apache.tools.ant.filters.ReplaceTokens -task prepYaCyProperties (type: Copy) { +task prepYaCyProperties (type: Copy, dependsOn : ['runGitComInf']) { mustRunAfter runGitComInf def propfile = "build/tmp/gitbuildnumber.properties"; if (project.file(propfile).exists()) { // must check otherwise any action may stop after clean on this error @@ -239,12 +242,11 @@ task prepYaCyProperties (type: Copy) { filter(ReplaceTokens, tokens: [REPL_VERSION: version, REPL_PKGMANAGER:"false", REPL_RESTARTCMD: "/etc/init.d/yacy restart"]) // gradle.project.version + some defaults from ant } } -prepYaCyProperties.dependsOn(runGitComInf) -compileJava.dependsOn(prepYaCyProperties) // must be executed before compile +compileJava.dependsOn(prepYaCyProperties) // must be executed before compile (due to source template filtering) // implement ant task to simulate old Ant build for htroot, // to avoid import of complete build.xml (as currently used) -task compileHtrootServlets { +task compileHtrootServlets (dependsOn: ['jar']) { ant { path(id:'project.class.path') { @@ -254,7 +256,7 @@ task compileHtrootServlets { configurations.compileClasspath.each { pathelement (location: it) } } javac (srcdir:'htroot', excludes:'processing/**', - source:'1.8', target:'1.8', + source:java.sourceCompatibility, target:java.targetCompatibility, debug:"true", debuglevel:"lines,vars,source", includeantruntime:"false", encoding:"UTF-8") { classpath (refid:'project.class.path') } @@ -262,3 +264,164 @@ task compileHtrootServlets { } startScripts.dependsOn(compileHtrootServlets) +// copy additional files into directory used to create distribution archive (distZip/distTar) +task copyFilesToDistDir (dependsOn : ['compileJava', 'jar', 'compileHtrootServlets']) { + String instDir = "$buildDir/RELEASE/MAIN/" + outputs.files fileTree(instDir) + + copy { + from 'addon' + into instDir + "addon" + } + copy { + from 'bin' + into instDir + "bin" + } + copy { + from 'defaults' + into instDir + "defaults" + } + copy { + from 'dictionaries' + into instDir + "dictionaries" + } + copy { + from 'examples' + into instDir + "examples" + } + copy { + from 'htroot' + into instDir + "htroot" + } + copy { + from 'langdetect' + into instDir + "langdetect" + } + copy { + from 'lib' + include '*.License' + into instDir + "lib" + } + copy { + from 'libbuild' + exclude '**/build/**' + exclude '**/target/**' + into instDir + "libbuild" + } + copy { + from 'locales' + into instDir + "locales" + } + copy { + from 'skins' + into instDir + "skins" + } + copy { + from 'source' + into instDir + "source" + } + copy { + from 'vocabularies' + into instDir + "vocabularies" + } + copy { + from new File('.') + include '*.bat' + include '*.sh' + include 'gradlew' + include 'AUTHORS' + include 'COPYRIGHT' + include 'NOTICE' + include 'readme.txt' + include 'ChangeLog' + include 'gpl.txt' + include 'yacy.yellow' + include '*.properties' + include 'build.gradle' + include 'settings.gradle' + include 'build.xml' + into instDir + } +} +distZip.dependsOn(copyFilesToDistDir) +distTar.dependsOn(copyFilesToDistDir) + +// declare distribution source directory to be added to archives +distributions { + main { + // Gradle appends always the version to the BaseName so this doesn't work, + // legacy archive name must be archieved by file rename + // + // String Dst = project.ext.filterTokens.get('DSTAMP') + // String rNr = project.ext.filterTokens.get('releaseNr') + // String branch = project.ext.filterTokens.get('branch') + // + // distributionBaseName = 'yacy' + branch + '_v' + version + '_' + Dst + '_' + rNr + + contents { // fyi: content completed by copyFilesToDistDir + from 'build/RELEASE/MAIN' + } + } +} + +// copy runtime dependencies (jar) to the distribution directory +task copyDependenciesForDistribution { +// do a late copy of dependencies to dist lib directory to not interfere with standard distZip +// which includes the lib (and bin) directory by default +// actually if copied early (e.g. task copyFilesToDistDir) final Gradle zip/tar archive has all files double in lib dir (believe it or not) + + String instDir = "$buildDir/RELEASE/MAIN/" + copy { // needed for legacy distribution file (task packageDist) - (fyi: gradle.distXxx includes it autom. in dist archive) + def destination = project.file(instDir + "lib") + from configurations.compileClasspath + eachFile { // prevent overwriting existing files + if (it.getRelativePath().getFile(destination).exists()) { + it.exclude() + } + } + into instDir + "lib" + } + copy { + from 'lib' + include 'yacycore.jar' + into instDir + "lib" + } +} + +// create a legacy distribution zip archive +task packageDistZip (type : Zip, dependsOn : ['copyDependenciesForDistribution','copyFilesToDistDir','prepYaCyProperties'] ) { + + String Dst = project.ext.filterTokens.get('DSTAMP') + String rNr = project.ext.filterTokens.get('releaseNr') + String branch = project.ext.filterTokens.get('branch') + String destName = 'yacy' + branch + '_v' + version + '_' + Dst + '_' + rNr + '.' + archiveExtension.get() + + archiveFileName = destName + destinationDirectory = layout.buildDirectory.dir('distributions') + + from layout.buildDirectory.dir("RELEASE/MAIN") + into 'yacy' +} + +// create a legacy distribution gz/tar archive +task packageDistTar (type : Tar, dependsOn : ['copyDependenciesForDistribution','copyFilesToDistDir','prepYaCyProperties']) { + + compression 'GZIP' + String Dst = project.ext.filterTokens.get('DSTAMP') + String rNr = project.ext.filterTokens.get('releaseNr') + String branch = project.ext.filterTokens.get('branch') + String destName = 'yacy' + branch + '_v' + version + '_' + Dst + '_' + rNr + '.tar.gz' // ! Gradle would use ext .tgz (archiveExtension.get()) + + archiveFileName = destName + destinationDirectory = layout.buildDirectory.dir('distributions') + + from layout.buildDirectory.dir("RELEASE/MAIN") + into 'yacy' +} + +// wrapper to create legacy distribution archives +task packageDist (dependsOn : ['copyDependenciesForDistribution','packageDistZip','packageDistTar']) { + // do a late copy of dependencies to dist lib directory to not interfere with standard distZip + // which includes the lib (and bin) directory by default (task copyDependenciesForDistribution) + // actually if copied early (e.g. in task copyFilesToDistDir) final Gradle zip/tar archive has all files double in lib dir (believe it or not) +} diff --git a/libbuild/J7Zip-modified/build.gradle b/libbuild/J7Zip-modified/build.gradle index 9b6c9de16..e5a65da25 100644 --- a/libbuild/J7Zip-modified/build.gradle +++ b/libbuild/J7Zip-modified/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java-library' + id 'maven-publish' } /** Port of older support library to be build with Gradle @@ -22,3 +23,42 @@ sourceSets { } version = '1.02' +group = 'net.yacy.extlib' + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'J7Zip-modified' + from components.java + versionMapping { + usage('java-api') { + fromResolutionOf('runtimeClasspath') + } + usage('java-runtime') { + fromResolutionResult() + } + } + pom { + name = 'J7Zip' + description = 'J7Zip library for YaCy sevenzipParser (not available in external maven repository)' + licenses { + license { + name = 'GNU Lesser General Public License 2.1' + url = 'http://www.gnu.org/licenses/lgpl-2.1.txt' + } + } + scm { + connection = 'scm:git:https://github.com/yacy/yacy_search_server.git' + url = 'https://github.com/yacy/yacy_search_server' + } + } + } + } + repositories { + maven { + // change URLs to point to your repos, e.g. http://my.org/repo + def releasesRepoUrl = layout.buildDirectory.dir('repos/releases') + } + } +} + diff --git a/settings.gradle b/settings.gradle index da552e08c..1bff82ebd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,2 @@ rootProject.name = 'yacycore' -include ('libbuild:J7Zip-modified')