Skip to content

Commit a2b534f

Browse files
committed
Fix release scripts to take into account cross compilation for linux and mac [skip ci]
1 parent ec8139b commit a2b534f

File tree

14 files changed

+183
-13
lines changed

14 files changed

+183
-13
lines changed

HOWTORELEASE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Release Process
2828
To publish everything in a local repo use command:
2929
- ./scripts/publish-local.sh (publishes scala 2.11 version)
3030
- ./scripts/publish-local-212.sh (publishes scala 2.12 version)
31+
- ./scripts/publish-local-native.sh (publishes native dependencies)
3132
To publish everything into sonatype snapshot repo use:
3233
- ./scripts/publish-all.sh
3334
Summary:

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ resolvers ++= Seq(
1616
)
1717

1818
libraryDependencies ++= Seq(
19-
"io.pdal" %% "pdal" % "1.6.0"
19+
"io.pdal" %% "pdal" % "1.7.0-RC1",
20+
"io.pdal" % "pdal-native" % "1.7.0-RC1"
2021
)
2122
```
2223

@@ -30,17 +31,19 @@ It's required to have native JNI binary in `java.library.path`:
3031
javaOptions += "-Djava.library.path=/usr/local/lib"
3132
```
3233

34+
You can use `pdal-native` dep in case you don't have installed JNI bindings and to avoid steps described above.
35+
3336
## PDAL-Scala
3437

3538
Scala API to build pipeline expressions instead of writing a raw JSON.
3639

3740
```scala
3841
libraryDependencies ++= Seq(
39-
"io.pdal" %% "pdal-scala" % "1.6.0"
42+
"io.pdal" %% "pdal-scala" % "1.7.0-RC1"
4043
)
4144
```
4245

43-
Scala API covers PDAL 1.6.0 but is compatible with PDAL >= 1.4, to use any custom DSL
46+
Scala API covers PDAL 1.7.0 but is compatible with PDAL >= 1.4, to use any custom DSL
4447
that is not covered by the current Scala API you can use `RawExpr` type to build `Pipeline
4548
Expression`.
4649

