Skip to content

Commit 1e3f3a7

Browse files
committed
Experiments with publishing
1 parent 746d3d6 commit 1e3f3a7

File tree

4 files changed

+64
-22
lines changed

4 files changed

+64
-22
lines changed

app/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ android {
1111
}
1212

1313
dependencies {
14-
// implementation(":library")
1514
implementation project(path: ':library')
1615
implementation(libs.lifecycleRuntime)
1716
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ kotlin.code.style=official
2020
# Enables namespacing of each library's R class so that its R class includes only the
2121
# resources declared in the library itself and none from the library's dependencies,
2222
# thereby reducing the size of the R class for that library
23-
android.nonTransitiveRClass=true
23+
android.nonTransitiveRClass=true
24+
android.disableAutomaticComponentCreation=true

library/build.gradle

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,20 @@ plugins {
44
id 'maven-publish'
55
}
66

7-
def githubProperties = new Properties()
8-
githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) //Set env variable GPR_USER & GPR_API_KEY if not adding a properties file
7+
98

109
def getVersion = { ->
11-
return "1.0.0" // Replace with version Name
10+
return "0.0.0" // Replace with version Name
1211
}
1312

1413
def getArtifactId = { ->
1514
return "library"
1615
}
1716

18-
publishing {
17+
/*publishing {
1918
publications {
2019
bar(MavenPublication) {
21-
// groupId 'com.github.fmaxx.stopwatch'
22-
groupId 'library'
20+
groupId 'AndroidStopwatch'
2321
artifactId getArtifactId()
2422
version getVersion()
2523
artifact("$buildDir/outputs/aar/${getArtifactId()}-release.aar")
@@ -55,32 +53,74 @@ publishing {
5553
5654
repositories {
5755
maven {
56+
def githubProperties = new Properties()
57+
githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
58+
5859
name = "GitHubPackages"
59-
/** Configure path of your package repository on Github
60-
** Replace GITHUB_USERID with your/organisation Github userID
61-
** and REPOSITORY with the repository name on GitHub
62-
*/
63-
url = uri("https://maven.pkg.github.com/fmaxx/androidStopwatch")
60+
url = uri("https://maven.pkg.github.com/fmaxx/AndroidStopwatch")
6461
credentials {
65-
/** Create github.properties in root project folder file with
66-
** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN
67-
** Set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/
68-
6962
username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
7063
password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
7164
}
7265
}
7366
}
74-
}
75-
76-
77-
// shared deps
78-
apply from: "$rootProject.projectDir/base.gradle"
67+
}*/
7968

8069
android {
70+
compileSdk 33
8171
namespace 'com.github.fmaxx.stopwatch'
72+
defaultConfig {
73+
minSdk 21
74+
targetSdk 33
75+
versionCode 1
76+
versionName "1.0"
77+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
78+
}
79+
80+
buildTypes {
81+
release {
82+
minifyEnabled false
83+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
84+
}
85+
}
86+
compileOptions {
87+
sourceCompatibility JavaVersion.VERSION_1_8
88+
targetCompatibility JavaVersion.VERSION_1_8
89+
}
90+
kotlinOptions {
91+
jvmTarget = '1.8'
92+
}
93+
94+
publishing {
95+
singleVariant("release") {
96+
withSourcesJar()
97+
withJavadocJar()
98+
}
99+
}
100+
101+
testOptions {
102+
unitTests.all {
103+
useJUnitPlatform()
104+
}
105+
}
82106
}
83107

84108
dependencies {
85109
implementation(libs.lifecycleViewmodelKtx)
110+
testImplementation(libs.bundles.test)
111+
androidTestImplementation(libs.bundles.androidTest)
112+
}
113+
114+
afterEvaluate {
115+
publishing {
116+
publications {
117+
// Creates a Maven publication called "release".
118+
release(MavenPublication) {
119+
from components.release
120+
groupId = 'AndroidStopwatch'
121+
artifactId = getArtifactId()
122+
version = getVersion()
123+
}
124+
}
125+
}
86126
}

library/jitpack.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
jdk:
2+
- openjdk11

0 commit comments

Comments
 (0)