Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ javadoc
lib
tmp
run-test
/.gradle
.idea
139 changes: 139 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
buildscript {
dependencies {
classpath files('gradle/gradle-witness.jar')
}
}

apply plugin: 'java'
apply plugin: 'witness'
apply plugin: 'maven-publish'
apply plugin: 'application'

compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}

version = "37"

repositories {
maven { url "http://4thline.org/m2" }
maven { url 'https://mvn.freenetproject.org' }
jcenter()
}

configurations {
extraLibs
}

dependencies {
compile group: 'org.freenetproject', name: 'fred', version: 'build+'
compile group: 'org.yaml', name: 'snakeyaml', version: '1.5'
testImplementation 'junit:junit:4.13'
}

dependencyVerification {
verify = [
'org.freenetproject:fred:a6021924f7e6572c19d5c290755c16bdbb7dfcb1a948a46dd8425c9eaa3d5079',
'org.yaml:snakeyaml:9cf5e385cea2aaa58eb943a6a63c3a674d9ba00d88eca480548294d93c7b85c0',
'org.bouncycastle:bcprov-jdk15on:1c31e44e331d25e46d293b3e8ee2d07028a67db011e74cb2443285aed1d59c85',
'net.java.dev.jna:jna-platform:f1d00c167d8921c6e23c626ef9f1c3ae0be473c95c68ffa012bc7ae55a87e2d6',
'net.java.dev.jna:jna:0c8eb7acf67261656d79005191debaba3b6bf5dd60a43735a245429381dbecff',
'org.freenetproject:freenet-ext:32f2b3d6beedf54137ea2f9a3ebef67666d769f0966b08cd17fd7db59ba4d79f',
]
}

def gitrev
task buildInfo {
try {
def cmd = "git describe --always --abbrev=4 --dirty"
def proc = cmd.execute()
gitrev = proc.text.trim()
} catch (java.io.IOException e) {
gitrev = "@unknown@"
}
}

test {
useJUnit()
}

application {
mainClassName = 'plugins.Library.ui.TestInterface'
}


import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;

Date getMTime(String file) {
return new Date(Files.readAttributes(Paths.get(file), BasicFileAttributes.class).lastModifiedTime().toMillis());
}

jar {
manifest {
attributes 'Plugin-Main-Class': 'plugins.Library.Main',
'Main-Class': 'plugins.Library.ui.TestInterface',
'Required-Node-Version': '1239',
'Implementation-Version': version,
'Built-By': System.getProperty('user.name'),
'Built-Date': getMTime("src/main/java/plugins/Library/Version.java"),
'Built-JDK': System.getProperty('java.version')
}
from (configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) }) {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
preserveFileTimestamps = false
reproducibleFileOrder = true
duplicatesStrategy = "exclude"
archiveName = 'freenet-Library.jar'
}

def jars = []
gradle.addListener(new TaskExecutionListener() {
void afterExecute(Task task, TaskState state) {
if(task in AbstractArchiveTask) {
jars << task.outputs.files.singleFile
}
}

void beforeExecute(Task task) { }
})
gradle.addBuildListener(new BuildAdapter() {
void buildFinished(BuildResult result) {
if(jars) {
def hash = {
File file -> def sha256 = java.security.MessageDigest.getInstance('SHA-256')
file.eachByte(1024 * 4) { buffer, len -> sha256.update(buffer, 0, len) }
println "SHA-256 of ${file.name}: ${sha256.digest().encodeHex().toString()}"
}

jars.each { hash(it) }
}
}
})

publishing {
publications {
mavenJava(MavenPublication) {
groupId 'org.freenetproject.plugins'
artifactId "Library"
version version
from components.java
}
}
repositories {
maven {
url "s3://mvn.freenetproject.org/"
credentials(AwsCredentials) {
accessKey System.getenv('AWS_ACCESS_KEY_ID')
secretKey System.getenv('AWS_SECRET_ACCESS_KEY')
}
}
}
}

73 changes: 0 additions & 73 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,79 +29,6 @@
</fileset>
</path>

