-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use experimental native mem management; clean up
- Loading branch information
Showing
17 changed files
with
109 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
plugins { | ||
kotlin("jvm") version "1.6.20" | ||
kotlin("jvm") version "1.6.21" | ||
} | ||
|
||
repositories { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
demo: main.c | ||
demo: copy | ||
clang main.c libevaluation_interop.dylib -o demo | ||
|
||
clean: | ||
rm -f demo | ||
|
||
copy: | ||
cp ../evaluation-interop/build/bin/macosX64/releaseShared/libevaluation_interop_api.h . | ||
cp ../evaluation-interop/build/bin/macosX64/releaseShared/libevaluation_interop.dylib . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,14 @@ | |
#include "stdio.h" | ||
|
||
int main(int argc, char** argv) { | ||
libevaluation_interop_ExportedSymbols* lib = libevaluation_interop_symbols(); | ||
|
||
libevaluation_interop_ExportedSymbols* lib = libevaluation_interop_symbols(); | ||
const char* rules = "[{\"allUsersTargetingConfig\":{\"allocations\":[{\"percentage\":6600,\"weights\":{\"control\":1,\"treatment\":1}}],\"bucketingKey\":\"amplitude_id\",\"conditions\":[],\"name\":\"default-segment\"},\"bucketingKey\":\"amplitude_id\",\"bucketingSalt\":\"xIsm9BUj\",\"customSegmentTargetingConfigs\":[],\"defaultValue\":\"off\",\"enabled\":true,\"flagKey\":\"brian-bug-safari\",\"flagName\":\"brian-bug-safari\",\"flagVersion\":15,\"globalHoldbackBucketingKey\":\"amplitude_id\",\"globalHoldbackPct\":0,\"globalHoldbackSalt\":\"5inHyVr4\",\"mutualExclusionConfig\":{\"bucketingKey\":\"amplitude_id\",\"groupSalt\":\"yYIqQGSY\",\"lowerBound\":0,\"percentage\":5000},\"useStickyBucketing\":false,\"userProperty\":\"[Amplitude][Flag]brian-bug-safari\",\"variants\":[{\"key\":\"control\",\"payload\":{\"asdf\":\"asdf\"}},{\"key\":\"treatment\",\"payload\":[\"array\"]}],\"variantsExclusions\":null,\"variantsInclusions\":null},{\"allUsersTargetingConfig\":{\"allocations\":[{\"percentage\":0,\"weights\":{\"control\":1,\"treatment\":1}}],\"bucketingKey\":\"amplitude_id\",\"conditions\":[],\"name\":\"default-segment\"},\"bucketingKey\":\"amplitude_id\",\"bucketingSalt\":\"LRVo9Day\",\"customSegmentTargetingConfigs\":[],\"defaultValue\":\"off\",\"enabled\":true,\"flagKey\":\"brian-bug-safari-2\",\"flagName\":\"brian-bug-safari-2\",\"flagVersion\":6,\"globalHoldbackBucketingKey\":\"amplitude_id\",\"globalHoldbackPct\":0,\"globalHoldbackSalt\":\"5inHyVr4\",\"mutualExclusionConfig\":{\"bucketingKey\":\"amplitude_id\",\"groupSalt\":\"yYIqQGSY\",\"lowerBound\":5000,\"percentage\":2500},\"useStickyBucketing\":false,\"userProperty\":\"[Experiment]brian-bug-safari-2\",\"variants\":[{\"key\":\"control\",\"payload\":null},{\"key\":\"treatment\",\"payload\":null}],\"variantsExclusions\":null,\"variantsInclusions\":null}]"; | ||
const char* user = "{\"amplitude_id\":1234567,\"user_id\":\"[email protected]\",\"device_brand\":\"asus\",\"device_manufacturer\":\"asus\",\"device_model\":\"asus_t00f1\",\"language\":\"spanish(puertorico)\"}"; | ||
|
||
const char* rules = "[{\"allUsersTargetingConfig\":{\"allocations\":[{\"percentage\":6600,\"weights\":{\"control\":1,\"treatment\":1}}],\"bucketingKey\":\"amplitude_id\",\"conditions\":[],\"name\":\"default-segment\"},\"bucketingKey\":\"amplitude_id\",\"bucketingSalt\":\"xIsm9BUj\",\"customSegmentTargetingConfigs\":[],\"defaultValue\":\"off\",\"enabled\":true,\"flagKey\":\"brian-bug-safari\",\"flagName\":\"brian-bug-safari\",\"flagVersion\":15,\"globalHoldbackBucketingKey\":\"amplitude_id\",\"globalHoldbackPct\":0,\"globalHoldbackSalt\":\"5inHyVr4\",\"mutualExclusionConfig\":{\"bucketingKey\":\"amplitude_id\",\"groupSalt\":\"yYIqQGSY\",\"lowerBound\":0,\"percentage\":5000},\"useStickyBucketing\":false,\"userProperty\":\"[Amplitude][Flag]brian-bug-safari\",\"variants\":[{\"key\":\"control\",\"payload\":{\"asdf\":\"asdf\"}},{\"key\":\"treatment\",\"payload\":[\"array\"]}],\"variantsExclusions\":null,\"variantsInclusions\":null},{\"allUsersTargetingConfig\":{\"allocations\":[{\"percentage\":0,\"weights\":{\"control\":1,\"treatment\":1}}],\"bucketingKey\":\"amplitude_id\",\"conditions\":[],\"name\":\"default-segment\"},\"bucketingKey\":\"amplitude_id\",\"bucketingSalt\":\"LRVo9Day\",\"customSegmentTargetingConfigs\":[],\"defaultValue\":\"off\",\"enabled\":true,\"flagKey\":\"brian-bug-safari-2\",\"flagName\":\"brian-bug-safari-2\",\"flagVersion\":6,\"globalHoldbackBucketingKey\":\"amplitude_id\",\"globalHoldbackPct\":0,\"globalHoldbackSalt\":\"5inHyVr4\",\"mutualExclusionConfig\":{\"bucketingKey\":\"amplitude_id\",\"groupSalt\":\"yYIqQGSY\",\"lowerBound\":5000,\"percentage\":2500},\"useStickyBucketing\":false,\"userProperty\":\"[Experiment]brian-bug-safari-2\",\"variants\":[{\"key\":\"control\",\"payload\":null},{\"key\":\"treatment\",\"payload\":null}],\"variantsExclusions\":null,\"variantsInclusions\":null}]"; | ||
const char* response = lib->kotlin.root.evaluate(rules, user); | ||
printf("result: %s\n", response); | ||
lib->DisposeString(response); | ||
|
||
const char* user = "{\"amplitude_id\":1234567,\"user_id\":\"[email protected]\",\"device_brand\":\"asus\",\"device_manufacturer\":\"asus\",\"device_model\":\"asus_t00f1\",\"language\":\"spanish(puertorico)\"}"; | ||
|
||
const char* response = lib->kotlin.root.evaluate(rules, user); | ||
|
||
printf("result: %s\n", response); | ||
|
||
lib->DisposeString(response); | ||
|
||
return 0; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,10 @@ plugins { | |
kotlin("multiplatform") | ||
kotlin("plugin.serialization") version Versions.serializationPlugin | ||
`maven-publish` | ||
signing | ||
id("org.jlleitschuh.gradle.ktlint") version Versions.kotlinLint | ||
} | ||
|
||
version = "0.0.1" | ||
|
||
kotlin { | ||
|
||
sourceSets.all { | ||
|
@@ -62,3 +61,57 @@ tasks.withType<Wrapper> { | |
gradleVersion = "7.4.1" | ||
distributionType = Wrapper.DistributionType.ALL | ||
} | ||
|
||
// Publishing | ||
|
||
version = "0.0.1" | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
create<MavenPublication>("release") { | ||
from(components["kotlin"]) | ||
pom { | ||
name.set("Amplitude Experiment Evaluation") | ||
description.set("Core kotlin multiplatform package for Amplitude Experiment's evaluation.") | ||
url.set("https://github.com/amplitude/experiment-evaluation") | ||
licenses { | ||
license { | ||
name.set("MIT") | ||
url.set("https://opensource.org/licenses/MIT") | ||
distribution.set("repo") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("amplitude") | ||
name.set("Amplitude") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
url.set("https://github.com/amplitude/experiment-evaluation") | ||
developerConnection.set("scm:[email protected]:amplitude/experiment-evaluation.git") | ||
connection.set("scm:[email protected]:amplitude/experiment-evaluation.git") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
val publishing = extensions.findByType<PublishingExtension>() | ||
val signingKeyId = properties["signingKeyId"]?.toString() | ||
val signingKey = properties["signingKey"]?.toString() | ||
val signingPassword = properties["signingPassword"]?.toString() | ||
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) | ||
sign(publishing?.publications) | ||
} | ||
|
||
tasks.withType<Sign>().configureEach { | ||
onlyIf { isReleaseBuild } | ||
} | ||
} | ||
|
||
val isReleaseBuild: Boolean | ||
get() = properties.containsKey("signingKey") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module "github.com/amplitude/experiment-evaluation" | ||
|
||
go 1.16 | ||
go 1.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
kotlin.code.style=official | ||
kotlin.native.enableDependencyPropagation=false | ||
kotlin.js.generate.executable.default=false | ||
kotlin.mpp.stability.nowarn=true | ||
kotlin.native.binary.memoryModel=experimental | ||
|
||
org.gradle.jvmargs=-Xmx4096m |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
|
||
rootProject.name = "experiment-evaluation" | ||
|
||
include( | ||
":evaluation-core", | ||
":evaluation-interop", | ||
":evaluation-js" | ||
":evaluation-js", | ||
) |