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

feat(ATS): add vuid manager #431

Merged
merged 17 commits into from
Dec 16, 2022
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
*.iml
.gradle
/local.properties
.idea

# selectively ignored (copyright must not be ignored)
/.idea/*
!/.idea/copyright

.DS_Store
/build
/captures
Expand Down
6 changes: 6 additions & 0 deletions .idea/copyright/FullStack_Copyright.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Optimizely Android X SDK Changelog


## [Unpublished]
* Upgrade gradle to 7.5
* add ODP module


## 3.13.2
April 7th, 2022

Expand Down
6 changes: 1 addition & 5 deletions android-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion compile_sdk_version
Expand All @@ -29,6 +28,7 @@ android {
versionName version_name
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
buildConfigField "String", "CLIENT_VERSION", "\"$version_name\""
multiDexEnabled true

// these rules will be merged to app's proguard rules
consumerProguardFiles '../proguard-rules.txt'
Expand All @@ -49,10 +49,6 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

dexOptions {
javaMaxHeapSize "4g"
}
}

dependencies {
Expand Down
33 changes: 23 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down Expand Up @@ -86,7 +86,7 @@ task clean(type: Delete) {
task cleanAllModules () {
logger.info("Running clean for all modules")
dependsOn(':android-sdk:clean', ':event-handler:clean',
':user-profile:clean', ':shared:clean', ':datafile-handler:clean')
':user-profile:clean', ':shared:clean', ':datafile-handler:clean', ':odp:clean')
}

task testAllModules () {
Expand All @@ -100,20 +100,21 @@ task testAllModulesTravis () {
':event-handler:connectedAndroidTest', ':event-handler:test',
':datafile-handler:connectedAndroidTest', ':datafile-handler:test',
':user-profile:connectedAndroidTest',
':shared:connectedAndroidTest')
':shared:connectedAndroidTest',
':odp:connectedAndroidTest', ':odp:test'
)
}

// Publish to MavenCentral

task ship() {
dependsOn(':android-sdk:ship', ':shared:ship', ':event-handler:ship', ':user-profile:ship', ':datafile-handler:ship')
dependsOn(':android-sdk:ship', ':shared:ship', ':event-handler:ship', ':user-profile:ship', ':datafile-handler:ship', ':odp:ship')
}

def publishedProjects = subprojects.findAll { it.name != 'test-app' }
configure(publishedProjects) {
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'maven-publish'
apply plugin: 'signing'

Expand All @@ -140,13 +141,17 @@ configure(publishedProjects) {
artifactName = 'android-sdk-user-profile'
docTitle = 'Optimizely X Android SDK: User Profile'
break
case 'odp':
artifactName = 'android-sdk-odp'
docTitle = 'Optimizely X Android SDK: ODP'
break
default:
return
}

android.libraryVariants.all { variant ->
task("${variant.name}Javadoc", type: Javadoc, dependsOn: "assemble${variant.name.capitalize()}") {
source = variant.javaCompile.source
source = variant.javaCompileProvider.get().source

title = docTitle

Expand Down Expand Up @@ -178,11 +183,20 @@ configure(publishedProjects) {
android.libraryVariants.all { variant ->
task("${variant.name}SourcesJar", type: Jar) {
classifier = 'sources'
from variant.javaCompile.source
from variant.javaCompileProvider.get().source
}
project.artifacts.add("archives", tasks["${variant.name}SourcesJar"]);
}

android {
publishing {
singleVariant("release") {
withSourcesJar()
withJavadocJar()
}
}
}

afterEvaluate {
publishing {
publications {
Expand All @@ -196,8 +210,6 @@ configure(publishedProjects) {
pom.description = 'The Android SDK for Optimizely Full Stack (feature flag management for product development teams)'

from components.release
artifact releaseSourcesJar
artifact releaseJavadocJar
}
}
repositories {
Expand Down Expand Up @@ -232,11 +244,12 @@ configure(publishedProjects) {
}
}

project(':android-sdk').ship.shouldRunAfter = [':android-sdk:clean', ':datafile-handler:ship', ':event-handler:ship', ':user-profile:ship']
project(':android-sdk').ship.shouldRunAfter = [':android-sdk:clean', ':datafile-handler:ship', ':event-handler:ship', ':user-profile:ship', ':odp:ship']
project(':datafile-handler').ship.shouldRunAfter = [':datafile-handler:clean', ':shared:ship']
project(':event-handler').ship.shouldRunAfter = [':event-handler:clean', ':shared:ship']
project(':shared').ship.shouldRunAfter = [':shared:clean']
project(':user-profile').ship.shouldRunAfter = [':user-profile:clean', ':shared:ship']
project(':odp').ship.shouldRunAfter = [':odp:clean', ':shared:ship']

// standard POM format required by MavenCentral

Expand Down
2 changes: 1 addition & 1 deletion datafile-handler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion compile_sdk_version
Expand All @@ -27,6 +26,7 @@ android {
targetSdkVersion target_sdk_version
versionCode 1
versionName version_name
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
testOptions {
Expand Down
2 changes: 1 addition & 1 deletion event-handler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion compile_sdk_version
Expand All @@ -27,6 +26,7 @@ android {
targetSdkVersion target_sdk_version
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
testOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ public void setupEventDAO() {
logger = mock(Logger.class);
context = InstrumentationRegistry.getInstrumentation().getTargetContext();
eventDAO = EventDAO.getInstance(context, "1", logger);
tearDownEventDAO();
}

@After
public void tearDownEventDAO() {
assertTrue(context.deleteDatabase(String.format(EventSQLiteOpenHelper.DB_NAME , "1")));
context.deleteDatabase(String.format(EventSQLiteOpenHelper.DB_NAME , "1"));
opti-jnguyen marked this conversation as resolved.
Show resolved Hide resolved
}

@Test
Expand All @@ -79,7 +80,7 @@ public void getEvents() throws MalformedURLException {
assertTrue(eventDAO.storeEvent(event3));

List<Pair<Long,Event>> events = eventDAO.getEvents();
assertTrue(events.size() == 3);
assertEquals(events.size(), 3);

Pair<Long,Event> pair1 = events.get(0);
Pair<Long,Event> pair2 = events.get(1);
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1g
android.disableAutomaticComponentCreation=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
org.gradle.jvmargs=-Xmx1g
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
1 change: 1 addition & 0 deletions odp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
77 changes: 77 additions & 0 deletions odp/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
// Copyright 2022, Optimizely, Inc. and contributors
//
// 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
//
// https://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.
//

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion compile_sdk_version
buildToolsVersion build_tools_version

defaultConfig {
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
testOptions {
unitTests.returnDefaultValues = true
}
buildTypes {
release {
minifyEnabled false
}
debug {
testCoverageEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion build_tools_version

kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {
api project(':shared')
implementation "androidx.annotation:annotation:$annotations_ver"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.test.ext:junit-ktx:1.1.3'

testImplementation "junit:junit:$junit_ver"
testImplementation "org.mockito:mockito-core:$mockito_ver"
testImplementation "org.powermock:powermock-mockito-release-full:$powermock_ver"

compileOnly "com.noveogroup.android:android-logger:$android_logger_ver"

androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit"
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver"
// Set this dependency to use JUnit 4 rules
androidTestImplementation "androidx.test:rules:$androidx_test_rules"
androidTestImplementation "androidx.test:core:$androidx_test_core"
androidTestImplementation "androidx.test:core-ktx:$androidx_test_core"

androidTestImplementation "org.mockito:mockito-core:$mockito_ver"
androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver"
androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver"
androidTestImplementation "com.crittercism.dexmaker:dexmaker-mockito:$dexmaker_ver"
}
Loading