get gradle assemble to work

This commit is contained in:
Zlatin Balevsky
2020-12-11 20:12:27 +00:00
parent 067ee80ba0
commit 183280871f
3 changed files with 19 additions and 109 deletions

View File

@ -9,8 +9,8 @@ sourceSets {
}
dependencies {
ext.jettyVersion = '9.2.25.v20180606'
ext.tomcatVersion = '8.5.40'
ext.jettyVersion = '9.3.29.v20201019'
ext.tomcatVersion = '9.0.40'
compile project(':core')
compile 'org.eclipse.jetty:jetty-http:' + ext.jettyVersion
compile 'org.eclipse.jetty:jetty-io:' + ext.jettyVersion

View File

@ -1,7 +1,3 @@
plugins {
id 'idea'
}
String getReleaseVersion() {
def releaseVersion
file("core/java/src/net/i2p/CoreVersion.java").readLines().findAll({ line ->
@ -45,24 +41,6 @@ String getBuiltBy() {
builtBy
}
boolean haveMonotone() {
file("_MTN").exists()
}
String getWorkspaceVersion() {
if (haveMonotone()) {
def stdout = new ByteArrayOutputStream()
exec {
executable 'mtn'
args 'automate', 'get_base_revision_id'
standardOutput = stdout
}
stdout.toString().trim()
} else {
'unknown'
}
}
String compat(String src) {
if (src.contains('.')) {
src.substring(src.lastIndexOf('.') + 1)
@ -71,13 +49,8 @@ String compat(String src) {
}
}
String javaExecutable(String targetJavaHome, String execName) {
def javaExecutablesPath = new File(targetJavaHome, "bin")
def executable = new File(javaExecutablesPath, execName)
if (!executable.exists()) {
throw new IllegalArgumentException("There is no ${execName} executable in ${javaExecutablesPath}")
}
executable.toString()
String getWorkspaceVersion() {
"git" // TODO: extract revision
}
def releaseVersion = getReleaseVersion()
@ -88,14 +61,9 @@ def fullVersion = "$releaseVersion-$buildVersion$buildExtra"
def builtBy = getBuiltBy()
def workspaceVersion = getWorkspaceVersion()
// Exclude apps/ dir itself, but include its subdirs
def javaProjects = subprojects - project(':apps')
configure(javaProjects) {
subprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'eclipse'
apply plugin: 'idea'
repositories {
jcenter()
@ -133,74 +101,16 @@ configure(javaProjects) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
def i2pBootClasspath
// Set java7BootClasspath=/path/to/rt.jar:/path/to/jce.jar in ~/.gradle/gradle.properties if needed
if (java7BootClasspath) {
i2pBootClasspath = java7BootClasspath
} else {
def java7Home = System.getenv("JAVA7_HOME")
if (java7Home) {
i2pBootClasspath = "${java7Home}/jre/lib/jce.jar:${java7Home}/jre/lib/rt.jar"
}
}
if (i2pBootClasspath) {
tasks.withType(AbstractCompile, { AbstractCompile ac ->
ac.options.bootstrapClasspath = files(i2pBootClasspath)
})
} else {
if (JavaVersion.current().java8Compatible && !JavaVersion.current().java9Compatible) {
throw new GradleException("Set java7BootClasspath property or JAVA7_HOME environment variable to enable cross-compilation, or run Gradle with JDK 9+")
}
project.afterEvaluate {
tasks.withType(JavaCompile) {
def version = compat(sourceCompatibility)
logger.info("Configuring $name to use --release $version")
options.compilerArgs.addAll(['--release', version])
}
}
}
// Set up Java override if configured (used to test with Java 7).
def targetJavaHome = System.getenv("TARGET_JAVA_HOME")
if (targetJavaHome) {
if (JavaVersion.current().java9Compatible) {
throw new GradleException("Only set TARGET_JAVA_HOME with JDK 8")
}
project.afterEvaluate {
logger.info("Target Java home set to ${targetJavaHome}")
logger.info("Configuring Gradle to use forked compilation and testing")
tasks.withType(JavaCompile) {
options.fork = true
options.forkOptions.javaHome = file(targetJavaHome)
}
tasks.withType(Javadoc) {
executable = javaExecutable(targetJavaHome, "javadoc")
}
tasks.withType(Test) {
executable = javaExecutable(targetJavaHome, "java")
}
tasks.withType(JavaExec) {
executable = javaExecutable(targetJavaHome, "java")
}
}
}
}
task codeCoverageReport(type: JacocoReport) {
dependsOn(javaProjects.test)
dependsOn(subprojects.test)
jacocoClasspath = project(':core').configurations.jacocoAnt
additionalSourceDirs.from(files(javaProjects.sourceSets.main.allSource.srcDirs))
sourceDirectories.from(files(javaProjects.sourceSets.main.allSource.srcDirs))
classDirectories.from(files(javaProjects.sourceSets.main.output))
executionData.from(files(javaProjects.jacocoTestReport.executionData))
additionalSourceDirs.from(files(subprojects.sourceSets.main.allSource.srcDirs))
sourceDirectories.from(files(subprojects.sourceSets.main.allSource.srcDirs))
classDirectories.from(files(subprojects.sourceSets.main.output))
executionData.from(files(subprojects.jacocoTestReport.executionData))
doFirst {
executionData = files(executionData.findAll { it.exists() })

View File

@ -1,17 +1,17 @@
include 'apps:addressbook'
include 'apps:BOB'
include 'apps:desktopgui'
include 'apps:i2psnark'
include 'apps:ministreaming'
include 'apps:streaming'
include 'apps:i2ptunnel'
include 'apps:jetty'
include 'apps:jrobin'
include 'apps:ministreaming'
include 'apps:routerconsole'
include 'apps:i2psnark'
include 'apps:systray'
include 'apps:BOB'
include 'apps:sam'
include 'apps:streaming'
include 'apps:routerconsole'
include 'apps:desktopgui'
include 'apps:jrobin'
include 'apps:addressbook'
include 'apps:susidns'
include 'apps:susimail'
include 'apps:systray'
include 'core'
include 'installer'
include 'router'