Skip to content

Commit

Permalink
Migrate to use sbt
Browse files Browse the repository at this point in the history
  • Loading branch information
razeghi71 committed Jan 2, 2024
1 parent 001e8db commit 3173785
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 149 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@ gradle.properties
.gradle/
.idea
build/
.bsp
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
.history
.cache
.lib/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ JalaliCalendar is a Persian Calendar for java inspired from Roozh project. It ha
JalaliCalendar is available in central maven repository. add `mavenCentral()` to your repository list in build.gradle. Then add this line to your dependencies:

```gradle
compile 'ir.huri:JalaliCalendar:1.3.3'
compile 'ir.huri:jalalicalendar:<version>'
```

# Getting Started
Expand Down
106 changes: 0 additions & 106 deletions build.gradle

This file was deleted.

54 changes: 54 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import sbt.url

scalaVersion := "2.13.6"

// Java project settings
crossPaths := false
autoScalaLibrary := false

// Project organization settings
organization := "ir.huri"
organizationName := "Marzghi"
organizationHomepage := Some(url("https://github.com/razeghi71/"))

// Project metadata
description := "JalaliCalendar is a Persian Calendar for java inspired from Roozh project. It has a better API and it's more developer friendly"
homepage := Some(url("https://github.com/razeghi71/JalaliCalendar"))
licenses := List("MIT License" -> url("https://opensource.org/licenses/MIT"))

// Developer information
developers := List(
Developer(
id = "razeghi71",
name = "Mohammad Razeghi",
email = "[email protected]",
url = url("https://github.com/razeghi71/")
)
)

// Source Control Management (SCM) information
scmInfo := Some(
ScmInfo(
url("https://github.com/razeghi71/JalaliCalendar"),
"scm:[email protected]:razeghi71/JalaliCalendar.git"
)
)

// Library dependencies
libraryDependencies ++= Seq(
"junit" % "junit" % "4.13.2" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
)

// Publishing settings
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}

publishMavenStyle := true

// POM configuration
pomIncludeRepository := { _ => false }
enablePlugins(GitVersioning)
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.4
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")
2 changes: 0 additions & 2 deletions settings.gradle

This file was deleted.

46 changes: 37 additions & 9 deletions src/main/java/ir/huri/jcal/JalaliCalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
import java.util.Date;
import java.util.GregorianCalendar;

/**
* Model for JalaliCalendar
*/
public class JalaliCalendar {

private int year, month, day;

/**
* Today Jalali Date
* Today's Jalali date
*/
public JalaliCalendar() {
fromGregorian(new GregorianCalendar());
}

/**
* Create a ir.huri.jcal.JalaliCalendar object
* Create a JalaliCalendar object
* @param year Jalali Year
* @param month Jalali Month
* @param day Jalali Day
Expand All @@ -29,7 +31,7 @@ public JalaliCalendar(int year, int month, int day) {


/**
* Create a ir.huri.jcal.JalaliCalendar object from gregorian calendar
* Create a JalaliCalendar object from gregorian calendar
* @param gc gregorian calendar object
*/
public JalaliCalendar(GregorianCalendar gc){
Expand All @@ -38,7 +40,7 @@ public JalaliCalendar(GregorianCalendar gc){


/**
* Create a ir.huri.jcal.JalaliCalendar object from Localdate(java 8)
* Create a JalaliCalendar object from Localdate(java 8)
* @param ld local date object
*/
public JalaliCalendar(LocalDate ld) {
Expand All @@ -47,7 +49,7 @@ public JalaliCalendar(LocalDate ld) {


/**
* Create a ir.huri.jcal.JalaliCalendar object from Date object
* Create a JalaliCalendar object from Date object
* @param date Date object
*/
public JalaliCalendar(Date date) {
Expand Down Expand Up @@ -192,10 +194,16 @@ public boolean isLeap() {
return getLeapFactor(getYear()) == 0;
}

/**
* @return the length of the current year. 366 for leap years and 365 for normal
*/
public int getYearLength() {
return isLeap() ? 366 : 365;
}

/**
* @return return length of the jalalic month
*/
public int getMonthLength() {
if ( getMonth() < 7 ) {
return 31;
Expand All @@ -210,30 +218,53 @@ public int getMonthLength() {
return 0;
}

/**
* @return day
*/
public int getDay() {
return day;
}

/**
* @return month
*/
public int getMonth() {
return month;
}

/**
* @return year
*/
public int getYear() {
return year;
}

/**
* @param month month number to set
*/
public void setMonth(int month) {
this.month = month;
}

/**
* @param year number to set
*/
public void setYear(int year) {
this.year = year;
}

/**
* @param day number to set
*/
public void setDay(int day) {
this.day = day;
}

/**
* @param year year number to set
* @param month month number to set
* @param day day number to set
*/
public void set(int year, int month, int day) {
setYear(year);
setMonth(month);
Expand Down Expand Up @@ -436,7 +467,4 @@ public int getDay() {
return day;
}
}



}
Loading

0 comments on commit 3173785

Please sign in to comment.