Skip to content

Commit f46e22d

Browse files
authored
Merge pull request #9 from yahoo/sal/buildfixes
Update gradle to work with publishing to Maven Central
2 parents fc0e6a3 + b9e9f65 commit f46e22d

File tree

7 files changed

+71
-80
lines changed

7 files changed

+71
-80
lines changed

behavior-graph/build.gradle

Lines changed: 37 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@
55

66
plugins {
77
id "org.jetbrains.kotlin.jvm"
8-
id "maven-publish"
98
id "java-library"
10-
id "signing"
119
id "org.jetbrains.dokka"
10+
id "com.vanniktech.maven.publish" version "0.29.0"
1211
}
1312

1413
java {
1514
withSourcesJar()
15+
sourceCompatibility = JavaVersion.VERSION_11
16+
targetCompatibility = JavaVersion.VERSION_11
17+
}
18+
19+
kotlin {
20+
compilerOptions {
21+
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
22+
}
1623
}
1724

1825
tasks.named('jar') {
@@ -28,63 +35,41 @@ def dokkaJavadocJar = tasks.register("dokkaJavadocJar", org.gradle.jvm.tasks.Jar
2835

2936
}
3037

31-
publishing {
32-
repositories {
33-
maven {
34-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
35-
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
36-
url = releasesRepoUrl //version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
37-
credentials {
38-
if (project.hasProperty("ossrhUsername")) {
39-
username = ossrhUsername
40-
password = ossrhPassword
41-
}
42-
}
43-
}
44-
}
45-
publications {
46-
release(MavenPublication) {
47-
from components.java
48-
groupId = 'com.yahoo.behaviorgraph'
49-
artifactId = 'bgjvm'
50-
version = '0.8.0'
51-
artifact dokkaJavadocJar
52-
repositories {
38+
import com.vanniktech.maven.publish.KotlinJvm
39+
import com.vanniktech.maven.publish.JavadocJar
40+
import com.vanniktech.maven.publish.SonatypeHost
5341

42+
mavenPublishing {
43+
configure(new KotlinJvm(new JavadocJar.Dokka("dokkaHtml"), true))
44+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
45+
coordinates("com.yahoo.behaviorgraph", "bgjvm", "0.8.0")
46+
pom {
47+
name = 'Behavior Graph'
48+
description = 'Behavior Graph lets you build your programs out of small, easily understood pieces in a way that lets the computer do more of the work for you.'
49+
url = 'https://github.com/yahoo/bgkotlin'
50+
licenses {
51+
license {
52+
name = 'The Apache License, Version 2.0'
53+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
5454
}
55-
pom {
56-
name = 'Behavior Graph'
57-
description = 'Behavior Graph lets you build your programs out of small, easily understood pieces in a way that lets the computer do more of the work for you.'
58-
url = 'https://github.com/yahoo/bgkotlin'
59-
licenses {
60-
license {
61-
name = 'The Apache License, Version 2.0'
62-
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
63-
}
64-
}
65-
developers {
66-
developer {
67-
id = 'slevin'
68-
name = 'Sean Levin'
69-
70-
}
71-
}
72-
scm {
73-
connection = 'scm:git:git://github.com/yahoo/bgkotlin.git'
74-
developerConnection = 'scm:git:ssh://github.com:yahoo/bgkotlin.git'
75-
url = 'https://github.com/yahoo/bgkotlin'
76-
}
55+
}
56+
developers {
57+
developer {
58+
id = 'slevin'
59+
name = 'Sean Levin'
60+
7761
}
7862
}
63+
scm {
64+
connection = 'scm:git:git://github.com/yahoo/bgkotlin.git'
65+
developerConnection = 'scm:git:ssh://github.com:yahoo/bgkotlin.git'
66+
url = 'https://github.com/yahoo/bgkotlin'
67+
}
7968
}
80-
}
69+
70+
signAllPublications()
8171

8272

83-
signing {
84-
if (project.hasProperty("signing.keyId")) {
85-
sign configurations.archives
86-
sign publishing.publications.release
87-
}
8873
}
8974

9075
dependencies {

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ project.group = 'com.yahoo.behaviorgraph'
22
version = '0.6.0-RC1'
33

44
buildscript {
5-
ext.kotlin_version = '1.6.21'
5+
ext.kotlin_version = '1.9.25'
66
repositories {
77
mavenLocal()
88
mavenCentral()
99
google()
1010
}
1111
dependencies {
1212
// Build system
13-
classpath 'com.android.tools.build:gradle:7.4.2'
13+
classpath 'com.android.tools.build:gradle:8.2.0'
1414
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
15-
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$kotlin_version"
15+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.9.20"
1616
}
1717
}
1818

example/build.gradle

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ repositories {
88
}
99

1010
android {
11-
compileSdkVersion 30
11+
12+
compileSdkVersion 33
1213

1314
defaultConfig {
1415
applicationId 'com.yahoo.demo.BehaviorGraphExample'
1516
minSdkVersion 19
16-
targetSdkVersion 30
17+
targetSdkVersion 33
1718
versionCode 1
1819
versionName "1.0"
1920

@@ -27,11 +28,11 @@ android {
2728
}
2829
}
2930
compileOptions {
30-
sourceCompatibility JavaVersion.VERSION_1_8
31-
targetCompatibility JavaVersion.VERSION_1_8
31+
sourceCompatibility JavaVersion.VERSION_11
32+
targetCompatibility JavaVersion.VERSION_11
3233
}
3334
kotlinOptions {
34-
jvmTarget = '1.8'
35+
jvmTarget = '11'
3536
}
3637
buildFeatures {
3738
viewBinding true
@@ -40,17 +41,18 @@ android {
4041
sourceSets.all {
4142
java.srcDir("src/$name/kotlin")
4243
}
44+
namespace 'com.example.myapplication'
4345
}
4446

4547
dependencies {
4648

4749
implementation project(':behavior-graph')
4850
//implementation 'com.yahoo.behavior-graph:bgkotlin:0.5.0-RC1'
4951
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
50-
implementation 'androidx.core:core-ktx:1.6.0'
52+
implementation "androidx.core:core-ktx:1.10.1"
5153
implementation 'androidx.appcompat:appcompat:1.3.1'
5254
implementation 'com.google.android.material:material:1.4.0'
53-
implementation 'androidx.annotation:annotation:1.2.0'
55+
//implementation 'androidx.annotation:annotation:1.3.0'
5456
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
5557
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
5658
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'

example/src/main/AndroidManifest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.example.myapplication">
3+
>
44

55
<application
66
android:allowBackup="true"
@@ -11,7 +11,8 @@
1111
android:theme="@style/Theme.MyApplication">
1212
<activity
1313
android:name=".ui.login.LoginActivityBG"
14-
android:label="@string/app_name">
14+
android:exported="true"
15+
android:label="@string/app_name">
1516
<intent-filter>
1617
<action android:name="android.intent.action.MAIN" />
1718

example/src/main/res/layout/activity_login.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@
4646
app:layout_constraintTop_toTopOf="parent" />
4747

4848
<EditText
49-
android:id="@+id/password"
50-
android:layout_width="172dp"
51-
android:layout_height="43dp"
52-
android:layout_marginStart="24dp"
53-
android:layout_marginTop="4dp"
54-
android:layout_marginEnd="24dp"
55-
android:hint="@string/prompt_password"
56-
android:imeActionLabel="@string/action_sign_in_short"
57-
android:imeOptions="actionDone"
58-
android:inputType="textPassword"
59-
android:selectAllOnFocus="true"
60-
app:layout_constraintEnd_toEndOf="parent"
61-
app:layout_constraintHorizontal_bias="0.489"
62-
app:layout_constraintStart_toStartOf="parent"
63-
app:layout_constraintTop_toBottomOf="@+id/username" />
49+
android:id="@+id/password"
50+
android:layout_width="171dp"
51+
android:layout_height="54dp"
52+
android:layout_marginStart="24dp"
53+
android:layout_marginTop="4dp"
54+
android:layout_marginEnd="24dp"
55+
android:hint="@string/prompt_password"
56+
android:imeActionLabel="@string/action_sign_in_short"
57+
android:imeOptions="actionDone"
58+
android:inputType="textPassword"
59+
android:selectAllOnFocus="true"
60+
app:layout_constraintEnd_toEndOf="parent"
61+
app:layout_constraintHorizontal_bias="0.489"
62+
app:layout_constraintStart_toStartOf="parent"
63+
app:layout_constraintTop_toBottomOf="@+id/username" />
6464

6565
<Button
6666
android:id="@+id/login"

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
1717
android.useAndroidX=true
1818
# Kotlin code style for this project: "official" or "obsolete":
1919
kotlin.code.style=official
20+
android.defaults.buildfeatures.buildconfig=true
21+
android.nonTransitiveRClass=false
22+
android.nonFinalResIds=false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Mon Aug 23 11:41:29 PDT 2021
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)