Configure Maven Central publishing

This commit is contained in:
William Brawner 2022-11-01 07:12:43 -06:00
parent 7a868e8cec
commit 102404f49a
10 changed files with 69 additions and 41 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" /> <bytecodeTargetLevel target="17" />
</component> </component>
</project> </project>

View file

@ -7,6 +7,7 @@
<option name="testRunner" value="GRADLE" /> <option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="17" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

20
.idea/jarRepositories.xml Normal file
View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:$USER_HOME$/.m2/repository/" />
</remote-repository>
</component>
</project>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17_PREVIEW" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -22,7 +22,7 @@ By default, the SDK will be enabled at app startup, though you can prevent this
opt-in or opt-out like so: opt-in or opt-out like so:
```xml ```xml
<string name="plausible_enable_startup">true</string> <string name="plausible_enable_startup">false</string>
``` ```
You can then manually enable the sdk with the following: You can then manually enable the sdk with the following:
@ -31,14 +31,6 @@ You can then manually enable the sdk with the following:
Plausible.enable(true) Plausible.enable(true)
``` ```
If you'd like to set a static user agent, you can do that as well:
```xml
<string name="plausible_user_agent" />
```
Though it's probably best to use a unique user-agent for
### Sending Events ### Sending Events
#### Page Views #### Page Views
@ -55,13 +47,18 @@ Plausible.event("ctaClick")
## Download ## Download
This project is still in early development, so while I finalize the API, write the documentation,
and begin writing tests, I'll only be publishing to Sonatype's snapshots repository:
```groovy ```groovy
repositories { repositories {
mavenCentral() maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
} }
dependencies { dependencies {
implementation 'com.wbrawner.plausble:plausible-android:0.1.0-SNAPSHOT' implementation 'com.wbrawner.plausible:plausible-android:0.1.0-SNAPSHOT'
} }
``` ```

View file

@ -9,4 +9,6 @@ plugins {
id 'com.android.library' version '7.3.0' apply false id 'com.android.library' version '7.3.0' apply false
id 'org.jetbrains.kotlin.android' version "1.7.20" apply false id 'org.jetbrains.kotlin.android' version "1.7.20" apply false
id 'org.jetbrains.kotlin.plugin.serialization' version "1.7.20" apply false id 'org.jetbrains.kotlin.plugin.serialization' version "1.7.20" apply false
id 'com.vanniktech.maven.publish' version '0.22.0' apply false
id 'org.jetbrains.dokka' version '1.7.20' apply false
} }

View file

@ -20,4 +20,24 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the # Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies, # resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library # thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
GROUP=com.wbrawner.plausible
POM_ARTIFACT_ID=plausible-android
POM_DESCRIPTION=An unofficial Android SDK for Plausible Analytics.
POM_DEVELOPER_ID=wbrawner
POM_DEVELOPER_NAME=William Brawner
POM_DEVELOPER_URL=https://github.com/wbrawner/
POM_INCEPTION_YEAR=2022
POM_LICENCE_DIST=repo
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_SCM_CONNECTION=scm:git:git://github.com/wbrawner/plausible-android.git
POM_SCM_DEV_CONNECTION=scm:git:git://github.com/wbrawner/plausible-android.git
POM_SCM_URL=https://github.com/wbrawner/plausible-android
POM_URL=https://github.com/wbrawner/plausible-android
RELEASE_SIGNING_ENABLED=true
SONATYPE_AUTOMATIC_RELEASE=true
SONATYPE_HOST=S01
# Don't forget to update the README when this changes
VERSION_NAME=0.1.0-SNAPSHOT

View file

@ -2,8 +2,8 @@ plugins {
id 'com.android.library' id 'com.android.library'
id 'org.jetbrains.kotlin.android' id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.plugin.serialization' id 'org.jetbrains.kotlin.plugin.serialization'
id 'maven-publish' id 'com.vanniktech.maven.publish'
id 'signing' id 'org.jetbrains.dokka'
} }
android { android {
@ -35,10 +35,12 @@ android {
kotlinOptions { kotlinOptions {
jvmTarget = '1.8' jvmTarget = '1.8'
} }
publishing { }
singleVariant("release") {
withSourcesJar() dokkaHtml.configure {
withJavadocJar() dokkaSourceSets {
named("main") {
noAndroidSdkLink.set(false)
} }
} }
} }
@ -53,23 +55,3 @@ dependencies {
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp_version" testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp_version"
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
} }
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
groupId 'com.wbrawner.plausible'
artifactId 'plausible-android'
version = android.defaultConfig.versionName
}
}
repositories {
// maven {
// name = 'local'
// url = "${project.buildDir}/repo"
// }
}
}
}

View file

@ -6,7 +6,7 @@ pluginManagement {
} }
} }
dependencyResolutionManagement { dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories { repositories {
google() google()
mavenCentral() mavenCentral()