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

Update gradle - publishing - kotlin ... #519

Closed
wants to merge 16 commits into from
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Build project
run: ./gradlew assembleDebug
Expand All @@ -42,10 +42,10 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Run instrumentation tests
uses: ReactiveCircus/android-emulator-runner@v2.21.0
Expand All @@ -54,4 +54,4 @@ jobs:
arch: x86_64
profile: pixel_2
disable-animations: true
script: ./gradlew :sample:connectedCheck :barista-compose:connectedCheck
script: ./gradlew :sample:connectedCheck
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

# Base64 decodes and pipes the GPG key content into the secret file
- name: Prepare environment
Expand Down
13 changes: 8 additions & 5 deletions barista-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ plugins {

apply(from = "../config/android-quality.gradle")

ext["PUBLISH_ARTIFACT_ID"] = "barista-compose"

apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle")

android {
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 21
targetSdk = 33
targetSdk = 34

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["clearPackageData"] = "true"
Expand All @@ -28,7 +26,12 @@ android {
kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get()
}

packagingOptions {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
Expand Down
11 changes: 7 additions & 4 deletions barista/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ plugins {

apply(from = "../config/android-quality.gradle")

ext["PUBLISH_ARTIFACT_ID"] = "barista"

apply(from = "${rootProject.projectDir}/scripts/publish-module.gradle")

android {
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 21
targetSdk = 33
targetSdk = 34
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
namespace = "com.adevinta.android.barista"

lint {
disable.add("InvalidPackage")
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

dependencies {
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ buildscript {
classpath libs.nexus.staging
}
}

apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'io.github.gradle-nexus.publish-plugin'

allprojects {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ org.gradle.vfs.watch=true
#org.gradle.unsafe.configuration-cache-problems=warn
#org.gradle.unsafe.configuration-cache.max-problems=100
signing.gnupg.executable=gpg
android.nonTransitiveRClass=false
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
gradlePlugin = "7.3.1"
kotlin = "1.7.20"
nexusPublish = "1.1.0"
nexusStaging = "0.22.0"
gradlePlugin = "8.1.2"
kotlin = "1.9.10"
nexusPublish = "1.3.0"
nexusStaging = "0.30.0"
compose = "1.3.1"
composeCompiler = "1.3.2"
composeCompiler = "1.5.3"
androidXAppCompat = "1.0.2"
androidXAnnotation = "1.0.2"
androidXCore = "1.0.1"
Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Dec 03 13:54:10 CET 2022
#Tue Oct 24 08:58:04 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 8 additions & 5 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
plugins {
id("com.android.application")
kotlin("android")
id("kotlin-android-extensions")
}

apply(from = "../config/android-quality.gradle")

android {
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 21
targetSdk = 33
targetSdk = 34

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments["clearPackageData"] = "true"

vectorDrawables.useSupportLibrary = true
}

buildFeatures {
viewBinding = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

testOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import android.os.Bundle
import android.provider.MediaStore
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.FileProvider
import com.adevinta.android.barista.sample.databinding.ActivityCameraBinding
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.activity_camera.image_view
import kotlinx.android.synthetic.main.activity_camera.take_picture
import java.io.File

class CameraActivity : AppCompatActivity() {
Expand All @@ -18,10 +17,13 @@ class CameraActivity : AppCompatActivity() {
val TAKE_PICTURE_REQUEST_CODE = 42
}

private lateinit var binding: ActivityCameraBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_camera)
take_picture.setOnClickListener {
binding = ActivityCameraBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.takePicture.setOnClickListener {
val uri = getPictureUri()
val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri)
Expand All @@ -33,14 +35,16 @@ class CameraActivity : AppCompatActivity() {
@SuppressLint("MissingSuperCall")
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == TAKE_PICTURE_REQUEST_CODE) {
Glide.with(this).load(getPictureUri()).into(image_view)
Glide.with(this).load(getPictureUri()).into(binding.imageView)
}
}

private fun getPictureUri(): Uri {
val path = applicationContext.cacheDir.path + "/test.jpg"
return FileProvider.getUriForFile(this,
applicationContext.packageName + ".barista.sample.provider",
File(path))
return FileProvider.getUriForFile(
this,
applicationContext.packageName + ".barista.sample.provider",
File(path)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package com.adevinta.android.barista.sample
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_chips.closeChip
import kotlinx.android.synthetic.main.activity_chips.closeChipText
import com.adevinta.android.barista.sample.databinding.ActivityChipsBinding

class ChipsActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_chips)
val binding = ActivityChipsBinding.inflate(layoutInflater)
setContentView(binding.root)

closeChip.setOnCloseIconClickListener {
closeChipText.visibility = View.VISIBLE
binding.closeChip.setOnCloseIconClickListener {
binding.closeChipText.visibility = View.VISIBLE
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2
import com.adevinta.android.barista.sample.ViewPager2Activity.Orientation.HORIZONTAL
import com.adevinta.android.barista.sample.ViewPager2Activity.Orientation.VERTICAL
import kotlinx.android.synthetic.main.activity_viewpager2.viewPager2
import com.adevinta.android.barista.sample.databinding.ActivityViewpager2Binding

class ViewPager2Activity : FragmentActivity() {

private lateinit var binding: ActivityViewpager2Binding

enum class Orientation {
VERTICAL,
HORIZONTAL
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityViewpager2Binding.inflate(layoutInflater)
setContentView(R.layout.activity_viewpager2)

viewPager2.adapter = ViewPager2Adapter(activity = this)
binding.viewPager2.adapter = ViewPager2Adapter(activity = this)
}

private class ViewPager2Adapter(activity: FragmentActivity) : FragmentStateAdapter(activity) {
Expand All @@ -33,7 +36,7 @@ class ViewPager2Activity : FragmentActivity() {
}

fun set(orientation: Orientation) = runOnUiThread {
viewPager2.orientation = when (orientation) {
binding.viewPager2.orientation = when (orientation) {
VERTICAL -> ViewPager2.ORIENTATION_VERTICAL
HORIZONTAL -> ViewPager2.ORIENTATION_HORIZONTAL
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.view.LayoutInflater
import android.widget.LinearLayout
import androidx.core.content.withStyledAttributes
import com.adevinta.android.barista.sample.R
import kotlinx.android.synthetic.main.sample_custom_view.view.customTextView
import com.adevinta.android.barista.sample.databinding.SampleCustomViewBinding

class SampleCustomView @JvmOverloads
constructor(
Expand All @@ -32,7 +32,12 @@ constructor(
LayoutInflater.from(context).inflate(R.layout.sample_custom_view, this, true)
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)

customTextView.text = "Demo text"
customTextView.setTextColor(customColor)
val binding = SampleCustomViewBinding.inflate(
LayoutInflater.from(context),
this
)

binding.customTextView.text = "Demo text"
binding.customTextView.setTextColor(customColor)
}
}
Loading
Loading