Migrate from Maven to Gradle 3.4 for building.

This commit is contained in:
Andreas Schildbach
2018-03-06 21:13:17 +01:00
parent a6fd71b767
commit aaa5262ef4
23 changed files with 147 additions and 1123 deletions

View File

@@ -15,13 +15,5 @@
# limitations under the License.
set -e
# Check if the jar has been built.
if [ ! -e target/build-checkpoints.jar ]; then
echo "Compiling BuildCheckpoints to a JAR"
cd ..
mvn package -DskipTests
cd tools
fi
java -jar target/build-checkpoints.jar "$@"
args="$@"
gradle -q build_checkpoints "-PappArgs=$args"

View File

@@ -1,33 +0,0 @@
@echo off
rem Copyright by the original author or authors.
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem Check if the jar has been built.
set TARGET_JAR=build-checkpoints.jar
if not exist "target/%TARGET_JAR%" goto BUILD
goto RUN
:BUILD
echo Compiling BuildCheckpoints to a JAR
cd ..
call mvn package -DskipTests
cd tools
:RUN
for /R "target/" %%F in (%TARGET_JAR%) do set JAR_NAME=%%~nxF
java -jar "target/%JAR_NAME%" %1 %2 %3 %4 %5 %6 %7 %8

26
tools/build.gradle Normal file
View File

@@ -0,0 +1,26 @@
apply plugin: 'java'
dependencies {
implementation project(':core')
implementation 'com.google.guava:guava:24.0-android'
implementation 'net.sf.jopt-simple:jopt-simple:4.3'
implementation 'org.slf4j:slf4j-jdk14:1.7.25'
}
sourceCompatibility = 1.8
task wallet_tool(type: JavaExec) {
description = 'Print and manipulate wallets.'
main = 'org.bitcoinj.tools.WalletTool'
if (project.hasProperty('appArgs') && appArgs.length() > 0)
args = Arrays.asList(appArgs.split("\\s+"))
classpath = sourceSets.main.runtimeClasspath
}
task build_checkpoints(type: JavaExec) {
description = 'Create checkpoint files to use with CheckpointManager.'
main = 'org.bitcoinj.tools.BuildCheckpoints'
if (project.hasProperty('appArgs') && appArgs.length() > 0)
args = Arrays.asList(appArgs.split("\\s+"))
classpath = sourceSets.main.runtimeClasspath
}

View File

@@ -1,115 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2012 Google Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-parent</artifactId>
<version>0.15-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bitcoinj-tools</artifactId>
<name>bitcoinj Tools</name>
<description>A collection of useful tools that use the bitcoinj library to perform wallet operations</description>
<build>
<plugins>
<!-- Create wallet-tool.jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<!-- Remove dead classes -->
<minimizeJar>true</minimizeJar>
<filters>
<filter>
<!-- exclude signatures, the bundling process breaks them for some reason -->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<id>shade-wallet-tool</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.bitcoinj.tools.WalletTool</mainClass>
</transformer>
</transformers>
<outputFile>target/wallet-tool.jar</outputFile>
</configuration>
</execution>
<execution>
<id>shade-build-checkpoints</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.bitcoinj.tools.BuildCheckpoints</mainClass>
</transformer>
</transformers>
<outputFile>target/build-checkpoints.jar</outputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.bitcoinj</groupId>
<artifactId>bitcoinj-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.167</version>
</dependency>
</dependencies>
</project>

View File

@@ -15,13 +15,5 @@
# limitations under the License.
set -e
# Check if the jar has been built.
if [ ! -e target/wallet-tool.jar ] || [[ "$ALWAYS_BUILD_WALLETTOOL" != "" ]]; then
echo "Compiling WalletTool to a JAR"
cd ..
mvn package -DskipTests
cd tools
fi
java -jar target/wallet-tool.jar "$@"
args="$@"
gradle -q wallet_tool "-PappArgs=$args"

View File

@@ -1,34 +0,0 @@
@echo off
rem Copyright by the original author or authors.
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem Check if the jar has been built.
set TARGET_JAR=wallet-tool.jar
if not exist "target/%TARGET_JAR%" goto BUILD
if defined ALWAYS_BUILD_WALLETTOOL goto BUILD
goto RUN
:BUILD
echo Compiling WalletTool to a JAR
cd ..
call mvn package -DskipTests
cd tools
:RUN
for /R "target/" %%F in (%TARGET_JAR%) do set JAR_NAME=%%~nxF
java -jar "target/%JAR_NAME%" %1 %2 %3 %4 %5 %6 %7 %8