Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated publish task. #9

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: gradle

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ It consist of a leading icon(optional), Text and a trailing icon (optional).
- Built with Compose UI

## Usage

implementation("co.yml:ytag:1.0.0")

**Basic**

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ plugins {
}

android {
namespace = "co.yml.ytag"
namespace = "co.yml.ytag.app"
defaultConfig {
applicationId = "co.yml.ytag"
applicationId = "co.yml.ytag.app"
versionCode = 1
versionName = "1.0"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.yml.ytag
package co.yml.ytag.app

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.yml.ytag
package co.yml.ytag.app

import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.lifecycle.Lifecycle
Expand Down Expand Up @@ -38,7 +38,7 @@ class MainActivityTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
Assert.assertTrue(appContext.packageName.contains("co.yml.ytag"))
Assert.assertTrue(appContext.packageName.contains("co.yml.ytag.app"))
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package co.yml.ytag.ui
package co.yml.ytag.app.ui

import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithTag
import co.yml.ytag.MainActivity
import co.yml.ytag.app.MainActivity
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Rule
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
package="co.yml.ytag.app">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name="co.yml.ytag.YTag"
android:name=".YTag"
tools:replace="android:allowBackup"
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package co.yml.ytag
package co.yml.ytag.app

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import co.yml.ytag.ui.AppScreen
import co.yml.ytag.app.ui.AppScreen
import dagger.hilt.android.AndroidEntryPoint

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.yml.ytag
package co.yml.ytag.app

import android.app.Application
import dagger.hilt.android.HiltAndroidApp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.yml.ytag.ui
package co.yml.ytag.app.ui

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.yml.ytag.ui
package co.yml.ytag.app.ui

import androidx.compose.runtime.Composable
import androidx.navigation.compose.NavHost
Expand Down
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ buildscript {
mavenCentral()
google()
gradlePluginPortal()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
dependencies {
classpath(versionCatalogLibs.android.gradle.plugin)
Expand Down
95 changes: 95 additions & 0 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,108 @@ plugins {
id("co.yml.ytag.library.compose")
id("co.yml.ytag.library")
id("co.yml.ytag.library.jacoco")
id("maven-publish")
id("signing")
id("org.jetbrains.dokka")
}

android {
namespace = "co.yml.ytag.ui"
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}

dependencies {
testImplementation(project(mapOf("path" to ":core:test")))
androidTestImplementation(project(mapOf("path" to ":core:test")))
}
val dokkaOutputDir = "$buildDir/dokka"

tasks.dokkaHtml {
outputDirectory.set(file(dokkaOutputDir))
}

val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") {
delete(dokkaOutputDir)
}
val javadocJar = tasks.register<Jar>("javadocJar") {
dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
archiveClassifier.set("javadoc")
from(dokkaOutputDir)
}

publishing {
repositories {
maven {
name = "YTag"
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = project.findProperty("mavenCentralUsername")?.toString() ?: System.getenv("MAVEN_USERNAME")
password = project.findProperty("mavenCentralPassword")?.toString() ?: System.getenv("MAVEN_PASSWORD")
}
}
}
publications {
register<MavenPublication>("release") {
groupId = "co.yml"
artifactId = "ytag"
version = "1.0.0"
afterEvaluate {
println("Components:${components.names}")
from(components["productionRelease"])
}
artifact(javadocJar)
pom {
name.set("YTag")
description.set("Y Tag is a UI element in Android (some times referred to as chips) which displays a piece of information. It consist of a leading icon(optional), Text and a trailing icon (optional).")
url.set("https://github.com/yml-org/YTag-android")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("sreekuttancj")
name.set("Sreekuttan C J")
url.set("https://github.com/sreekuttancj")
}
developer {
id.set("dkk009")
name.set("Deepak KK")
url.set("https://github.com/dkk009")
}
developer {
id.set("kikoso")
name.set("Enrique López Mañas")
url.set("https://github.com/kikoso")
}
}
scm {
url.set("https://github.com/yml-org/YTag-android")
connection.set("scm:git:git://github.com/yml-org/YTag-android.git")
developerConnection.set("scm:git:ssh://git@github.com:yml-org/YTag-android.git")
}
}
}
}
}


signing {
useInMemoryPgpKeys(
project.findProperty("signing.keyId")?.toString() ?: System.getenv("SIGNINGKEY"),
project.findProperty("signing.InMemoryKey")?.toString() ?: System.getenv("MEMORY_KEY"),
project.findProperty("signing.password")?.toString()?:System.getenv("SIGNINGPASSWORD")
)
sign(publishing.publications)
}
2 changes: 1 addition & 1 deletion feature/ytag/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android {
dependencies {
implementation(versionCatalogLibs.hilt.nav.compose)
implementation(versionCatalogLibs.androidx.lifecycle.viewModelCompose)
implementation(project(mapOf("path" to ":core:ui")))
implementation("co.yml:ytag:1.0.0")
implementation(project(mapOf("path" to ":core:test")))
testImplementation(project(mapOf("path" to ":core:test")))

Expand Down
Loading