Add a docker-based build
Motivation: Because of the current dependency on snapshot versions of the Panama Foreign version of OpenJDK 16, this project is fairly involved to build. Modification: To make it easier for newcomers to build the binaries for this project, a docker-based build is added. The docker image is constructed such that it contains a fresh snapshot build of the right fork of Java. A make file has also been added, which encapsulates the common commands one would use for working with the docker build. Result: It is now easy for newcomers to make builds, and run tests, of this project, as long as they have a working docker installation.
This commit is contained in:
parent
a1785e8161
commit
59b564ddc8
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@ -0,0 +1,6 @@
|
||||
.DS_Store
|
||||
*.iml
|
||||
target
|
||||
.idea
|
||||
*.jfr
|
||||
.git
|
36
Dockerfile
Normal file
36
Dockerfile
Normal file
@ -0,0 +1,36 @@
|
||||
# Prepare environment
|
||||
FROM fedora:latest
|
||||
RUN dnf -y install file findutils unzip zip libXtst-devel libXt-devel libXrender-devel libXrandr-devel \
|
||||
libXi-devel cups-devel fontconfig-devel alsa-lib-devel make autoconf diffutils git clang \
|
||||
java-latest-openjdk-devel
|
||||
|
||||
# Build panama-foreign openjdk
|
||||
WORKDIR /home/build
|
||||
RUN git clone https://github.com/openjdk/panama-foreign.git panama-foreign
|
||||
WORKDIR /home/build/panama-foreign
|
||||
RUN chmod +x configure
|
||||
RUN ./configure --with-debug-level=fastdebug \
|
||||
--with-toolchain-type=clang \
|
||||
--with-vendor-name=jackalope \
|
||||
--enable-warnings-as-errors=no
|
||||
RUN make images
|
||||
ENV JAVA_HOME="/home/build/panama-foreign/build/linux-x86_64-server-fastdebug/images/jdk"
|
||||
|
||||
# Prepare our own build environment
|
||||
WORKDIR /home/build
|
||||
RUN curl https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar -xz
|
||||
ENV PATH=/home/build/apache-maven-3.6.3/bin:$PATH
|
||||
|
||||
# Prepare a snapshot of Netty 5
|
||||
RUN git clone -b master https://github.com/netty/netty.git netty
|
||||
WORKDIR /home/build/netty
|
||||
RUN mvn install -DskipTests -T1C -B -am -pl buffer
|
||||
WORKDIR /home/build
|
||||
|
||||
# Prepare our own build
|
||||
COPY pom.xml pom.xml
|
||||
RUN mvn dependency:go-offline surefire:test -ntp
|
||||
|
||||
# Copy over the project code and run our build
|
||||
COPY . .
|
||||
CMD mvn verify -o -B -C -T1C -fae -nsu -npu
|
22
Makefile
Normal file
22
Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
.PHONY: image test dbg clean build
|
||||
|
||||
image:
|
||||
docker build --tag netty-incubator-buffer:build .
|
||||
|
||||
test: image
|
||||
docker run --rm --name build-container netty-incubator-buffer:build
|
||||
|
||||
dbg:
|
||||
docker create --name build-container-dbg --entrypoint /bin/bash -t netty-incubator-buffer:build
|
||||
docker start build-container-dbg
|
||||
docker exec -it build-container-dbg bash
|
||||
|
||||
clean:
|
||||
docker rm -fv build-container-dbg
|
||||
|
||||
build: image
|
||||
docker create --name build-container netty-incubator-buffer:build
|
||||
docker start -a build-container
|
||||
docker wait build-container
|
||||
docker cp build-container:/home/build/target .
|
||||
docker rm build-container
|
84
pom.xml
84
pom.xml
@ -72,6 +72,7 @@
|
||||
<netty.build.version>28</netty.build.version>
|
||||
<java.version>16</java.version>
|
||||
<junit.version>5.7.0</junit.version>
|
||||
<surefire.version>3.0.0-M5</surefire.version>
|
||||
<skipTests>false</skipTests>
|
||||
<argLine.java9.extras />
|
||||
<!-- Export some stuff which is used during our tests -->
|
||||
@ -110,6 +111,10 @@
|
||||
<compilerArgument>-Xlint:-options</compilerArgument>
|
||||
<meminitial>256m</meminitial>
|
||||
<maxmem>1024m</maxmem>
|
||||
<compilerArgs>
|
||||
<arg>--add-modules</arg>
|
||||
<arg>jdk.incubator.foreign</arg>
|
||||
</compilerArgs>
|
||||
<excludes>
|
||||
<exclude>**/package-info.java</exclude>
|
||||
</excludes>
|
||||
@ -154,16 +159,77 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<version>${surefire.version}</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Test*.java</include>
|
||||
</includes>
|
||||
<runOrder>random</runOrder>
|
||||
<argLine>${argLine.common} ${argLine.printGC} ${argLine.java9}</argLine>
|
||||
<argLine>${argLine.common} ${argLine.printGC} ${argLine.java9} --add-modules jdk.incubator.foreign</argLine>
|
||||
<!-- Ensure the whole stacktrace is preserved when an exception is thrown. See https://issues.apache.org/jira/browse/SUREFIRE-1457 -->
|
||||
<trimStackTrace>false</trimStackTrace>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<!-- Declare the surefire dynamic dependencies explicitly, to speed up the docker build. -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit-platform</artifactId>
|
||||
<version>${surefire.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.3.2</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<version>5.3.2</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>2.28.2</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<version>1.3</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.powermock</groupId>
|
||||
<artifactId>powermock-reflect</artifactId>
|
||||
<version>2.0.5</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>3.9.1</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easytesting</groupId>
|
||||
<artifactId>fest-assert</artifactId>
|
||||
<version>1.4</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<!-- always produce osgi bundles -->
|
||||
<plugin>
|
||||
@ -270,20 +336,6 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>META-INF/native/**</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
20
src/main/java/io/netty/buffer/api/memseg/package-info.java
Normal file
20
src/main/java/io/netty/buffer/api/memseg/package-info.java
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2020 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you 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:
|
||||
*
|
||||
* https://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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Experimental {@code Buf} implementation, based on the MemorySegment API from OpenJDK Panama Foreign.
|
||||
*/
|
||||
package io.netty.buffer.api.memseg;
|
@ -15,6 +15,6 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Experimental {@code Buf} implementation, based on MemorySegment, as a potential alternative to {@code ByteBuf}.
|
||||
* Incubating {@code Buf} API, as a proposed alternative to {@code ByteBuf}.
|
||||
*/
|
||||
package io.netty.buffer.api;
|
||||
|
@ -42,6 +42,11 @@ import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.Stream.Builder;
|
||||
|
||||
import static io.netty.buffer.api.Fixture.Properties.CLEANER;
|
||||
import static io.netty.buffer.api.Fixture.Properties.COMPOSITE;
|
||||
import static io.netty.buffer.api.Fixture.Properties.DIRECT;
|
||||
import static io.netty.buffer.api.Fixture.Properties.HEAP;
|
||||
import static io.netty.buffer.api.Fixture.Properties.POOLED;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
@ -86,12 +91,12 @@ public class BufTest {
|
||||
return Arrays.stream(fxs);
|
||||
}
|
||||
List<Fixture> initFixtures = List.of(
|
||||
new Fixture("heap", Allocator::heap, Properties.HEAP),
|
||||
new Fixture("direct", Allocator::direct, Properties.DIRECT),
|
||||
new Fixture("directWithCleaner", Allocator::directWithCleaner, Properties.DIRECT, Properties.CLEANER),
|
||||
new Fixture("pooledHeap", Allocator::pooledHeap, Properties.POOLED, Properties.HEAP),
|
||||
new Fixture("pooledDirect", Allocator::pooledDirect, Properties.POOLED, Properties.DIRECT),
|
||||
new Fixture("pooledDirectWithCleaner", Allocator::pooledDirectWithCleaner, Properties.POOLED, Properties.DIRECT, Properties.CLEANER));
|
||||
new Fixture("heap", Allocator::heap, HEAP),
|
||||
new Fixture("direct", Allocator::direct, DIRECT),
|
||||
new Fixture("directWithCleaner", Allocator::directWithCleaner, DIRECT, CLEANER),
|
||||
new Fixture("pooledHeap", Allocator::pooledHeap, POOLED, HEAP),
|
||||
new Fixture("pooledDirect", Allocator::pooledDirect, POOLED, DIRECT),
|
||||
new Fixture("pooledDirectWithCleaner", Allocator::pooledDirectWithCleaner, POOLED, DIRECT, CLEANER));
|
||||
Builder<Fixture> builder = Stream.builder();
|
||||
initFixtures.forEach(builder);
|
||||
|
||||
@ -117,7 +122,7 @@ public class BufTest {
|
||||
b.close();
|
||||
}
|
||||
};
|
||||
}, Properties.COMPOSITE));
|
||||
}, COMPOSITE));
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +145,7 @@ public class BufTest {
|
||||
alloc.close();
|
||||
}
|
||||
};
|
||||
}, Properties.COMPOSITE));
|
||||
}, COMPOSITE));
|
||||
|
||||
for (Fixture fixture : initFixtures) {
|
||||
builder.add(new Fixture(fixture + ".ensureWritable", () -> {
|
||||
@ -180,7 +185,7 @@ public class BufTest {
|
||||
allocator.close();
|
||||
}
|
||||
};
|
||||
}, Properties.COMPOSITE));
|
||||
}, COMPOSITE));
|
||||
}
|
||||
|
||||
return builder.build().flatMap(f -> {
|
||||
|
Loading…
Reference in New Issue
Block a user