Skip to content

Commit

Permalink
Merge pull request #498 from google/moe_sync_11/15/2016
Browse files Browse the repository at this point in the history
Moe sync 11/15/2016
  • Loading branch information
ronshapiro authored Nov 16, 2016
2 parents e20517e + 5abbc82 commit b4811d0
Show file tree
Hide file tree
Showing 23 changed files with 1,762 additions and 621 deletions.
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ jdk:

android:
components:
- build-tools-23.0.0
- android-23
licenses:
- android-sdk-license-5be876d5
- tools
- tools # Duplicated as per https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943
- build-tools-25.0.0
- android-25
- platform-tools
- extra-android-m2repository

before_install:
- sudo rm -f /etc/mavenrc
Expand Down Expand Up @@ -38,3 +40,7 @@ branches:
only:
- master
- /^release.*$/

cache:
directories:
- $HOME/.m2
79 changes: 79 additions & 0 deletions android/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2016 Google, Inc.
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-parent</artifactId>
<version>HEAD-SNAPSHOT</version>
</parent>

<artifactId>dagger-android</artifactId>
<name>Dagger for Android</name>

<packaging>aar</packaging>

<properties>
<java.version>1.6</java.version>
</properties>

<repositories>
<repository>
<id>android-support</id>
<url>file://${env.ANDROID_HOME}/extras/android/m2repository</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<type>aar</type>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-annotations</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>${android.latest.version}</platform>
<path>${env.ANDROID_HOME}</path>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2016 The Dagger Authors.
*
* 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 test.android;

import java.lang.annotation.Annotation;
import javax.inject.Qualifier;

@Qualifier
@interface InScope {
Class<? extends Annotation> value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 The Dagger Authors.
*
* 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 test.android;

import static android.content.ComponentCallbacks2.TRIM_MEMORY_MODERATE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import dagger.android.ReleaseReferencesAt;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.inject.Scope;

@Documented
@Retention(RUNTIME)
@Target({TYPE, METHOD})
@ReleaseReferencesAt(TRIM_MEMORY_MODERATE)
@Scope
@interface ReleaseWhenModerate {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 The Dagger Authors.
*
* 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 test.android;

import static android.content.ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import dagger.android.ReleaseReferencesAt;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.inject.Scope;

@Documented
@Retention(RUNTIME)
@Target({TYPE, METHOD})
@ReleaseReferencesAt(TRIM_MEMORY_UI_HIDDEN)
@Scope
@interface ReleaseWhenUiHidden {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 The Dagger Authors.
*
* 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 test.android;

import dagger.Component;
import dagger.android.AndroidMemorySensitiveReferenceManager;
import javax.inject.Singleton;

@Singleton
@ReleaseWhenUiHidden
@ReleaseWhenModerate
@Component(modules = TestModule.class)
interface TestComponent {
AndroidMemorySensitiveReferenceManager manager();

@InScope(ReleaseWhenUiHidden.class)
Object releasedWhenUiHidden();

@InScope(ReleaseWhenModerate.class)
Object releasedWhenModerate();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2016 The Dagger Authors.
*
* 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 test.android;

import dagger.Module;
import dagger.Provides;

@Module
class TestModule {
int releasedWhenUiHiddenCalls;
int releasedWhenModerateCalls;

@Provides
@ReleaseWhenUiHidden
@InScope(ReleaseWhenUiHidden.class)
Object releasedWhenUiHidden() {
++releasedWhenUiHiddenCalls;
return new Object();
}

@Provides
@ReleaseWhenModerate
@InScope(ReleaseWhenModerate.class)
Object releasedWhenModerate() {
++releasedWhenModerateCalls;
return new Object();
}
}
Loading

0 comments on commit b4811d0

Please sign in to comment.