Skip to content

Commit

Permalink
Close #143 - Add core sub-project
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-lee committed Jan 9, 2020
1 parent 1747b99 commit 3656a7f
Show file tree
Hide file tree
Showing 51 changed files with 41 additions and 29 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Expand Up @@ -26,7 +26,7 @@ jobs:
${{ runner.os }}-ivy-scala-2_10-
- name: Build for Scala 2.10
run: .github/workflows/sbt-build-simple.sh 2.10.7
run: .github/workflows/sbt-build-simple.sh core 2.10.7

build_scala2_11:
runs-on: ubuntu-latest
Expand All @@ -50,7 +50,7 @@ jobs:
${{ runner.os }}-ivy-scala-2_11-
- name: Build for Scala 2.11
run: .github/workflows/sbt-build-simple.sh 2.11.12
run: .github/workflows/sbt-build-simple.sh core 2.11.12

build_scala2_12:
runs-on: ubuntu-latest
Expand All @@ -74,7 +74,7 @@ jobs:
${{ runner.os }}-ivy-scala-2_12-
- name: Build for Scala 2.12
run: .github/workflows/sbt-build-simple.sh 2.12.10
run: .github/workflows/sbt-build-simple.sh core 2.12.10

build_scala2_13:
runs-on: ubuntu-latest
Expand All @@ -100,4 +100,4 @@ jobs:
- name: Build for Scala 2.13
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: .github/workflows/sbt-build.sh 2.13.0
run: .github/workflows/sbt-build.sh core 2.13.0
15 changes: 8 additions & 7 deletions .github/workflows/release.yml
Expand Up @@ -17,16 +17,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_AUTH_TOKEN }}
run: |
echo "Run] sbt GitHub release"
echo 'sbt -J-Xmx2048m "; clean; +test; +packagedArtifacts; gitHubRelease"'
sbt -J-Xmx2048m "; clean; +test; +packagedArtifacts; gitHubRelease"
echo 'sbt -J-Xmx2048m "; project core; clean; +test; +packagedArtifacts; gitHubRelease"'
sbt -J-Xmx2048m "; project core; clean; +test; +packagedArtifacts; gitHubRelease"
- name: sbt Publish
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_PASS: ${{ secrets.BINTRAY_PASS }}
run: |
echo "Run] sbt GitHub release"
echo 'sbt -J-Xmx2048m "; clean; +publish"'
sbt -J-Xmx2048m "; clean; +publish"
echo 'sbt -J-Xmx2048m "; project core; clean; +publish"'
sbt -J-Xmx2048m "; project core; clean; +publish"
- name: Sync to Maven Central
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
Expand All @@ -35,10 +35,11 @@ jobs:
PROJECT_VERSION="${GITHUB_REF#refs/tags/v}"
BINTRAY_SUBJECT=kevinlee
BINTRAY_REPO=maven
BINTRAY_PACKAGE=just-fp
BINTRAY_PACKAGE=just-fp-core
echo "BINTRAY_SUBJECT: $BINTRAY_SUBJECT"
echo " BINTRAY_REPO: $BINTRAY_REPO"
echo "BINTRAY_PACKAGE: $BINTRAY_PACKAGE"
echo "PROJECT_VERSION: $PROJECT_VERSION"
echo "Sync to Maven Central..."
curl --user $BINTRAY_USER:$BINTRAY_PASS -X POST "https://api.bintray.com/maven_central_sync/$BINTRAY_SUBJECT/$BINTRAY_REPO/$BINTRAY_PACKAGE/versions/$PROJECT_VERSION"
# Uncomment once Bintray is connected to JCenter
# echo "Sync to Maven Central..."
# curl --user $BINTRAY_USER:$BINTRAY_PASS -X POST "https://api.bintray.com/maven_central_sync/$BINTRAY_SUBJECT/$BINTRAY_REPO/$BINTRAY_PACKAGE/versions/$PROJECT_VERSION"
13 changes: 7 additions & 6 deletions .github/workflows/sbt-build-simple.sh
Expand Up @@ -2,23 +2,24 @@

set -x