<exec executable="git"
failifexecutionfails="false"
errorProperty="git.errror"
outputproperty="git.describe"
resultproperty="git.result">
<arg value="describe" />
<arg value="--always" />
<arg value="--abbrev=4" />
</exec>
<condition property="git.revision" value="${git.describe}" else="@unknown@">
<and>
<equals arg1="${git.result}" arg2="0" />
<isset property="git.describe" />
</and>
</condition>

<!-- ================================================== -->
<target name="mkdir">
<mkdir dir="${build}"/>
<mkdir dir="${build-test}"/>
<mkdir dir="${run-test}"/>
<mkdir dir="${dist}"/>
<echo message="Using ${freenet-cvs-snapshot.location} as freenet-cvs-snapshot.jar"/>
<echo message="Using ${freenet-ext.location} as freenet-ext.jar"/>
</target>

<!-- ================================================== -->
<target name="build-dep">
<mkdir dir="lib/"/>
<mkdir dir="${tmp}"/>
<ant target="SnakeYAML-get"/>
<!--<ant target="KeyExplorer-get"/>-->
<delete dir="${tmp}"/>
</target>

<property name="SnakeYAML.mirror" value="https://downloads.freenetproject.org/snakeyaml-1.5.jar" />
<property name="SnakeYAML.md5" value="1788db5d529a981b090632b8e49b8cd2" />
<property name="SnakeYAML.sha" value="a3654035d0b68db775034afa5425a62250de8184" />
<available property="SnakeYAML.exist" classname="org.yaml.snakeyaml.Yaml" classpathref="lib.path"/>
<target name="SnakeYAML-get" unless="SnakeYAML.exist">
<get verbose="true" src="${SnakeYAML.mirror}" dest="${tmp}/snakeyaml-1.5.jar" />
<checksum file="${tmp}/snakeyaml-1.5.jar" algorithm="MD5" property="${SnakeYAML.md5}" verifyProperty="SnakeYAMLMD5ok" />
<checksum file="${tmp}/snakeyaml-1.5.jar" algorithm="SHA" property="${SnakeYAML.sha}" verifyProperty="SnakeYAMLSHAok" />
<fail message="SnakeYAML.zip checksum mismatch">
<condition>
<or>
<equals arg1="${SnakeYAMLMD5ok}" arg2="false" />
<equals arg1="${SnakeYAMLSHAok}" arg2="false" />
</or>
</condition>
</fail>
<move file="${tmp}/snakeyaml-1.5.jar" todir="lib/" />
</target>

<!--<property name="KeyExplorer.mirror" value="http://cloud.github.com/downloads/freenet/plugin-Library-staging/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" />
<property name="KeyExplorer.md5" value="be5f1ec860fe71c55d029ebe0350f129" />
<property name="KeyExplorer.sha" value="12bf9bc1b4d436424e43c6b509b87690ac887de1" />
<available property="KeyExplorer.exist" classname="plugins.KeyExplorer.KeyExplorerUtils" classpathref="lib.path"/>
<target name="KeyExplorer-get" unless="KeyExplorer.exist">
<get verbose="true" src="${KeyExplorer.mirror}" dest="${tmp}/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" />
<checksum file="${tmp}/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" algorithm="MD5" property="${KeyExplorer.md5}" verifyProperty="KeyExplorerMD5ok" />
<checksum file="${tmp}/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" algorithm="SHA" property="${KeyExplorer.sha}" verifyProperty="KeyExplorerSHAok" />
<fail message="KeyExplorer.jar checksum mismatch">
<condition>
<or>
<equals arg1="${KeyExplorerMD5ok}" arg2="false" />
<equals arg1="${KeyExplorerSHAok}" arg2="false" />
</or>
</condition>
</fail>
<move file="${tmp}/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" todir="lib/" />
</target>-->

<!-- ================================================== -->
<target name="setver" if="version.present">
<!-- Update the Version.java file in ${build}-->
Expand Down
Binary file added gradle/gradle-witness.jar
Binary file not shown.
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionSha256Sum=8626cbf206b4e201ade7b87779090690447054bc93f052954c78480fa6ed186e
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading