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

添加 growingio sdk bom-platform #163

Merged
merged 8 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
216 changes: 0 additions & 216 deletions CHANGELOG.md

This file was deleted.

83 changes: 59 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,36 @@ buildscript {
]

releaseConfiguration = [

// bom version
releaseVersion : "3.4.0",
releaseVersionCode: 30400,

pluginVersion : "3.4.0",

trackerVersion : "3.4.0",
autotrackerVersion: "3.4.0",

trackerCore : "3.4.0",
autotrackerCore : "3.4.0",

hybrid : "3.4.0",
okhttp3 : "3.4.0",
urlconnection : "3.4.0",
volley : "3.4.0",
database : "3.4.0",
debugger : "3.4.0",
circler : "3.4.0",
json : "3.4.0",
protobuf : "3.4.0",
encoder : "3.4.0",

analyticsFa : "3.4.0",
analyticsGa : "3.4.0",
oaid : "3.4.0",
crash : "3.4.0",

annotationVersion : "3.4.0",
]

versions = [
Expand Down Expand Up @@ -43,31 +71,38 @@ buildscript {
],

'growingio': [
'gmonitor' : 'com.growingio.android:gmonitor:1.5.0',
'tracker_core' : "com.growingio.android:tracker-core:$releaseConfiguration.releaseVersion",
'tracker' : "com.growingio.android:tracker:$releaseConfiguration.releaseVersion",
'tracker_cdp' : "com.growingio.android:tracker-cdp:$releaseConfiguration.releaseVersion",
'autotracker_core': "com.growingio.android:autotracker-core:$releaseConfiguration.releaseVersion",
'autotracker' : "com.growingio.android:autotracker:$releaseConfiguration.releaseVersion",
'autotracker_cdp' : "com.growingio.android:autotracker-cdp:$releaseConfiguration.releaseVersion",
'annotation' : "com.growingio.android:annotation:$releaseConfiguration.releaseVersion",
'compiler' : "com.growingio.android:compiler:$releaseConfiguration.releaseVersion",

'analytics-fa' : "com.growingio.android:analytics-fa:$releaseConfiguration.releaseVersion",
'analytics-ga' : "com.growingio.android:analytics-ga:$releaseConfiguration.releaseVersion",
'hybrid' : "com.growingio.android:hybrid:$releaseConfiguration.releaseVersion",
'okhttp3' : "com.growingio.android:okhttp3:$releaseConfiguration.releaseVersion",
'database' : "com.growingio.android:database:$releaseConfiguration.releaseVersion",
'volley' : "com.growingio.android:volley:$releaseConfiguration.releaseVersion",
'urlconnection' : "com.growingio.android:urlconnection:$releaseConfiguration.releaseVersion",
'debugger' : "com.growingio.android:debugger:$releaseConfiguration.releaseVersion",
'circler' : "com.growingio.android:circler:$releaseConfiguration.releaseVersion",
'json' : "com.growingio.android:json:$releaseConfiguration.releaseVersion",
'protobuf' : "com.growingio.android:protobuf:$releaseConfiguration.releaseVersion",
'encoder' : "com.growingio.android:encoder:$releaseConfiguration.releaseVersion",
'crash' : "com.growingio.android:crash:$releaseConfiguration.releaseVersion",
'oaid' : "com.growingio.android:oaid:$releaseConfiguration.releaseVersion",
// growingio autotrack bom platform
'autotracker_bom' : "com.growingio.android:autotracker-bom:$releaseConfiguration.releaseVersion",

// sdk
'tracker' : "com.growingio.android:tracker:$releaseConfiguration.trackerVersion",
'tracker_cdp' : "com.growingio.android:tracker-cdp:$releaseConfiguration.trackerVersion",
'autotracker' : "com.growingio.android:autotracker:$releaseConfiguration.autotrackerVersion",
'autotracker_cdp' : "com.growingio.android:autotracker-cdp:$releaseConfiguration.autotrackerVersion",

'tracker_core' : "com.growingio.android:tracker-core:$releaseConfiguration.trackerCore",
'autotracker_core': "com.growingio.android:autotracker-core:$releaseConfiguration.autotrackerCore",

'annotation' : "com.growingio.android:annotation:$releaseConfiguration.annotationVersion",
'compiler' : "com.growingio.android:compiler:$releaseConfiguration.annotationVersion",

'hybrid' : "com.growingio.android:hybrid:$releaseConfiguration.hybrid",
'okhttp3' : "com.growingio.android:okhttp3:$releaseConfiguration.okhttp3",
'volley' : "com.growingio.android:volley:$releaseConfiguration.volley",
'urlconnection' : "com.growingio.android:urlconnection:$releaseConfiguration.urlconnection",
'database' : "com.growingio.android:database:$releaseConfiguration.database",
'debugger' : "com.growingio.android:debugger:$releaseConfiguration.debugger",
'circler' : "com.growingio.android:circler:$releaseConfiguration.circler",
'json' : "com.growingio.android:json:$releaseConfiguration.json",
'protobuf' : "com.growingio.android:protobuf:$releaseConfiguration.protobuf",
'encoder' : "com.growingio.android:encoder:$releaseConfiguration.encoder",
'oaid' : "com.growingio.android:oaid:$releaseConfiguration.oaid",
'analytics_fa' : "com.growingio.android:analytics-fa:$releaseConfiguration.analyticsFa",
'analytics_ga' : "com.growingio.android:analytics-ga:$releaseConfiguration.analyticsGa",

'crash' : "com.growingio.android:crash:$releaseConfiguration.crash",
'snappy' : "com.growingio.android:snappy:1.1.0",
'gmonitor' : 'com.growingio.android:gmonitor:1.5.0',
],

'google' : [
Expand Down
8 changes: 0 additions & 8 deletions changelog-option.js

This file was deleted.

2 changes: 1 addition & 1 deletion demos/demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
maven {url "https://s01.oss.sonatype.org/content/repositories/snapshots/"}
}
dependencies {
classpath "com.growingio.android:autotracker-gradle-plugin:${releaseConfiguration.releaseVersion}"
classpath "com.growingio.android:autotracker-gradle-plugin:${releaseConfiguration.pluginVersion}"
//classpath "com.growingio.android:autotracker-gradle-plugin:3.4.0"
}
}
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ BINTARY_DESC=GrowingIO Tracker Android SDK
GROUP=com.growingio.android
POM_DESCRIPTION=GrowingIO Android SDK Library.
POM_DEVELOPER_EMAIL=sdk-integration@growingio.com
POM_COMPANY=Groiwngio, Inc.
POM_OFFICIAL_WEBSITE=https://www.growingio.com
POM_URL=https://github.com/growingio/growingio-sdk-android-autotracker
POM_SCM_URL=https://github.com/growingio/growingio-sdk-android-autotracker
POM_SCM_CONNECTION=scm:git@github.com:growingio/growingio-sdk-android-autotracker.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:growingio/growingio-sdk-android-autotracker.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_SCM_ISSUES=https://github.com/growingio/growingio-sdk-android-autotracker/issues
POM_DEVELOPER_ID=GrowingIo Sdk
POM_DEVELOPER_NAME=GrowingIo Sdk
85 changes: 85 additions & 0 deletions gradle/existDenpendices.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright 2022 Cpacm
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import okhttp3.OkHttpClient
import okhttp3.Request

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.squareup.okhttp3:okhttp:4.9.3"
}
}

