diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c4cd2b..1c970a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Change Log ========== +Version 1.0.0-beta2 *(2018-02-11)* +---------------------------------- +* Add `FeaturePlugin` and `InstantAppPlugin` support [#28](https://github.com/canelmas/let/issues/28) +* Rename `Delayed Tasks` to `ScheduledTasks` +* Update copyright + Version 1.0.0-beta1 *(2017-09-04)* ---------------------------------- * Use Transform API for weaving [#23](https://github.com/canelmas/let/issues/23) @@ -18,5 +24,4 @@ Version 0.1.10 *(2016-03-20)* Version 0.1.9 *(2015-11-12)* ---------------------------- - -initial release \ No newline at end of file +* initial release \ No newline at end of file diff --git a/build.gradle b/build.gradle index f2fb66b..5609200 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,14 @@ buildscript { ext.versions = [ - compileSdkVersion : 26, - buildToolsVersion : '26.0.1', + compileSdkVersion : 27, + buildToolsVersion : '27.0.3', minSdkVersion : 14, - targetSdkVersion : 26, + targetSdkVersion : 27, supportLibrary : '26.0.1', aspectjrt : '1.8.9', aspectjtools : '1.8.9', - androidPlugin : '3.0.0-beta4', + androidPlugin : '3.0.1', androidMavenPlugin: '1.2' ] diff --git a/gradle.properties b/gradle.properties index 2dcc5cd..d09f089 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ # org.gradle.parallel=true #Tue Sep 22 16:15:19 EEST 2015 -VERSION_NAME=1.0.0-beta1 +VERSION_NAME=1.0.0-beta2 GROUP=com.canelmas.let POM_DESCRIPTION=Annotation based simple API flavoured with AOP to handle new Android runtime permission model diff --git a/let-annotations/build.gradle b/let-annotations/build.gradle index 681561a..5565faf 100644 --- a/let-annotations/build.gradle +++ b/let-annotations/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-annotations/gradle.properties b/let-annotations/gradle.properties index 63cf88f..2c318b4 100644 --- a/let-annotations/gradle.properties +++ b/let-annotations/gradle.properties @@ -1,10 +1,10 @@ # -# Copyright (C) 2015 Can Elmas +# Copyright (C) 2018 Can Elmas # # 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 diff --git a/let-annotations/src/main/java/com/canelmas/let/AskPermission.java b/let-annotations/src/main/java/com/canelmas/let/AskPermission.java index ed14177..edc81d7 100644 --- a/let-annotations/src/main/java/com/canelmas/let/AskPermission.java +++ b/let-annotations/src/main/java/com/canelmas/let/AskPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-plugin/build.gradle b/let-plugin/build.gradle index 788f5a1..8df0764 100644 --- a/let-plugin/build.gradle +++ b/let-plugin/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-plugin/gradle.properties b/let-plugin/gradle.properties index 05e0a88..d6e06aa 100644 --- a/let-plugin/gradle.properties +++ b/let-plugin/gradle.properties @@ -1,10 +1,10 @@ # -# Copyright (C) 2015 Can Elmas +# Copyright (C) 2018 Can Elmas # # 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 diff --git a/let-plugin/src/main/groovy/com/canelmas/let/LetPlugin.groovy b/let-plugin/src/main/groovy/com/canelmas/let/LetPlugin.groovy index c8a8ad2..86a307d 100644 --- a/let-plugin/src/main/groovy/com/canelmas/let/LetPlugin.groovy +++ b/let-plugin/src/main/groovy/com/canelmas/let/LetPlugin.groovy @@ -1,11 +1,11 @@ /* - * Copyright (C) 2017 Can Elmas + * Copyright (C) 2018 Can Elmas * * 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 + * 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, @@ -17,6 +17,8 @@ package com.canelmas.let import com.android.build.gradle.AppPlugin +import com.android.build.gradle.FeaturePlugin +import com.android.build.gradle.InstantAppPlugin import com.android.build.gradle.LibraryPlugin import org.gradle.api.Plugin import org.gradle.api.Project @@ -26,23 +28,26 @@ class LetPlugin implements Plugin<Project> { @Override void apply(Project project) { - makeSureProjectIsAndroidAppOrLib(project) + makeSureProjectIsCompatible(project) project.android.registerTransform(new LetTransform(project)) project.dependencies { implementation 'org.aspectj:aspectjrt:1.8.9' - implementation 'com.canelmas.let:let-runtime:1.0.0-beta1' - implementation 'com.canelmas.let:let-annotations:1.0.0-beta1' + implementation 'com.canelmas.let:let-runtime:1.0.0-beta2' + implementation 'com.canelmas.let:let-annotations:1.0.0-beta2' } } - private void makeSureProjectIsAndroidAppOrLib(Project project) { - def hasApp = project.plugins.withType(AppPlugin) - def hasLib = project.plugins.withType(LibraryPlugin) + private void makeSureProjectIsCompatible(Project project) { + def hasAppPlugin = project.plugins.withType(AppPlugin) + def hasLibPlugin = project.plugins.withType(LibraryPlugin) + def hasFeaturePlugin = project.plugins.withType(FeaturePlugin) + def hasInstantAppPlugin = project.plugins.withType(InstantAppPlugin) - if (!hasApp && !hasLib) { - throw new IllegalStateException("'android' or 'android-library' plugin required.") + if (!hasAppPlugin && !hasLibPlugin && !hasFeaturePlugin && !hasInstantAppPlugin) { + throw new IllegalStateException("Project must have one the following plugins applied " + + ": 'android', 'android-library', 'feature', 'instantapp'") } } diff --git a/let-plugin/src/main/groovy/com/canelmas/let/LetTransform.groovy b/let-plugin/src/main/groovy/com/canelmas/let/LetTransform.groovy index d664380..349c6c6 100644 --- a/let-plugin/src/main/groovy/com/canelmas/let/LetTransform.groovy +++ b/let-plugin/src/main/groovy/com/canelmas/let/LetTransform.groovy @@ -1,11 +1,11 @@ /* - * Copyright (C) 2017 Can Elmas + * Copyright (C) 2018 Can Elmas * * 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 + * 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, @@ -18,6 +18,7 @@ package com.canelmas.let import com.android.annotations.NonNull import com.android.build.api.transform.* +import com.android.build.gradle.LibraryPlugin import com.google.common.base.Joiner import com.google.common.base.Strings import com.google.common.collect.Lists @@ -32,9 +33,19 @@ import org.gradle.api.logging.Logger class LetTransform extends Transform { private Project project + private boolean isLibrary + + private static final Set<QualifiedContent.Scope> LIBRARY_SCOPE = Sets.immutableEnumSet( + QualifiedContent.Scope.PROJECT) + + private static final Set<QualifiedContent.Scope> APP_SCOPE = Sets.immutableEnumSet( + QualifiedContent.Scope.PROJECT, + QualifiedContent.Scope.SUB_PROJECTS, + QualifiedContent.Scope.EXTERNAL_LIBRARIES) LetTransform(Project project) { this.project = project + this.isLibrary = project.plugins.hasPlugin(LibraryPlugin) } @Override @@ -129,8 +140,7 @@ class LetTransform extends Transform { @NonNull @Override Set<QualifiedContent.Scope> getScopes() { - return Sets.immutableEnumSet(QualifiedContent.Scope.PROJECT, - QualifiedContent.Scope.EXTERNAL_LIBRARIES) + return isLibrary ? LIBRARY_SCOPE : APP_SCOPE } @Override diff --git a/let-plugin/src/main/resources/META-INF/gradle-plugins/let.properties b/let-plugin/src/main/resources/META-INF/gradle-plugins/let.properties index 26ffb9a..466be26 100644 --- a/let-plugin/src/main/resources/META-INF/gradle-plugins/let.properties +++ b/let-plugin/src/main/resources/META-INF/gradle-plugins/let.properties @@ -1,5 +1,5 @@ # -# Copyright (C) 2015 Can Elmas +# Copyright (C) 2018 Can Elmas # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/let-runtime/build.gradle b/let-runtime/build.gradle index c7640da..1f8c319 100644 --- a/let-runtime/build.gradle +++ b/let-runtime/build.gradle @@ -1,9 +1,5 @@ -import org.aspectj.bridge.IMessage -import org.aspectj.bridge.MessageHandler -import org.aspectj.tools.ajc.Main - /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,40 +50,4 @@ android { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } -} - -android.libraryVariants.all { variant -> - JavaCompile javaCompile = variant.javaCompile - javaCompile.doLast { - String[] args = [ - "-showWeaveInfo", - "-1.5", - "-inpath", javaCompile.destinationDir.toString(), - "-aspectpath", javaCompile.classpath.asPath, - "-d", javaCompile.destinationDir.toString(), - "-classpath", javaCompile.classpath.asPath, - "-bootclasspath", android.bootClasspath.join(File.pathSeparator) - ] - - MessageHandler handler = new MessageHandler(true); - new Main().run(args, handler) - - def log = project.logger - for (IMessage message : handler.getMessages(null, true)) { - switch (message.getKind()) { - case IMessage.ABORT: - case IMessage.ERROR: - case IMessage.FAIL: - log.error message.message, message.thrown - break; - case IMessage.WARNING: - case IMessage.INFO: - log.info message.message, message.thrown - break; - case IMessage.DEBUG: - log.debug message.message, message.thrown - break; - } - } - } } \ No newline at end of file diff --git a/let-runtime/gradle.properties b/let-runtime/gradle.properties index af29580..fbcee9f 100644 --- a/let-runtime/gradle.properties +++ b/let-runtime/gradle.properties @@ -1,10 +1,10 @@ # -# Copyright (C) 2015 Can Elmas +# Copyright (C) 2018 Can Elmas # # 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 diff --git a/let-runtime/src/androidTest/java/com/canelmas/let/ApplicationTest.java b/let-runtime/src/androidTest/java/com/canelmas/let/ApplicationTest.java index 86807ba..5361e5d 100644 --- a/let-runtime/src/androidTest/java/com/canelmas/let/ApplicationTest.java +++ b/let-runtime/src/androidTest/java/com/canelmas/let/ApplicationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-runtime/src/main/AndroidManifest.xml b/let-runtime/src/main/AndroidManifest.xml index bff1716..9705c2c 100644 --- a/let-runtime/src/main/AndroidManifest.xml +++ b/let-runtime/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-runtime/src/main/java/com/canelmas/let/DeniedPermission.java b/let-runtime/src/main/java/com/canelmas/let/DeniedPermission.java index 097182c..d6dca2f 100644 --- a/let-runtime/src/main/java/com/canelmas/let/DeniedPermission.java +++ b/let-runtime/src/main/java/com/canelmas/let/DeniedPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-runtime/src/main/java/com/canelmas/let/Let.java b/let-runtime/src/main/java/com/canelmas/let/Let.java index d5eb9d7..e349925 100644 --- a/let-runtime/src/main/java/com/canelmas/let/Let.java +++ b/let-runtime/src/main/java/com/canelmas/let/Let.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ public final class Let { */ public static void handle(Object source, int requestCode, String[] permissions, int[] grantResults) { - final DelayedTasks.Task delayedTask = DelayedTasks.get(requestCode); + final ScheduledTasks.Task delayedTask = ScheduledTasks.get(requestCode); if (null != delayedTask) { diff --git a/let-runtime/src/main/java/com/canelmas/let/LetAspect.java b/let-runtime/src/main/java/com/canelmas/let/LetAspect.java index 464143d..4fe25e8 100644 --- a/let-runtime/src/main/java/com/canelmas/let/LetAspect.java +++ b/let-runtime/src/main/java/com/canelmas/let/LetAspect.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-runtime/src/main/java/com/canelmas/let/LetContext.java b/let-runtime/src/main/java/com/canelmas/let/LetContext.java index a8da329..00c97e0 100644 --- a/let-runtime/src/main/java/com/canelmas/let/LetContext.java +++ b/let-runtime/src/main/java/com/canelmas/let/LetContext.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-runtime/src/main/java/com/canelmas/let/LetException.java b/let-runtime/src/main/java/com/canelmas/let/LetException.java index ac4d788..5d50cab 100644 --- a/let-runtime/src/main/java/com/canelmas/let/LetException.java +++ b/let-runtime/src/main/java/com/canelmas/let/LetException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-runtime/src/main/java/com/canelmas/let/RuntimePermissionListener.java b/let-runtime/src/main/java/com/canelmas/let/RuntimePermissionListener.java index 7c5549b..e21684b 100644 --- a/let-runtime/src/main/java/com/canelmas/let/RuntimePermissionListener.java +++ b/let-runtime/src/main/java/com/canelmas/let/RuntimePermissionListener.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-runtime/src/main/java/com/canelmas/let/RuntimePermissionRequest.java b/let-runtime/src/main/java/com/canelmas/let/RuntimePermissionRequest.java index b4fd5df..9fd20c4 100644 --- a/let-runtime/src/main/java/com/canelmas/let/RuntimePermissionRequest.java +++ b/let-runtime/src/main/java/com/canelmas/let/RuntimePermissionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ private Object proceed(final boolean retry) { final int requestCode = PERMISSIONS_REQUEST_CODE.getAndIncrement() & 0xff; - DelayedTasks.add(new DelayedTasks.Task(permissionsToAsk, requestCode, joinPoint)); + ScheduledTasks.add(new ScheduledTasks.Task(permissionsToAsk, requestCode, joinPoint)); letContext.requestPermissions(permissionsToAsk.toArray(new String[]{}), requestCode); diff --git a/let-runtime/src/main/java/com/canelmas/let/DelayedTasks.java b/let-runtime/src/main/java/com/canelmas/let/ScheduledTasks.java similarity index 95% rename from let-runtime/src/main/java/com/canelmas/let/DelayedTasks.java rename to let-runtime/src/main/java/com/canelmas/let/ScheduledTasks.java index 2a69c11..e9d3762 100644 --- a/let-runtime/src/main/java/com/canelmas/let/DelayedTasks.java +++ b/let-runtime/src/main/java/com/canelmas/let/ScheduledTasks.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import java.util.Map; import java.util.concurrent.Callable; -final class DelayedTasks { +final class ScheduledTasks { @SuppressLint("UseSparseArrays") private static Map<Integer, Task> tasks = Collections.synchronizedMap(new HashMap<Integer, Task>()); @@ -67,7 +67,7 @@ public Object call() throws Exception { } catch (Throwable t) { throw new LetException("Future Task execution failed!", t); } finally { - DelayedTasks.remove(this); + ScheduledTasks.remove(this); } } diff --git a/let-runtime/src/main/res/values/strings.xml b/let-runtime/src/main/res/values/strings.xml index 5b2cabd..5ca2cdf 100644 --- a/let-runtime/src/main/res/values/strings.xml +++ b/let-runtime/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-runtime/src/test/java/com/canelmas/permissioncompat/ExampleUnitTest.java b/let-runtime/src/test/java/com/canelmas/permissioncompat/ExampleUnitTest.java index 1df92d2..75f87d6 100644 --- a/let-runtime/src/test/java/com/canelmas/permissioncompat/ExampleUnitTest.java +++ b/let-runtime/src/test/java/com/canelmas/permissioncompat/ExampleUnitTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2018 Can Elmas + * + * 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. + */ + package com.canelmas.let; import org.junit.Test; diff --git a/let-sample-library/.gitignore b/let-sample-library/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/let-sample-library/.gitignore @@ -0,0 +1 @@ +/build diff --git a/let-sample-library/build.gradle b/let-sample-library/build.gradle new file mode 100644 index 0000000..8e53812 --- /dev/null +++ b/let-sample-library/build.gradle @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2018 Can Elmas + * + * 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. + */ + +buildscript { + repositories { + jcenter() + google() + mavenLocal() + } + dependencies { + classpath 'com.canelmas.let:let-plugin:1.0.0-beta2' + } +} + +repositories { + mavenLocal() +} + +apply plugin: 'com.android.library' +apply plugin: 'let' + +android { + compileSdkVersion 27 + + defaultConfig { + minSdkVersion 14 + targetSdkVersion 27 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation deps.appCompatv7 + implementation deps.supportDesign + + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' +} diff --git a/let-sample-library/proguard-rules.pro b/let-sample-library/proguard-rules.pro new file mode 100644 index 0000000..8f85fda --- /dev/null +++ b/let-sample-library/proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/can/Documents/android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/let-sample-library/src/androidTest/java/com/cnlms/let_sample_library/ExampleInstrumentedTest.java b/let-sample-library/src/androidTest/java/com/cnlms/let_sample_library/ExampleInstrumentedTest.java new file mode 100644 index 0000000..e55b79e --- /dev/null +++ b/let-sample-library/src/androidTest/java/com/cnlms/let_sample_library/ExampleInstrumentedTest.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2018 Can Elmas + * + * 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. + */ + +package com.cnlms.let_sample_library; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.cnlms.let_sample_library.test", appContext.getPackageName()); + } +} diff --git a/let-sample-library/src/main/AndroidManifest.xml b/let-sample-library/src/main/AndroidManifest.xml new file mode 100644 index 0000000..ef53274 --- /dev/null +++ b/let-sample-library/src/main/AndroidManifest.xml @@ -0,0 +1,18 @@ +<!-- + ~ Copyright (C) 2018 Can Elmas + ~ + ~ 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. + --> + +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.canelmas.let.sample.library" /> diff --git a/let-sample-library/src/main/java/com/canelmas/let/sample/library/LibTest.java b/let-sample-library/src/main/java/com/canelmas/let/sample/library/LibTest.java new file mode 100644 index 0000000..56727ec --- /dev/null +++ b/let-sample-library/src/main/java/com/canelmas/let/sample/library/LibTest.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2018 Can Elmas + * + * 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. + */ + +package com.canelmas.let.sample.library; + +import com.canelmas.let.AskPermission; + +public class LibTest { + + @AskPermission + public void test(){ + + } +} diff --git a/let-sample-library/src/main/res/values/strings.xml b/let-sample-library/src/main/res/values/strings.xml new file mode 100644 index 0000000..7692d12 --- /dev/null +++ b/let-sample-library/src/main/res/values/strings.xml @@ -0,0 +1,19 @@ +<!-- + ~ Copyright (C) 2018 Can Elmas + ~ + ~ 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. + --> + +<resources> + <string name="app_name">let-sample-library</string> +</resources> diff --git a/let-sample-library/src/test/java/com/cnlms/let_sample_library/ExampleUnitTest.java b/let-sample-library/src/test/java/com/cnlms/let_sample_library/ExampleUnitTest.java new file mode 100644 index 0000000..f566e36 --- /dev/null +++ b/let-sample-library/src/test/java/com/cnlms/let_sample_library/ExampleUnitTest.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2018 Can Elmas + * + * 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. + */ + +package com.cnlms.let_sample_library; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/let-sample/build.gradle b/let-sample/build.gradle index 46b434b..d6ce67f 100644 --- a/let-sample/build.gradle +++ b/let-sample/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,17 @@ buildscript { repositories { jcenter() google() + mavenLocal() } dependencies { - classpath 'com.canelmas.let:let-plugin:1.0.0-beta1' + classpath 'com.canelmas.let:let-plugin:1.0.0-beta2' } } +repositories { + mavenLocal() +} + apply plugin: 'com.android.application' apply plugin: 'let' @@ -50,6 +55,7 @@ android { abortOnError false } + buildToolsVersion versions.buildToolsVersion } dependencies { diff --git a/let-sample/src/androidTest/java/com/canelmas/let/ApplicationTest.java b/let-sample/src/androidTest/java/com/canelmas/let/ApplicationTest.java index 86807ba..5361e5d 100644 --- a/let-sample/src/androidTest/java/com/canelmas/let/ApplicationTest.java +++ b/let-sample/src/androidTest/java/com/canelmas/let/ApplicationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/AndroidManifest.xml b/let-sample/src/main/AndroidManifest.xml index d6f7814..324a91e 100644 --- a/let-sample/src/main/AndroidManifest.xml +++ b/let-sample/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/java/com/canelmas/let/sample/ContactsActivity.java b/let-sample/src/main/java/com/canelmas/let/sample/ContactsActivity.java index e20a9ff..2d116bf 100644 --- a/let-sample/src/main/java/com/canelmas/let/sample/ContactsActivity.java +++ b/let-sample/src/main/java/com/canelmas/let/sample/ContactsActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/java/com/canelmas/let/sample/SampleActivity.java b/let-sample/src/main/java/com/canelmas/let/sample/SampleActivity.java index 3954df6..431700b 100644 --- a/let-sample/src/main/java/com/canelmas/let/sample/SampleActivity.java +++ b/let-sample/src/main/java/com/canelmas/let/sample/SampleActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/java/com/canelmas/let/sample/SampleFragment.java b/let-sample/src/main/java/com/canelmas/let/sample/SampleFragment.java index e3e47cf..59d1c09 100644 --- a/let-sample/src/main/java/com/canelmas/let/sample/SampleFragment.java +++ b/let-sample/src/main/java/com/canelmas/let/sample/SampleFragment.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/java/com/canelmas/let/sample/SampleFragmentActivity.java b/let-sample/src/main/java/com/canelmas/let/sample/SampleFragmentActivity.java index f325303..d1c3459 100644 --- a/let-sample/src/main/java/com/canelmas/let/sample/SampleFragmentActivity.java +++ b/let-sample/src/main/java/com/canelmas/let/sample/SampleFragmentActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/java/com/canelmas/let/sample/SampleV4Fragment.java b/let-sample/src/main/java/com/canelmas/let/sample/SampleV4Fragment.java index 2288c2f..3483f9b 100644 --- a/let-sample/src/main/java/com/canelmas/let/sample/SampleV4Fragment.java +++ b/let-sample/src/main/java/com/canelmas/let/sample/SampleV4Fragment.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/java/com/canelmas/let/sample/SampleV4FragmentActivity.java b/let-sample/src/main/java/com/canelmas/let/sample/SampleV4FragmentActivity.java index 204a8a1..a4bf110 100644 --- a/let-sample/src/main/java/com/canelmas/let/sample/SampleV4FragmentActivity.java +++ b/let-sample/src/main/java/com/canelmas/let/sample/SampleV4FragmentActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 Can Elmas + * Copyright (C) 2018 Can Elmas * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/layout/activity_fragment.xml b/let-sample/src/main/res/layout/activity_fragment.xml index 9ead78c..c9abfa7 100644 --- a/let-sample/src/main/res/layout/activity_fragment.xml +++ b/let-sample/src/main/res/layout/activity_fragment.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/layout/activity_sample.xml b/let-sample/src/main/res/layout/activity_sample.xml index b4ea857..fd51bd9 100644 --- a/let-sample/src/main/res/layout/activity_sample.xml +++ b/let-sample/src/main/res/layout/activity_sample.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/layout/fragment.xml b/let-sample/src/main/res/layout/fragment.xml index 9a9520a..fd05c4e 100644 --- a/let-sample/src/main/res/layout/fragment.xml +++ b/let-sample/src/main/res/layout/fragment.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/layout/fragment_contacts.xml b/let-sample/src/main/res/layout/fragment_contacts.xml index 3c9338b..fa4a9b1 100644 --- a/let-sample/src/main/res/layout/fragment_contacts.xml +++ b/let-sample/src/main/res/layout/fragment_contacts.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/menu/menu_.xml b/let-sample/src/main/res/menu/menu_.xml index db14f9b..ada38af 100644 --- a/let-sample/src/main/res/menu/menu_.xml +++ b/let-sample/src/main/res/menu/menu_.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/menu/menu_sample.xml b/let-sample/src/main/res/menu/menu_sample.xml index c5f3a46..a9a9a15 100644 --- a/let-sample/src/main/res/menu/menu_sample.xml +++ b/let-sample/src/main/res/menu/menu_sample.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/values-v21/styles.xml b/let-sample/src/main/res/values-v21/styles.xml index 88701f1..3c77681 100644 --- a/let-sample/src/main/res/values-v21/styles.xml +++ b/let-sample/src/main/res/values-v21/styles.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/values-w820dp/dimens.xml b/let-sample/src/main/res/values-w820dp/dimens.xml index 69d5271..04ba568 100644 --- a/let-sample/src/main/res/values-w820dp/dimens.xml +++ b/let-sample/src/main/res/values-w820dp/dimens.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/values/dimens.xml b/let-sample/src/main/res/values/dimens.xml index bf1bb1a..e83dd46 100644 --- a/let-sample/src/main/res/values/dimens.xml +++ b/let-sample/src/main/res/values/dimens.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/values/strings.xml b/let-sample/src/main/res/values/strings.xml index 5648feb..4ed8bdc 100644 --- a/let-sample/src/main/res/values/strings.xml +++ b/let-sample/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/main/res/values/styles.xml b/let-sample/src/main/res/values/styles.xml index e5bbdc7..72ec90b 100644 --- a/let-sample/src/main/res/values/styles.xml +++ b/let-sample/src/main/res/values/styles.xml @@ -1,5 +1,5 @@ <!-- - ~ Copyright (C) 2015 Can Elmas + ~ Copyright (C) 2018 Can Elmas ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. diff --git a/let-sample/src/test/java/com/canelmas/permissioncompat/ExampleUnitTest.java b/let-sample/src/test/java/com/canelmas/permissioncompat/ExampleUnitTest.java index 1df92d2..75f87d6 100644 --- a/let-sample/src/test/java/com/canelmas/permissioncompat/ExampleUnitTest.java +++ b/let-sample/src/test/java/com/canelmas/permissioncompat/ExampleUnitTest.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2018 Can Elmas + * + * 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. + */ + package com.canelmas.let; import org.junit.Test; diff --git a/settings.gradle b/settings.gradle index 53d2887..298d94d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -include ':let-annotations' +include ':let-annotations', ':let-sample-library' include ':let-plugin' include ':let-runtime' include ':let-sample' \ No newline at end of file