Release scala source jars to bintray (#767)

Tested with a dry run:
Copying .../com_github_digital_asset_daml/bazel-out/k8-fastbuild/bin/ledger/api-server-damlonx/api-server-damlonx_src.jar
to .../com/daml/ledger/api-server-damlonx_2.12/100.12.11/api-server-damlonx_2.12-100.12.11-sources.jar
This commit is contained in:
Jussi Mäki 2019-04-29 17:11:01 +02:00 committed by GitHub
parent f4b79c7518
commit d887b21036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 29 deletions

View File

@ -17,6 +17,7 @@ HEAD — ongoing
- Remove DAML-LF Dev major version, ``--target dev`` option, and sandbox ``--allow-dev``
option. A "1.dev" target will handle the intended "Dev" use cases in a future release.
- Include list of DAML packages used during interpretation in the produced transaction.
- Release source jars for scala libraries.
0.12.11 - 2019-04-26
--------------------

View File

@ -47,25 +47,25 @@
- target: //daml-lf/transaction/src/main/protobuf:blindinginfo_java_proto
type: jar-proto
- target: //daml-lf/transaction:transaction
type: jar
type: jar-scala
- target: //daml-lf/transaction-scalacheck:transaction-scalacheck
type: jar
- target: //daml-lf/lfpackage:lfpackage
type: jar
type: jar-scala
- target: //daml-lf/interface:interface
type: jar
type: jar-scala
- target: //daml-lf/validation:validation
type: jar
type: jar-scala
- target: //daml-lf/interpreter:interpreter
type: jar
type: jar-scala
- target: //daml-lf/scenario-interpreter:scenario-interpreter
type: jar
type: jar-scala
- target: //daml-lf/engine:engine
type: jar
type: jar-scala
- target: //daml-lf/repl:repl
type: jar
- target: //daml-lf/testing-tools:testing-tools
type: jar
type: jar-scala
- target: //ledger-api/grpc-definitions:ledger-api-protos-tarball
type: targz
location:
@ -92,27 +92,27 @@
- target: //ledger-api/grpc-definitions:ledger-api-scalapb
type: jar
- target: //ledger-api/testing-utils:testing-utils
type: jar
type: jar-scala
- target: //language-support/scala/bindings:bindings
type: jar
type: jar-scala
- target: //ledger-api/rs-grpc-akka:rs-grpc-akka
type: jar
type: jar-scala
- target: //ledger/ledger-api-akka:ledger-api-akka
type: jar
type: jar-scala
- target: //scala-protoc-plugins/scala-logging:scala-logging-lib
type: jar
type: jar-scala
- target: //ledger/ledger-api-scala-logging:ledger-api-scala-logging
type: jar
type: jar-scala
- target: //ledger/backend-api:backend-api
type: jar
type: jar-scala
- target: //ledger/ledger-api-client:ledger-api-client
type: jar
type: jar-scala
- target: //ledger/ledger-api-domain:ledger-api-domain
type: jar
type: jar-scala
- target: //ledger/ledger-api-common:ledger-api-common
type: jar
type: jar-scala
- target: //ledger/sandbox:sandbox
type: jar
type: jar-scala
- target: //ledger/ledger-api-integration-tests:semantic-test-runner
type: jar-deploy
- target: //ledger/ledger-api-test-tool:ledger-api-test-tool
@ -122,7 +122,7 @@
- target: //language-support/scala/codegen:codegen-main
type: jar
- target: //language-support/scala/bindings-akka:bindings-akka
type: jar
type: jar-scala
- target: //language-support/java/codegen:shaded_binary
type: jar
- target: //navigator/backend:navigator-binary
@ -132,16 +132,16 @@
- target: //language-support/codegen-main:shaded_binary
type: jar
- target: //ledger/participant-state:participant-state
type: jar
type: jar-scala
- target: //ledger/participant-state/reference:reference
type: jar
type: jar-scala
- target: //ledger/participant-state-index:participant-state-index
type: jar
type: jar-scala
- target: //ledger/participant-state-index/reference:reference
type: jar
type: jar-scala
- target: //ledger/api-server-damlonx:api-server-damlonx
type: jar
type: jar-scala
- target: //ledger/participant-state/kvutils:daml_kvutils_java_proto
type: jar-proto
- target: //ledger/participant-state/kvutils:kvutils
type: jar
type: jar-scala

View File

@ -62,7 +62,18 @@ data ReleaseType
| Jar JarType
deriving Show
data JarType = Plain | Lib | Deploy | Proto
data JarType
= Plain
-- ^ Plain java or scala library, without source jar.
| Lib
-- ^ A java library jar, with a source jar.
| Deploy
-- ^ Deploy jar, e.g. a fat jar containing transitive deps.
| Proto
-- ^ A java protobuf library (*-speed.jar).
| Scala
-- ^ A scala library jar, with a source jar. Use when source jar
-- is desired, otherwise use 'Plain'.
deriving (Eq, Show)
instance FromJSON ReleaseType where
@ -74,6 +85,7 @@ instance FromJSON ReleaseType where
"jar-lib" -> pure $ Jar Lib
"jar-deploy" -> pure $ Jar Deploy
"jar-proto" -> pure $ Jar Proto
"jar-scala" -> pure $ Jar Scala
_ -> fail ("Could not parse release type: " <> unpack t)
data Artifact c = Artifact
@ -115,7 +127,8 @@ buildTargets art@Artifact{..} =
| otherwise = artTarget
(directory, _) = splitBazelTarget artTarget
in [jarTarget, pomTar] <>
[BazelTarget ("//" <> directory <> ":" <> srcJar) | Just srcJar <- pure (sourceJarName art)]
[BazelTarget ("//" <> directory <> ":" <> srcJar) | Just srcJar <- pure (sourceJarName art)] <>
[BazelTarget ("//" <> directory <> ":" <> srcJar) | Just srcJar <- pure (scalaSourceJarName art)]
Zip -> [artTarget]
TarGz -> [artTarget]
@ -191,12 +204,17 @@ mainFileName releaseType name =
Lib -> "lib" <> name <> ".jar"
Deploy -> name <> "_deploy.jar"
Proto -> "lib" <> T.replace "_java" "" name <> "-speed.jar"
Scala -> name <> ".jar"
sourceJarName :: Artifact a -> Maybe Text
sourceJarName Artifact{..}
| Jar Lib <- artReleaseType = Just $ "lib" <> snd (splitBazelTarget artTarget) <> "-src.jar"
| otherwise = Nothing
scalaSourceJarName :: Artifact a -> Maybe Text
scalaSourceJarName Artifact{..}
| Jar Scala <- artReleaseType = Just $ snd (splitBazelTarget artTarget) <> "_src.jar"
| otherwise = Nothing
-- | Given an artifact, produce a list of pairs of an input file and the corresponding output file.
artifactFiles :: E.MonadThrow m => AllArtifacts -> Artifact PomData -> m [(Path Rel File, Path Rel File)]
@ -217,10 +235,14 @@ artifactFiles allArtifacts art@Artifact{..} = do
mbSourceJarIn <- traverse (parseRelFile . unpack) (sourceJarName art)
sourceJarOut <- parseRelFile (unpack (pomArtifactId #"-"# pomVersion # ostxt # "-sources" # mainExt artReleaseType))
mbScalaSourceJarIn <- traverse (parseRelFile . unpack) (scalaSourceJarName art)
scalaSourceJarOut <- parseRelFile (unpack (pomArtifactId #"-"# pomVersion # ostxt # "-sources" # mainExt artReleaseType))
pure $
[(directory </> mainArtifactIn, outDir </> mainArtifactOut) | shouldRelease allArtifacts artPlatformDependent] <>
[(directory </> pomFileIn, outDir </> pomFileOut) | isJar artReleaseType, shouldRelease allArtifacts (PlatformDependent False)] <>
[(directory </> sourceJarIn, outDir </> sourceJarOut) | shouldRelease allArtifacts (PlatformDependent False), Just sourceJarIn <- pure mbSourceJarIn]
[(directory </> sourceJarIn, outDir </> sourceJarOut) | shouldRelease allArtifacts (PlatformDependent False), Just sourceJarIn <- pure mbSourceJarIn] <>
[(directory </> scalaSourceJarIn, outDir </> scalaSourceJarOut) | shouldRelease allArtifacts (PlatformDependent False), Just scalaSourceJarIn <- pure mbScalaSourceJarIn]
shouldRelease :: AllArtifacts -> PlatformDependent -> Bool
shouldRelease (AllArtifacts allArtifacts) (PlatformDependent platformDependent) =