if [ -z "$1" ]
if [ -z "$2" ]
then
echo "Scala version is missing. Please enter the Scala version."
echo "sbt-build-simple.sh 2.11.12"
echo "Missing parameters. Please enter the [project] and [Scala version]."
echo "sbt-build-simple.sh core 2.12.10"
exit 1
else
scala_version=$1
project_name=$1
scala_version=$2
echo "============================================"
echo "Build projects (Simple)"
echo "--------------------------------------------"
echo ""
CURRENT_BRANCH_NAME="${GITHUB_REF#refs/heads/}"
if [[ "$CURRENT_BRANCH_NAME" == "master" || "$CURRENT_BRANCH_NAME" == "release" ]]
then
sbt -J-Xmx2048m "; ++ ${scala_version}!; clean; test; packagedArtifacts"
sbt -J-Xmx2048m "; project ${project_name}; ++ ${scala_version}! -v; clean; test; packagedArtifacts"
else
sbt -J-Xmx2048m "; ++ ${scala_version}!; clean; test; package"
sbt -J-Xmx2048m "; project ${project_name}; ++ ${scala_version}! -v; clean; test; package"
fi

echo "============================================"
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/sbt-build.sh
Expand Up @@ -2,26 +2,27 @@

set -x

if [ -z "$1" ]
if [ -z "$2" ]
then
echo "Scala version is missing. Please enter the Scala version."
echo "sbt-build.sh 2.11.12"
echo "Missing parameters. Please enter the [project] and [Scala version]."
echo "sbt-build.sh core 2.12.10"
exit 1
else
scala_version=$1
project_name=$1
scala_version=$2
echo "============================================"
echo "Build projects"
echo "--------------------------------------------"
echo ""
export CI_BRANCH="${GITHUB_REF#refs/heads/}"
if [[ "$CI_BRANCH" == "master" || "$CI_BRANCH" == "release" ]]
then
sbt -J-Xmx2048m "; ++ ${scala_version}!; clean; coverage; test; coverageReport; coverageAggregate"
sbt -J-Xmx2048m "; ++ ${scala_version}!; coveralls"
sbt -J-Xmx2048m "; ++ ${scala_version}!; clean; packagedArtifacts"
sbt -J-Xmx2048m "; project ${project_name}; ++ ${scala_version}!; clean; coverage; test; coverageReport; coverageAggregate"
sbt -J-Xmx2048m "; project ${project_name}; ++ ${scala_version}!; coveralls"
sbt -J-Xmx2048m "; project ${project_name}; ++ ${scala_version}!; clean; packagedArtifacts"
else
sbt -J-Xmx2048m "; ++ ${scala_version}!; clean; coverage; test; coverageReport; coverageAggregate; package"
sbt -J-Xmx2048m "; ++ ${scala_version}!; coveralls"
sbt -J-Xmx2048m "; project ${project_name}; ++ ${scala_version}!; clean; coverage; test; coverageReport; coverageAggregate; package"
sbt -J-Xmx2048m "; project ${project_name}; ++ ${scala_version}!; coveralls"
fi


Expand Down
15 changes: 12 additions & 3 deletions build.sbt
Expand Up @@ -30,13 +30,22 @@ ThisBuild / scmInfo :=
, "git@github.com:Kevin-Lee/just-fp.git"
))

def prefixedProjectName(name: String) = s"just-fp${if (name.isEmpty) "" else s"-$name"}"

lazy val justFp = (project in file("."))
.enablePlugins(DevOopsGitReleasePlugin)
.settings(
name := "just-fp"
name := prefixedProjectName("")
, description := "Just FP Lib"
)
.dependsOn(core)

lazy val core = (project in file("core"))
.enablePlugins(DevOopsGitReleasePlugin)
.settings(
name := prefixedProjectName("core")
, description := "Just FP Lib - Core"
, unmanagedSourceDirectories in Compile ++= {
val sharedSourceDir = (baseDirectory in ThisBuild).value / "src/main"
val sharedSourceDir = baseDirectory.value / "src/main"
if (scalaVersion.value.startsWith("2.13") || scalaVersion.value.startsWith("2.12"))
Seq(sharedSourceDir / "scala-2.12_2.13")
else
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3656a7f

Please sign in to comment.