def getModuleVersion() {
def moduleId = POM_ARTIFACT_ID
def version = 'SNAPSHOT'
libraries.growingio.each { key, value ->
def library = value.split(":")
def libraryId = library[1]
if (moduleId.equals(libraryId)) {
version = library[2]
return true
}
}
return version
}

//tasks.withType(PublishToMavenLocal)
tasks.withType(PublishToMavenRepository) {
onlyIf {
// CI_PUBLISH.toBoolean()
def version = getModuleVersion()
//println moduleId + ":" + version
// SNAPSHOT always should publish
if (version.endsWith('SNAPSHOT')) {
return true
}
// publish when library not in maven repository
if (checkMavenAarExist(moduleId, version)) {
println String.format("%s:%s already exist in release maven repository, you should't publish it.", moduleId, version)
return false
}
return true

}
}

static def getReleaseMavenRepositoryUrl(moduleId, version) {
return String.format("https://repo.maven.apache.org/maven2/com/growingio/android/%s/%s/", moduleId, version)
}

static def checkMavenAarExist(moduleId, version) {
try {
def client = new OkHttpClient()
def request = new Request.Builder().url(getReleaseMavenRepositoryUrl(moduleId, version)).head().build()
def response = client.newCall(request).execute()
//println response.headers()
//println response.code()
if (response.code() == 404) {
response.close()
return false
} else {
response.close()
return true
}
} catch (IOException e) {
println "Something error:" + e.toString()
return true
}
}
1 change: 1 addition & 0 deletions gradle/publishAllToMavenLocal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ export IS_EXCLUDE_DEMOS=true
&& ./gradlew :gio-sdk:tracker-cdp:publishMavenAgentPublicationToMavenLocal \
&& ./gradlew :gio-sdk:autotracker:publishMavenAgentPublicationToMavenLocal \
&& ./gradlew :gio-sdk:autotracker-cdp:publishMavenAgentPublicationToMavenLocal \
&& ./gradlew :growingio-sdk-bom:publishBomPublicationToMavenLocal \
&& ./gradlew clean
export IS_EXCLUDE_DEMOS=false
31 changes: 27 additions & 4 deletions gradle/publishMaven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,23 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