@@ -75,6 +78,11 @@ val pc: PipelineConstructor = LasRead("/path/to/las") ~ CropFilter() ~ LasWrite(
7578
val pcWithRawExpr = LasRead("/path/to/las") ~ RawExpr(Map("type" -> "filters.crop").asJson) ~ LasWrite("/path/to/new/las")
7679
```
7780

81+
### Demo project example
82+
83+
SBT projects with examples how to add dependencies, and with some working basic example can
84+
be found [here](./examples)
85+
7886
## How to compile
7987

8088
Development purposes (including binaries):
@@ -93,13 +101,11 @@ Finally the possible command to launch and build PDAL JNI bindings could be:
93101

94102
```bash
95103
# Including binaries build
96-
# WARN: PDAL should be built without `-DWITH_PDAL_JNI=ON` flag
97104
./sbt
98105
```
99106

100107
```bash
101108
# Java side development without binaries build
102-
# WARN: PDAL should be built with `-DWITH_PDAL_JNI=ON` flag
103109
PDAL_DEPEND_ON_NATIVE=false ./sbt -Djava.library.path=<path>
104110
```
105111

build.sbt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ lazy val commonSettings = Seq(
4646
<url>http://github.com/pomadchin/</url>
4747
</developer>
4848
</developers>
49-
)
49+
),
50+
PgpKeys.useGpg in Global := true,
51+
PgpKeys.gpgCommand in Global := "gpg"
5052
)
5153

5254
lazy val root = (project in file("."))
@@ -81,4 +83,7 @@ lazy val native = project
8183
.settings(crossPaths := false)
8284
.settings(name := "pdal-native")
8385
.settings(sourceDirectory in nativeCompile := sourceDirectory.value)
86+
.settings(artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
87+
artifact.name + "-" + nativePlatform.value + "-" + module.revision + "." + artifact.extension
88+
})
8489
.enablePlugins(JniNative, JniPackage)

scripts/crosscompile-mac.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
## Script to run cross compilation on Mac OS host machine
4+
## The result of this script would be an jar of a proper version
5+
## Which contains native bindings for Linux (64 bit) and Mac Os (64 bit)
6+
7+
# --suffix: sets the suffix you want to publish lib with
8+
9+
for i in "$@"
10+
do
11+
case $i in
12+
--suffix=*)
13+
PDAL_VERSION_SUFFIX="${i#*=}"
14+
shift
15+
;;
16+
*)
17+
;;
18+
esac
19+
done
20+
21+
export PDAL_VERSION_SUFFIX=${PDAL_VERSION_SUFFIX-"-SNAPSHOT"}
22+
23+
./scripts/crosscompile.sh "$@"
24+
./scripts/pack-native.sh "$@"
25+
./scripts/merge-native.sh "$@"

scripts/crosscompile.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
# --suffix: sets the suffix you want to publish lib with
4+
5+
for i in "$@"
6+
do
7+
case $i in
8+
--suffix=*)
9+
PDAL_VERSION_SUFFIX="${i#*=}"
10+
shift
11+
;;
12+
*)
13+
;;
14+
esac
15+
done
16+
17+
export PDAL_VERSION_SUFFIX=${PDAL_VERSION_SUFFIX-"-SNAPSHOT"}
18+
19+
# Linux
20+
docker run -it --rm \
21+
-v $PWD:/workdir \
22+
-v $HOME/.ivy2:/root/.ivy2 \
23+
-v $HOME/.sbt:/root/.sbt \
24+
daunnc/crossbuild-pdal:latest bash -c "./scripts/pack-native.sh --suffix=${PDAL_VERSION_SUFFIX}"
25+
26+
# Apple cross compilation
27+
# docker run -it --rm -v $PWD:/workdir -e CROSS_TRIPLE=x86_64-apple-darwin daunnc/crossbuild-pdal:latest ./sbt "project native" nativeCompile
28+
29+
# Windows cross compilation
30+
# docker run -it --rm -v $PWD:/workdir -e CROSS_TRIPLE=win64 daunnc/crossbuild-pdal:latest ./sbt "project native" nativeCompile

scripts/docker/1.7.1/crossbuild/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ ENV JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-amd64
1515

1616
RUN echo 'deb http://ftp.us.debian.org/debian/ unstable main contrib non-free' > /etc/apt/sources.list.d/debian-unstable.list
1717

18-
RUN apt-get update && apt-get -y install pdal bash
18+
# https://tracker.debian.org/pkg/pdal
19+
RUN apt-get update && apt-get -y install pdal libpdal-dev bash

scripts/merge-native.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# --suffix: sets the suffix you want to publish lib with
4+
5+
for i in "$@"
6+
do
7+
case $i in
8+
--suffix=*)
9+
PDAL_VERSION_SUFFIX="${i#*=}"
10+
shift
11+
;;
12+
*)
13+
;;
14+
esac
15+
done
16+
17+
export PDAL_VERSION_SUFFIX=${PDAL_VERSION_SUFFIX-"-SNAPSHOT"}
18+
19+
cd ./native/target
20+
rm -f ./pdal-native-1.7.0-SNAPSHOT.jar
21+
rm -rf ./tmp; mkdir -p ./tmp
22+
23+
cd tmp; jar -xf ../pdal-native-x86_64-darwin-1.7.0-SNAPSHOT.jar; cd ~-
24+
cd tmp; jar -xf ../pdal-native-x86_64-linux-1.7.0-SNAPSHOT.jar; cd ~-
25+
26+
jar -cvf pdal-native-1.7.0${PDAL_VERSION_SUFFIX}.jar -C tmp .
27+
28+
cd ./tmp
29+

scripts/pack-native.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# --suffix: sets the suffix you want to publish lib with
4+
5+
for i in "$@"
6+
do
7+
case $i in
8+
--suffix=*)
9+
PDAL_VERSION_SUFFIX="${i#*=}"
10+
shift
11+
;;
12+
*)
13+
;;
14+
esac
15+
done
16+
17+
export PDAL_VERSION_SUFFIX=${PDAL_VERSION_SUFFIX-"-SNAPSHOT"}
18+
19+
echo $PDAL_VERSION_SUFFIX
20+
21+
rm -rf ./native/target/native
22+
./sbt -J-Xmx2G "project native" package
23+
rm -rf ./native/target/native

scripts/publish-212.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@ fi
3030

3131
PDAL_DEPEND_ON_NATIVE=false ./sbt "-212" "project core" ${COMMAND}
3232
PDAL_DEPEND_ON_NATIVE=false ./sbt "-212" "project core-scala" ${COMMAND}
33-
./sbt "-212" "project native" ${COMMAND}

scripts/publish-all.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3-
./scripts/publish.sh "$@"
4-
./scripts/publish-212.sh "$@"
5-
./scripts/publish-javastyle.sh "$@"
3+
# ./scripts/publish.sh "$@"
4+
# ./scripts/publish-212.sh "$@"
5+
# ./scripts/publish-javastyle.sh "$@"
6+
./scripts/publish-native.sh "$@"

0 commit comments

Comments
 (0)