Skip to content

Commit

Permalink
Update Mill and fixed build (#3)
Browse files Browse the repository at this point in the history
Fix #4

Pull request: #3
  • Loading branch information
lefou authored Feb 27, 2024
2 parents 463478b + 5bbbe70 commit 83f8dc3
Show file tree
Hide file tree
Showing 8 changed files with 437 additions and 165 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
push:
branches:
- main
tags:
- '**'
pull_request:
workflow_dispatch:

# cancel older runs of a pull request;
# this will not cancel anything for normal git pushes
concurrency:
group: cancel-old-pr-runs-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
java-version: [8, 11, 17]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: temurin

- run: ./mill __.compile + __.test + __.publishLocal testrepo

publish:
needs: [build]
if: github.repository == 'lefou/domino-java' && (startsWith( github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch' ) )

runs-on: ubuntu-latest
concurrency: publish-{{ github.sha }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin

- name: Setup GPG secrets for publish
run: |
gpg --version
cat <(echo "${{ secrets.GPG_SECRET_KEY }}") | base64 --decode | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Publish to Maven Central
run: ./millw -i mill.scalalib.PublishModule/publishAll --sonatypeCreds "${{ secrets.SONATYPE_CREDS }}" --gpgArgs "--passphrase=${{ secrets.GPG_SECRET_KEY_PASS}},--batch,--yes,-a,-b,--pinentry-mode,loopback" --publishArtifacts __.publishArtifacts --readTimeout 600000 --awaitTimeout 600000 --release true --signed true
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.6-88-ecfbc9
0.10.15
74 changes: 38 additions & 36 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import $ivy.`de.tototec::de.tobiasroeser.mill.osgi::0.5.0`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`

import java.io.File

import mill._
Expand All @@ -7,19 +10,15 @@ import mill.modules.Util
import mill.scalalib._
import mill.scalalib.publish._

import $ivy.`de.tototec::de.tobiasroeser.mill.osgi:0.0.6`
import de.tobiasroeser.mill.osgi._

import $ivy.`de.tototec::de.tobiasroeser.mill.publishM2:0.1.0`
import de.tobiasroeser.mill.publishM2._
import de.tobiasroeser.mill.vcs.version.VcsVersion

object main
extends MavenModule
with PublishModule
with OsgiBundleModule
with PublishM2Module {
with OsgiBundleModule {

override def publishVersion = "0.3.1-SNAPSHOT"
override def publishVersion = VcsVersion.vcsState().format()

val url = "https://github.com/domino-osgi/domino-java"

Expand All @@ -41,16 +40,16 @@ object main
override def artifactName = "domino-java"
override def bundleSymbolicName = "domino.java"

def osgiHeaders = T {
override def osgiHeaders = T {
super.osgiHeaders().copy(
`Import-Package` = Seq(
"org.slf4j.*;resolution:=optional",
"""org.slf4j.*;version="[1.7,3)";resolution:=optional""",
"de.tototec.utils.functional.*;resolution:=optional",
"*"
),
`Export-Package` = Seq(
s"""${bundleSymbolicName()};version="0.3.0"""",
s"""${bundleSymbolicName()}.capsule;version="0.1.0""""
s"""${bundleSymbolicName()}""",
s"""${bundleSymbolicName()}"""
)
)
}
Expand Down Expand Up @@ -78,40 +77,44 @@ object main

override def compileIvyDeps = Agg(
// Deps.slf4j.optional(true)
Dep(Deps.slf4j.dep.copy(optional = true), cross = CrossVersion.empty(false), force = false),
Dep(Deps.utilsFunctional.dep.copy(optional = true), cross = CrossVersion.empty(false), force = false)
Dep(Deps.slf4j.dep.withOptional(true), cross = CrossVersion.empty(false), force = false),
Dep(Deps.utilsFunctional.dep.withOptional(true), cross = CrossVersion.empty(false), force = false)
)

def docletIvyDeps = T {
Agg(
Deps.asciiDoclet
)
}
override def javacOptions = Seq("-source", "8", "-target", "8", "-encoding", "UTF-8", "-deprecation")

def docletClasspath = T {
resolveDeps(docletIvyDeps)
}
override def javadocOptions: T[Seq[String]] = super.javadocOptions() ++ Seq("-Xdoclint:none")

// def docletIvyDeps = T {
// Agg(
// Deps.asciiDoclet
// )
// }

// def docletClasspath = T {
// resolveDeps(docletIvyDeps)
// }

override def generatedSources = T {
val dest = T.ctx().dest
Seq("README.adoc", "LICENSE.txt").foreach(f => os.copy.into(millSourcePath / f, dest))
Seq(PathRef(dest))
}

override def javadocOptions = Seq(
"-doclet", "org.asciidoctor.Asciidoclet",
"-docletpath", s"${docletClasspath().map(_.path).mkString(File.pathSeparator)}",
"-overview", s"${millSourcePath / "README.adoc"}",
"--base-dir", s"${millSourcePath}",
"--attributes-file", s"${millSourcePath / 'src / 'main / 'doc / "placeholders.adoc"}",
"--attribute", s"name=${artifactName}",
"--attribute", s"version=${publishVersion}",
"--attribute", s"dominojavaversion=${publishVersion}",
"--attribute", s"title-link=${url}[${bundleSymbolicName} ${publishVersion}]",
"--attribute", "env-asciidoclet=true"
)

object test extends Tests {
// override def javadocOptions = Seq(
// "-doclet", "org.asciidoctor.Asciidoclet",
// "-docletpath", s"${docletClasspath().map(_.path).mkString(File.pathSeparator)}",
// "-overview", s"${millSourcePath / "README.adoc"}",
// "--base-dir", s"${millSourcePath}",
// "--attributes-file", s"${millSourcePath / 'src / 'main / 'doc / "placeholders.adoc"}",
// "--attribute", s"name=${artifactName}",
// "--attribute", s"version=${publishVersion}",
// "--attribute", s"dominojavaversion=${publishVersion}",
// "--attribute", s"title-link=${url}[${bundleSymbolicName} ${publishVersion}]",
// "--attribute", "env-asciidoclet=true"
// )

object test extends Tests with TestModule.Junit4 {
override def ivyDeps = T {
super.ivyDeps() ++ Agg(
Deps.lambdaTest,
Expand All @@ -122,7 +125,6 @@ object main
Deps.utilsFunctional
)
}
def testFrameworks = Seq("com.novocode.junit.JUnitFramework")
}

}
Expand Down
Loading

0 comments on commit 83f8dc3

Please sign in to comment.