version = releaseConfiguration.releaseVersion
version = getModuleVersion()
group = GROUP

def getModuleVersion() {
def moduleId = POM_ARTIFACT_ID
def version = '3.0.0-SNAPSHOT'
libraries.growingio.each { key, value ->
def library = value.split(":")
def libraryId = library[1]
if (moduleId.equals(libraryId)) {
version = library[2]
return true
}
}
return version
}

@SuppressWarnings("GrMethodMayBeStatic")
def isReleaseBuild() {
return !version.contains("SNAPSHOT")
Expand Down Expand Up @@ -72,6 +86,11 @@ def configurePom(pom) {
}
}

pom.issueManagement {
system = 'GitHub Issues'
url = POM_SCM_ISSUES
}

pom.developers {
developer {
id = POM_DEVELOPER_ID
Expand Down Expand Up @@ -188,9 +207,11 @@ afterEvaluate { project ->
def groupId = it.group
def artifactId = it.name
if (it instanceof ProjectDependency) {
def properties = it.getDependencyProject().getProperties()
groupId = properties.get("GROUP")
artifactId = properties.get("POM_ARTIFACT_ID")
// skip eg:implementation project(:module)
// def properties = it.getDependencyProject().getProperties()
// groupId = properties.get("GROUP")
// artifactId = properties.get("POM_ARTIFACT_ID")
return
}
println "dependencies:" + groupId + ":" + artifactId + ":" + it.version
def dependencyNode = dependenciesNode.appendNode('dependency')
Expand Down Expand Up @@ -228,3 +249,5 @@ signing {
sign publication
}
}

apply from: "${rootProject.projectDir}/gradle/existDenpendices.gradle"
74 changes: 74 additions & 0 deletions growingio-sdk-bom/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright (C) 2020 Beijing Yishu Technology Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id 'java-platform'
id 'maven-publish'
}

javaPlatform {
allowDependencies()
}

dependencies {
constraints {

// sdk
api libraries.growingio.tracker
api libraries.growingio.tracker_cdp
api libraries.growingio.autotracker
api libraries.growingio.autotracker_cdp
api libraries.growingio.tracker_core
api libraries.growingio.autotracker_core

// custom module generate
api libraries.growingio.annotation
api libraries.growingio.compiler

// module
api libraries.growingio.hybrid
api libraries.growingio.database
api libraries.growingio.okhttp3
api libraries.growingio.volley
api libraries.growingio.urlconnection
api libraries.growingio.debugger
api libraries.growingio.circler
api libraries.growingio.json
api libraries.growingio.protobuf
api libraries.growingio.oaid
api libraries.growingio.encoder
api libraries.growingio.crash
api libraries.growingio.analytics_fa
api libraries.growingio.analytics_ga

// 2升3模块
api 'com.growingio.android.sdk.upgrade:autotracker-upgrade-2to3-cdp:1.2.0'

// giokit
api 'com.growingio.giokit:giokit:1.2.0'
api 'com.growingio.giokit:giokit-no-op:1.2.0'

// saas sdk
//api 'com.growingio.android:vds-android-agent:autotrack-2.9.13'
//api 'com.growingio.android:vds-android-agent:track-2.9.13'

// tool
//runtime "com.growingio.android:snappy:1.1.0"
//runtime 'com.growingio.android:gmonitor:1.5.0'
}
}

apply from: "publishMaven.gradle"
4 changes: 4 additions & 0 deletions growingio-sdk-bom/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POM_NAME=autotracker-bom
POM_ARTIFACT_ID=autotracker-bom
POM_PACKAGING=pom
POM_DESCRIPTION=Provide the BoM for the GrowingIO Autotracker Sdk.
Loading