Skip to content

Commit

Permalink
Require data argument in WeekViewItem again
Browse files Browse the repository at this point in the history
  • Loading branch information
thellmund committed Dec 24, 2021
1 parent f2e7ad6 commit c24d73e
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ internal val Calendar.year: Int

internal fun Calendar.isEqual(other: Calendar) = timeInMillis == other.timeInMillis

internal fun Calendar.isNotEqual(other: Calendar) = isEqual(other).not()

internal operator fun Calendar.plus(days: Days): Calendar {
return copy().apply {
add(Calendar.DATE, days.days)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ internal fun ResolvedWeekViewEntity.toWeekViewItem(): WeekViewItem {
cornerRadius = style.cornerRadius,
),
configuration = WeekViewItem.Configuration(
respectDayGap = this is WeekViewEntity.Event<*>,
respectDayGap = this is ResolvedWeekViewEntity.Event<*>,
arrangement = when (this) {
is ResolvedWeekViewEntity.Event<*> -> WeekViewItem.Arrangement.Foreground
is ResolvedWeekViewEntity.BlockedTime -> WeekViewItem.Arrangement.Background
},
canBeDragged = this is WeekViewEntity.Event<*>,
canBeDragged = this is ResolvedWeekViewEntity.Event<*>,
),
data = (this as? ResolvedWeekViewEntity.Event<*>)?.data,
data = (this as? ResolvedWeekViewEntity.Event<*>)?.data ?: Unit,
)
}
2 changes: 1 addition & 1 deletion core/src/main/java/com/alamkanak/weekview/WeekViewItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data class WeekViewItem(
val timing: Timing,
val style: Style = Style(),
val configuration: Configuration = Configuration(),
val data: Any? = null,
val data: Any,
) {

/**
Expand Down
124 changes: 124 additions & 0 deletions scripts/publish-mavencentral.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'

ext {
PUBLISH_GROUP_ID = 'com.thellmund.android-week-view'
PUBLISH_VERSION = '5.3.0'
}

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
if (project.plugins.findPlugin("com.android.library")) {
from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
} else {
from sourceSets.main.java.srcDirs
from sourceSets.main.kotlin.srcDirs
}
}

task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
archiveClassifier.set('javadoc')
from dokkaJavadoc.outputDirectory
}

artifacts {
archives androidSourcesJar
archives javadocJar
}

group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION

ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''

File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
}

publishing {
publications {
release(MavenPublication) {
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

if (project.plugins.findPlugin("com.android.library")) {
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
} else {
artifact("$buildDir/libs/${project.getName()}-${version}.jar")
}

artifact androidSourcesJar
artifact javadocJar

pom {
name = PUBLISH_ARTIFACT_ID
description = 'Display highly customizable calendar views in your Android app'
url = 'https://github.com/thellmund/Android-Week-View'
packaging = 'aar'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'thellmund'
name = 'Till Hellmund'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:github.com/thellmund/Android-Week-View.git'
developerConnection = 'scm:git:ssh://github.com/thellmund/Android-Week-View.git'
url = 'https://github.com/thellmund/Android-Week-View/tree/main'
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')

project.configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
repositories {
maven {
name = "sonatype"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"

credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}

signing {
sign publishing.publications
}

0 comments on commit c24d73e

Please sign in to comment.